compact propositional encoding of first order theories
Post on 07-Jan-2016
31 Views
Preview:
DESCRIPTION
TRANSCRIPT
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
1
Compact Propositional Compact Propositional Encoding ofEncoding of
First Order TheoriesFirst Order Theories
Eyal AmirEyal AmirUniversity of Illinois at Urbana-ChampaignUniversity of Illinois at Urbana-Champaign
(Joint with (Joint with Deepak RamachandranDeepak Ramachandran and and Igor GammerIgor Gammer))
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
2
Example: Pigeonhole PrincipleExample: Pigeonhole Principle
p1
p2
p3
p4
H1
H2
H3
H4
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
3
Pigeonhole: Classical EncodingPigeonhole: Classical Encoding
HH11(p(pii) ) H H22(p(pii) ) H H33(p(pii) ) H H44(p(pii) )
[H[H11(p(pii) ) H H22(p(pii)])]
p,q (pp,q (pq q H Hii(p) (p) H Hii(q))(q))
O(n2) props
Every i:Every i:
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
4
A ReformulationA ReformulationHHii
++(p) : pigeon p is not in a hole in the subtree rooted at i.(p) : pigeon p is not in a hole in the subtree rooted at i.
H1+
H3+H2
+
p1
p2
p3
p411 22 33 44
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
5
A ReformulationA Reformulation
H1+p[H1
+(p) (H2+(p) H3
+(p))
p[H2+(p) (-H1(p) -H2(p)) p[H1
+(p) (-H3(p)-H4(p))
p1
p2
p3
p4
HHii++(p) : pigeon p is not in a hole in the subtree rooted at i.(p) : pigeon p is not in a hole in the subtree rooted at i.
11 22 33 44
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
6
A ReformulationA Reformulation
p[H1(p) H2(p)] p[H3(p)H4(p)]
p[H1+(p) H2
+(p)]
p1
p2
p3
p4
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.
11 22 33 44
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
7
A ReformulationA Reformulation
H1+
H3+H2
+
p,q[Hi(p)Hi(q) (p=q)]
p1
p2
p3
p4
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
8
A ReformulationA Reformulation
H3+H2
+
p[H1+(p)]
p1
p2
p3
p4
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.Hi+(p) : pigeon p is not in a hole in the subtree rooted at i.
O(n·logn) props
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
9
Propositional Encodings: Propositional Encodings: MotivationMotivation
• How do we do this in general? – scientific How do we do this in general? – scientific curiositycuriosity
• Applications:Applications:– Formal verification, BMC – specification in FOLFormal verification, BMC – specification in FOL– AI: planning, diagnosis, spatial reasoning, AI: planning, diagnosis, spatial reasoning,
question answering from knowledge – specified question answering from knowledge – specified in FOLin FOL
– Useful with many objects, predicates, time Useful with many objects, predicates, time steps, etc.steps, etc.
• Can use efficient SAT solversCan use efficient SAT solvers
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
10
OutlineOutline1.1. Algorithm for compact prop. encodingAlgorithm for compact prop. encoding
2.2. AnalysisAnalysis1.1. Interpolants – correctness of algorithmInterpolants – correctness of algorithm
2.2. A different Treewidth – number of props.A different Treewidth – number of props.
3.3. Towards automatic partitioningTowards automatic partitioning
3.3. Related work & open questionsRelated work & open questions
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
11
Naïve Propositional EncodingNaïve Propositional Encoding• Tasks converted into propositional logicTasks converted into propositional logic
– P(a) P(a) P Pa a x P(x) x P(x) P Pa a PPb b PPc c
((Naive Naive Propositionalization)Propositionalization)
• Problem: Very many propositions:Problem: Very many propositions:
|P||C||P||C|kk for |P| predicates of arity k, for |P| predicates of arity k, and |C| constant symbolsand |C| constant symbols
• Note: Assumes Domain Closure (DCA)Note: Assumes Domain Closure (DCA)– constant symbols name all domain objectsconstant symbols name all domain objects
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
12
Our ResultsOur Results
• New method for propositioal encodingNew method for propositioal encoding
• Size depends on optimal tree Size depends on optimal tree decomposition (e.g., decomposition (e.g., O(|P|+|C|) sometimes; O(|P|+|C|) sometimes; O(n logn) instead of O(nO(n logn) instead of O(n22) for Pigeonhole ) for Pigeonhole PrinciplePrinciple))
• Applications: Applications: – Machine scheduling problemMachine scheduling problem– Board-Level Routing Problem for FPGA’sBoard-Level Routing Problem for FPGA’s
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
13
Our New AlgorithmOur New AlgorithmRough algorithm (given theory T):Rough algorithm (given theory T):
1.1. Partition theory T into TPartition theory T into T11…T…Tr r (*1)(*1)
2.2. Encode every TEncode every Tii in propositional logic in propositional logic
TTii’ separately (create proposition P’ separately (create proposition Paa for for
constant a and predicate P in L(Tconstant a and predicate P in L(Tii)) ))
(*2)(*2)
3.3. Return UReturn Uii≤≤rrTTii’’
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
14
Partitioned TheoryPartitioned Theory
…
T
))()()(.( xPxRxQx
))()()(.( xTxRxQx
))()()(.( xPxWxVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
15
Partitioned TheoryPartitioned Theory
… …
T1 T2
))()(
)(.(
xPxR
xQx
))()()(.( xTxRxQx P
))()(
)(.(
xPxW
xVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
16
Propositional EncodingPropositional Encoding
… …
T1 T2
))()(
)(.(
xPxR
xQx
))()()(.( xTxRxQx P
))()(
)(.(
xPxW
xVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
17
Propositional EncodingPropositional Encoding
… …
T1 T2
))()(
)(.(
xPxR
xQx
))()()(.( xTxRxQx P
))()(
)(.(
xPxW
xVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
18
Propositional EncodingPropositional Encoding
… …
T1 T2
))()(
)(.(
xPxR
xQx
TRQE ,,
P))()(
)(.(
xPxW
xVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
19
Propositional EncodingPropositional Encoding
… …
T1 T2
PRQE ,,
TRQE ,,
P))()(
)(.(
xPxW
xVx
))()()(.( xWxYxZx
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
20
Propositional EncodingPropositional Encoding
… …
T1 T2
PRQE ,,
TRQE ,,
P
PWVE ,,
WYZE ,,
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
21
Propositional EncodingPropositional Encoding
… …
T1 T2
PRQE ,,
TRQE ,, P
PWVE ,,
WYZE ,,
...1
,,, ...
PC
RQTRQ
EP
EE
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
22
Partitioned Propositional Partitioned Propositional EncodingEncoding
Algorithm:Algorithm:
1.1. Partition theory T into TPartition theory T into T11…T…Trr
2.2. Propositionalize each TPropositionalize each Tii separately separately
3.3. Return the propositional encoding UReturn the propositional encoding Uii≤≤rrTTii
How to make this sound+complete?How to make this sound+complete?
# props. in partitioned encoding 1# props. in partitioned encoding 1# props. in naïve encoding # props. in naïve encoding #partitions#partitions
an exponential speed-up for SAT solver
|P|Pii||C||Cii| props.| props.
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
23
Experiments: Board-Level Experiments: Board-Level RoutingRouting
#prop. vars per problem SAT Running time (sec.) per problem
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
24
Experiments: Machine Experiments: Machine SchedulingScheduling
#prop. vars per problem SAT Running time (sec.) per problem
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
25
OutlineOutline1.1. Algorithm for compact prop. encodingAlgorithm for compact prop. encoding
2.2. AnalysisAnalysis1.1. Interpolants – correctness of algorithmInterpolants – correctness of algorithm
2.2. A different Treewidth – number of props.A different Treewidth – number of props.
3.3. Towards automatic partitioningTowards automatic partitioning
3.3. Related work & open questionsRelated work & open questions
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
26
Key to Exact EncodingKey to Exact Encoding
• Craig’s interpolation theoremCraig’s interpolation theorem (First-Order Logic): (First-Order Logic):– If T1 T2, then there is a formula C including only If T1 T2, then there is a formula C including only
symbols from L(T1) symbols from L(T1) L(T2) such that T1 C and L(T2) such that T1 C and C T2C T2
P(x)
T1 T2
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
27
Key to Exact EncodingKey to Exact Encoding
• Craig’s interpolation theoremCraig’s interpolation theorem (First-Order Logic): (First-Order Logic):– If T1 If T1 T2, then there is a formula C including only T2, then there is a formula C including only
symbols from L(T1) symbols from L(T1) L(T2) such that T1 C and L(T2) such that T1 C and C C T2T2
P(x)
T1 T2T1T1T2 has no model, iff T2 has no model, iff
T1 T1 T2T2
The only interpolants (the C’s) The only interpolants (the C’s) can be can be xP(x),xP(x),xP(x),… xP(x),…
(+6 others)(+6 others)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
28
Key to Exact EncodingKey to Exact Encoding
• Key idea: If our prop. encoding of T1 [T2] Key idea: If our prop. encoding of T1 [T2] implies all possible interpolants in implies all possible interpolants in L(T1)L(T1)L(T2), then the combined encoding L(T2), then the combined encoding is SAT iff T (in FOL) is SAT.is SAT iff T (in FOL) is SAT.
P(x)
T1 T2T1T1T2 has no model, iff T2 has no model, iff
T1 T1 T2T2
The only interpolants (the C’s) The only interpolants (the C’s) can be can be xP(x),xP(x),xP(x),… xP(x),…
(+6 others)(+6 others)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
29
Propositional EncodingPropositional Encoding
… …
T1 T2
PRQE ,,
TRQE ,, P
PWVE ,,
WYZE ,,
...1
,,, ...
PC
RQTRQ
EP
EE
The only interpolants (the C’s)The only interpolants (the C’s) can be can be xP(x),xP(x),xP(x),…xP(x),…
(+6 others)(+6 others)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
30
Correctness of Encoding Alg.Correctness of Encoding Alg.• Encoding of each partition needs to Encoding of each partition needs to
include include encodings of all possible encodings of all possible interpolants (interpolants (detailed nextdetailed next))
• When there are more than two When there are more than two partitions, the partitions are arranged in partitions, the partitions are arranged in a a tree decomposition (in next section)tree decomposition (in next section)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
31
OutlineOutline1.1. Algorithm for compact prop. encodingAlgorithm for compact prop. encoding
2.2. AnalysisAnalysis1.1. Interpolants – correctness of algorithmInterpolants – correctness of algorithm
2.2. A different Treewidth – number of props.A different Treewidth – number of props.
3.3. Towards automatic partitioningTowards automatic partitioning
3.3. Related work & open questionsRelated work & open questions
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
32
Propositional Encoding SizePropositional Encoding Size
… …
T1 T2
PRQE ,,
TRQE ,, P
PWVE ,,
WYZE ,,
...1
,,, ...
PC
RQTRQ
EP
EE
The only interpolants (the C’s)The only interpolants (the C’s) can be can be xP(x),xP(x),xP(x),…xP(x),…
(+6 others)(+6 others)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
33
Propositional encoding of Propositional encoding of Monadic FOLMonadic FOL
)()(())()(())()(())()(())()((
yyQxPxyQxPxyyQxxPyyQxPxyyQxPyx
FactorFactor = single-variable existentially = single-variable existentiallyquantified formulaquantified formula
TheoremTheorem : : Can convert any monadic FOL Can convert any monadic FOL formula to a conjunction of disjunctions of formula to a conjunction of disjunctions of factorsfactors
Example: Example:
QP EE~
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
34
Propositionalizing a Partition in Propositionalizing a Partition in Monadic FOLMonadic FOL
1.1. Convert TConvert Tii to to factorized formfactorized form
2.2. Replace Replace factorsfactors in in ΤΤii with prop. symbols with prop. symbols
3.3. Add meaning of new propositionsAdd meaning of new propositions
...},{...},{
,,
,
QPQPQPQP
QPccPa
EEEEEEEQPEP
QPExQxPxaP
,))()(()(
εε(T(Tii) =) =
aP
This approach creates |PThis approach creates |P ii||C||Cii|+3|+3|Pi||Pi| propositional symbols. propositional symbols.
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
35
OutlineOutline1.1. Algorithm for compact prop. encodingAlgorithm for compact prop. encoding
2.2. AnalysisAnalysis1.1. Interpolants – correctness of algorithmInterpolants – correctness of algorithm
2.2. A different Treewidth – number of props.A different Treewidth – number of props.
3.3. Towards automatic partitioningTowards automatic partitioning
3.3. Related work & open questionsRelated work & open questions
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
36
Automatic Partitioning and Automatic Partitioning and Propositional EncodingPropositional Encoding
• Optimization criteriaOptimization criteria– Tree of partitions of axioms that satisfies Tree of partitions of axioms that satisfies
the running intersection propertythe running intersection property
– Minimize |PMinimize |Pii||C||Cii|+3|+3|Pi||Pi| (contrast with (contrast with
treewidth, where we minimize |Pi|)treewidth, where we minimize |Pi|)
• Can use current algorithms for treewidth Can use current algorithms for treewidth and decomposition as a starting pointand decomposition as a starting point
• Sometime need reformulation of axiomsSometime need reformulation of axioms
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
37
Automatic PartitioningAutomatic Partitioning• Find a Find a tree decompositiontree decomposition G of G of
minimum width:minimum width:– Every node in G is a set of symbols from TEvery node in G is a set of symbols from T– G satisfies the G satisfies the running intersection running intersection
propertyproperty: if P appears in both v,u in G, then : if P appears in both v,u in G, then P appears in all the nodes on the path P appears in all the nodes on the path connecting themconnecting them
– Choose G with minimum Choose G with minimum widthwidth (width(G) is (width(G) is the size of its largest node v)the size of its largest node v)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
38
OutlineOutline1.1. Algorithm for compact prop. encodingAlgorithm for compact prop. encoding
2.2. AnalysisAnalysis1.1. Interpolants – correctness of algorithmInterpolants – correctness of algorithm
2.2. A different Treewidth – number of props.A different Treewidth – number of props.
3.3. Towards automatic partitioningTowards automatic partitioning
3.3. Related work & open questionsRelated work & open questions
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
39
Related WorkRelated Work• [McMillan 2005] – some ground (QF) [McMillan 2005] – some ground (QF)
FOL theories have ground interpolantsFOL theories have ground interpolants– May use his results for similar results on May use his results for similar results on
compact prop. for those theoriescompact prop. for those theories
• McMillan’s talk yesterday – may use our McMillan’s talk yesterday – may use our compact prop. method to generate all compact prop. method to generate all interpolantsinterpolants
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
40
Related WorkRelated Work• [Pnueli, Rodeh, Strichman, Siegel ’99, [Pnueli, Rodeh, Strichman, Siegel ’99,
’02] – equational theories (no ’02] – equational theories (no predicates), and weak(er?) boundpredicates), and weak(er?) bound
where R = resulting universe size, and where R = resulting universe size, and others are problem dependent (worst others are problem dependent (worst case n!, for n variables/constants)case n!, for n variables/constants)
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
41
ConclusionConclusion• Created efficient propositional encodings:Created efficient propositional encodings:
– Monadic FOL – Sound + CompleteMonadic FOL – Sound + Complete– Ramsey class – Sound, Ramsey class – Sound, IncompleteIncomplete without DCA without DCA– Applies to general FOL (with DCA)Applies to general FOL (with DCA)
• Speedup in SAT solvingSpeedup in SAT solving• Exploits the structure of real world problemsExploits the structure of real world problems• Future workFuture work: Classes beyond Monadic FOL: Classes beyond Monadic FOL
– Right now: ground FOL with equalityRight now: ground FOL with equality– 2-var fragment2-var fragment
• Some software on Some software on http://reason.cs.uiuc.edu/eyalhttp://reason.cs.uiuc.edu/eyal
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
42
THE ENDTHE END
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
43
Problems with Naïve Prop.Problems with Naïve Prop.• Problem 1: Very large number of Problem 1: Very large number of
propositions:propositions:
|P||C||P||C|kk for |P| predicates of arity k, for |P| predicates of arity k, and |C| constant symbolsand |C| constant symbols
• Problem 2: Assumes Domain Closure Problem 2: Assumes Domain Closure Assumption (DCA) – only elements are Assumption (DCA) – only elements are those with constant symbolsthose with constant symbols
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
44
General FOL (with DCA)General FOL (with DCA)
Use DCA repeatedly until we get a Use DCA repeatedly until we get a formula in Monadic FOLformula in Monadic FOL
– Replace Replace xx11QxQx22…Qx…Qxnn(x(x11,…, x,…, xnn) with) with
ccCC QxQx22…Qx…Qxnn(x(x11,…, x,…, xnn))
– Replace Replace xx11QxQx22…Qx…Qxnn(x(x11,…, x,…, xnn) with ) with
ccCC QxQx22…Qx…Qxnn(x(x11,…, x,…, xnn))
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
45
Automatic PartitioningAutomatic Partitioning
• Begin with logical Knowledge Base in FOLBegin with logical Knowledge Base in FOL
• Construct symbol graphConstruct symbol graph– vertex = symbolvertex = symbol– edge = axiom uses both symbolsedge = axiom uses both symbols
• Find a Find a tree decompositiontree decomposition
• Partition axioms using clusters in tree Partition axioms using clusters in tree decompositiondecomposition
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
46
key locked can_opencan_open try_open openopen fetch broomkey opentry_open open broom fetch
broom dry can_cleancan_clean cleanbroom let_dry drytime let_drydrier let_drytime drier
Automatic PartitioningAutomatic Partitioning
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
47
key locked can_opencan_open try_open openopen fetch broomkey opentry_open open broom fetch
broom dry can_cleancan_clean cleanbroom let_dry drytime let_drydrier let_drytime drier
Automatic PartitioningAutomatic Partitioning
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
48
key locked can_opencan_open try_open openopen fetch broomkey opentry_open open broom fetch
broom dry can_cleancan_clean cleanbroom let_dry drytime let_drydrier let_drytime drier
Automatic PartitioningAutomatic Partitioning
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
49
Automatic PartitioningAutomatic Partitioning
key locked
can_open try_open
open fetch
broom
dry
clean
let_dry
time
drier
can_clean
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
50
Automatic PartitioningAutomatic Partitioning
key locked
can_open try_open
open fetch
broom
dry
clean
let_dry
time
drier
can_clean
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
51
Automatic PartitioningAutomatic Partitioning
key locked
can_open try_open
open fetch
broom
dry
clean
let_dry
time
drier
can_clean
broom
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
52
Automatic PartitioningAutomatic Partitioning
broom
key locked
can_open try_open
open fetch
broom
dry
clean
let_dry
time
drier
can_clean
broom
Compact Encoding of FOLEyal Amir, Cambridge Present., May 2006
53
Automatic PartitioningAutomatic Partitioning
key locked can_opencan_open try_open openopen fetch broomkey opentry_open open broom fetch
broom dry can_cleancan_clean cleanbroom let_dry drytime let_drydrier let_drytime drier
broom
top related