Matthias van der Hallen
28/10/2019
Introduce variables representing non-logical objects:
\(\forall x : Person(x) \lor Dog(x).\)
"Everything is either a dog or a person."
Also introduce variables representing predicates & functions:
\(\exists P : P(alice) \land P(bob).\)
"There is a set that contains both \(alice\) and \(bob\)."
\(Edge(a,b), Edge(c,b), Edge(c,d),\)
\(Edge(d,c), Edge(d,e), Edge(e,e).\)
Predicate representing its \(Edge\) relation:
\(color(a)=red, color(b)=blue, color(c)=green\)
\(color(d)=blue, color(e)=red.\)
Coloring represented by the function:
\(h(f) = c, h(g) = d\)
Homomorphism represented by the function:
\(shift(monday)=alice, shift(tuesday)=bob,\)
\(\ldots\)
Schedule represented by the function:
Many interesting problems use these concepts!
Find a graph \(\mathcal{G}\) such that:
Find a graph \(\mathcal{G}\) such that:
+ example
Candidate for \(\mathcal{G}\)
- example
\(\lnot \exists f : \forall x, y : \mathcal{G}(x,y) \Rightarrow NegEx(x,y).\)
Find a graph \(\mathcal{G}\) such that:
\(\exists f : \forall x, y : \mathcal{G}(x,y) \Rightarrow PosEx(x,y).\)
Theory
This requires support for Second-Order Logic!
Divide \(n\) people over \(k\) cars such that
nobody has to sit with someone they dislike.
Critical friendship pair:
Two distinct people s.t. if they would dislike each other, no proper division exists.
Observations:
Alice
Bob
David
Charles
Alice
Bob
David
Charles
Observations:
type Person. % The Person type, corresponding to nodes
type Car. % The Car type, corresponding to colours
dislike :: (Person, Person). % A predicate encoding dislikes
p1 :: Person. % A person constant
p2 :: Person. % A second person constant
p1 ≠ p2.
∃f :: (Person)→Car: ∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b).
∀f :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b)) ⇒ f(p1)=f(p2).
Model:
type Person. % The Person type, corresponding to nodes
type Car. % The Car type, corresponding to colours
dislike :: (Person, Person). % A predicate encoding dislikes
p1 :: Person. % A person constant
p2 :: Person. % A second person constant
p1 ≠ p2.
∃f :: (Person)→Car: ∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b).
∀f :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b)) ⇒ f(p1)=f(p2).
Model:
Person = {Alice; Bob; Charles; David}. Car = {Astra; Berlingo}. dislike = {Alice, Bob; Bob, David; Charles, David}.
p1 = Bob, p2 = Charles
Model expansion
Step 1: Translate (grounding) the high-level language to a simpeler low-level language.
Step 2: Use a general-purpose solver to find interpretations for this translation.
Step 3: Back-translate to an interpretation for the high-level model.
Translation to SAT:
SAT
Formulas over propositional variables
\(x \lor \lnot (y \land z)\)
Translation to SAT:
\(\forall x : \phi \rightsquigarrow \bigwedge_{c \in type(x)} \phi[x/c]\).
\(\exist x : \phi \rightsquigarrow \bigvee_{c \in type(x)} \phi[x/c]\).
type Person = {Alice; Bob}.
type Car = {Astra; Berlingo}.
dislike :: (Person, Person). % A predicate encoding dislikes
sitsIn :: (Person)→Car
∀ a, b :: Person : dislike(a,b) ⇒ sitsIn(a) ≠ sitsIn(b).
∀ a, b :: Person : ¬dislike(a,b) ∨ sitsIn(a) ≠ sitsIn(b).
∀ a, b :: Person : ¬dislike(a,b) ∨
(∃ sa, sb :: Car : sitsIn(a) = sa ∧ sitsIn(b) = sb ∧ ≠(sa,sb)).
∀ a, b :: Person : ¬dislike(a,b) ∨
(∃ sa, sb :: Car : sitsIn(a,sa) ∧ sitsIn(b,sb) ∧ ≠(sa,sb)).
(¬dislike(Alice,Bob) ∨
((sitsIn(Alice,Astra) ∧ sitsIn(Bob,Astra) ∧ ≠(Astra, Astra )) ∨
(sitsIn(Alice,Astra) ∧ sitsIn(Bob,Berlingo) ∧ ≠(Astra, Berlingo)) ∨
(sitsIn(Alice,Berlingo) ∧ sitsIn(Bob,Astra) ∧ ≠(Berlingo, Astra )) ∨
(sitsIn(Alice,Berlingo) ∧ sitsIn(Bob,Berlingo) ∧ ≠(Berlingo, Berlingo)))) ∧
...
\((\lnot d_{Alice,Bob} \lor (s_{Alice,Astra} ∧ s_{Bob,Berlingo}) ∨ (s_{Alice,Berlingo} ∧ s_{Bob,Astra})) \land ...\)
Translation to Quantified Boolean Formulas:
Introduces quantifiers (\(\forall, \exists\)) for propositional variables
\(\forall x\exists y\forall z . x \lor \lnot (y \land z)\)
Translation to Quantified Boolean Formulas:
Ground second-order quantifications \(\forall P : \phi\), \(\exist P : \phi \):
type Person = {Alice; Bob}.
type Car = {Astra; Berlingo}.
dislike :: (Person, Person). % A predicate encoding dislikes
∀s :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ s(a)≠s(b)) ⇒ s(p1)=s(p2).
\(\forall s_{Alice,Astra}, s_{Alice,Berlingo}, s_{Bob,Astra}, s_{Bob,Berlingo} :\)
\((\Psi) \Rightarrow (\lnot d_{Alice,Bob} \lor (s_{Alice,Astra} ∧ s_{Bob,Berlingo}) ∨ (s_{Alice,Berlingo} ∧ s_{Bob,Astra})) \land ...\)
\((s_{Alice, Astra} \lor s_{Alice,Berlingo} \lor s_{Bob,Astra} \lor s_{Bob,Berlingo}) \land \)
\((\lnot s_{Alice,Astra} \lor \lnot s_{Alice,Berlingo}) \land\)
\((\lnot s_{Bob,Astra} \lor \lnot s_{Bob,Berlingo})\)
\(\Psi\):
Standard technique: Tseitin transformation
But
\(\bigwedge_i C_i\) where \(C_i = \bigvee_j p_{i,j}\)
Naive introduction of auxiliary propositions can introduce unwanted dependencies between propositions, hurting search
\((p_1 \land p_2) \lor p_3 \rightsquigarrow \exists t . (t \Leftrightarrow p_1 \land p_2) \land (t \lor p_3)\)
Use knowledge about the truth value of sub-formulas to simplify formulas.
\[\forall a,b . dislike(a,b) \Rightarrow f(a) \neq f(b).\]
While grounding for \(a,b\), if \(dislike(a,b)\) can be evaluated, replace it and simplify the formula.
Derive Certainly-True and Certainly-False values of unknown predicates using lifted (symbolic) reasoning.
\(\forall x . P(x) \Rightarrow Q(x).\)
If we know e.g. \(P(1)\), derive \(Q(1)\)
When deriving CT / CF value for second-order variable
\(\exist\): Process normally
\(\forall\): derive UNSAT
Extend CT/CF concept to (sub-)formulas and manipulate them to reduce grounding.
\(\phi \lor (\forall x . P(x) \Rightarrow Q(x)).\)
\(Type(x) = \{1;2;3\}, P_{ct} = \{1;2\}, Q_{ct} = \{1\}\) \(\Rightarrow \forall_{ct} = \{1\}\)
Ground \(\forall\) for \(x \not\in \forall_{ct}\)
Consider a Quantified Boolean Formula in Prenex-CNF form:
\(Q_1 X_1, \ldots, Q_n X_n . \phi\) with \(Q_i \in \{\exist, \forall\}\)
Consecutive variables \(x\) with the same quantifier \(Q\) are gathered in quantifier blocks \(X\)
\(Q_1 X_, \ldots, Q_n X_n\) often abbreviated to \(\Pi\)
\(\Pi\) introduces ordering: \(x \prec_{\Pi} x'\)
Conflict / Solution driven clause/cube learning
Generalization of well-known SAT solving technique CDCL: QCDCL
Clause:
Cube:
PCNF \(\phi\)
Extend Assignment \(A\)
\(\phi[A]\) = T/F
Propagation
T: Learn Cube
F: Learn Clause
No
UNSAT
\(\empty\) Clause
\(\empty\) Cube
SAT
Backtrack
Cube/Clause \(\neq\empty\)
Resolution-Clause/Cube: From \(C_1 \cup \{p\}\) and \(C_2 \cup \{\overline{p}\}\), learn \(C_1 \cup C_2\) if \(p\) is \(\exist\) / \(\forall\)
Reduce Clause: Drop \(\forall\)-quantified \(l\) from \(C \cup \{l\}\) to learn \(C\) iff. \(C\) contains no \(\exist\)-quantified variable \(l'\) s.t. \(l \prec_{\Pi} l'\)
Reduce Cube: Drop \(\exist\)-quantified \(l\) from \(C \cup \{l\}\) to learn \(C\) iff. \(C\) contains no \(\forall\)-quantified variable \(l'\) s.t. \(l \prec_{\Pi} l'\)
Consider prefix: \(\exist x, y \forall a\exist z\)
Start with cubes
\(\overline{x} \land \overline{y} \land \overline{a} \land \overline{z}\)
\(\overline{x} \land \overline{y} \land a \land z\)
red
\(\overline{x} \land \overline{y} \land \overline{a}\)
\(\overline{x} \land \overline{y} \land a\)
res
\(\overline{x} \land \overline{y}\)
red
red
\(\empty\)
Extend SOGrounder with:
Observations:
type Person. % The Person type, corresponding to nodes
type Car. % The Car type, corresponding to colours
dislike :: (Person, Person). % A predicate encoding dislikes
p1 :: Person. % A person constant
p2 :: Person. % A second person constant
p1 ≠ p2.
∃f :: (Person)→Car: ∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b).
∀f :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b)) ⇒ f(p1)=f(p2).
Model:
type Person. % The Person type, corresponding to nodes
type Car. % The Car type, corresponding to colours
dislike :: (Person, Person). % A predicate encoding dislikes
p1 :: Person. % A person constant
p2 :: Person. % A second person constant
p1 ≠ p2.
∃f :: (Person)→Car: ∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b).
∀f :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b)) ⇒ f(p1)=f(p2).
type Person. % The Person type, corresponding to nodes
type Car. % The Car type, corresponding to colours
dislike :: (Person, Person). % A predicate encoding dislikes
p1 :: Person. % A person constant
p2 :: Person. % A second person constant
p1 ≠ p2.
∃f :: (Person)→Car: ∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b).
∀f :: (Person)→Car: (∀ a,b :: Person: dislike(a,b) ⇒ f(a)≠f(b)) ⇒ f(p1)=f(p2).
Step 1: Translate the high-level language to a simpeler low-level language.
Step 2: Use a general-purpose solver to find interpretations for this translation.
Step 3: Back-translate to an interpretation for the high-level model.
Translation to SAT:
Formulas over propositional variables
\( x \lor \lnot y \land z \)
\(\forall x : \phi \rightsquigarrow \bigwedge_{c \in type(x)} \phi[x/c]\).
\(\exist x : \phi \rightsquigarrow \bigvee_{c \in type(x)} \phi[x/c]\).
PCNF \(\phi\)
Extend Assignment
\(\phi[A]\) = T/F
Propagation
T: Learn Cube
F: Learn Clause
No
UNSAT
\(\empty\) Clause
\(\empty\) Cube
SAT
Backtrack
Cube/Clause \(\neq\empty\)