Adelfa logoAdelfa
Lambda Calculus

Uniqueness of typing for the simply typed lambda-calculus

Adelfa logo
unique.lf
ty : type.
arr : {T:ty}{U:ty}ty.

tm : type.
app : {E1:tm}{E2:tm}tm.
abs : {T:ty}{R:{x:tm}tm}tm.

of : {E:tm}{T:ty}type.
of_app : {M1:tm}{M2:tm}{T1:ty}{T2:ty}
          {a1:of M1 (arr T1 T2)} {a2:of M2 T1} of (app M1 M2) T2.
of_abs : {T1:ty}{T2:ty}{R : {x:tm} tm}
          {a1:({x:tm}{z:of x T1} of (R x) T2)}
          of (abs T1 ([x] R x)) (arr T1 T2).

eq : {T:ty}{U:ty}type.
refl : {T:ty} eq T T.
Adelfa logo
unique.ath
%Uniqueness of typing for the simply typed lambda-calculus




 {T}(x:tm,y:of x T).

%%% Strengthening properties for ty and eq.

   
    


   


%%% Main lemma which includes context G in the conclusion formula

  { G |- D1 : of E T1 } => { G |- D2 : of E T2 } =>
  exists D3, { G |- D3 : eq T1 T2 }.
  

  %case 1: of_abs
    
    
    
     

  %case 2: of_app
    
    
    
     

  %case 3: context
    
     


%%% Final result is proved by applying the strengthening result to form with a context

  { G |- D1 : of E T1 } => { G |- D2 : of E T2 } =>
  exists D3, { D3 : eq T1 T2 }.
    


%%% A short proof that a self application term is untypable

  forall T U P, {P : of (app (abs U ([x] (app x x))) (abs U ([x] (app x x)))) T} => false.