Title: Compact Encoding of FOL
1Compact Propositional Encoding ofFirst Order
Theories
- Eyal Amir
- University of Illinois at Urbana-Champaign
- (Joint with Deepak Ramachandran and Igor Gammer)
2Example Pigeonhole Principle
p1
H1
p2
H2
p3
H3
p4
H4
3Pigeonhole Classical Encoding
- H1(pi) ? H2(pi) ? H3(pi) ? H4(pi)
- ? H1(pi) ? H2(pi)
- ??p,q (p?q ? Hi(p) ? Hi(q))
Every i
O(n2) props
4A Reformulation
- Hi(p) pigeon p is not in a hole in the subtree
rooted at i.
H1
p1
p3
H3
H2
p4
p2
1
2
3
4
5A Reformulation
Hi(p) pigeon p is not in a hole in the subtree
rooted at i.
?pH1(p) ?(H2(p)? H3(p))
H1
p1
p3
?pH2(p) ?(-H1(p)? -H2(p))
?pH1(p) ?(-H3(p)?-H4(p))
p4
p2
1
2
3
4
6A Reformulation
- Hi(p) pigeon p is not in a hole in the subtree
rooted at i.
?pH1(p) ? H2(p)
p1
p3
?p?H1(p) ??H2(p)
?p?H3(p)??H4(p)
p4
p2
1
2
3
4
7A Reformulation
- Hi(p) pigeon p is not in a hole in the subtree
rooted at i.
H1
p1
p3
H3
H2
?p,qHi(p)?Hi(q) ?(pq)
p4
p2
8A Reformulation
- Hi(p) pigeon p is not in a hole in the subtree
rooted at i.
?p?H1(p)
p1
p3
H3
H2
O(nlogn) props
p4
p2
9Propositional Encodings Motivation
- How do we do this in general? scientific
curiosity - Applications
- Formal verification, BMC specification in FOL
- AI planning, diagnosis, spatial reasoning,
question answering from knowledge specified in
FOL - Useful with many objects, predicates, time steps,
etc. - Can use efficient SAT solvers
10Outline
- Algorithm for compact prop. encoding
- Analysis
- Interpolants correctness of algorithm
- A different Treewidth number of props.
- Towards automatic partitioning
- Related work open questions
11Naïve Propositional Encoding
- Tasks converted into propositional logic
- P(a) ? Pa ?x P(x) ? Pa ? Pb ? Pc
- (Naive Propositionalization)
- Problem Very many propositions
- PCk for P predicates of arity k,
and C constant symbols - Note Assumes Domain Closure (DCA)
- constant symbols name all domain objects
12Our Results
- New method for propositioal encoding
- Size depends on optimal tree decomposition (e.g.,
O(PC) sometimes O(n logn) instead of O(n2)
for Pigeonhole Principle) - Applications
- Machine scheduling problem
- Board-Level Routing Problem for FPGAs
13Our New Algorithm
- Rough algorithm (given theory T)
- Partition theory T into T1Tr (1)
- Encode every Ti in propositional logic Ti
separately (create proposition Pa for constant a
and predicate P in L(Ti)) (2) - Return UirTi
14Partitioned Theory
T
15Partitioned Theory
T1
T2
16Propositional Encoding
T1
T2
17Propositional Encoding
T1
T2
18Propositional Encoding
T1
T2
19Propositional Encoding
T1
T2
20Propositional Encoding
T1
T2
21Propositional Encoding
T1
T2
22Partitioned Propositional Encoding
- Algorithm
- Partition theory T into T1Tr
- Propositionalize each Ti separately
- Return the propositional encoding UirTi
PiCi props.
? an exponential speed-up for SAT solver
How to make this soundcomplete?
23Experiments Board-Level Routing
prop. vars per problem
SAT Running time (sec.) per problem
24Experiments Machine Scheduling
prop. vars per problem
SAT Running time (sec.) per problem
25Outline
- Algorithm for compact prop. encoding
- Analysis
- Interpolants correctness of algorithm
- A different Treewidth number of props.
- Towards automatic partitioning
- Related work open questions
26Key to Exact Encoding
- Craigs interpolation theorem (First-Order
Logic) - If T1 T2, then there is a formula C including
only symbols from L(T1) ? L(T2) such that T1 C
and C T2
T1
T2
P(x)
27Key to Exact Encoding
- Craigs interpolation theorem (First-Order
Logic) - If T1 ?T2, then there is a formula C
including only symbols from L(T1) ? L(T2) such
that T1 C and C ?T2
T1
?T2
The only interpolants (the Cs) can be
?xP(x),?xP(x), (6 others)
P(x)
28Key to Exact Encoding
- Key idea If our prop. encoding of T1 T2
implies all possible interpolants in L(T1)?L(T2),
then the combined encoding is SAT iff T (in FOL)
is SAT.
T1
?T2
The only interpolants (the Cs) can be
?xP(x),?xP(x), (6 others)
P(x)
29Propositional Encoding
T1
T2
30Correctness of Encoding Alg.
- Encoding of each partition needs to include
encodings of all possible interpolants (detailed
next) - When there are more than two partitions, the
partitions are arranged in a tree decomposition
(in next section)
31Outline
- Algorithm for compact prop. encoding
- Analysis
- Interpolants correctness of algorithm
- A different Treewidth number of props.
- Towards automatic partitioning
- Related work open questions
32Propositional Encoding Size
T1
T2
33Propositional encoding of Monadic FOL
Factor single-variable existentially quantified
formula Theorem Can convert any monadic FOL
formula to a conjunction of disjunctions of
factors Example
34Propositionalizing a Partition in Monadic FOL
- Convert Ti to factorized form
- Replace factors in ?i with prop. symbols
-
-
- Add meaning of new propositions
e(Ti)
This approach creates PiCi3Pi
propositional symbols.
35Outline
- Algorithm for compact prop. encoding
- Analysis
- Interpolants correctness of algorithm
- A different Treewidth number of props.
- Towards automatic partitioning
- Related work open questions
36Automatic Partitioning and Propositional Encoding
- Optimization criteria
- Tree of partitions of axioms that satisfies the
running intersection property - Minimize PiCi3Pi (contrast with
treewidth, where we minimize Pi) - Can use current algorithms for treewidth and
decomposition as a starting point - Sometime need reformulation of axioms
37Automatic Partitioning
- Find a tree decomposition G of minimum width
- Every node in G is a set of symbols from T
- G satisfies the running intersection property if
P appears in both v,u in G, then P appears in all
the nodes on the path connecting them - Choose G with minimum width (width(G) is the size
of its largest node v)
38Outline
- Algorithm for compact prop. encoding
- Analysis
- Interpolants correctness of algorithm
- A different Treewidth number of props.
- Towards automatic partitioning
- Related work open questions
39Related Work
- McMillan 2005 some ground (QF) FOL theories
have ground interpolants - May use his results for similar results on
compact prop. for those theories - McMillans talk yesterday may use our compact
prop. method to generate all interpolants
40Related Work
- Pnueli, Rodeh, Strichman, Siegel 99, 02
equational theories (no predicates), and
weak(er?) bound - where R resulting universe size, and others
are problem dependent (worst case n!, for n
variables/constants)
41Conclusion
- Created efficient propositional encodings
- Monadic FOL Sound Complete
- Ramsey class Sound, Incomplete without DCA
- Applies to general FOL (with DCA)
- Speedup in SAT solving
- Exploits the structure of real world problems
- Future work Classes beyond Monadic FOL
- Right now ground FOL with equality
- 2-var fragment
- Some software on http//reason.cs.uiuc.edu/eyal
42THE END
43Problems with Naïve Prop.
- Problem 1 Very large number of propositions
- PCk for P predicates of arity k,
and C constant symbols - Problem 2 Assumes Domain Closure Assumption
(DCA) only elements are those with constant
symbols
44General FOL (with DCA)
- Use DCA repeatedly until we get a formula in
Monadic FOL - Replace ?x1Qx2Qxn?(x1,, xn) with
- ?c?C Qx2Qxn?(x1,, xn)
- Replace ?x1Qx2Qxn?(x1,, xn) with
- ?c?C Qx2Qxn?(x1,, xn)
45Automatic Partitioning
- Begin with logical Knowledge Base in FOL
- Construct symbol graph
- vertex symbol
- edge axiom uses both symbols
- Find a tree decomposition
- Partition axioms using clusters in tree
decomposition
46Automatic Partitioning
key ? ?locked ? can_open can_open Ù
try_open ? open open Ù fetch ?
broom key ? open try_open ? open ? broom ? fetch
broom Ù dry ? can_clean can_clean ?
clean broom Ù let_dry ? dry time ?
let_dry drier ? let_dry time ? drier
47Automatic Partitioning
key ? ?locked ? can_open can_open Ù
try_open ? open open Ù fetch ?
broom key ? open try_open ? open ? broom ? fetch
broom Ù dry ? can_clean can_clean ?
clean broom Ù let_dry ? dry time ?
let_dry drier ? let_dry time ? drier
48Automatic Partitioning
key ? ?locked ? can_open can_open Ù
try_open ? open open Ù fetch ?
broom key ? open try_open ? open ? broom ? fetch
broom Ù dry ? can_clean can_clean ?
clean broom Ù let_dry ? dry time ?
let_dry drier ? let_dry time ? drier
49Automatic Partitioning
key
locked
can_open
try_open
clean
can_clean
open
fetch
dry
time
broom
let_dry
drier
50Automatic Partitioning
key
locked
can_open
try_open
clean
can_clean
open
fetch
dry
time
broom
let_dry
drier
51Automatic Partitioning
broom
key
locked
can_open
try_open
clean
can_clean
open
fetch
dry
time
broom
let_dry
drier
52Automatic Partitioning
broom
key
locked
can_open
try_open
clean
can_clean
broom
open
fetch
dry
time
broom
let_dry
drier
53Automatic Partitioning
key ? ?locked ? can_open can_open Ù
try_open ? open open Ù fetch ?
broom key ? open try_open ? open ? broom ? fetch
broom Ù dry ? can_clean can_clean ?
clean broom Ù let_dry ? dry time ?
let_dry drier ? let_dry time ? drier
broom