Lambda Calculus with Types Henk Barendregt ICIS Radboud University Nijmegen The Netherlands
New book Cambridge University Press / ASL Perspectives in Logic, 2011 —————————————————————————————– Lambda Calculus with Types (698 pp) Authors: Henk Barendregt, Wil Dekkers, Richard Statman Part 1. Simple Types λ A → Gilles Dowek Marc Bezem Silvia Ghilezan Michael Moortgat Part 2. Recursive Types λ A = Mario Coppo Felice Cardone Part 3 Intersection Types λ S ∩ Mariangiola Dezani-Ciancaglini Fabio Alessi Furio Honsell Paula Severi Pawel Urzyczyn —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
The fathers —————————————————————————————– Alonzo Church (1903-1995) Haskell B. Curry (1900-1982) as mathematics student as BA in mathematics at Princeton University (1922 or 1924) at Harvard (1920) —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Church’s contribution: untyped lambda terms (1933) —————————————————————————————– Lambda terms c | var ′ var ::= var | term term | λ var term term ::= Lambda calculus mathematical axiom ( λx.M ) N = M [ x := N ] M = M M = N ⇒ N = M M = N & N = L ⇒ M = L logical axiom and rules M = N ⇒ MP = NP ⇒ M = N PM = PN ⇒ M = N λx.M = λx.N We write ⊢ λ M = N if M = N is provable by these axioms and rules � • Computations termination Functional programming • Processes continuation (Lisp, Scheme, ML, Clean, Haskell) —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Curry’s contributions —————————————————————————————– Curry: Russell paradox as fixed point of the operator Not Idea: For a ∈ A write Aa Then as { x | P [ x ] } we can take λx.P [ x ] Indeed, we get the intended interpretation a ∈{ x | P [ x ] } becomes ( λx.P [ x ]) a = P [ a ] Taking R = { x | x / ∈ x } = λx. ¬ ( xx ) we get ∀ r. [ Rr ⇐ ⇒ ¬ ( rr )] hence RR ⇐ ⇒ ¬ ( RR ) Note that RR ≡ ( λx. ¬ ( xx ))( λx. ¬ ( xx )) = Y ( ¬ ) � Typing of Whitehead-Russell was transformed into ‘functionality’ Γ ⊢ FABM Γ ⊢ AN Γ , Ax ⊢ BM Γ ⊢ B ( MN ) Γ ⊢ FAB ( λx.M ) —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Curry’s contributions —————————————————————————————– Curry: Russell paradox as fixed point of the operator Not Idea: For a ∈ A write Aa Then as { x | P [ x ] } we can take λx.P [ x ] Indeed, we get the intended interpretation a ∈{ x | P [ x ] } becomes ( λx.P [ x ]) a = P [ a ] Taking R = { x | x / ∈ x } = λx. ¬ ( xx ) we get ∀ r. [ Rr ⇐ ⇒ ¬ ( rr )] hence RR ⇐ ⇒ ¬ ( RR ) Note that RR ≡ ( λx. ¬ ( xx ))( λx. ¬ ( xx )) = Y ( ¬ ) � Typing of Whitehead-Russell was transformed into ‘functionality’ Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B Γ ⊢ MN : B Γ ⊢ λx.M : ( A → B ) —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Curry: combinators, correspondence with logic, linguistics —————————————————————————————– � I : A → A λx.x � A → B → A K λxy.x : � S λxyz.xz ( yz ) : ( A → B → C ) → ( A → B ) → A → C From these all closed lambda terms can be defined applicatively Also with types Curry: “Hey, these are tautologies” �→ Curry-Howard correspondence Inspired by Ajdukiewicz (and indirectly by Le´ sniewski) Curry gave types to syntactic categories n noun/subject s sentence n → n ‘red hat’ (adjective) (n → s) → (n → s) adverbs (n → n) → n ‘redness’ (n → s) → s quantifiers n → (n → n) ‘(John and Henry) are brothers’ n → s ‘Mary sleeps’ n → n → s ‘Mary kisses John’ s → s ‘not(Mary kisses John)’ More complex cases (n → n) → (n → n) → (n → n) ‘slightly large’ ((n → n) → (n → n)) → (n → n) → (n → n) ‘slightly too large’ —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Principia Mathematica (Whitehead-Russell 1910) —————————————————————————————– Substitution is needed PM does not provide it: λ -calculus does —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
The cycle —————————————————————————————– Untyped lambda terms (6) � Λ , ·� λ λ A Simple types (22) Free type algebras � A , →� → λ A �A , → , = � Recursive types (2) Type algebras = λ S �S , → , ≤� Subtyping (1) Type structures ≤ λ S �S , → , ≤ , ∩ , ⊤� Intersection types (4) Intersection type structures ∩ All untyped lambda terms appear again —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
→ ⊆ λ A = ⊆ λ S ≤ ⊆ λ S λ A → An increasing chain of systems λ A ∩ —————————————————————————————– 8 8 8 8 Γ , x : A ⊢ x : A > > > > > > > > > > > > > > < > λ A > > Γ , x : A ⊢ M : B > Γ ⊢ M : ( A → B ) Γ ⊢ N : A > > > → > > > > > > > > > > > > > > < > > Γ ⊢ ( MN ) : B Γ ⊢ ( λx.M ) : ( A → B ) λ A > > > > : > > = > > > > > > > > < > > λ S > > Γ ⊢ M : A > A = B > ≤ > > > > > > > > > > > > > > > Γ ⊢ M : B > : < > λ S > > ∩ > > > > Γ ⊢ M : A A ≤ B > > > > > > > > > > > > > > Γ ⊢ M : B : > > > > > > Γ ⊢ M : A ∩ B Γ ⊢ M : A ∩ B Γ ⊢ M : A Γ ⊢ M : B > > > > > > Γ ⊢ M : A Γ ⊢ M : B Γ ⊢ M : A ∩ B > > > > > > Γ ⊢ M : ⊤ : —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
→ ⊆ λ A = ⊆ λ S ≤ ⊆ λ S λ A → An increasing chain of systems λ A ∩ —————————————————————————————– Γ , x : A ⊢ x : A λ A Γ , x : A ⊢ M : B Γ ⊢ M : ( A → B ) Γ ⊢ N : A → Γ ⊢ ( MN ) : B Γ ⊢ ( λx.M ) : ( A → B ) Γ ⊢ M : A A = B λ A = Γ ⊢ M : B Γ ⊢ M : A A ≤ B λ S ≤ Γ ⊢ M : B Γ ⊢ M : A ∩ B Γ ⊢ M : A ∩ B Γ ⊢ M : A Γ ⊢ M : B λ S Γ ⊢ M : A Γ ⊢ M : B Γ ⊢ M : A ∩ B ∩ Γ ⊢ M : ⊤ —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
λ A → Examples —————————————————————————————– λ A λxy.xyy : ( A → A → B ) → A → B → λ A λx.xx : A if A = A → B in A = ( λx.xx )( λx.xx ) : B λ S λx.xx : A → B only; if A ≤ A → B in S ≤ λx.xx : ( A → B ) → B if A → B ≤ A λ S λx.xx : A ∩ ( A → B ) → B ∩ KI Ω : A → A where Ω � ( λx.xx )( λx.xx ) as Ω : ⊤ —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
λ A → Simply typed λ -calculus —————————————————————————————– Simple types from ground type 0 0 | T T → T T T = T Λ( A ) : λ -terms of type A . Write Λ → = � T Λ( A ) A ∈ T x A ∈ Λ( A ) M ∈ Λ( A → B ) , N ∈ Λ( A ) ⇒ ( MN ) ∈ Λ( B ) ( λx A .M ) ∈ Λ( A → B ) M ∈ Λ( B ) ⇒ Church’s version of λ A → Default equality = βη preserves types ( λx A .M ) N M [ x A := N ] = β -conversion λx A .Mx A = M η -conversion —————————————————————————————– HB Lambda Calculus with Types Types’10, October 13, 2010
Recommend
More recommend