CORNELL CS 611 - Lecture 14 The Curry-Howard Isomorphism

Unformatted text preview:

CS611 Lecture 14 The Curry-Howard Isomorphism November 26, 2001Scribe: Christopher Capobianco and Walter Chang Lecturer: Andrew Myers1 Curry-Howard Isomorphism (a.k.a. formulas-as-types)1.1 HistoryIn 1968, Mathematician William Howard, building on work by Haskel Curry, identified a one-to-one relation-ship between propositional formulas and logical proofs to types and programs respectively. More genreally,it was noticed that logical ideas have computational significance. This idea became known, rather naturally,as the Curry-Howard Isomorphism.1.2 Logical FormulasHere we define the form of the logical expressions we will use in our exploration of the Curry-HowardIsomorphismφ ::= T | F | φ1∧ φ2| φ1∨ φ2| φ1⇒ φ2|¬φ |∀x.φ |∃x.φ | x1.3 Proof RulesNow that we have our logical formulas, we need a way to prove any logical assertion. And so we define proofrules.φ1φ2φ1∧ φ2φ1∧ φ2φ1φ1∧ φ2φ2φ1φ1∨ φ2φ2φ1∨ φ2φ1⇒ φ2φ1φ2φ1∨ φ2φ1⇒ φ3φ1⇒ φ3φ32 Constructive L ogic (a.k.a. Intuitionistic)In Constructive Logic one needs to prove a logical formula is true by proving it is true, not by proving thenegation is false (proof by contradiction). While the latter might be perfectly acceptable in classical logic,that method cannot be used in the Constructive logic system. So the following classical logic proof rules arenot found in Constructive logic:¬¬φφ φ ∨¬φφ1∨ φ2¬ φφ2For an ⇒,weassumethehypothesistobetrueandneedtoprovetheconsequence.13 Natural DeductionIn 1934 Gerhard Getzen introduced Natural deduction. This proof method uses a list of assumptions tocome upon a conclusion: φ1, ..., φn φ . That is we assert that φ is true based upon the assumption thatφ1, ..., φnare all true. We call the set of assumptions, φ1, ..., φn,Γ.We need to stick Γ into the logical proof rules we defined above, which would result in:Γ  φ1Γ  φ2Γ  φ1∧ φ2Γ  φ1∧ φ2Γ  φ1Γ  φ1∧ φ2Γ  φ2Γ  φ1Γ  φ1∨ φ2Γ  φ2Γ  φ1∨ φ2Γ  φ1⇒ φ2Γ  φ1Γ  φ2Γ  φ1∨ Γ  φ2Γ  φ1⇒ φ3Γ  φ1⇒ φ3Γ  φ3We now provide a proof to illustrate the application of the proof rules; here is the proof of transitivity ofimplications:...  X ⇒ Y ∧ Y ⇒ Z...  Y ⇒ Z...  X ⇒ Y ∧ Y ⇒ Z...  X ⇒ Y ...  X...  YX, Y , Z ;(X ⇒ Y ) ∧ (Y ⇒ Z),X  ZX, Y , Z ;(X ⇒ Y ) ∧ (Y ⇒ Z)  (X ⇒ Z)X, Y , Z ; ∅(X ⇒ Y ) ∧ (Y ⇒ Z) ⇒ (X ⇒ Z)∀X, Y , Z . (X ⇒ Y ) ∧ (Y ⇒ Z) ⇒ (X ⇒ Z)The proof tree for logical formulas, Γ  φ, looks like that for typing, Γ  e : τ .Ifwelookclosertotheeach of the logical proof rules, we can find a corresponding one in the typing proof rules, e.g.:Γ  φ1Γ  φ2Γ  φ1∧ φ2Γ  e1: τ1Γ  e2: τ2Γ e1,e2 : τ1∗ τ2Γ  φ1∧ φ2Γ  φ1Γ  e : τ1∗ τ2Γ  left e : τ1Γ  φ1Γ  φ1∨ φ2Γ  e : τ1Γ  inl e : τ1+ τ2Γ  φ1∨ Γ  φ2Γ  φ1⇒ φ3Γ  φ1⇒ φ3Γ  φ3Γ  e0: τ1+ τ2Γ  λx. e1: τ1→ τ3Γ  λx. e2: τ2→ τ3Γ  case e0of x.e1| x.e2: τ324 The Curry-Howard IsomorphismWe notice the following isomorphism between logical rules and typing rules.Logical Rule Typing Rule∧ *∨ +⇒→∀∀T1(B)F 0 (empty domain)φ1⇔ φ2τ1≡ τ2¬φτ→ 0Under this isomorphism, since  φ ⇔e :τ, if a statement is logically derivable then there is a programand a value of type τ.Wesaythatτ is inhabited if you can construct a value of that type (it is possible toconstruct types for which no values exist; these types are uninhabited)Since the proof is encoded in the structure of the term itself, it turns out that this is very useful for proofcarrying code.5 Logical TautologiesSeveral well-known logical tautologies have interesting interpretations under this isomorphism. For example,(A ∧ B ⇒ C) ⇔ (A ⇒ B ⇒ C) becomesA ∗ B → C ≡ A → B → C which is a statement about currying and uncurrying.Also, deMorgan’s law, A ∧ B ⇔¬(¬A ∨¬B) suggests that there is a way to encode sums using productsand vice versa.Lastly, double negation translates to τ ≡ (τ → 0) → 0 is continuation passing under the isomorphism:D[[ 1 ]] = 1D[[ τ → τ]] = τ → (τ→ 0) → 0D[[ Γ  e:τ]] = ( [[ τ ]] → 0) → 0D[[ Γ ,x:τ  x :τ]] = λk :[[τ]] → 0.kxD[[ Γ  e0e1:τ]] = λk.[[ τ]] → 0. D[[ Γ  e0:τ → τ]] ( λf :[[τ → τ]] . D[[ Γ  e1: τ]] ( λv :[[τ ]] .fvk)): ([[τ]] → 0)D[[ Γ  λx : τe: τ → τ]] = λk :[[tau → τ]] → 0.k(λv :[[τ]] .λk:[[τ]] → 0. D[[ Γ  e : τ]]


View Full Document

CORNELL CS 611 - Lecture 14 The Curry-Howard Isomorphism

Download Lecture 14 The Curry-Howard Isomorphism
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 14 The Curry-Howard Isomorphism 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 14 The Curry-Howard Isomorphism 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?