• Keine Ergebnisse gefunden

Exercise 2 (Kruskal’s theorem): (2 points)

N/A
N/A
Protected

Academic year: 2021

Aktie "Exercise 2 (Kruskal’s theorem): (2 points)"

Copied!
4
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Term Rewriting Systems SS 11 Solution - Exercise Sheet 6 aa

Prof. Dr. Jürgen Giesl Marc Brockschmidt, Carsten Fuhs, Thomas Ströder

Exercise 1 (Reduction and Simplification Orders): (2 + 8 = 10 points)

a) The following TRSRis terminating. Please show that there is no simplification order by which termination ofRcan be proved, i.e., for every simplification orderwe have→R*.

minus(x ,O) → x minus(s(x),s(O)) → x

minus(s(s(x)),s(s(y))) → minus(s(p(s(x))),s(p(s(y)))) p(s(x)) → x

b) Please prove or disprove the following propositions. Here,Bdenotes the subterm relation.

i For every well-founded relationwe have that ∪Bis well-founded.

ii For every reduction orderwe have that ∪Bis well-founded.

iii For every reduction orderwe have that ∪Bis a reduction order.

iv For every reduction orderwe have that ∪ emb is well-founded.

v Let be a stable and irreflexive relation withB⊆ . Then for every two termss andt with st we haveV(t)⊆ V(s).

Hints:

• You may use the previous exercise part.

Solution:

a) Consider the third rule minus(s(s(x)),s(s(y))) → minus(s(p(s(x))),s(p(s(y)))) of the TRS R. We have minus(s(p(s(x))),s(p(s(y)))) emb minus(s(s(x)),s(s(y))). Thus, every simplification order must al- so satisfyminus(s(p(s(x))),s(p(s(y)))) minus(s(s(x)),s(s(y))). Since every simplification order is well- founded, we obtainminus(s(s(x)),s(s(y)))minus(s(p(s(x))),s(p(s(y)))).

b) i Wrong. Consider the relation = {(a,f(a))}. The relation is obviously well-founded, but we have af(a)Ba. . . in contradiction to the well-foundedness of ∪B.

ii Right. Letbe a reduction order. Assume ∪Bis not well-founded. Then there is an infinite sequence t1,1t1,2 · · · t1,n1 Bt2,1t2,2 · · · t2,n2 Bt3,1. . .

(since bothandBare well-founded, they must both occur infinitely often in this sequence). Because of monotonicity ofwe obtain

t1,1t1,2 · · · t1,n1 =q1[t2,1]π1 q1[t2,2]π1 · · · q1[t2,n2]π1 =q2[q1[t3,1]π1]π2. . . and have, thus, a contradiction to the well-foundedness of.

iii Wrong. The relation =∅ is a reduction order, but ∪ B=Bis no reduction order, since Bis not monotonic.

iv Wrong. The TRSRfrom exercise part a) is terminating and, hence,→R is a reduction relation. Thus, =→+R is a reduction order. However, ∪ emb is not well-founded, because we have

minus(s(s(x)),s(s(y)))→+R minus(s(p(s(x))),s(p(s(y))))embminus(s(s(x)),s(s(y))). . .

1

(2)

Term Rewriting Systems SS 11 Solution - Exercise Sheet 6

v Wrong. Let =C∪ B (i.e., the symmetric closure ofB). As we have for every term s that neither s Bs nors Cs holds,is irreflexive. We already know from the first exercise sheet thatBis stable.

Obviously, C is stable, too. Hence, is stable. Moreover, we trivially have B⊆ . However, we have f(x , y)Bx and, thus,xf(x , y), whileV(f(x , y))*V(x).

.

Exercise 2 (Kruskal’s theorem): (2 points)

Consider the real numberπ= 3.14159. . ., describing the ratio of a circle’s circumference to its diameter. We use πn to denote the n-th digit ofπ, i.e.π=π12π3. . ., whereπ1= 3,π2= 1 andπ3= 4. For two sequences of digitss =s1, . . . , sn and t=t1, . . . , tm withsi, ti ∈ {0, . . . ,9}, we calls a subsequence oft if for all 1≤i ≤n there is aki∈ {1, . . . , m}such thatsi=tki andki< kj for alli < j. For example,45is a subsequence of14159.

Use Kruskal’s theorem to show that for eachk≥1, there aren, mwithk ≤n < msuch thatπnπn+1. . . π2nis a subsequence ofπmπm+1. . . π2m.

