- By
**powa** - Follow User

- 92 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Solving Partial Order Constraints for LPO termination' - powa

**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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

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
- The problem is NP-complete.

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.

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.

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).

Partial Order ConstraintsExamples

- Let F = {f, g, h}
- The following are partial order constraints on F:

Partial Order ConstraintsExamples (cont.)

- Φ1can be satisfied by the orders:
- g < f < h
- g = h < f
- Φ2 cannot be satisfied.
- Can Φ3 be satisfied?

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

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

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)

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

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 Φ.

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.

“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.

Encoding of Axioms:Examples

For a set F

- Reflexivity of = is encoded by:
- Transitivity of < is encoded by:

“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).

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.

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.

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.

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.

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

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:

A symbol-based propositional encoding, cont.

- A constraint of the form (f > g) is encoded recursively by: for k > 1

A symbol-based propositional encoding, cont.

- We encode a constraint Φby replacing each atom (e.g. (f < g)) with its k-bit encoding.

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

Theorem 2

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

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.

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 encodingAlternative encodingExample

- The constraint:is encoded as follows: (a1, a2 are the special variables)

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

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.

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.

Term Rewrite SystemsExample

- Fibonacci:

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))

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?

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.

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.

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):

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.

Experimentation results

- Running time in seconds for strict-LPO termination

Download Presentation

Connecting to Server..