Lambda-Calculus (III-6)
[email protected] Tsinghua University, September 17, 2010
Plan
•
Bohm trees -- reminders•
Morris extensional equivalence•
Bohm trees and !-rule•
Observational equivalences•
Relation with Scott’s modelsBohm tree semantics - reminders
•
Theorem [continuity] For allb∈N such thatb�C[M], thenb�C[a]for somea∈N such thata�M.
•
Theorem [monotony] M�NimpliesC[M]�C[N]•
Theorem [!-theory] M≡NimpliesC[M]≡C[N]Proofs: easy consequences of previous proofs.
Approximations and
η-rule
Bohm tree and !-rule
•
We need take !-rule into account ! How to mix !-rule and Bohm tree construction ?•
Functional extensionality has not been considered since we can have:MP≡NP for allP, butM�≡N.
(TakeM=xandN=λy.xy)
•
We take for granted that ηand β,ηare confluent.Moreover η strongly normalizes.
•
The prefix ordering between approximants must be extended. For instance:xΩ=ηλy.xΩy≤λy.xyy λx.yΩ≤λx.yx=ηy
Finite approximants
•
Lemma : We have following commutation properties:•
We consider the set of !-normal forms of finite approximants with following relation:Ne
a≤eb iff a(≤ ∪=η)∗b
η≤ ⊂ ≤ η
≤ η ⊂ η≤
η η ⊂ η η
•
Corollary: a≤eb iff a ηa�≤b� η b•
Examples:λy.xΩ ≤λy.xy ηx xΩ ηλy.xΩy ≤ λy.xyy
Extensional Bohm trees
•
Definition : Let ωe(M) be theη-normal form ofω(M).•
Definition : The extensional Bohm tree BTe(M) ofMis defined by:BTe(M) ={a∈Ne | a ≤e ωe(N), M N}
M�eN iff BTe(M)⊂BTe(N) M≡eN iff BTe(M) = BTe(N)
•
Definition : Extensional Bohm tree semanticsExtensional Bohm trees
•
Theorem : �eis a monotonic semantics and≡eforms aλ-theory.•
Theorem [Hyland, 1975]:M�eN iff for allC[ ],C[M] n.f. impliesC[N] n.f.
J.Morris extensional equivalence
MIT-1968
Closed Bohm trees
Finite Bohm trees revisited
•
We just added !-rule to the standard Bohm tree construction with completion by ideals.•
However, we forgot slight difficulty: now, thanks to !-rule, finite Bohm tree now dominates an infinite number of other finite Bohm trees. See:a0=Ω a1=λx1.xΩ a2=λx1.x(λx2.x1Ω) a3=λx1.x(λx2.x1(λx3.x2Ω))
I0={Ω}
I1={a∈Ne | a≤ea1} I2={a∈Ne | a≤ea2} I3={a∈Ne | a≤ea3} I∞={a∈Ne | a≤ex}
�∞
n=0In
a∞=x
new point
added by ideal completion
Finite Bohm trees revisited
•
There are two ways of completing finite Bohm trees.standard completion by ideals (what we did)
completion with closed ideals (does not add new limit point) 1-
2-
BTec(M) = cl(BTec(M))
•
We define the closure of directed sets as being the set with its already existing limit in Ne•
We therefore have:I≡eclJ where J=Y(λfxy.x(fy))
•
and normal forms are no longer isolated points.Finite Bohm trees revisited
•
The equality between I and J is not so unnatural since one may emulate infinite !- expansion with the "-rule:I=λx.x η λxx1.xx1
η λxx1.x(λx2.x1x2)
η λxx1.x(λx2.x1(λx3.x2x3))
η ...
J=Y(λfxx1.x(fx1)) =β λxx1.x(Jx1)
=β λxx1.x(λx2.x1(Jx2))
=β λxx1.x(λx2.x1(λx3.x2(Jx3)))
=β ...
.
•
same phenomenon as for these two versions of identity on natural numbers:I(n) ⇐ n
J(n) ⇐ ifn= 0then1else1 +J(n−1) .
Bohm trees and Scott’s models
•
We have following correspondances:1- 2-
M�ecN iff M�D∞N M�N iff M�TωN
(Scott’s model) (Plotkin’s model)
•
One can also show that:3- M�e+N iff M�PωN (Scott’s model)
where�e+ is Bohm tree construction from η≤ordering onNe.
•
finally, one may order Bohm trees with symmetrical:4- M�e−N
where�e−is Bohm tree construction from≤ η ordering onNe.
Observational equivalences
•
To conclude we have the following results:1- 2-
M�ecN iff for all contextsC[ ], C[M] hnf implies C[N] hnf M�eN iff for all contextsC[ ], C[M] nf implies C[N] nf
•
Making observational equivalences with other Bohm tree semantics is more difficult since one has to fight with !-equality. Take for instanceλx.xx andλx.x(λy.xy)Homeworks
Exercices
1-Show that ifM has no hnf, thenMis totally undefined.
2- ShowΩM≡Ωandλx.Ω≡Ω. Show thatM ωN, thenM≡N.
4- ShowM�≡λx.Mxwhenx�∈var(M). What ifM≡λx.M1?
5- LetY0=Y,Yn+1=Yn(λxy.y(xy)). Show thatY ≡Ynfor alln. However allYn
are pairwise non interconvertible.
6 If M ≤ P andN ≤ P (M andN are prefix compatible), then BT(M�N) = BT(M)∩BT(N). (Thus BT is stable in Berry’s sense, 1978). What if not com- patible ?
3- FindM andN such thatMP ≡NP for allP, butM�≡N. (Meaning that≡is not extensional)
Exercices
7- [Barendregt 1971]
A closed expressionM (i.e. var(M) =∅) is solvable iff:
∀P,∃N1,N2, ...Nnsuch thatMN1N2· · ·Nn=βP (in short:
∀P,∃N,� MN� =βP )
Show that for every closed termM, the following are equivalent:
1. M has a hnf
2. ∃N,� MN� has a normal form 3. ∃N,� MN� =βI
4. M is solvable 8- [Barendregt 1974]
Show that, in theλI-calculus, a termM is solvable iffit has a normal form.
Exercices
9- LetRbe a preorder onN (reflexive + transitive) compatible with its structure:
a1Rb1, ...anRbn implies xa1a2· · ·an
aRb implies λx.aRλx.b
LetM�RN iff ∀a∈BT(M), ∃b∈BT(N), aRb Show that whenM is a closed term, one has:
∀P�,M�P�RNP� iff ∀C[ ], C[M]�RC[N]
10- (cont’d 1) LetMRNbe “ifM has a normal form, thenNhas a normal form”
Give examples ofM andNsuch thatM�RNbutM��N.
(cont’d 2) LetMRNbe “ifMhas a hnf, thenN has a hnf”
Give examples ofMandN such thatM�RNbutM��N.
11-
12- (cont’d 2) LetMRN be “ifMhas a hnf, thenNhas a similar hnf”
Give examples of M andN such that M �R N butM �� N. (Hint: consider M=λx.xxandN=λx.x(λy.xy)) [Compare withHyland 1975])