Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compact Propositional Encoding of First Order Theories

Similar presentations


Presentation on theme: "Compact Propositional Encoding of First Order Theories"— Presentation transcript:

1 Compact Propositional Encoding of First Order Theories
Eyal Amir University of Illinois at Urbana-Champaign (Joint with Deepak Ramachandran and Igor Gammer) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

2 Example: Pigeonhole Principle
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

3 Pigeonhole: Classical Encoding
Every i: H1(pi)  H2(pi)  H3(pi)  H4(pi)  [H1(pi)  H2(pi)] p,q (pq  Hi(p)  Hi(q)) O(n2) props Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

4 A Reformulation 1 2 3 4 H1+ p1 p3 H2+ H3+ p4 p2
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i. H1+ p1 p3 H2+ H3+ p4 p2 1 2 3 4 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

5 A Reformulation 1 2 3 4 H1+ p1 p3 p4 p2
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i. p[H1+(p) (H2+(p) H3+(p)) H1+ p1 p3 p[H2+(p) (-H1(p) -H2(p)) p[H1+(p) (-H3(p)-H4(p)) p4 p2 1 2 3 4 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

6 A Reformulation Hi+(p) : pigeon p is not in a hole in the subtree rooted at i. p[H1+(p)  H2+(p)] p1 p3 p[H1(p) H2(p)] p[H3(p)H4(p)] p4 p2 1 2 3 4 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

7 A Reformulation p,q[Hi(p)Hi(q) (p=q)] H1+ p1 p3 H2+ H3+ p4 p2
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i. H1+ p1 p3 H2+ H3+ p,q[Hi(p)Hi(q) (p=q)] p4 p2 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

8 A Reformulation O(n·logn) props p[H1+(p)] p1 p3 H2+ H3+ p4 p2
Hi+(p) : pigeon p is not in a hole in the subtree rooted at i. p[H1+(p)] p1 p3 H2+ H3+ O(n·logn) props p4 p2 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

9 Propositional 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

10 Outline Algorithm for compact prop. encoding Analysis
Interpolants – correctness of algorithm A different Treewidth – number of props. Towards automatic partitioning Related work & open questions Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

11 Naïve Propositional Encoding
Tasks converted into propositional logic P(a)  Pa x P(x)  Pa  Pb  Pc (Naive Propositionalization) Problem: Very many propositions: |P||C|k for |P| predicates of arity k, and |C| constant symbols Note: Assumes Domain Closure (DCA) constant symbols name all domain objects Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

12 Our Results New method for propositioal encoding
Size depends on optimal tree decomposition (e.g., O(|P|+|C|) sometimes; O(n logn) instead of O(n2) for Pigeonhole Principle) Applications: Machine scheduling problem Board-Level Routing Problem for FPGA’s Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

13 Our New Algorithm Rough algorithm (given theory T):
Partition theory T into T1…Tr (*1) Encode every Ti in propositional logic Ti’ separately (create proposition Pa for constant a and predicate P in L(Ti)) (*2) Return Ui≤rTi’ Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

14 Partitioned Theory T … Compact Encoding of FOL
Eyal Amir, Cambridge Present., May 2006

15 Partitioned Theory T1 T2 … … Compact Encoding of FOL
Eyal Amir, Cambridge Present., May 2006

16 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

17 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

18 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

19 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

20 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

21 Propositional Encoding
Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

22 Partitioned Propositional Encoding
Algorithm: Partition theory T into T1…Tr Propositionalize each Ti separately Return the propositional encoding Ui≤rTi |Pi||Ci| props. # props. in partitioned encoding # props. in naïve encoding #partitions  an exponential speed-up for SAT solver How to make this sound+complete? Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

23 Experiments: Board-Level Routing
#prop. vars per problem SAT Running time (sec.) per problem Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

24 Experiments: Machine Scheduling
#prop. vars per problem SAT Running time (sec.) per problem Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

25 Outline Algorithm for compact prop. encoding Analysis
Interpolants – correctness of algorithm A different Treewidth – number of props. Towards automatic partitioning Related work & open questions Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

26 Key to Exact Encoding ^ P(x) ^ ^ ^ T1 T2
Craig’s 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) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

27 Key to Exact Encoding ^ P(x) ^ ^ ^ T1 ^
Craig’s 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 has no model, iff T1 T2 ^ T1 ^ T2 The only interpolants (the C’s) can be xP(x),xP(x),… (+6 others) P(x) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

28 Key to Exact Encoding ^ P(x)
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 has no model, iff T1 T2 ^ T1 ^ T2 The only interpolants (the C’s) can be xP(x),xP(x),… (+6 others) P(x) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

29 Propositional Encoding
The only interpolants (the C’s) can be xP(x),xP(x),… (+6 others) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

30 Correctness 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) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

31 Outline Algorithm for compact prop. encoding Analysis
Interpolants – correctness of algorithm A different Treewidth – number of props. Towards automatic partitioning Related work & open questions Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

32 Propositional Encoding Size
The only interpolants (the C’s) can be xP(x),xP(x),… (+6 others) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

33 Propositional 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: Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

34 Propositionalizing a Partition in Monadic FOL
Convert Ti to factorized form Replace factors in Τi with prop. symbols Add meaning of new propositions ε(Ti) = This approach creates |Pi||Ci|+3|Pi| propositional symbols. Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

35 Outline Algorithm for compact prop. encoding Analysis
Interpolants – correctness of algorithm A different Treewidth – number of props. Towards automatic partitioning Related work & open questions Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

36 Automatic Partitioning and Propositional Encoding
Optimization criteria Tree of partitions of axioms that satisfies the running intersection property Minimize |Pi||Ci|+3|Pi| (contrast with treewidth, where we minimize |Pi|) Can use current algorithms for treewidth and decomposition as a starting point Sometime need reformulation of axioms Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

37 Automatic 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) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

