Upload
emma-reeves
View
215
Download
0
Embed Size (px)
Citation preview
Polynomials over the reals in proofs of termination: from theory to practice
Salvador LucasDep. de Sistemas Informáticos y Computación
Universidad Politécnica de [email protected]
Introduction: termination of TRSs Orderings and termination:
Theorem: A TRS is terminating iff there is a well-founded ordering > such that
t > s
whenever
t s
for all terms t,s.
Problem: infinite number of checkings; automatization?
Introduction: termination of TRSs Algebras and orderings:
Theorem: Algebraic interpretations (A, FA, >A) can be used to induce term orderings:
t > s if and only if [t] >A [s]
Well-foundedness of > is ensured if (A,>A) is a well-founded ordering
Introduction: termination of TRSs Reduction orderings and termination:
Theorem: A TRS is terminating iff there is a well-founded, stable and monotonic ordering > such that
l > r
for each rule
l r
of the TRS.
Finite number of checkings: automatization!
Introduction: termination of TRSs Algebras and reduction orderings:
Well-foundedness of > is ensured if (A,>A) is a well-founded ordering
Stability of > is automatically achieved by definition Monotonicity of > is guaranteed if
x >A y
implies
fA(x1,...,xi-1,x,...,xk) >A fA (x1,..., xi-1, y,...,xk)
for all x1,...,xk,x,y in A and all i between 1 and k
Introduction: termination of TRSs Example: [Der95, Example 1] (TPDB version)
\(x,x) -> e .(x,\(x,y)) -> y/(x,x) -> e .(/(y,x),x) -> y.(e,x) -> x \(x,.(x,y)) -> y.(x,e) -> x /(.(y,x),x) -> y\(e,x) -> x /(x,\(y,x)) -> y/(x,e) -> x \(/(x,y),x) -> y
[\](X1,X2) = X1 + X2 + 2[e] = 1[/](X1,X2) = X1 + X2 + 2[.](X1,X2) = X1 + X2
Introduction: termination of TRSs Example: [Der95, Example 1] (TPDB version)
\(x,x) -> e .(x,\(x,y)) -> y/(x,x) -> e .(/(y,x),x) -> y.(e,x) -> x \(x,.(x,y)) -> y.(x,e) -> x /(.(y,x),x) -> y\(e,x) -> x /(x,\(y,x)) -> y/(x,e) -> x \(/(x,y),x) -> y
[\](X1,X2) = X1 + X2 + 2[e] = 1[/](X1,X2) = X1 + X2 + 2[.](X1,X2) = X1 + X2
[.(e,x)] = 1+x > x = [x]
Introduction: termination of TRSs Dependency pairs and termination (I):
A reduction pair (≥ , ) consists of a weakly monotonic and stable quasi-ordering ≥ and a stable and well-founded ordering such that
≥ ° is a subset of or ° ≥ is a subset of
Given a rule f(l1,…,lm) r, a dependency pair is a pair F(l1,…,lm),G(s1,…,sn )), where g(s1,…,sn ) is an operation rooted subterm of r, and F, G are new symbols (called ‘tuple symbols’) associated to f and g
Introduction: termination of TRSs Dependency pairs and termination (II):
Theorem: A TRS is terminating iff there is a reduction pair (≥ , ) such that
l ≥ r for each rule l rt s for each dependency pair
(t,s)of the TRS.
Less restrictive checkings: better automatization!
Example: [AG01, Example 1]
minus(x,0) -> xminus(s(x),s(y)) -> minus(x,y)quot(0,s(y)) -> 0quot(s(x),s(y)) -> s(quot(minus(x,y),s(y)))
[minus](X1,X2) = X1 [quot](X1,X2) = X1[0] = 0 [MINUS](X1,X2) = X1[QUOT](X1,X2) = X1 [s](X) = X + 1
MINUS(s(x),s(y)) -> MINUS(x,y)QUOT(s(x),s(y)) -> QUOT(minus(x,y),s(y))QUOT(s(x),s(y)) -> MINUS(x,y)
Introduction: termination of TRSs
Example: [AG01, Example 1]
minus(x,0) -> xminus(s(x),s(y)) -> minus(x,y)quot(0,s(y)) -> 0quot(s(x),s(y)) -> s(quot(minus(x,y),s(y)))
[minus](X1,X2) = X1 [quot](X1,X2) = X1[0] = 0 [MINUS](X1,X2) = X1[QUOT](X1,X2) = X1 [s](X) = X + 1
MINUS(s(x),s(y)) -> MINUS(x,y)QUOT(s(x),s(y)) -> QUOT(minus(x,y),s(y))QUOT(s(x),s(y)) -> MINUS(x,y)
Introduction: termination of TRSs
[minus(x,0)] = x x = [x]
[MINUS(s(x),s(y))] = x + 1 > x = [MINUS(x,y)]
Introduction: termination of CSR -reduction orderings and termination:
Theorem: A TRS is -terminating iff there is a well-founded, stable and -monotonic ordering > such that
l > r
for each rule
l r
of the TRS.
Introduction: termination of CSR Algebras and -reduction orderings:
Well-foundedness of > is ensured if (A,>A) is a well-founded ordering
Stability of > is automatically achieved by definition -monotonicity of > is guaranteed if
x >A y
implies
fA(x1,...,xi-1,x,...,xk) >A fA (x1,..., xi-1, y,...,xk)
for all x1,...,xk,x,y in A and i in (f)
Example: [Zan97, Example 1]
g(x) -> h(x)c -> dh(d) -> g(c)
[g](x) = x2 - 3x + 4 [c] = 1[h](x) = x2 - 3x + 4 [d] = 0
Introduction: termination of CSR
(g)={}(h)={}
Example: [Zan97, Example 1]
g(x) -> h(x)c -> dh(d) -> g(c)
[g](x) = x2 - 3x + 4 [c] = 1[h](x) = x2 - 3x + 4 [d] = 0
Introduction: termination of CSR
(g)={}(h)={}
[h(d)] = 0-0+4 = 4 > 3 = 1-3+4 = [g(c)]
Termination and monotonicity Termination of rewriting: ™f, (f)={1,…,ar(f)} Termination of rewriting with DPs: ™f, (f) =
Termination of CSR: f, (f) {1,…, ar(f)} Top-termination: ™ f, can(f) (f) Termination of innermost rewriting: inn
Example: [GM04, Introduction]
nats -> adx(zeros)zeros -> cons(0,zeros)incr(cons(X,Y)) -> cons(s(X),incr(Y))adx(cons(X,Y)) -> incr(cons(X,adx(Y)))hd(cons(X,Y)) -> Xtl(cons(X,Y)) -> Y
[nats] = 5 [incr](x) = x + 1 [cons](x,y) = x + 1/2 y [adx](x) = x + 3 [s](x) = 0 [tl](x) = 2x + 1 [zeros] = 1 [hd](x) = x + 1 [0] = 0
Introduction: termination of CSR
(0)=ˆ(s)=ˆ(nil)=ˆ(cons)=ˆ(adx)={1}(incr)={1}(hd)={1}(tl)={1}(nats)={1}
Introduction: termination of CSR Algebras and -reduction orderings:
Well-foundedness of > gets lost: e.g., (0, >) is not well-founded:
1 > 1/2 > 1/4 > ··· > 1/n > ··· > ··· ∞ ·· > 0
On the other hand, it is possible to prove that the termination of this TRS cannot be proved by a polynomial interpretation over the naturals.
Summary Specifying non-monotonic orderings Term (quasi-) orderings induced from
algebras over the reals Polynomial algebras over the reals Automatic generation of polynomial
algebras over the reals Related work Conclusions and future work
Specifying non-monotonic orderings Replacement map [Luc98]:
A mapping which associates a subset (f) of {1,…,ar(f))} to each function symbol f
Used to specify -monotonic orderings >: for all arguments i in (f),
t > s implies f(t1,...,ti-1,t,...,tk) > f(t1,..., ti-1, s,...,tk)
Algebras over the reals Algebraic interpretations (A, FA, >A) can be
used to induce (-)reduction orderings:
t > s if and only if [t] >A [s]
We consider algebras whose carrier A is a subset of and whose functions are real functions
Algebras over the reals We guarantee well-foundedness as follows:
let (A, FA) be an algebra over the real numbers and be a number. Define:
t > s if and only if [t] - [s] ≥
This idea has already been used by Geser (1991) and Hofbauer (2001) among others
Algebras over the reals
Monotonicity (or -monotonicity) has tobe proved apart…
Theorem: Let A m for some real number m and >0. Then > is a well-founded and stable ordering on terms.
Example: The following TRS
can be proved terminating by using the 0-bounded algebra (0,{[f],[g]}), where
[f](x) = x + 1/2
[g](x) = x
Algebras over the reals
f(f(x)) f(g(f(x)))
Proposition: Let T be a finite set of pairs of terms. If for each (t,s) T there is t,s > 0 such that [t]-[s] ≥ t,s, then
min({t,s | (t,s) T})
issuch that t > s for all (t,s) T.
Avoiding the choice of
Avoiding the choice of Example: Since
[f(f(x))] = x + 3/2
[f(g(f(x)))] = x + 1/2
we have [f(f(x))] - [f(g(f(x)))] = 1
Then, f(f(x)) >1 f(g(f(x))) and, since >1 is monotonic (ad-hoc proof!), termination of R is proved.
Theorem: If ∂f/∂xi ≥ 1 for all symbols f and replacing arguments i, then > is -monotone for all >0.
Criterion for monotonicity
Example: The following TRS
can be proved -terminating by using the well-founded, stable and monotonic ordering >1 induced by the 0-bounded algebra (1,{[f],[g]}), where
[f](x,y,z) = x + xy-1 + zy-1 + z[a] = 2[b] = 1[c] = 3
Algebras over the reals
c a f(a,b,x) f(x,x,x)
c b
(a)=ˆ(b)=ˆ(c)=ˆ(f) ={1,3}
Example: Since
[f(a,b,x)] = 2x + 4
[f(x,x,x)] = 2x + 2
we have [f(a,b,x)] - [f(x,x,x)] = 2and [c] - [a] = 1; [c] - [b] = 2
Thus, the rules are compatible with >1
Furthermore, ∂[f]/∂x = 1 + y-1 ≥ 1 for all y ≥ 1
∂[f]/∂z = 1 + y-1 ≥ 1 for all y ≥ 1
Then, >1 is monotonic and the -termination of R is proved.
Algebras over the reals
Proposition: Let ≥ 0 be such that A and P be a polynomial without negative coefficients.
Then, = P(,…, ) is the minimum of P in An
Avoiding the choice of
Example: The polynomial with negative coefficients
P(x,y) = (xy - 1)2 + x2
is positive in 2 but it does not reach any minimum value!
Avoiding the choice of
Corollary: Let T be a finite set of pairs of terms. Let ≥ 0 be such that A and (A, FA) be a polynomial algebra.
If for all (t,s) T, Pt,s = [t] - [s] has no negative coefficient and t,s = P(,…, ) > 0,then
min({t,s | (t,s) T}) satisfies t > s for all (t,s) T.
Avoiding the choice of
Avoiding the choice of
When comparing terms t and s (from rules or dependency pairs) we will require that Pt,s be
a positive polynomial without negative coefficients
Proposition: There is a TRS which can be proved -terminating by using a polynomial interpretation over the reals, whereas it cannot be proved -terminating by using a polynomial interpretation over the naturals
Generating non-monotonic orderings
zeros -> 0:zerostl(x:y) -> y
(zeros)=ˆ(0)=ˆ(:) ={1}(tl)={1}
[zeros] = 0 x[:]y = x + 1/2 y [0] = 0 [tl](x) = 2x + 1
Generic framework: -terminationWe let A =
1. Restrictions due to the algebraicity of the interpretation:
[f](x1,…,xk) ≥ 0 for all symbols f and x1,…,xk ≥ 0 2. Restrictions due to the monotonicity specification :
[f] / xi ≥ 1 for all symbols f and i (f)
3. Compatibility of > with the rules:
Pl,r = [l] - [r] > 0
and Pl,r has no negative coefficient
Implicit !
Generic framework: DP terminationWe let A =
1. Restrictions due to the algebraicity of the interpretation:
[f](x1,…,xk) ≥ 0 for all symbols f and x1,…,xk ≥ 0 2. Restrictions due to the weak monotonicity of :
[f] / xi ≥ 0 for all symbols f and i {1,..,ar(f)}
3. Compatibility of with the rules:
Pl,r = [l] - [r] 0
4. Compatibility of > with the dependency pairs:
Pt,s = [t] - [s] > 0
and Pt,s has no negative coefficient
Implicit !
Example: [GM04, Introduction]
nats -> adx(zeros)zeros -> cons(0,zeros)incr(cons(X,Y)) -> cons(s(X),incr(Y))adx(cons(X,Y)) -> incr(cons(X,adx(Y)))hd(cons(X,Y)) -> Xtl(cons(X,Y)) -> Y
Proving termination of CSR
(0)=ˆ(s)=ˆ(nil)=ˆ(cons)=ˆ(adx)={1}(incr)={1}(hd)={1}(tl)={1}(nats)={1}
Proving termination of CSR We start with undeterminate polynomial interpretations Example: (linear interpretations)
[nats] = a0
[adx](x) = b1x + b0
[zeros] = c0
[cons](x,y) = d10x + d01y + d00
[0] = e0
[incr](x) = f1x + f0
[s](x) = g1x + g0
[hd](x) = h1x + h0
[tl](x) = i1x + i0
Coefficients can bearbitrary real numbers
Proving termination of CSR The previous results are used to put restrictions over the
undeterminate coefficients: let A =
1. Restrictions due to the algebraicity of the interpretation:
af,i ≥ 0 for all symbols and coefficients
3. Restrictions due to the monotonicity specification given by :
f / xi = af,i ≥ 1 if i is in (f)
2. Compatibility with the rules:
Pl,r = [l] - [r] > 0
and Pl,r has no negative coefficient
Proving termination of CSR Example (cont’d): Algebraicity: only non-negative coefficients are allowed Monotonicity restrictions in the example:
b1 ≥ 1 f1 ≥ 1 h1 ≥ 1 i1 ≥ 1
Compatibility with the rule l rzeros cons(0,zeros)
[zeros ] - [cons(0,zeros)] > 0 iff
c0 - (d10e0 + d01c0 + d00) > 0 iff
c0 - d10e0 - d01c0 - d00 > 0
since Pl,r only has a constant coefficient, this restriction implies the absence of negative coefficients, as required.
Proving termination of CSR Consider the rule l r
incr(x:y) s(x):incr(y)
[incr(x:y)] - [s(x):incr(y)] > 0 iff
(f1d10 - d10g1)x + (f1d01 - d01f1)y + (f1 d00 + f0 - d10 g0 - d01 f0 - d00) > 0
in order to guarantee that Pl,r only has non-negative coefficients, we further impose:
f1d10 - d10g1 ≥ 0
f1d01 - d01f1 ≥ 0
f1 d00 + f0 - d10 g0 - d01 f0 - d00 > 0
Proving termination of CSR Example: (cont’d) The collected set of constraints
can be sent to a constraint solving system (over the reals) like CON’FLEX to obtain, e.g.:
[nats] = 1.740 [incr](x) = 1.000x + 0.251 [cons](x,y) = 0.431x + 0.431y + 0.288[adx](x) = 1.100x + 0.658 [s](x) = 0.300x + 0.224[tl](x) = 2.322x + 0.300 [zeros] = 0.932 [hd](x) = 2.322x + 0.300 [0] = 0.300
Implicit : 0.046275
More… Dependency pairs: similar scheme; no significative
differences Non-linear interpretations: simple and simple mixed
interpretations discussed Polynomials with negative coefficients: new family of
intrpretations: 2-simple mixed Implemented: the techniques are the basis of MU-TERM:
http://www.dsic.upv.es/~slucas/csr/termination/muterm
Polynomials over the naturals
Introduced by Lankford (1979) All coefficients are natural numbers The interpretation domain N is obviously
well-founded
Polynomials over the naturals Recently, Contejean, Marché, Tomás and Urbain have described
how to automatically compute such polynomials [CMTU04]: let A = N
1. Restrictions due to the algebraicity of the interpretation: Only natural coefficients are allowed
3. Restrictions due to (full) monotonicity:For each symbol f and argument i,
there is a linear monomial af,i xi where af,i ≥ 12. Compatibility with the rules:
Pl,r = [l] - [r] > 0
and Pl,r has no negative coefficient
Polynomials over the naturals
Our framework subsumes this!
They (CiME, AProVE, TTT designers) just need to solve the obtained
constraints over the reals!!
Polynomials over the reals
Proposed by Dershowitz (1979) All coefficients are real numbers The interpretation domain is not well-founded,
so a subterm property is additionally required:
[f](x1,…, xi,…,xk) > xi
for all symbols f, arguments i, and x1,…,xk
Polynomials over the reals Giesl has investigated how to automatically compute
such polynomials [Gie95]: let A = Compatibility with the rules:
[l] - [r] > 0 Weak subterm
[f](x1,…, xi,…,xk) ≥ xi Weak monotonicity
[f] / xi ≥ 0 for all symbols f and i {1,..,ar(f)} Non-negative constants:
[c] ≥ 0 for all constant symbol c
Polynomials over the reals Then, Giesl applies two differentiation rules to
obtain a final set of constraints over the underterminate coefficients
According to Hong and Jakuš, all polynomials involved in the initial constraints above must have non-negative coefficients
Again, our framework subsumes this withoutrequiring any subterm property!
There are TRSs whose termination can be directly proved by means of a polynomial interpretation over the reals (or rationals) but it cannot be proved by using polynomials over the naturals!
RECENTLY SOLVED OLD OPEN PROBLEM !!!
Polynomials over the reals
Conclusions
New technique for defining reduction pairs by using algebras over the reals
Useful for proving termination of rewriting by using non-monotonic polynomial interpretations together with the Dependency Pairs approach
Implemented in MU-TERM
Future work
Investigate other families of interpretations over the reals which can be well-suited for automatization (e.g., polynomial fractions)
Implement in MU-TERM: More efficient use of rational coefficients
OPEN PROBLEMS
Efficient representation of real coefficients Analysis techniques to detect when to use them Use of bounded intervals Use of transcendental real numbers Connections/use with/of Algebraic Geometry …
Salvador LucasDep. de Sistemas Informáticos y Computación
Universidad Politécnica de [email protected]
Polynomials over the reals in proofs of termination: from theory to practice