Natural Deduction and the Curry-Howard-Isomorphism
Total Page:16
File Type:pdf, Size:1020Kb
Natural Deduction and the Curry-Howard-Isomorphism Andreas Abel August 2016 Abstract We review constructive propositional logic and natural deduction and connect it to the simply-typed lambda-calculus with the Curry- Howard Isomorphism. Constructive Logic A fundamental property of constructive logic is the disjunction property: If the disjunction A _ B is provable, then either A is provable or B is provable. This property is not compatible with the principle of the excluded middle (tertium non datur), which states that A _:A holds for any proposition A. While each fool can state the classical tautology \aliens exist or don't", this certainly does not give us a means to decide whether aliens exist or not. A constructive proof of the fool's statement would require either showcasing an alien or a stringent argument for the impossibility of their existence.1 1 Natural deduction for propositional logic The proof calculus of natural deduction goes back to Gentzen[1935]. 1 For a more mathematical example of undecidability, refer to the continuum hypothesis CH which states that no cardinal exists between the set of the natural numbers and the set of reals. It is independent of ZFC, Zermelo-Fr¨ankel set theory with the axiom of choice, meaning that in ZFC, neither CH nor :CH is provable. 1 1.1 Propositions Formulæ of propositional logic are given by the following grammar: P; Q atomic proposition A; B; C ::= P j A ) B implication j A ^ B j > conjunction, truth j A _ B j ? disjunction, absurdity Even though we write formulas in linearized (string) form, we think of them as (abstract syntax) trees. Formulas of propositional logic are binary trees where the inner nodes are labelled with one of the connectives ) or ^ or _, and leafs with a generic atomic proposition P or with > or ?. The label of the root of such a tree is also called the principal connective of the formula. Any subtree of a formula A is called a subformula of A. The children of the root node are called the immediate subformulæ. Example 1 (Propositions). Given SH := \Sokrates is a human" FL := \Sokrates has four legs" we can form the implication SH ) FL verbalized as \if Sokrates is a human, he has four legs". This example presents a well-formed proposition, but its truth is not without conditions. It is important to clearly separate between well-formedness and truth. However, speaking about truth usually presupposes well-formedness; discussions about the truth of ill-formed propositions maybe be entertaining after sufficient consumption of good wine, though. While well-formedness of propositional formulas is simply adherence to a simple grammar, truth requires more sophisticated tools, such as proof. 1.2 Judgements and derivations Definition 1. A proof of a proposition A is a derivation of the judgement A true by the proof rules of propositional logic (to follow). In general, we refer to judgements such as A true with letter J.A rule r has the following form J1 :::Jn r J 2 where J1::n (with n ≥ 0) are the premises and J is the conclusion. Informally, it means that if we can make all the judgements Ji, then we can also make judgements J, by virtue of applying rule r. Rules without premises n = 0 are called axioms. Subsequent rule applications are organized into a tree, for instance: r3 J3 J4 J5 r1 r2 J1 J2 r0 J0 In this case, the final judgement J0 is justified by a binary rule r0 whose first premise J1 is justified by axiom r1. Its second premise J2 is justified by a ternary rule r2. The first of these new three premises J3 is justified by axiom r3, the other two premises J4 and J5 are missing justification. The tree leading to judgement J0 is called the derivation of J0. We use letters D and E, to refer to derivations and write D :: J for \tree D is a derivation of judgement J". If all leaves of the derivation trees are axioms, we speak of a closed derivation, otherwise of an open derivation, like the example above. Suppose we find justifications D4 :: J4 and D5 :: J5 of the remaining open premises, then we can close the derivation of J0 like this: D4 D5 r3 J3 J4 J5 r1 r2 J1 J2 r0 J0 The whole derivation D0 :: J0 can now be written in prefix notation as J0 J1 J2 J3 D0 = r0 (r1 ; r2 (r3 ; D4; D5)) where the superscripts annotate each rule with the judgement it derives, or, dropping annotations, briefly as D0 = r0(r1; r2(r3; D4; D5)). 1.3 Introduction and elimination rules The judgement A true for a propositional formula A is established by rules that fall into two classes: 1. Introduction rules. These establish the truth of a compound proposi- tion, for instance conjuction A ^ B from the truth of its subformulas A and B. A true B true ^I A ^ B true 3 2. Elimination rules. These allow us to use (parts of) a true compound proposition to derive the truth of other propositions. For instance, the truth of A ^ B entails the truth of its subformulas A and B. A ^ B true A ^ B true ^E ^E A true 1 B true 2 Connectives that can be defined with introduction and elimination rules referring only to subformulas (or generic new formulas) are called orthogonal. Introduction and elimination rules need to fit together. Introduction rules allow us to assemble evidence, and elimination rules allow us to use it, or to disassemble it. The elimination rules for a connective are adequate if we can retrieve by the elimination rules every piece of information we put in by introduction rules, and only the information we put in. Adequacy can be formulated as local soundness and local completeness, i. e., the presence of certain proof transformations detailed as follows. Local soundness states that we can simplify any proof detour that con- sists of the introduction of a connective immediately followed by the con- nective. There are n · m different detour shapes for a connective with n introduction rules and m elimination rules. The removal of such a detour is also called β-reduction, sometimes qualified by the connective, e. g., β^- reduction. In case of conjunction, there are two possible detours that qualify for β-reduction: D1 D2 D1 D2 A true B true A true B true ^I ^I A ^ B true A ^ B true ^E1 ^E2 A true B true Both pieces of evidence (A true and B true) fed into the introduction rule ^I can be recovered by the elimination rules ^E1 and ^E2. The β-reductions simplify these proof trees as follows: D1 D2 A true B true D1 ^I −!β A true A ^ B true ^E1 A true D1 D2 A true B true D2 ^I −!β B true A ^ B true ^E2 B true 4 These reductions show that the eliminations ^E1=2 are not too strong: they do not produce more than we put in with the introduction rule ^I. This is why we can cut the detours out. Exercise 1. Invent a (locally) unsound elimination rule for conjunction, which does not allow the reduction of detours. Local completeness in contrast expresses that the elimination rules are not too weak. The elimination rules for a connective should give us all the evindence such that we can reconstruct a proof for the formula we elimi- nated. This means that any proof for a proposition should be presentable by introducing the principal connective of the proposition. The premises for the introduction rule(s) are constructed via the elimination rule. Lo- cal completeness is witnesses by η-expansion, a proof transformation that introduces a detour of the form elimination rule followed by introduction rules. For conjunction, η-expansion creates the following detour: D D D A ^ B true A ^ B true A ^ B true −!η− ^E1 ^E2 A true B true ^I A ^ B true Exercise 2. Reflect on the fate of local completeness for conjunction when we drop one of the elimination rules. 1.4 Trivial proposition With binary conjunction, we can express any finite conjunction except for the empty conjunction >. A proof of the empty conjunctions asks us to provide proofs for all of the 0 conjuncts. Thus, we get an introduction rule without premises. >I > true There is no elimination rule for >: A proof of > is constructed from nothing, so there is no information contained in it we could retrieve by elimination. As a consequence, there is no β-reduction. Local completeness is wit- nessed by the η-expansion: D > true −! − >I η > true This proof transformation replaces any derivation of the trivial proposition by the trivial derivation. 5 1.5 Hypothetical judgements The elimination rule for implication is the well-known modes ponens: If A implies B and A holds, then B must hold as well. A ) B true A true )E B true While, classically, implication A ) B can be reduced to disjunction and negation :A _ B, the disjunction property would be immediately violated by such an interpretation. A universal truth such as \if aliens exist, there must a be habitable planet" does not allow us to decide whether there is a habitable planet or no aliens exist. Instead the implication A ) B allows us to conclude B from the hypoth- esis A. This means that we can assume the truth of A to derive the truth of B. Let us consider the tautology (A ^ B) ) (B ^ A). Our proof would first derive the conclusion B ^ A from an assumed truth of A ^ B, by the following open derivation: A ^ B true A ^ B true B true A true B ^ A true Then, the introduction of the implication (A ^ B) ) (B ^ A) enables us to discharge the hypothesis A ^ B and close the derivation.