1 / 44

Solving Partial Order Constraints for LPO termination

Solving Partial Order Constraints for LPO termination. Outline. We are given a partial order constraint, which is a formula of the form The constraint is satisfiable if there exists a partial order on the symbols of the formula (f, g, h in the example above) that makes the formula true.

powa
Download Presentation

Solving Partial Order Constraints for LPO termination

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solving Partial Order Constraints for LPO termination

  2. Outline • We are given a partial order constraint, which is a formula of the form • The constraint is satisfiable if there exists a partial order on the symbols of the formula (f, g, h in the example above) that makes the formula true. • The partial order h<f=g makes the above formula true, hence it is satisfiable. • The problem is NP-complete.

  3. SAT formulaeand SAT-solver • Logic formulae in propositional logic: • Satisfiability: Is there an assignment of truth values to the variables in the formula, which makes the formula true? • SAT solvers test for satisfiability of a formula. • Can handle hundreds of thousands of clauses. • A practical way to handle NP-hard problems, up to some extent.

  4. Outline, cont. • To decide satisfiability of a constraint Φ: • Encode it as a SAT formula Φ’; • Use SAT-solver to the satisfiability of Φ’ . • Running time of a SAT solver depends upon the formula’s length and number of variables. • We want to encode the constraint in a compact way – to reduce the running time of the SAT solver.

  5. Partial order constraints • A partial order constraint is just like a formula in propositional logic, except that propositions are atoms of the form(f < g) or (f = g).

  6. Partial Order ConstraintsExamples • Let F = {f, g, h} • The following are partial order constraints on F:

  7. Partial Order ConstraintsExamples (cont.) • Φ1can be satisfied by the orders: • g < f < h • g = h < f • Φ2 cannot be satisfied. • Can Φ3 be satisfied?

  8. Total Order ≤ is a total order if it is: • Transitive. • Reflexive. • Anti-symmetric. • Total on a set F: for every a,b in F, a ≤b or b ≤a. Example: g<f=d<h=e

  9. Partial Order ConstraintsSatisfiabilty • The definition of satisfiabilty is changed. • A constraint Φ on a set F is satisfiable if there exists an total order ≤ on F such that Φis true when atoms in Φare interpreted as follows: • (a < b) in Φ is true iff (a ≤ b) and ¬(b ≤ a) in the total order • (a = b) in Φ is true iff (a ≤ b) and (b ≤ a) in the total order

  10. Axioms on the derived relations < and = For every f, g and h in F: • Reflexivity: (f = f) • Symmetry: (f = g) implies (g = f) • Asymmetry: ¬((f > g) and (g < f)) • Transitivity:((f > g) and (g > h)) implies (f > h)((f = g) and (g = h)) implies (f = h)

  11. More Axioms on < and = • Identity: ((f > g) and (g = h)) implies (f > h) ((f = g) and (g > h)) implies (f > h) • Comparability:(f > g) or (f < g) or (f = g) • Comment: Comparability is required from a total order

  12. Partial and Total orders • Recall that any partial order can be extended into a total order. • For negation-free constraints: If there exists an partial order such that Φis satisfied, then there exists a total order as well. • We are concerned with the question of satisfiability of partial order constraints. Not, for example, the number of possible partial orders satisfying Φ.

  13. Solving Partial Order ConstraintsUsing SAT-solvers • Encoding: A partial order constraint Φon a set of symbols F is encoded by a propositional formula Φ’ such that Φis satisfiable if and only if Φ’ is. • A good encoding yields short formulae with a small number of variables.

  14. “Atom-based” Encoding • First approach: atom-based encoding. Encode each atom as a propositional variable. • Notation: denotes the propositional variable corresponding to atom a. • Enforce the axioms of order and equality by adding propositions to the formula.

  15. Encoding of Axioms:Examples For a set F • Reflexivity of = is encoded by: • Transitivity of < is encoded by:

  16. “Atom-based” encoding:Size of the resulting formulae • For |F| = n, the resulting formula involves: • O(n2) variables. • O(n3) connectives. • This bound is always met. • Even if the formula is short, we still need • A variable for every pair of symbols in F. • A few connectives for every three symbols in F. (justto encode transitivity, for example).

  17. Integer assignment and solution Let Φbe a partial order constraint on F, and let |F |=n. • An integer assignment for Φis a mapping μ : F→{1,…,n} • An integer solution for Φis an assignment θwhich makes Φtrue under the natural interpretations of < and = on the natural numbers.

  18. Integer assignment and solutionExample • Consider again the constraint: • The assignment f = 2, g=1, h=1 is an integer solution for Φ1. • So is: f=2, g=1, h=3.

  19. Theorem 1 • A partial order constraint is satisfiable if and only if it has an integer solution. • Reminder: a constraint is satisfiable if there exists a total order that makes it true.

  20. A symbol-based propositional encoding • Encoding: A partial order constraint Φon a set of symbols F is encoded by a propositional formula Φ’ such that Φis satisfiable if and only if Φ’ is. • Our approach: Symbol-based. we encode the values of the symbols in F in an integer solution.

  21. A symbol-based propositional encoding, cont. • Each symbol is modeled using propositional variables that encode the binary representation of its value. • Constraints of the form (f < g) or (f = g) are interpreted as constraints on integers, encoded in k-bit arithmetic. • Denote the encoding by: ||(f < g)||k

  22. A symbol-based propositional encoding, cont. • Fora symbol f in F, the k-bit representation of its value is: • A constraint of the form (f = g) is encoded by:

  23. A symbol-based propositional encoding, cont. • A constraint of the form (f > g) is encoded recursively by: for k > 1

  24. A symbol-based propositional encoding, cont. • We encode a constraint Φby replacing each atom (e.g. (f < g)) with its k-bit encoding.

  25. A symbol-based encodingExample The constraint on F={g,f,h}: The propositional variables are:

  26. A symbol-based encoding Example, cont.

  27. A symbol-based encoding Example, cont. Putting it all together: A satisfying assignment:

  28. A symbol-based encodingSolution of the Example • We found the satisfying assignment: • The corresponding integer solution is:f=3, h=2, g=2 • The corresponding total order is: h=g<f

  29. Theorem 2 • A partial order constraint Φ on symbols F is satisfiable if and only if its symbol-based propositional encoding is satisfiable.

  30. A symbol-based encoding:Size • The encoding of a constraint Φ with n symbols involves: • O(nlog(n)) variables. • O(|Φ|log(n)) connectives. • Recall that in the first approach, the encoding involved: • O(n2) variables. • O(n3) connectives.

  31. Encode symbols as k-bit representation (as in symbol-based encoding). Encode each atom that appears in Φ as a special variable. Add propositions to connect atoms of the formula (just once!)with the symbol-based encoding of their meanings. What if Φ is long?Alternative encoding

  32. Alternative encodingExample • The constraint:is encoded as follows: (a1, a2 are the special variables)

  33. Alternative symbol-based encodingSize • The encoding of a constraint Φ with on a set F with n symbols involves • O(n2) variables.(for each unique atom in Φ) • O(|Φ|+ n2log(n)) connectives. • Good for long constraints

  34. MotivationTerm Rewrite Systems • A term rewrite system is a set of rules of the form where l and r are terms constructed from functionsymbols and variables.

  35. Term Rewrite Systems • The rules of a TRS are used to rewrite expressions. • A rule s→t can be applied on an expression e if e matches a sub-term of s.

  36. Term Rewrite SystemsExample • Fibonacci:

  37. Term Rewrite SystemsExample, cont. Computing fib(3): • fib(s(s(s(0))) →5fib(s(s(0))+fib(s(o)) • fib(s(s(0))+fib(s(o)) →4 fib(s(s(0))+s(0) • fib(s(s(0))+s(0) →5 fib(s(0))+fib(0)+s(0) • fib(s(0))+fib(0)+s(0) →3 fib(s(0))+0+s(0) • fib(s(0))+0+s(0) →1 fib(s(0))+s(0) • fib(s(0))+s(0) →4 s(0)+s(0) • s(0)+s(0) →2 s(s(0))

  38. Term Rewrite SystemsImportance • A subject of theoretical interest. • Many applications, for example: • Automatic theorem proving. • Verifications of programs and chips. • Termination of a TRS: does the rewrite stop after a finite number of steps, for every expression?

  39. LPO Termination ofTerm Rewrite Systems • In general, termination of terms rewrite systems is undecidable. • Lexicographic path order (LPO) is an order on the terms, that is induced by a partial order on the function symbols. • The partial order on functions can be thought of as “precedence” order.

  40. LPO Termination ofTerm Rewrite Systems, cont. • LPO termination problem: is there a partial order >F over function symbols, such that for every rule it hold thatWhere is the order induced by >F • LPO termination implies termination of the rewrite system.

  41. Partial Order Constraintsand LPO Termination • The lexicographic path order (LPO) is induced by a partial order on the function symbols. • The rules of the TRS unfolds a partial order constrain on the function symbols. • Example: consider the rule s(x)+y → s(x+y):

  42. Experimentation • Termination tools are tested against benchmarks. • Benchmarks used: 751 rewrite systems. • Our method, poSAT, is compared with another method called TTT. • TTT: a fast and powerful tool with a convenient interface.

  43. Experimentation results • Running time in seconds for strict-LPO termination

  44. Thank you!

More Related