generating minimum transitivity constraints in p-time for deciding equality logic
DESCRIPTION
Generating minimum transitivity constraints in P-time for deciding Equality Logic. Ofer Strichman and Mirron Rozanov Technion, Haifa, Israel. Equality Logic. A Boolean combination of equalities ( x 1 = x 2 Æ ( x 2 = x 3 Ç x 1 x 3 )) x 1 , x 2 , x 3 2 N - PowerPoint PPT PresentationTRANSCRIPT
Technion 1
Generating minimum transitivity constraints in P-time for deciding Equality LogicOfer Strichman and Mirron Rozanov
Technion, Haifa, Israel
Technion 2
Equality Logic
A Boolean combination of equalities
(x1 = x2 Æ (x2 x3 Ç x1 x3)) x1,x2,x3 2 N
Typically combined with Uninterpreted Functions (EUF)
The decision problem for Equality Logic: NP – C
Technion 3
Basic notions
E: x = y Æ y = z Æ z x
x
y
z
(non-polar) Equality Graph:
Gives an abstract view of E
Technion 4
From Equality to Propositional LogicBryant & Velev CAV’00 – the Sparse method
E : x1 = x2 Æ x2 = x3 Æ x1 x3
sk : e1,2 Æ e2,3 Æ :e1,3
Encode all edges with Boolean variables This is an abstraction Transitivity of equality is lost! Must add transitivity constraints!
e 1,3
e1,2
e 2,3
x1
x2
x3
Technion 5
From Equality to Propositional LogicBryant & Velev CAV’00 – the Sparse method
E : x1 = x2 Æ x2 = x3 Æ x1 x3
sk : e1,2 Æ e2,3 Æ :e1,3
Transitivity Constraints: For each cycle of size n, forbid a true assignment to n-1 edges
T S = (e1,2 Æ e2,3 ! e1,3) Æ (e1,2 Æ e1,3 ! e2,3) Æ
(e1,3 Æ e2,3 ! e1,2)
Check: sk Æ T S
e 1,3
e1,2
e 2,3
x1
x2
x3
Technion 6
Thm-1: It is sufficient to constrain chord-free simple cycles
There can be an exponential number of chord-free simple cycles…
e1
e2
e3
e4
e5
T
T
T
F
T
F
From Equality to Propositional LogicBryant & Velev CAV’00 – the Sparse method
Technion 7
Make the graph ‘chordal’.
In a chordal graph, it is sufficient to constrain only triangles. Polynomial # of edges and constraints. # constraints = 3 £ #triangles
From Equality to Propositional LogicBryant & Velev CAV’00 – the Sparse method
Technion 8
An improvementReduced Transitivity Constraints (RTC)
So far we did not consider the polarity of the edges.
Assuming E is in Negation Normal Form
E: x = y Æ y = z Æ z x
x
y
z
(polar) Equality Graph:
= =
Technion 10
Here, T R = e3 Æ e2 ! e1 is sufficient
This is only true because of monotonicity of NNF
An improvementReduced Transitivity Constraints (RTC)
e1
e2
e3
x
z
y
=
=
Allowing e.g. x = z, x = y, z y
F
T
T
T
’:x = z, x = y, z = y
Technion 11
Definitions Dfn-1: A contradictory cycle is a cycle with exactly
one disequality edge.
Dfn-2: A contradictory Cycle C is constrained under T if T does not allow an assignment in which dashed edges are True and the solid edge is False.
C =
F
T
T T
T
Technion 12
Main theorem
Let T R be a conjunction of transitivity constraints.
If T R constrains all simple contradictory cycles then
E is satisfiable iff sk Æ T R is satisfiable
The Equality Formula
Technion 13
Proof strategy for the main theorem
() Proof strategy: Let R be a satisfying assignment to sk Æ T R
We will construct S that satisfies sk Æ T S
From this we will conclude that E is satisfiable
Skip proof
Technion 14
Transitivity: 5 constraintsRTC: 0 constraints
Transitivity: 5 constraintsRTC: 1 constraint
F
T
T
T
T
Technion 15
Applying RTC
How can we use the theorem without enumerating contradictory cycles ?
Answer: Consider the chordal graph. Still – which triangles ? in which direction?
Technion 16
x0
x1
x2
x3
x4
x5
Our CAV’05 solution
Exp # cycles to traverse. Solution: Stop before adding an existing constraint With a cost: must constrain non-simple cycles as well.
cache:
e0,2 Æ e1,2 e0,1e1,3 Æ e2,3 e1,2
e2,4 Æ e3,4 e2,3
e4,5 Æ e3,5 e3,4
Technion 19
x0
x1
x2
x3 x6
x4
x5
Constraining simple contradictory cycles
es
x71. Focus on each solid edge es separately
- (find its dashed Bi-connected component)
2. Make the graph chordal
Do we need: e5,6 Æ e3,6 ! e3,5 ?
Technion 20
x0
x1
x2
x3 x6
x4
x5
Constraining simple contradictory cycles
es
Do we need: e5,6 Æ e3,6 ! e3,5 ?yes! Do we need: e3,5 Æ e3,6 ! e5,6 ?
Technion 21
x0
x1
x2
x3 x6
x4
x5
Constraining simple contradictory cycles3. Remove a vertex xk that leans on an edge (xi,xj)
4. Is (xi,xj) on a simple cycle with es? O(|E|)
5. If yes, add (ek,i Æ ek,j ! ei,j)
es
e5,6 Æ e3,6 e3,5
Technion 22
x0
x1
x2
x3 x6
x4
x5
Constraining simple contradictory cycles1. Remove a vertex vk that leans on an edge (vi,vj)
2. Does (vi,vj) on the same simple cycle with es?
3. If yes, add (ek,i Æ ek,j ! ei,j)
es
e5,6 Æ e3,6 e3,5
Technion 23
Random graphs (Satisfiable)
Technion 24
Results – random graphs
V=200, E=800, 16 random topologies
0
50000
100000
150000
200000
250000
300000
350000
400000
10 30 50 70
% dashed
Co
nst
rain
ts
RTC
RTCS
# constraints: reduction of 17%Run time: reduction of 32%
Technion 25
Results – random graphs
V=200, E=800, 16 random topologies
# constraints: reduction of 17%Run time: reduction of 32%
0
50
100
150
200
250
300
350
400
450
1 2 3 4
% dashed
run
-tim
e
RTC
RTCS
Technion 26
A crafted example
2n assignments satisfy sk. None satisfy the theory.
Technion 27
ResultsUclid benchmarks* (all unsat)
* Results strongly depend on the reduction method of Uninterpreted Functions.
Technion 28
Possible refutations of CNF’s generated by Sparse
T R
T S – T R
BP3
P1
P0 P4
Thm: B is satisfiable ! B Æ (T S – T R) is satisfiable
T SB Æ
P2
Constraints of the form e1 Æ e2 ! e3Hypothesis: (T S – T R) clauses hardly participate in the proof
P2
Boolean Encoding
Transitivity constraints
A P3 proof exists according to the main theorem.
Technion 29
CNF
T S- T R
T R B
Core
T S- T R
T R B
Average on:10 graphs, ~890K clausesAll UnsatSparse: ~ 22 sec.RTC: ~ 12 Sec.
B – Boolean encodingT R – RTC constraintsT S – Sparse constraints
Technion 30
Summary
The RTC method is ~dominant over the Sparse method.
Open issue: find a P-time algorithm that exploits the full power of the main theorem.
Technion 38
Example: Circuit Transformations
A pipeline processes data in stages Data is processed in parallel – as in an
assembly line Formal Model:
Stage 1Stage 1
Stage 3Stage 3
Stage 2Stage 2
Technion 39
Example: Circuit Transformations
The maximum clock frequency depends on the longest path between two latches
Note that the output of g is usedas input to k
We want to speed up the design by postponing k to the third stage
Technion 40
Validating Circuit Transformations
==??
Technion 41
Validating a compilation process Source program
z = (x1 + y1) (x2 + y2);
Target program u1 = x1 + y1;u2 = x2 + y2;z = u1 u2 ;
Need to prove that:(u1 = x1 + y1 u2 = x2 + y2 z = u1 u2) $ z = (x1 + y1) (x2 + y2)
Compilation
Target Source
Technion 42
Validating a compilation process
Need to prove that:(u1 = x1 + y1 u2 = x2 + y2 z = u1 u2) $ z = (x1 + y1) (x2 + y2)
f1 f2g1
g2
f1 f2
Source program z = (x1 + y1) (x2 + y2);
Target program u1 = x1 + y1;u2 = x2 + y2;z = u1 u2 ;
Compilation
Technion 43
Need to prove that:(u1 = x1 + y1 u2 = x2 + y2 z = u1 u2) $ z = (x1 + y1) (x2 + y2)
f1 f2g1
g2
f1 f2
Instead, prove:
under functional consistency: for every uninterpreted function f x = y ! f(x) = f(y)
Which translates to (via Ackermann’s reduction):
Validating a compilation process
Technion 45
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
TF
Either dashed or
solid
Technion 46
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
TF
TTv1 v2
v3
Technion 47
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
TF
TTv1 v2
v3
Technion 48
Proof… Observation 1:
The combinationis impossible if = R
(recall: R ² T R)
Observation 2: if (v1,v3) is solid, then
FT
Tv1 v2
v3
Technion 49
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
FT
T
In all other cases S = R
FT
T
F T
v1 v2
v3
v1 v2
v3
Technion 50
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
Technion 51
Proof…
Invariant: contradictory cycles are not violating throughout the reconstruction.
contradicts the precondition to make this assignment…
FT
Tv1 v2
v3
F
T
T
Technion 52
Proof…
Invariant: contradictory cycles are not violating throughout the reconstruction.
contradicts the precondition to make this assignment…
FT
Tv1 v2
v3
TT
F
Technion 53
x0
x1
x2
x3 x6
x4
x5
The constraint e3,6 Æ e3,5 e5,6 is not added
Constraining simple contradictory cycles
cache:…e5,6 Æ e4,6 e4,5
Open problem: constrain simple contradictory cycles in P time
Technion 54
x0
x1
x2
x3 x6
x4
x5
the constraint e3,6 Æ e3,5 e5,6 is not added, though needed Suppose the graph has 3 more edges
Constraining simple contradictory cycles
cache:…e5,6 Æ e4,6 e4,5
Here we will stop, although …
Open problem: constrain simple contradictory cycles in P time