§ Nondeterministic Nelson Oppen
§ Stably infinite thories
- A theory is stably infinite iff every satisfiable quantifier free formula is satisfiable in an infinite model.
- EUF and arithmetic are stably infinite.
- Bitvectors are not stably infinite, since they don't have infinite models. (i.e. the structure is itself finite)
- Theory of strings of bounded length (structure is finite).
§ Converting Formula to Separate Form
- Consider 1≤2∧f(x)=f(2)∧f(x)=f(1) in TE∪TZ (equality, integers).
- Separate, introduce new variable y=2,z=1.
- The array part becomes f(x)=f(y)∧f(z)=f(z).
- The integer part becomes 1≤2∧y=2∧z=1.
- So, the two theories "communicate" via variables.
§ Theory Solvers need to coordinate
- Suppose we have F=F1∧F2
- If either F1,F2 are are UNSAT, then F is UNSAT.
- But if both F1,F2 are SAT, not guaranteed that the whole thing is SAT.
§ Coordinating Equivalence Relation
- Let S be a set of terms with ∼ an equivalence relation.
- Then we write F[∼]≡(∧t∼st=s)∧(∧t∼st=s).
- For elements that are not related, we force disequality!
§ Non deterministic Nelson Oppen
- Take two disjoint theories T1,T2
- That is, theories T1,T2 with signatures S1,S2 such that S1∩S2=∅ so no common symbols.
- Let F be a conjunction of literals from T1∪T2.
- Convert F to separate form: F1∧F2.
- Guess a coordinating. equivalence relation ∼ over vars(F1)∩vars(F2).
- Run DP1(F1∧F[∼]), and DP2(F1∧F[∼]).
- If both solvers are SAT, then return SAT, since we have found a common assignment.
- Otherwise, F is UNSAT.
- CLAIM: this is a correct algorithm!
§ Proof of correctness (Non-deterministic)
- For the proof, we need to know the reduct of a model to a smaller signature, and the notion of a model homomorphism.
§ Reduct of a model
- Let us a have a model (M,S,T) where M is the model, S is the signature (tells us what the functions and predicates are), and T is the theory (tells us what the axioms are.
- Then, for any subset S′⊆S, it's possible to build (M,S′) as a reduct of (M,S).
- For example, (Z,+,0) is a reduct of (Z,+,0,1,×).
§ Thm1: Conjunct SAT iff they agree on intersection
- Let F1 be an S1 model, and F1 has variables V1 (mutatis mutandis for F2).
- Claim: F1∧F2 is satisfiable if and only if there exist m1⊨F1, m2⊨F2 such that m1∼m2 on S1∩S2(i.e. m1∣S1∩S2,V1∩V2 is isomorphic as a S1∩S2 model to m2∣S1∩S2,V1∩V2).
§ Proof (Large to small): F1∧F2 SAT implies existence of m1,m2
- If F1∧F2 is SAT, then there's a S1US2 model M. Let m1≡M∣S1, (ditto M2).
- Clearly, the restriction of the large model M to S1 will continue to model F1, and ditto F2, hence done.
§ Proof (small to large gluing): Isomrphic m1⊨F1 and m2⊨F2 implies existence of large model M⊨F1∧F2
- Idea: embed (m2,S2) as a submodel of (m1,S1) via the isomorphism h.
- This "just works", since they agree on the variables.
- Let h be the iso m1∼S1∩S2m2
- Let M≡m1
- Let M∣S1=m1
- For v2∈V2,vinV1, define M(v2)≡h−1(m2(v2)).
- For f2∈S2,finS1, define M(f2,a∈m1,…,z∈m1)≡h−1(f(h(a),h(b),…,h(z))).
- So we push a,⋯,z forward via h, evaluate f2, then pull value back.
§ Meditation
- The key point is the sheaf-condition, which says that they agree on the intersection.
- Intuitively, this shows that we can form a pushout.
§ Thm2: Weaken Isomorphism To Cardinality + Equality Preservation
- Let F1 be an S1 model, and F1 has variables V1 (mutatis mutandis for F2).
- Claim: F1∧F2 is satisfiable if an only if there exist m1⊨F1, m2⊨F2 such that:
- (a) ∣m1∣=∣m2∣ (underlying sets have same size)
- (b) For each variable x,y∈V1∩V2, we have that m1⊨x=y iff m2⊨x=y.
§ Proof (Large to small): M⊨F1∧F2 implies existence of smaller models such that \dots
- Pick m1=M∣S1, m2=M∣S2. Clearly, same underlying set so same cardinality, and same model, so witnesses same equalities.
§ Proof (small to large gluing): Isomorphic m1⊨F1 and m2⊨F2 implies existence of large model M⊨F1∧F2
- Key idea: Since the models have the same cardinality, we can build the iso piecewise:
- Let h:m1[V1∩V2]tom2[V1∩V2] be an empty iso from the values that V1∩V2 take in m1 to the values that V1∩V2 take in m2.
- Start by updating h such that h(m1(v))=m2(v).
- This is injective, bcause suppose h(m1(v))=h(m1(v′)). Then this means that m2(v)=m2(v′), which implies m1(v)=m1(v′), and thus we are done.
- The condition that m1⊨x=y iff m2⊨x=y ensures that h remains an iso.
- This is onto since we've exhausted every variable in V1∩V2.
- Since h is bijective, we have that ∣m1[V1∩V2]∣=∣m2[V2∩V2]∣. Since |m 1| = |m 2|, this implies that we can extend h arbitrarily to a bijective function on all of m1,m2.
- Clearly, by construction h is an iso, and we thus apply previous theorm!
§ Meditation
- If we agree on variables, then we have the seed of an iso that witnesses that things are equal for ground formulae
- Then since we have same cardinality, we can extend to full iso!
§ Nelson Oppen Is Correct
- Let T1 be stably infinite S1 theory (mutatis mutandis).
- Let F1 be a S1 formula with variables V1 (mutatis mutandis).
- Let S1∩S2=∅.
- F1∧F2 is T1∪T2 satisfiable if and only if :
- There is an equivalence relation ∼ over V1∩V2 such that: Fi∧F[∼] is Ti satisfiable.
§ Proof (large to small)
- Pick M1=M∣S1,V1∩V2 and M2≡M∣S2,V1∩V2, x∼y⟺x=y.
§ Proof (small to large gluing):
- Suppose ∼ is equivalence relation such that Fi∧F[ ] is Ti satisfiable.
- Since T1 is stably infinite, we have infinite model M1⊨F1capF[∼].
- By downward lowenheim skolem, we have a countably infinite model M1.
- So choose M1,M2 countable, thus ∣M1∣=∣M2∣.
- Since M1⊨F[∼] and M2⊨F[∼], this means that M1(x)=M1(x′) if and only if M2(x)=M2(x′), because F[∼] asserts that all elements in the equivalence class are equal, and elements that are not in the equvalence class are not equal.
- Thus, we have that M1(x)=M1(x′) if and only if x∼x′ if and only if M2(x)=M2(x′).
- TODO: I am not totally convinced here! I need to think :)
§ References