Lambda-Calculus and Type Theory Part II Ugo Dal Lago Scuola Estiva AILA, Gargnano, August 2018
Propositional Intuitionistic Logic: Natural Deduction ◮ Formulas are derived by the grammar ϕ ::= ⊥ | p | ϕ → ϕ | ϕ ∧ ϕ | ϕ ∨ ϕ , where p ranges over a set Θ of propositional variables. ◮ Judgments have the form Γ ⊢ ϕ , where Γ is a finite set of formulas. Given two such sets Γ and ∆ , their union is indicated as Γ , ∆ . ◮ The rules of propositional intuitionistic logic are as follows: Γ , ϕ ⊢ ϕ AX Γ , ϕ ⊢ τ Γ ⊢ ϕ → τ Γ ⊢ ϕ Γ ⊢ ϕ → τ I → E → Γ ⊢ τ Γ ⊢ ϕ Γ ⊢ τ Γ ⊢ ϕ ∧ τ Γ ⊢ ϕ ∧ τ E L ∧ E R ∧ I ∧ Γ ⊢ ϕ ∧ τ Γ ⊢ ϕ Γ ⊢ τ Γ ⊢ ϕ Γ ⊢ ϕ Γ ⊢ τ Γ , ϕ ∨ τ ⊢ ρ Γ ⊢ τ Γ ⊢ ϕ ∨ τ I L ∨ Γ ⊢ ϕ ∨ τ I R ∨ E ∨ Γ ⊢ ρ Γ ⊢ ⊥ Γ ⊢ ϕ E ⊥
Propositional Intuitionistic Logic: Semantics ◮ Heyting Algebras ◮ Distributive lattices with top and bottom elements, in which relative pseudo-complement always exist. ◮ Meet and joins interpret conjunctions and disjunctions, respectively. Implication is given semantics by way of pseudo-complements. ◮ Γ | = ϕ indicates that every Heyting Algebra validating Γ also validates ϕ . ◮ Kripke Semantics ◮ Propositional variables are put in relation with the elements of a partial order or possible worlds . ◮ Conjuction and disjuction are interpreted in Tarski-style, while implication is given semantics by way of the underlying partial order ◮ Γ � ϕ indicates that every Kripke model validating Γ also validates ϕ . Theorem (Completeness) Γ ⊢ ϕ if and only if Γ | = ϕ if and only if Γ � ϕ .
Simply-Typed λ -Calculus à la Curry ◮ An implicational propositional formula is called a simple type . The set of all simple types is denoted by Φ → . ◮ An environment is a finite set Γ of pairs of the form { x 1 : ϕ 1 , · · · , x n : ϕ n } , where the x i are distinct variables and ϕ i are simple types. In this case, dom (Γ) is { x 1 , · · · , x n } . ◮ A typing judgement is a triple Γ ⊢ M : ϕ , consisting of an environment, a λ -term and a simple type. ◮ The rules are as follows: Γ , x : ϕ ⊢ x : ϕ V Γ , x : ϕ ⊢ M : τ Γ ⊢ M : ϕ → τ Γ ⊢ N : ϕ Γ ⊢ λxM : ϕ → τ λ @ Γ ⊢ MN : τ ◮ The obtained calculus is referred to as ST → .
Subject Reduction Lemma (Generation Lemma) Suppose that Γ ⊢ M : ϕ . Then: 1. If M is a variable x , then Γ( x ) = ϕ ; 2. If M is an application NL , then there is τ such that Γ ⊢ N : τ → ϕ and Γ ⊢ L : τ ; 3. If M is an abstraction λxN and x / ∈ dom (Γ) , then ϕ = τ → ρ , where Γ , x : τ ⊢ N : ρ . Lemma (Substitution Lemma) 1. If Γ ⊢ M : ϕ and Γ( x ) = ∆( x ) for every x ∈ FV ( M ) , then ∆ ⊢ M : ϕ 2. If Γ , x : ϕ ⊢ M : τ and Γ ⊢ N : ϕ , then Γ ⊢ M [ x := N ] : τ . Theorem (Subject Reduction Theorem) If Γ ⊢ M : ϕ and M ։ β N , then Γ ⊢ N : ϕ .
Simply-Typed λ -Calculus à la Church ◮ Preterms of the simply-typed λ -calculus à la Church are defined as follows: M ::= x | ( MM ) | ( λx : ϕM ) . ◮ The notions of substitution, α -conversion, term, and reduction can be generalised to terms à la Church . ◮ Typing rules are the obvious ones: Γ , x : ϕ ⊢ x : ϕ V Γ , x : ϕ ⊢ M : τ Γ ⊢ M : ϕ → τ Γ ⊢ N : ϕ Γ ⊢ λx : ϕM : ϕ → τ λ @ Γ ⊢ MN : τ ◮ The Subject Reduction Theorem can be easily reproved.
Curry vs. Church Proposition In the Simply-Typed λ -calculus à la Church, if Γ ⊢ M : ϕ and Γ ⊢ M : τ , then ϕ = τ . ◮ The erasing map | · | from terms à la Church to terms à la Curry is defined by induction on the structure of terms, as follows: | x | := x | λx : ϕM | := λx | M | | MN | := | M || N | ◮ Typability and reduction judgments in the two styles can be translated into each other relatively easily.
Weak Normalisation Theorem Every term typable in ST → has a normal form. ◮ The proof is based on the following key ideas : ◮ One can assign to each typable term M , a pair natural numbers m M := ( δ M , n M ) in such a way that if M is not a normal form, then there is N with M → β N and m M > m N in the lexicographic order. ◮ Then, one proves the statement for every typable term M by lexicographic induction on m M . ◮ This is not a proof of strong normalisation.
Strong Normalisation Theorem Every term typable in ST → is strongly normalising. ◮ A Proof Based on Reducibility . ◮ For every type ϕ , a set of terms Red ϕ , the reducible terms; ◮ A proof that any term of type ϕ is in Red ϕ ; ◮ A proof that any term in Red ϕ is strongly normalizing. ◮ A Proof through λI ◮ η -reduction is the smaller compatible relation → η including pairs of the form λx ( Mx ) → η M (where x / ∈ FV ( M ) . → βη is the union of → β and → η . ◮ In the λI -calculus, one can form an abstraction λxM only if x ∈ FV ( M ) . ◮ In the λI -calculus, WN β = SN β .
The Church-Rosser Property ◮ Let → be a binary relation on a set X . ◮ → has the Church-Rosser property (CR) iff for all a, b, c ∈ X such that a → + b and a → + c there is d such that b → + d and c → + d . ◮ → has the Weak Church-Rosser property (WCR) iff for all a, b, c ∈ X such that a → b and a → c there is d such that b → + d and c → + d . ◮ → is strongly normalizing (SN) iff there is no infinite sequence a 1 → a 2 → · · · . Proposition (Newman’s Lemma) Let → be a binary relation satisfying SN. If → satisfies WCR, then → satisfies CR. Theorem Church-style ST → is WCR, thus CR.
Expressivity ◮ The normal form of a term of length n can in the worst case have size 2 ... 2 � Θ( n ) times 2 which is higher (as a function on n ) than any elementary function. Theorem (Statman) The problem of deciding whether any two given Church-style terms M and N of the same type are beta-equal is of nonelementary complexity.
Expressivity ◮ Let int = ( p → p ) → ( p → p ) , where p is an arbitrary type variable. A function f : N k → N is ST → -definable if there is a term M f with ∅ ⊢ M f : int k → int such that M f n 1 · · · n k ։ β f ( n 1 , . . . , n k ) ◮ The class of extended polynomials is the smallest class of functions over N which is closed under compositions and contains the constant functions, projections, addition, multiplication, and the conditional function � m if n = 0 ; cond ( n, m, p ) = p otherwise. Theorem (Schwichtenberg) The ST → -definable functions are exactly the extended polynomials.
The Curry-Howard Correspondence ◮ If Γ = { x 1 : ϕ 1 , · · · , x n : ϕ n } , then rg (Γ) is the set of implicational propositional formulas { ϕ 1 , . . . , ϕ n } . Proposition (Curry-Howard Isomorphism) 1. If Γ ⊢ M : ϕ in ST → , then rg (Γ) ⊢ ϕ in IPL → . 2. If Γ ⊢ ϕ in IPL → , then there are ∆ , M with rg (∆) = Γ and ∆ ⊢ M : ϕ . Corollary IPL → is consistent.
The Curry-Howard Correspondence ◮ The one we presented is not an isomorphism between proofs of IPL → and terms of ST → . ◮ Getting an exact isomorphism requires altering the way we presented natural deduction: [ ϕ ] i . . . . ϕ → τ ϕ τ ϕ → τ ( i ) τ ◮ What corresponds to β -reduction is the following rule: . [ ϕ ] i . . . . . . . ϕ . . ⇒ . . τ . . ϕ → τ ( i ) . ϕ . τ τ
Hilbert-Style Proofs ◮ Logical axioms are defined as all those instances of the following t two schemes: ϕ → τ → ϕ ; ( A1 ) ( ϕ → τ → ρ ) → ( ϕ → τ ) → ϕ → ρ ; ( A2 ) ◮ The Hilbert-Style rules for propositional intuitionistic logic are as follows: ϕ is a logical axiom Γ ⊢ H ϕ → τ Γ ⊢ H ϕ Γ , ϕ ⊢ H ϕ Γ ⊢ H ϕ Γ ⊢ H τ Theorem (Deduction Theorem) If Γ , ϕ ⊢ H τ , then Γ ⊢ H ϕ → τ . Theorem Γ ⊢ H ϕ iff Γ ⊢ ϕ
Combinatory Logic ◮ Terms of combinatory logic are defined as follows: M ::= x | ( MM ) | K | S . ◮ The relation → w is the least compatible relation on combinatory logic terms such that K MN → w M ; S MNL → w ML ( NL ) . As usual, ։ w is the reflexive and transitive closure of → w . ◮ The notions of normal forms, weak normalization and strong normalization are defined as usual.
Typed Combinatory Logic ◮ Typing Rules for Combinatory Logic Terms are defined as follows: Γ , x : ϕ ⊢ x : ϕ V Γ ⊢ S : ( ϕ → τ → ρ ) → ( ϕ → τ ) → ϕ → ρ S Γ ⊢ M : ϕ → τ Γ ⊢ N : ϕ @ Γ ⊢ K : ϕ → τ → ϕ K Γ ⊢ MN : τ Theorem (Subject Reduction) If Γ ⊢ M : ϕ and M ։ w N , then Γ ⊢ N : ϕ . Theorem (Strong Normalization) Γ ⊢ M : ϕ , then M is strongly normalizing.
Recommend
More recommend