38 Outline Algorithm for compact prop. encoding Analysis
Interpolants – correctness of algorithm A different Treewidth – number of props. Towards automatic partitioning Related work & open questions Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

39 Related Work [McMillan 2005] – some ground (QF) FOL theories have ground interpolants May use his results for similar results on compact prop. for those theories McMillan’s talk yesterday – may use our compact prop. method to generate all interpolants Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

40 Related 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) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

41 Conclusion 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

42 THE END Compact Encoding of FOL
Eyal Amir, Cambridge Present., May 2006

43 Problems with Naïve Prop.
Problem 1: Very large number of propositions: |P||C|k for |P| predicates of arity k, and |C| constant symbols Problem 2: Assumes Domain Closure Assumption (DCA) – only elements are those with constant symbols Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

44 cC Qx2…Qxn(x1,…, xn) General FOL (with DCA) cC Qx2…Qxn(x1,…, xn)
Use DCA repeatedly until we get a formula in Monadic FOL Replace x1Qx2…Qxn(x1,…, xn) with cC Qx2…Qxn(x1,…, xn) Replace x1Qx2…Qxn(x1,…, xn) with cC Qx2…Qxn(x1,…, xn) Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

45 Automatic 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

46 Automatic 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

47 Automatic 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

48 Automatic 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

49 Automatic Partitioning
key locked can_open try_open can_clean clean open fetch dry time broom let_dry drier Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

50 Automatic Partitioning
key locked can_open try_open can_clean clean open fetch dry time broom let_dry drier Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

51 Automatic Partitioning
broom key locked can_open try_open can_clean clean open fetch dry time broom let_dry drier Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

52 Automatic Partitioning
broom key locked can_open try_open can_clean clean broom open fetch dry time broom let_dry drier Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006

53 Automatic 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 Compact Encoding of FOL Eyal Amir, Cambridge Present., May 2006


Download ppt "Compact Propositional Encoding of First Order Theories"

Similar presentations


Ads by Google