Sendika tipi olan lamda terimlerinin karakterizasyonu


29

Birçok ders kitabı lambda-matemindeki kesişim tiplerini kapsar. Kavşak için yazım kuralları aşağıdaki gibi tanımlanabilir (basit bir şekilde alt tipleme ile yazılan lambda hesabının üstüne):

ΓM:T1ΓM:T2ΓM:T1T2(I)ΓM:(I)

Kavşak tipleri normalleşme açısından ilginç özelliklere sahiptir:

  • Bir lambda vadeli kullanmadan yazılabilir I kuvvetle normale IFF kural.
  • Bir lambda süreli bir tür içermeyen kabul normal bir formu vardır IFF.

Ya kavşak eklemek yerine sendika eklersek?

ΓM:T1ΓM:T1T2(I1)ΓM:T2ΓM:T1T2(I2)

Basit türleri, alt tipleri ve sendikaları olan lambda calculus'un benzer bir özelliği var mı? Sendika ile yazılabilir terimler nasıl tanımlanabilir?


Interesting question. Could you say that interfaces from OOP correspond to this?
Raphael

Yanıtlar:


11

İlk sistemde alt tip olarak adlandırdığınız şey şu iki kuraldır:

Γ,x:T1M:SΓ,x:T1T2M:S(E1)Γ,x:T2M:SΓ,x:T1T2M:S(E2)

They correspond to elimination rules for ; without them the connective is more or less useless.

In the second system (with connectives and , to which we could also add a ), the above subtyping rules are irrelevant, and I think the accompanying rules you had in mind are the following:

Γ,x:T1M:SΓ,x:T2M:SΓ,x:T1T2M:S(E)Γ,x:M:S(E)

For what it's worth, this system allows to type (λx.I)Ω:AA (using the E rule), which cannot be typed with just simple types, which has a normal form, but is not strongly normalizing.


Random thoughts: (maybe this is worth asking on TCS)

This leads me to conjecture that the related properties are something like:

  • a λ-term M admits a type not containing iff MN has a normal form for all N which has a normal form. (δ fails both tests, but the above λ-term pass them)
  • a λ-term M can be typed without using the E rule iff MN is strongly normalizing for all strongly normalizing N.

Exercise: prove me wrong.

Also it seems to be a degenerated case, maybe we should consider adding this guy into the picture. As far as I remember, it would allow to obtain A(A)?


Good point about the subtyping rules, they show that union types aren't nearly as natural as intersections (which get typed orthogonally to arrows). About the second part I need to think some more.
Gilles 'SO- stop being evil'

I think M=(λx.xx)(λy.y) answers the exercise, if you are talking about union types.
jmad

About call/cc: it needs more than just lambda-terms (like lambda-mu-terms or another framework) but type systems are more complex, logic systems, in which union types may be irrelevant.
jmad

@jmad: Indeed, intersection types are needed to type this term :-( Maybe considering unions and intersections together would be interesting?
Stéphane Gimenez

I would be interested in a λ-term one can type with union types (rs. with intersection types) but not with simple types (rs. with intersection types).
jmad

16

I just want to explain why intersection types are well-suited to characterize classes of normalization (strong, head or weak), whereas other type systems can not. (simply-typed or system F).

The key difference is that you have to say: "if I can type M2 and M1M2 then I can type M1". This is often not true in non-intersection types because a term can be duplicated:

(λx.Mxx)NMNN

and then typing MNN means that you can type both occurrences of N but not with the same type, for example

M:T1T2T3N:T1N:T2
With intersection types you can transform this into:
M:T1T2T1T2T3N:T1T2
and then the crucial step is now really easy:
(λx.Mxx):T1T2T3N:T1T2
so (λx.Mxx)N can by typed with intersection types.

Now about union types: suppose you can type (λx.xx)(λy.y) with some union type, then you can also type λx.xx and then get for some types S,T1,

x:T1T2Tnxx:S
But you still have to prove that for every i, x:Tixx:S which seems impossible even is S is an union type.

This is why I don't think there is an easy characterization about normalization for union types.

Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.