CORNELL CS 611 - Lecture 29 Propositions as Types

Unformatted text preview:

CS611 Lecture 29 Propositions as Types 13 November 2006Lecturer: Dexter Kozen1 Intuitionistic Logic and Constructive MathematicsWe have previously observed that several familiar type judgements ` e : τ of the pure simply-typed λ-calculus correspond to a tautologies of propositional logic:type judgement propositional tautology` I : α → α P → P` K : α → β → α P → (Q → P )` S : (α → β → γ) → (α → β) → (α → γ) (P → Q → R) → (P → Q) → (P → R)This is no accident. It turns out that all derivable type judgements ` e : τ (with the empty environmentto the left of the turnstile) give propositional tautologies. This is because the typing rules of λ→correspondexactly to the proof rules of propositional intuitionistic logic.Intuitionistic logic is the basis of constructive mathematics. Constructive mathematics takes a much moreconservative view of truth than class ical mathematics. It is concerned less with truth than with provability.Its main proponents were Kronecker and Brouwer around the beginning of the last century. Their views atthe time generated great controversy in the mathematical world.In constructive mathematics, not all deductions of classical logic are considered valid. For example,to prove in classical logic that there exists an object having a certain property, it is enough to assumethat no such object exists and derive a contradiction. Intuitionists would not consider this argument valid.Intuitionistically, you must actually construct the object and prove that it has the desired property.Intuitionists do not accept the law of double negation: P ↔ ¬¬P . They do believe that P → ¬¬P , thatis, if P is true then it is not false; but they do not believe ¬¬P → P , that is, even if P is not false, thenthat do es not automatically make it true.Similarly, intuitionists do not accept the law of the excluded middle P ∨ ¬P . In order to prove P ∨ ¬P,you must prove either P or ¬P . It may well be that neither is provable, in which case the intuitionist wouldnot accept that P ∨ ¬P .For intuitionists, the implication P → Q has a much stronger meaning than merely ¬P ∨Q, as in classicallogic. To prove P → Q, one must show how to construct a proof of Q from any given pro of of P . So a proofof P → Q is a (computable) function from proofs of P to proofs of Q. Similarly, to prove P ∧ Q, you mustprove both P and Q; thus a proof of P ∧ Q is a pair consisting of a proof of P and a proof of Q.1.1 ExampleHere is an example of a proof that would not be accepted by an intuitionist.Theorem There exist irrational numbers a and b such that abis rational.Proof. Either√2√2is rational or not. If it is, take a = b =√2 and we are done. If it is not, take a =√2√2and b =√2; then ab= (√2√2)√2=√22= 2, and again we are done.Now an intuitionist would not like this, because we haven’t actually constructed a definite a and b withthe desired property. We have used the law of the excluded middle, which is cheating.2 SyntaxSyntactically, formulas ϕ, ψ, . . . of intuitionistic logic look the same as their classical counterparts. At theprop os itional level, we have propositional variables P, Q, R, . . . and formulasϕ ::= > | ⊥ | P | ϕ → ψ | ϕ ∨ ψ | ϕ ∧ ψ | ¬ϕ.1We might also add a second-order quantifier ∀P ranging over propositions:ϕ ::= ··· | ∀P .ϕ.3 Natural Deduction (Gentzen, 1943)Intuitionistic logic uses a sequent calculus to derive the truth of formulas. Assertions are judgements of theform ϕ1, . . . , ϕn` ϕ, which means that ϕ can be derived from the assumptions ϕ1, . . . , ϕn. If ` ϕ withoutassumptions, then ϕ is a theorem of intuitionistic logic. The system is called natural deduction.As we write down the proof rules, it will be clear that they correspond exactly to the typing rules of thepure simply-typed λ-calculus λ→(and with quantifiers, System F). We will show them side by side. Thereare generally introduction and elimination rules for each operator.intuitionistic logic λ→or System F type system(axiom) Γ, ϕ ` ϕ Γ, x : τ ` x : τ(→-intro)Γ, ϕ ` ψΓ ` ϕ → ψΓ, x : σ ` e : τΓ ` (λx : σ. e) : σ → τ(→-elim)Γ ` ϕ → ψ Γ ` ϕΓ ` ψΓ ` e0: σ → τ Γ ` e1: σΓ ` (e0e1) : τ(∧-intro)Γ ` ϕ Γ ` ψΓ ` ϕ ∧ ψΓ ` e1: σ Γ ` e2: τΓ ` (e1, e2) : σ ∗ τ(∧-elim)Γ ` ϕ ∧ ψΓ ` ϕΓ ` ϕ ∧ ψΓ ` ψΓ ` e : σ ∗ τΓ ` #1 e : σΓ ` e : σ ∗ τΓ ` #2 e : τ(∨-intro)Γ ` ϕΓ ` ϕ ∨ ψΓ ` ψΓ ` ϕ ∨ ψΓ ` e : σΓ ` inlσ +τ: eσ + τΓ ` e : τΓ ` inrσ+τ: eσ + τ(∨-elim)Γ ` ϕ ∨ ψ Γ ` ϕ → χ Γ ` ψ → χΓ ` χΓ ` e : σ + τ Γ ` e1: σ → ρ Γ ` e2: τ → ρΓ ` case e0of e1| e2: ρ(∀-intro)Γ, P ` ϕΓ ` ∀P .ϕ∆, α; Γ ` e : τ α /∈ FV(Γ)∆; Γ ` (Λα. e) : ∀α.τ(∀-elim)Γ ` ∀P .ϕΓ ` ϕ{ψ/P}∆; Γ ` e : ∀α.τ ∆ ` σ∆; Γ ` (e σ) : τ {σ/α}The →-elimination rule is often called modus ponens.4 The Curry–Howard IsomorphismThe fact that propositions in intuitionistic logic correspond to types in our λ-calculus type systems is knownas the Curry–Howard isomorphism or the propositions as types principle. The analogy is far reaching:type theory logicτ type ϕ propositionτ inhabited type ϕ theoreme well-typed program π proof→ function space → implication* product ∧ conjunction+ sum ∨ disjunction∀ type quantifier ∀ 2nd order quantifier1 unit > truth0 void ⊥ falsity2A proof in intuitionistic logic is a construction, which is essentially a program (λ-term). Saying that aprop os ition has an intuitionistic or constructive proof says essentially that the corresponding type is inhabitedby a λ-term.If we are given a well-typed term in System F or λ→, then its proof tree will look exactly like the prooftree for the corresponding formula in intuitionistic logic. This means that every well-typed program provessomething, i.e. is a proof in constructive logic. Conversely, every theorem in constructive logic correspondsto an inhabited type. Several automated deduction systems (e.g. Nuprl, Coq) are based on this idea.5 Theorem Proving and Type CheckingWe have seen that type inference is the process of inferring a type for a given λ-term. Under the Curry–Howard isomorphism, this is the same as determining what theorem a given proof proves. Theorem proving,on the other hand, is going in the opposite direction: Given a formula, do es it


View Full Document

CORNELL CS 611 - Lecture 29 Propositions as Types

Download Lecture 29 Propositions as Types
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 29 Propositions as Types and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 29 Propositions as Types 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?