Download - jan willem klop roel de vrijer
1
jan willem klop
roel de vrijer
infinitarynormalization
TeR, 1 y 8 junio 2007
Finite and infinite reductions
TRS: f(x,y) f(y,x)
f(a,b) f(b, a) f(a,b) f(b, a) …
f(a,a) f(a, a) f(a,a) f(a, a) …
TRS: c g(c)
c g(c) g(g(c)) g(g(g(c)))) …
3
Cauchy converging reduction sequence: activity may occur everywhere
Strongly converging reduction sequence, with descendant relations
Transfinite reductions
TRS: c g(c)
c g(c) g(g(c)) g(g(g(c)))) … g
The last “step” is a limit transition
We have:
c g
gg
gg
5
F(0) P
0 F
S
0
P
P
P
P
0
S
0 S
S
0
.....
Limit: infinite sequence of natural numbers
TRS: F(x) → P(x, F(S(x)))
Finite and infinite terms
term = term tree = set of labeled positions
1 the set of positions is closed under prefixes2 each position is labeled by a function
symbol or a variable3 the arity of the function symbol at a position
equals the number of outgoing edges
Streams
x : y infix notation for P(x,y)
F(0) → 0 : F(S(0)) → 0 : S(0) : F(S(S(0))) → 0 : S(0) : S(S(0)) : F(S(S(S(0)))) → ….
→ω 0 : S(0) : S(S(0)) : S(S(S(0))) : ….
8
zip(zeros, ones) and alt rewrite in infinitely many steps to the same infinite normal form
9
P
F F
0 0
P
F
0
PP
PP
P
0S0 S
S0
PP
PP
P
0S0 S
S0
P
PP
PP
0S0 S
S0
P
Transfinite reduction sequence of length
Transfinite reductions
TRS: c g(c) c g
c : c : c : ….
g : c : c : ….
g : g : c : ….
g : g : g : …. …….
c : c : c : c : … . g : g : g : g : …
Convergence and divergence
We have ρ: t t at limit ordinal if:
1. For each limit ordinal λ < β the prefix βλ is convergent
2. (dα)α < tends to infinity
3. the limit is t
ρ is divergent if 1. but not 2.
12
0 ·2 ·3 2
depth of contracted redex tends to infinity at each limit ordinal
13
Every countable ordinal can be the length of a transfinite reduction.
TRS: c f(a, c) a b
f
faa f
faaBut no uncountable
reductions!-- only finitely many reduction steps at depth n-- no infinite descending chains of ordinals
14
For orthogonal TRSs we have the
Compression Lemma:
every transfinite reduction of length can be compressed to or less.
Left-linearity is essential for compression:
TRS: f(x,x) c a g(a) b g(b)
f(a,b) f(g,g) c
So f(a,b) +1 c
16
How to define SN and WN?
WN is easy: There is a possibly infinite reduction to a possibly infinite normal form.
SN: all reductions will eventually terminate in a (infinitary) normal form ?
?
17
Examples of SN
a g(a)
c f(a, c) and a b
S-terms in CL
18
Example of not SN
I(x) x
This TRS is SN, but:
I I I I …
19
Good and bad reductions. In ordinary rewriting the finite reductions are good, they have an end point. The infinite ones are bad, they have no end point.
In infinitary rewriting the good reductions are the ones that are strongly convergent, they have an end point:
a b(a) reaches after steps the end point b.
The bad reductions (divergent) are the ones without end point. These reductions may be long, a limit ordinal long, but there they fail.
20
What is a divergent (bad) reduction?
- Select step after step a redex and perform it
- Go on until a limit ordinal - At that point look back
- If strongly convergent: take the limit and go on
- If not, stop there: we found a divergent reduction
21
Divergent reduction (again)
Suppose you have for each ordinal < limit ordinal (convergent) reductions that extend each other
Suppose there is no limit for these reductions
Together these reductions constitute a divergent reduction of length
22
SN: there are no divergent reductions
So a divergent reduction is counterexample to SN
(such as an infinite reduction is counterexample to SN)
Important note:Given a divergent reduction we can find a term where infinitely often a root step was performed.
Divergence: (dα)α < does not tend to infinity
n. <. >. d n, take N smallest such n and take s.t. >. d ≥ N, then from :
1. Infinitely many steps at depth N2. Finitely many positions at depth N3. At one of these positions infinitely many root steps (head steps)
Conclusion: a divergent reduction with infinitely many head steps
24
Failure of Newman’s Lemma, infinitary version
We do not have the implication WCR & SN CR .
I.e. Newman’s Lemma, WCR & SN CR, fails for infinitary term rewriting.
C A(C)A(C) B(C)A(B(x)) B(A(x))
Note that we do not have A(x) B(x)!
Check WCR by looking at the critical pairs. We also have SN.
But CR∞ fails, as C reduces in steps to A and B
25
A(C)
A(A(C))B(C)
C A(C)A(C) B(C)A(B(x)) B(A(x)).
A(B(C))
B(A(C))
Huet’s critical pair lemma
WCR
26
A(x) x B(x) x C A(B(C))
C A(B(C))
A(C) B(C) A(A(B(C))) B(A(B(C))) A(A(C)) B(B(C)) A(A(A(B(C)))) B(B(A(B(C)))) A(A(A(C))) B(B(B(C))) A B
......
......
C ABC ABABC ABABABC ABABABABAB...
A B
...
(a) (b)
Failure of infinitary confluence
27
Sxyz xz(yz) Kxy x
@(@(@(S, x), y), z) @(@(x, z), @(y, z)) @(@(K, x), y) x
@
@ K
K
@
@ S
K
@
@ K
K @
@ S
K @
@ K
K @
@ S
K @
@
@ S
K @
@ S
K @
@ S
K @
@ S
K @
@
@ K
K @
@ K
K @
@ K
K @
@ K
K @
collapsing contexts
Failure of infinitary confluence for Combinatory Logic
Non-confluent infinite reduction diagram
for OTRSs: PML
Projection of convergent reduction against parallel step
Projection of a parallel step over infinite reduction
can result in infinite development:
TRS: f(x) x : f(x) a b
f(a) a : a : a : a … 1. Redex a has infinitely many residuals2. But all are parallel !!3. Development of a parallel set of redexes is always convergent
31
Developments are not always convergent
I(x) x
Consider in I the set of all redexes
I I I I …
for OTRSs: UN
A term t has at most 1 infinite normal form
Easy consequence:
SN => CR
Proof of UN
C-stable reduction: All activity below prefix CC-stable term t: From t only C-stable reductionn-stable: Stable for full prefix of depth n
Lemma: if t has a C-stable reduction to nf, then t is C-stable
Redex overlapping with prefix
Proof of Lemma: t has C-stable reduction to nf => t is C-stable
1. No redex in t overlaps with C2. Projection of C-stable over C-stable is C-stable3. If t → s then - C is prefix of s - no redex of s overlaps with C
4. Repeating this: t is C-stable
Note that we used PML
Proof of UN
37
THEOREM. SN WN
is clear
Suppose not SN
So there is a term with an infinite reduction in which infinitely many root steps occur
Such a term does not have an (infinite) normal form,
i.e. not WN. This uses the Head Normalization Theorem generalized to infinite terms
38
Head Normalization Theorem
THEOREM. In an orthogonal TRS let t t’ t” ...
be a reduction containing infinitely many head steps.
(i) Then t has no head normal form.(ii) Consequence: t has no (infinitary) normal form.
t is a head normal form (hnf) when it does not reduce to a redex; i.e. no reduction from t contains a root (head) step
39
Head Normalization Theorem: proof
- Reduction to head normal form can always be finite
- Projection of
t0 t1 t2 ... with infinitely many head steps over parallel step yields infinitely many head steps again
40
Projection of head step over parellel step t t+1
↓ p ↓ p+1
t’ t+1’
Either of two possibilities:1. p internal, then projection of head step again head step2. p head step, then p+1 empty step
Projecting ρ with infinitely many head steps:- If 2. occurs in ρ, then the projection is eventually ρ- If 2. never occurs, then in the projection infinitely many head steps by 1.