Solution:

UsingΣ0={c}andΣ1={f0,f1, . . . ,f9}, we can construct a bijectionϕbetween sequences of digits and ground terms over the signatureΣ0∪Σ1:

ϕ(s) =

(c s =

fd(ϕ(s0)) s =d s0withd ∈ {0, . . . ,9} ands0∈ {0, . . . ,9}

We now consider the infinite sequenceϕ(πk. . . π2k),ϕ(πk+1. . . π2k+2),. . .of ground terms. By Kruskal’s theo- rem, there are n, m with k ≤ n < m and ϕ(πn. . . π2n) emb ϕ(πm. . . π2m). But then by construction of ϕ, πn. . . π2n is a subsequence ofπm. . . π2m.

.

Exercise 3 (Termination Proofs with Simplification Orders): (1 + 2 + 3 = 6 points)

Please prove termination of the following TRSs using the embedding order. If this is not possible, use the LPO instead and explicitly state the precedence you are using. In this exercise, x, y, and z denote variables while all other identifiers denote function symbols.

To prove that for two terms t1 and t2 we have t1 emb t2 or t1 lpo t2, use a proof tree notation to indi- cate which case of the definition ofemb orlpo you are using. This is illustrated by the following example where we havet1=f(s(x),O), t2=f(x ,s(O)), andt1lpo t2:

Choose fAsAO. Then we have

xlpo x = s(x)lpo x 1

O lpo O = f(s(x),O)lpo O 1 f(s(x),O)lpos(O) 2 f(s(x),O)lpof(x ,s(O)) 3 a)

element(Cons(x , y)) → x

element(Cons(x , y)) → element(y)

2

(3)

Term Rewriting Systems SS 11 Solution - Exercise Sheet 6

b)

rev(rev(x)) → x rev(x) → r(x ,Nil) r(Nil, y) → y

r(Cons(x , z), y) → r(z ,Cons(x , y)))

c)

Dx(var(x)) → s(O) Dx(const(x)) → O

Dx(plus(x , y)) → plus(Dx(x),Dx(y))

Dx(times(x , y)) → plus(times(y ,Dx(x)),times(x ,Dx(y)))

Solution:

a)

xembx = Cons(x , y)embx 1 element(Cons(x , y))embx 1

yemby = Cons(x , y)emby 1

element(Cons(x , y))embelement(y) 2

b) We chooserevArAConsANil.

xlpox = rev(x)lpox 1 rev(rev(x))lpo x 1

x lpox =

rev(x)lpox 1 rev(x)lpo Nil2 rev(x)lpor(x ,Nil) 2

y lpo y = r(Nil, y)lpo y 1

zlpoz = Cons(x , z)lpo z 1

x lpo x = Cons(x , z)lpox 1 r(Cons(x , z), y)lpox 1

y lpo y = r(Cons(x , z), y)lpo y 1 r(Cons(x , z), y)lpo Cons(x , y) 2 r(Cons(x , z), y)lpo r(z ,Cons(x , y))) 3

c) We chooseDxAtimesAplusAsAO.

Dx(var(x))lpo O 2

Dx(var(x))lpo s(O) 2 Dx(const(x))lpo O 2

x lpo x = plus(x , y)lpo x 1 Dx(plus(x , y))lpoDx(x) 3

ylpo y = plus(x , y)lpo y 1 Dx(plus(x , y))lpo Dx(y) 3 Dx(plus(x , y))lpoplus(Dx(x),Dx(y)) 2

3

(4)

Term Rewriting Systems SS 11 Solution - Exercise Sheet 6

p1 p2

Dx(times(x , y))lpo plus(times(y ,Dx(x)),times(x ,Dx(y))) 2

xlpo x = times(x , y)lpo x 1 Dx(times(x , y))lpo x 1

y lpo y = times(x , y)lpo y 1 Dx(times(x , y))lpoDx(y) 3

p1 2

ylpo y = times(x , y)lpo y 1 Dx(times(x , y))lpo y 1

x lpo x = times(x , y)lpo x 1 Dx(times(x , y))lpo Dx(x) 3

p2 2

withp1=Dx(times(x , y))lpotimes(x ,Dx(y))andp2=Dx(times(x , y))lpo times(y ,Dx(x))

.

4

Referenzen

ÄHNLICHE DOKUMENTE