Lemma PT5
If E,F are terms of the
-calculus, and
v is a variable of the aforementioned, and p is a
path which properly addresses E
and not seen(v,E,p) then there is an E' which is
-congruent to E for which
Proof
Let E' be formed from E by
-converting
any
-abstraction found on p whose bound
variable is a member of FV(F) to an abstraction whose bound
variable is not a member of FV(F).
We now proceed by induction on visible(v,p)
Base Case
In the base-case visible(v,p)=0, so that E = \v.H. Hence
E'[v:=F][p] = E'[p]
by S5.
Inductive Step
Suppose for some natural number n that
visible(v,p)
n implies that
Consider a path p for which length(p) = n+1
Then p = s::p', where p'=tl(p), and
length(p')=n.
- Case 1-2 E'=v, a variable, or E'=c, a constant.
Since p properly addresses E', these cases don't occur.
- Case 3: E' = (C D), an application.
We have 2 sub-cases,
s=0 and s=1
- Sub-case 3.1, s=0
The last step above uses the inductive hypothesis, justified because
length(p') = n, and seen(v,C,p') by
SC3. On the other hand, using S5
E'[v:=F][p] = (C[v:=F] D[v:=F])[p] = C[v:=F][p']
Hence the result holds in this sub-case.
- Sub-case 3.2, s=1
This is similar to 3.1
- Case 4: E' =
x . H, an abstraction.
We have 2 sub-cases,
s=0 and s=1
- Sub-case 4.1, s=0
E'[p][v:=F] = (
x . H)[p][v:=F]
= (
x . H)[v:=F]
= (
x . H)[v:=F][p]
Since substitution converts an abstraction into an abstraction.
So the result holds for this sub-case.
- Sub-case 4.2, s=1
using the inductive hypothesis.
On the other hand, we have our very favourite can of worms when we come to
because we have to consider cases S5-S7 of the definition of
substitution.
- Sub-sub-case 4.2.1, x=v
In this sub-sub-case, v goes out of scope, so, by ex falsa
libet the result holds.
- Sub-sub-case 4.2.2, x
v
and either x
FV(F)
or v
FV(H)
Here
E'[v:=F][p] = (
x. H)[v:=F][p]
= (
x. H[v:=F])[p]
= H[v:=F][p']
So the result holds in this sub-sub-case
- Sub-sub-case 4.2.3, x
v
and x
FV(F)
or v
FV(H)
This
sub-case can't occur because of the way we have defined E'.
Lemma PT6
If E,F,G are terms of the
-calculus, and
v is a variable of the aforementioned, and p is a
path which properly addresses E
and seen(v,E,p) then there is an E' which is
-congruent to E for which
E'[p:=G][v:=F] = E'[v:=F][p:=G[v:=F]]
Proof
Let E' be formed from E by
-converting
any
-abstraction found on p whose bound
variable is a member of FV(F) to an abstraction whose bound
variable is not a member of FV(F).
We now proceed by induction on the length of p.
Base Case
In the base-case length(p)=0, so that p = ().
In this case, since by UP1 E'[p:=G]=G and v is in scope,
we have
While
E'[v:=F][p:=G[v:=F]] = G[v:=F]
Inductive Step
Suppose for some natural number n that
length(p)
n implies that
E'[p:=G][v:=F] = E'[v:=F][p:=G[v:=F]]
Consider a path p for which length(p) = n+1
Then p = s::p', where p'=tl(p), and length(p')=n
- Case 1-2 E'=v, a variable, or E'=c, a constant.
Since p properly addresses E', these cases don't occur.
- Case 3: E' = (C D), an application.
We have 2 sub-cases,
s=0 and s=1
- Sub-case 3.1, s=0
E'[p:=G][v:=F] = (C[p':=G] D)[v:=F]
= (C[p':=G][v:=F] D[v:=F])
= (C[v:=F][p':=G[v:=F]] D[v:=F])
The last step above uses the inductive hypothesis, justified because
length(p') = n, and seen(v,C,p') by
SC3. On the other hand, using S5
Hence the result holds in this sub-case.
- Sub-case 3.2, s=1
This is similar to 3.1
- Case 4: E' =
x . H, an abstraction.
We have 2 sub-cases,
s=0 and s=1
Figure for Proposition LC3
Proposition LC3
Let (E = (
u.C) G)
be a redex of the
-calculus.
Let p be a path for which
E[p] = (
u.D) H)
where hd(p)=0 and hd(tl(p))=1.
Let p' = tl(tl(p)). Then
Proof
Let C' be formed from C by
-converting
any
-abstraction whose bound
variable is a member of FV(G)
FV(H)
to an abstraction whose bound
variable is not a member of FV(G))
FV(H).
Let (E' = (
u'.C') G)
and let u',D', H' be the converted forms of u,D,H.
Consider that by Lemma PT3.
using the definition of path-addressing, and expanding E.
This is a redex. So, we can work out
(
(E',()),p')
that is
=
(C'[u':=G]),p')
using lemma PT6, as being
= C'[u':=G][p':=D'[u':=G]]
On the other hand, we can immediately apply the definition of
to
(
(E',p),())
obtaining
=
(E'[p:=D'[v':=H']],())
Expanding E' and using (twice) the definition of
path-addressing, we obtain
=
(((
u'. C'[p':=D'[v':=H']])G)),())
which, by the definition of
is
Now, we can use lemma PT4 to distribute the outer-substitution across
the path-update:
Whence we can apply Lemma Sub.4 because
we have chosen v'
FV(G)
FV(H).
Thus we have shown that local-confluence holds for E', which
is
-congruent to E. Local confluence for
Eitself follows from
-conversion.