Decision Procedures in First Order Logicldillon/914/www/Lectures/equality...1 Daniel Kroening and...
Transcript of Decision Procedures in First Order Logicldillon/914/www/Lectures/equality...1 Daniel Kroening and...
1
Daniel Kroening and Ofer Strichman 1
Decision Procedures in First Order Logic
Decision Procedures for Equality Logic
Decision Procedures An algorithmic point of view 2
Part III – Decision Procedures for Equality Logic and Uninterpreted Functions
Algorithm I – From Equality to Propositional Logic Adding transitivity constraints Making the graph chordal An improved procedure: consider polarity
Algorithm II – Range-Allocation What is the small-model property? Finding a small adequate range (domain) to each variable Reducing to Propositional Logic
Decision Procedures An algorithmic point of view 3
We will first investigate methods that solve Equality Logic. Uninterpreted functions are eliminated with one of the reduction schemes.
Our starting point: the E-Graph GE(φE)
Recall: GE(φE) represents an abstraction of φE:
It represents ALL equality formulas with the same set of equality predicates as φE
Decision Procedures for Equality Logic
Decision Procedures An algorithmic point of view 4
From Equality to Propositional Logic Bryant & Velev 2000: the Sparse method
φE = x1 = x2 ∧ x2 = x3 ∧ x1 ≠ x3
φenc = e1 ∧ e2 ∧ ¬e3
Encode all edges with Boolean variables (note: for now, ignore polarity) This is an abstraction Transitivity of equality is lost! Must add transitivity constraints!
e 3
e2
e1
2
Decision Procedures An algorithmic point of view 5
From Equality to Propositional Logic
φE = (x1 = x2 ∧ x2 = x3 ∧ x1 ≠ x3
φenc = e1 ∧ e2 ∧ ¬e3
For each cycle add a transitivity constraint φtrans = (e1 ∧ e2 → e3) ∧
(e1 ∧ e3 → e2) ∧ (e3 ∧ e2 → e1)
Check: φenc ∧ φtrans
e 3
e2
e1
Decision Procedures An algorithmic point of view 6
From Equality to Propositional Logic
There can be an exponential number of cycles, so let’s try to make it better.
Thm: it suffices to constrain simple cycles only.
e1
e2 e3
e4
e5 e6
T T
T
T T
? T
Still, there is an exponential number of simple cycles. Thm [Bryant & Velev]: It suffices to constrain chord-
free simple cycles
Decision Procedures An algorithmic point of view 7
From Equality to Propositional Logic
e1
e2
e3
e4
e5
T
T ? T
T
T
Decision Procedures An algorithmic point of view 8
Still, there can be an exponential number of chord-free simple cycles…
.
….
From Equality to Propositional Logic
3
Decision Procedures An algorithmic point of view 9
Still, there can be an exponential number of chord-free simple cycles…
….
From Equality to Propositional Logic
Decision Procedures An algorithmic point of view 10
Still, there can be an exponential number of chord-free simple cycles…
.
….
From Equality to Propositional Logic
Decision Procedures An algorithmic point of view 11
Still, there can be an exponential number of chord-free simple cycles…
….
From Equality to Propositional Logic
Decision Procedures An algorithmic point of view 12
Still, there can be an exponential number of chord-free simple cycles…
Solution: make the graph ‘chordal’ by adding edges.
….
From Equality to Propositional Logic
4
Decision Procedures An algorithmic point of view 13
From Equality to Propositional Logic
Dfn: A graph is chordal iff every cycle of size 4 or more has a chord.
How to make a graph chordal ? eliminate vertices one at a time, and connect their neighbors.
Decision Procedures An algorithmic point of view 14
From Equality to Propositional Logic
Once the graph is chordal, we can constrain only the triangles.
Note that this procedure adds not more than a polynomial # of edges, and results in a polynomial number of constraints.
T
T
T T
? T T
T
Decision Procedures An algorithmic point of view 15
Improvement
So far we did not consider the polarity of the edges.
Claim: in the following graph φrtc = e3 ∧ e2 → e1 is sufficient
This is only true because of monotonicity of NNF
e1
e2
e3
Skipping rest of this set of slides. Left here for completeness (but they need work).
Decision Procedures An algorithmic point of view 16
5
Decision Procedures An algorithmic point of view 17
Definitions Dfn: A contradictory Cycle C is constrained under
formula T if T does not allow this assignment
C = F
T
T T
T
Decision Procedures An algorithmic point of view 18
Main theorem
If T R constrains all simple contradictory cycles,
and
For every assignment αS, αS |- T S → αS |- T R
then
φE is satisfiable iff B ∧ T R is satisfiable
The Equality Formula
From the Sparse method
Decision Procedures An algorithmic point of view 19
Transitivity: 5 constraints RTC: 0 constraints
Transitivity: 5 constraints RTC: 1 constraint
F
T
T
T
T
Decision Procedures An algorithmic point of view 20
Proof of the main theorem
() φE is satisfiable B∧T S is satisfiable B∧T R is satisfiable
() Proof strategy: Let αR be a satisfying assignment to B ∧ T R We will construct αS that satisfies B ∧ T S
From this we will conclude that φE is satisfiable
Skip proof
6
Decision Procedures An algorithmic point of view 21
Definitions for the proof…
A Violating cycle under an assignment αR:
This assignment violates T S but not necessarily T R
eF
eT2
eT1
T
T F
Either dashed or
solid
Decision Procedures An algorithmic point of view 22
More definitions for the proof… An edge e = (vi,vj) is equal under an assignment α iff
there is an equality path between vi and vj all assigned T under α. Denote:
T
T F
T T v1 v2
v3
Decision Procedures An algorithmic point of view 23
More definitions for the proof… An edge e = (vi,vj) is disequal under an assignment α
iff there is a disequality path between vi and vj in which the solid edge is the only one assigned false by α. Denote:
T
T F
T T v1 v2
v3
Decision Procedures An algorithmic point of view 24
Proof…
Observation 1: The combination is impossible if α= αR (recall: αR ² T R)
Observation 2: if (v1,v3) is solid, then
F T
T v1 v2
v3
7
Decision Procedures An algorithmic point of view 25
ReConstructing αS
Type 1: It is not the case that
Assign αS (e23) = F
Type 2: Otherwise it is not the case that
Assign α (e13) = T
F T
T
In all other cases αS = αR
F T
T
F T
v1 v2
v3
v1 v2
v3
Decision Procedures An algorithmic point of view 26
ReConstructing αS
Starting from αR, repeat until convergence: α(eT) := F in all Type 1 cycles α(eF) := T in all Type 2 cycles
All Type 1 and Type 2 triangles now satisfy T S B is still satisfied (monotonicity of NNF) Left to prove: all contradictory cycles are still
satisfied
Decision Procedures An algorithmic point of view 27
Proof…
Invariant: contradictory cycles are not violating throughout the reconstruction.
contradicts the precondition to make this assignment…
F T
T v1 v2
v3
F T
T
Decision Procedures An algorithmic point of view 28
Proof…
Invariant: contradictory cycles are not violating throughout the reconstruction.
contradicts the precondition to make this assignment…
F T
T v1 v2
v3
T T
F
8
Decision Procedures An algorithmic point of view 29
Applying RTC
How can we use the theorem without enumerating contradictory cycles ?
Answer: Consider the chordal graph. Constrain triangles if they are part of a (simple)
contradictory cycle How?
Decision Procedures An algorithmic point of view 30
The RTC algorithm
Bi-Connected Component (BCC) – maximal set of edges s.t. any two edges in the set lie on a common simple cycle.
Find all BCC-s with one solid edge. Add solid chords from the graph, and auxiliary
dashed chords to make the BCC chordal.
Decision Procedures An algorithmic point of view 31
• Should we constrain this triangle?
• In which direction ?
• Is this constraint necessary ?
Decision Procedures An algorithmic point of view 32
Decomposing the graph
Focus on Bi-connected dashed components built on top of a solid edge Includes all contradictory cycles involving this edge
9
Decision Procedures An algorithmic point of view 33
Make the component chordal Chordal-ity guarantees: every cycle contains a simplicial
vertex, i.e. a vertex that its neighbors are connected.
Decision Procedures An algorithmic point of view 34
The RTC algorithm Constraints cache:
e2 ∧ e3 → e1
e4 ∧ e7 → e2
e5 ∧ e8 → e4
1
2 3
4
5
6
8
9
12 11
7
Decision Procedures An algorithmic point of view 35
Constrains all contradictory cycles Constraints cache:
e2 ∧ e3 → e1
e4 ∧ e7 → e2
e6∧ e3 → e4
1
2 3
4
5
6
8
9
12 11
7
Decision Procedures An algorithmic point of view 36
Results – random graphs
V=200, E=800, 16 random topologies
10
Decision Procedures An algorithmic point of view 37
Random graphs (Satisfiable)