Lecture Notes on Combinatory Modal Logic

Similar documents
3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule.

Lecture Notes on Kripke Semantics for Validity

Lecture Notes on Sequent Calculus

Lecture Notes on The Curry-Howard Isomorphism

Lecture Notes on Intuitionistic Kripke Semantics

Lecture Notes on Focusing

Propositional Logic: Syntax

Logic for Computer Science - Week 4 Natural Deduction

Lecture Notes on Linear Logic

02 Propositional Logic

Propositions and Proofs

A Judgmental Reconstruction of Modal Logic

TR : Binding Modalities

AN ALTERNATIVE NATURAL DEDUCTION FOR THE INTUITIONISTIC PROPOSITIONAL LOGIC

Lecture 11: Measuring the Complexity of Proofs

TR : Tableaux for the Logic of Proofs

CHAPTER 11. Introduction to Intuitionistic Logic

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Lecture Notes on Certifying Theorem Provers

Evaluation Driven Proof-Search in Natural Deduction Calculi for Intuitionistic Propositional Logic

Lecture Notes on Heyting Arithmetic

Modal Logic XX. Yanjing Wang

Consequence Relations and Natural Deduction

Hypersequent Calculi for some Intermediate Logics with Bounded Kripke Models

On Modal Logics of Partial Recursive Functions

Modal Logic as a Basis for Distributed Computation

Lecture Notes on Classical Linear Logic

Semantical study of intuitionistic modal logics

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Decomposing Modalities

Systems of modal logic

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge

Logic Part II: Intuitionistic Logic and Natural Deduction

Propositional logic (revision) & semantic entailment. p. 1/34

Lecture Notes on Call-by-Value and Call-by-Name

Introduction to Metalogic

On Urquhart s C Logic

Explicit Logics of Knowledge and Conservativity

Display calculi in non-classical logics

Lecture Notes on Cut Elimination

Logic for Computer Science - Week 5 Natural Deduction

A MODAL EXTENSION OF FIRST ORDER CLASSICAL LOGIC Part I

Propositional Logic Review

Chapter 3: Propositional Calculus: Deductive Systems. September 19, 2008

Implementing Proof Systems for the Intuitionistic Propositional Logic

Equivalence for the G 3-stable models semantics

Propositional Logics and their Algebraic Equivalents

Extended Abstract: Reconsidering Intuitionistic Duality

Uniform Schemata for Proof Rules

Proving Completeness for Nested Sequent Calculi 1

On the Complexity of the Reflected Logic of Proofs

Introduction to Intuitionistic Logic

Modal and temporal logic

Bidirectional Decision Procedures for the Intuitionistic Propositional Modal Logic IS4

1. Propositional Calculus

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011

Consequence Relations and Natural Deduction

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

Proof-theoretic semantics, self-contradiction and the format of deductive reasoning

On a Logical Foundation for Explicit Substitutions

Constructive Linear-Time Temporal Logic: Proof Systems and Kripke Semantics

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012

CS Lecture 19: Logic To Truth through Proof. Prof. Clarkson Fall Today s music: Theme from Sherlock

Filtrations and Basic Proof Theory Notes for Lecture 5

Categories, Proofs and Programs

Chapter 11: Automated Proof Systems

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

S4LP and Local Realizability

Natural Deduction for Propositional Logic

Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory

Advanced Topics in LP and FP

On a computational interpretation of sequent calculus for modal logic S4

Propositional Logic: Part II - Syntax & Proofs 0-0

Sequent Combinators: A Hilbert System for the Lambda Calculus

Lecture Notes on Constructive Logic: Overview

Deductive Systems. Lecture - 3

A SIMPLE AXIOMATIZATION OF LUKASIEWICZ S MODAL LOGIC

Command = Value Context. Hans-Dieter Hiep. 15th of June, /17

cse371/mat371 LOGIC Professor Anita Wasilewska Fall 2018

Chapter 11: Automated Proof Systems (1)

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 15 Propositional Calculus (PC)

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

A Note on Bootstrapping Intuitionistic Bounded Arithmetic

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Propositional Logic Arguments (5A) Young W. Lim 11/30/16

Propositional Logic: Syntax

Logic. Propositional Logic: Syntax

A NOTE ON DERIVATION RULES IN MODAL LOGIC

A New Intuitionistic Fuzzy Implication

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson

Basic Algebraic Logic

c 2002 Published by Elsevier Science B. V. Open access under CC BY-NC-ND license.

KRIPKE S THEORY OF TRUTH 1. INTRODUCTION

Inquisitive Logic. Ivano Ciardelli.

Module 5 K and Equivalent Systems

Human-Readable Machine-Verifiable Proofs for Teaching Constructive Logic

Realization Using the Model Existence Theorem

Axiomatic systems. Revisiting the rules of inference. Example: A theorem and its proof in an abstract axiomatic system:

FORMAL PROOFS DONU ARAPURA

Transcription:

Lecture Notes on Combinatory Modal Logic 15-816: Modal Logic Frank Pfenning Lecture 9 February 16, 2010 1 Introduction The connection between proofs and program so far has been through a proof term assignment for natural deduction. Proof reduction then forms the basis of computation. This might be called the Howard isomorphism [How80]. So where does Curry enter into the picture? He had discovered much earlier that one can assign types combinators in a way that validates the axioms of intuitionistic propositional logic [Cur34]. Combinators are a variable-free notation for functions, with a form of computation that does not rely on substitution in the way that natural deduction does. In this lecture we first present this connection for intuitionistic logic and then extend it to include necessity and possibility. 2 Hilbert-Style Axiom Systems Deductive systems in the tradition of Hilbert [HB34] are characterized by a minimal number of inference rules and many axioms. This reflects mathematical tradition where theories are characterized axiomatically, and logic is seen as a particular kind of mathematical theory. Classical and intuitionstic logic, for example, just have a single rule of inference, namely modus ponens which we abbreviate as mp: A B hil B hil A hil mp

L9.2 Combinatory Modal Logic Here we write A hil to indicate that A follows according to the axioms and rules of inference of intuitionistic logic. Where in the judgmental approach we characterize implication via hypothetical judgments, in Hilbert systems modus ponens can be seen as a meaning explanation for implication. Particular logical connectives are now characterized by axioms. For example, we might have the following three axioms for conjunction: A B A B hil A B A hil A B B hil We will not specify right now the axioms for implication, but develop them together with a proof that A hil iff A true, that is, the axiomatic and the natural deduction approach prove the same theorems. Nevertheless, the two approaches are vastly different because the structure of proofs, of primary importance in the constructive interpretation of logic, is very different, as we will see. 3 From Hilbert Proofs to Natural Deductions Generally speaking, this direction is easy. Since the rule of modus ponens is the same as implication elimination ( E), all we have to do is to prove the axioms in natural deduction, and any axiomatic proof can be translated into natural deduction form. Once we have completed our axiomatic system, we will show how to prove the axioms at the end of the next section. 4 From Natural Deductions to Hilbert Proofs The difficult direction is to translate natural deductions to Hilbert proofs. This is difficult because the introduction rule for implication employs hypotheses which are not directly available in Hilbert proofs. The key to the solution are hypothetical Hilbert derivations. They allow a rather straighforward translation of natural deductions. We prove separately that, on Hilbert proofs, hypotheses can be eliminated using the crucial deduction theorem. We will prove this first, because it motivates the particular axioms we need. We write Γ for hypotheses A 1 hil,..., A n hil. Theorem 1 (Deduction Theorem) If Γ, A hil C hil then Γ A C hil.

Combinatory Modal Logic L9.3 Proof: By induction on the structure of the given proof. We will introduce the necessary axioms for this proof as we go along. Γ, A hil A hil hyp In this case we need to show that Γ A A hil. We introduce the axiom schema A A hil (I) from which Γ A A hil follows by weakening. B hil Γ Γ, A hil B hil hyp In this case we need to prove Γ A B hil. We introduce the axiom schema B (A B) hil (K) and procceed as follows: Γ B hil Γ B (A B) hil Γ A B hil By hypothesis B hil Γ By axiom (K) and weakening By rule (mp) Γ, A hil B C hil Γ, A hil B hil Γ, A hil C hil mp Γ A (B C) hil Γ A B hil At this point we need to introduce the axiom schema (A (B C)) (A B) (A C) hil (S) Now we can complete the proof.

L9.4 Combinatory Modal Logic Γ (A (B C)) (A B) (A C) hil Γ (A B) (A C) hil Γ A C hil By (S) and weakening By rule (mp) By rule (mp) Now we have introduced several axiom schemas X, for each of which we have Γ X hil. These also have to be covered in the proof. for an axiom X (either I, K, or S). Γ X hil X Γ X hil Γ X (A X) hil Γ A X hil Axiom By axiom (K) By rule (mp) In summary, for the purely implicational fragment we obtain the deduction theorem with the following axioms: A A hil B (A B) hil (A (B C)) (A B) (A C) hil (I) (K) (S) together with the single rule of modus ponens A B hil B hil A hil mp From the deduction theorem it follows easily that we can translate natural deduction to Hilbert proofs. We write ˆΓ for the translation of judgments A true to A hil. Theorem 2 (From Natural Deduction to Hilbert Proofs) If Γ A true then ˆΓ A hil. Proof: By induction on the given natural deduction. A true Γ Γ A true hyp

Combinatory Modal Logic L9.5 ˆΓ A hil By hypothesis A hil ˆΓ. Γ, A 1 true A 2 true Γ A 1 A 2 true I ˆΓ, A 1 hil A 2 hil ˆΓ A 1 A 2 hil By the deduction theorem (Theorem 1) Γ B A true Γ A true Γ B true E ˆΓ B A hil ˆΓ B hil ˆΓ A hil By rule (mp) Since deduction in a Hilbert-style system is usually not presented with hypotheses, the following corollary is really the desired result. Corollary 3 (Completeness of IKS) If A true then A hil. Proof: From Theorem 2 by taking Γ = ( ). We can also return to the translation from Hilbert proofs to natural deductions which we postponed earlier. Theorem 4 (From Hilbert Proofs to Natural Deductions) If A hil then A true. Proof: By induction on the structure of the given deduction. We just show the corresponding natural deduction proof term which can be unwound into a proof. A A hil (I). λx. x : A A

L9.6 Combinatory Modal Logic B (A B) hil (K). λx. λy. x : B (A B) (A (B C)) (A B) (A C) (S). λx. λy. λz. (x z) (y z) : (A (B C)) (A B) (A C) B A hil A hil B hil mp M : B A N : B M N : A By rule E 5 Combinatory Reduction In order to understand the computational meaning of Hilbert s system, we assign proof terms to the axioms and inference rules. We write H M : A if combinator term M represents a Hilbert proof of A. H S : (A (B C)) (A B) (A C) H K : A B A H I : A A H M : A B H M N : B H N : A mp From the translation of these into proof terms for natural deduction at the end of the last section, we can derive reductions for terms built from combinators. The idea is to supply enough arguments that the resut is no longer a λ-abstraction. Recall that juxtaposition (representing E in natural deduction proof terms and modus ponens in combinator terms) is leftassociative. We write ˆM for the translation of a combinator into a natural deduction proof term.

Combinatory Modal Logic L9.7 Î = λx. x I x x ˆK = λx. λy. x K x y x Ŝ = λx. λy. λz. (x z) (y z) S x y z (x z) (y z) Here, x, y, and z on the right-hand side stand for combinator terms of appropriate type. As an example, we consider z:a H S K K z : A which reduces to z: S K K z (K z) (K z) z This means that S K K acts like I, both in terms of typing and in terms of reduction. When the analogue of local expansion is considered, however, the result is less clear, so I is often retained as a primitive combinator. Combinatory reduction is interesting from the computational perspective because it does not involve substitution for a bound variable as a primitive operation. It has therefore been considered as the basis for compilation, especially for lazy functional languages, both using a fixed set of combinators (such as S, K, I) or varying set of combinators defined by their own rewrite rules. In either case, we need to compile functional programs to combinator form, which is discussed in the next section. 6 Bracket Abstraction As with all prior metatheoretic proofs in the constructive section of this course, the proof of the deduction theorem is itself constructive. This means it contains an algorithm for constructing a proof of Γ A C hil given a proof of Γ, A hil C hil. We can extract this algorithm and write is out as an explicit translation on combinators terms. To express hypothetical Hilbert proofs we follow the standard approach for hypothetical judgments, namely labeling assumptions with distinct variables and referring to them as proof terms. x:a Γ hyp Γ H x : A Now we can specify [x]m as the combinator term implementing the proof of the deduction theorem: If Γ, x:a H M : C then Γ H [x]m : A C.

L9.8 Combinatory Modal Logic Keeping in mind the cases of the proof of the deduction theorem (Theorem 1), we obtain the following: [x]x = I [x]y = K y for y x [x](m 1 M 2 ) = S ([x]m 1 ) ([x]m 2 ) [x]x = K X where X = I, K, or S We can combine the second and last case as follows: [x]x = I [x]m = K M for x not in M [x](m 1 M 2 ) = S ([x]m 1 ) ([x]m 2 ) This second version leads to significantly smaller combinator terms, when compared to the first version which inserts applications of S for every subterm when translating [x]m, even if x does not occur in M at all. For a more detailed analysis of the complexity of bracket abstraction, see Statman [Sta86]. We can now easily extend bracket abstraction to compilation of functional terms. We write M for the compilation of a term Γ M : A. We will have that ˆΓ H M : A. In particular, for a closed term with M : A we obtain H M : A, which is a closed combinator term. (λx. M) = [x]m (M 1 M 2 ) = M 1 M 2 x = x 7 Hilbert Deduction for Modal Logic We now revisit the modal logic of necessity and possibility with the goal of developing a complete axiom system. Before that, we have to add one new rule of inference, the rule of necessity. A hil A hil nec For hypothetical Hilbert proofs, we follow the same strategy as for natural deduction: we allow hypotheses A hil and A hvalid, where the latter means valid in the sense of Hilbert. We write ; Γ A hil. The necessity rule

Combinatory Modal Logic L9.9 then becomes the rule on the left, and we also have an additional hypothesis rule. ; A hil ; Γ A hil nec A hvalid vhyp ; Γ A hil Anticipating the translation from natural deduction to Hilbert proofs, we prove a generalized version of the deduction theorem. This proof will suggest new axiom schemas to handle necessity and possibility. Theorem 5 (Modal Deduction Theorem) (i) If ; Γ, A hil C hil then ; Γ A C hil. (ii) If, A hvalid; Γ C hil then ; Γ A C hil Proof: By induction on the structure of the given deduction. Part (i) works exactly as before, in the proof of Theorem 5. We show some cases of part (ii) below; the other cases go as for part (i)., A hvalid; Γ A hil vhyp In this case we need to show ; Γ A A hil. We introduce the new axiom schema A A hil (T ) from which the desired conclusion follows by weakening. C hvalid, A hvalid; Γ C hil vhyp ; Γ C hil By rule vhyp ; Γ C ( A C) hil By axiom K ; Γ A C hil By modus ponens, A hvalid; C 1 hil, A hvalid; Γ C 1 hil nec

L9.10 Combinatory Modal Logic ; A C 1 hil ; Γ ( A C 1 ) hil By rule nec At this point we need to introduce a new axiom schema and continue with the proof ( A C) ( A C) hil (K4 ) ; Γ A C 1 hil By modus ponens Because there are no special rules regarding possibility, we do not need any special cases in the modal deduction theorem. However, we will need appropriate axioms in order to translate natural deductions to Hilbert proofs. We let this proof give us the remaining axioms. We extend the notation ˆΓ to valid hypotheses as before. Theorem 6 (From Modal Natural Deduction to Hilbert Proofs) 1. If ; Γ A true then ˆ ; ˆΓ A hil. 2. If ; Γ A poss then ˆ ; ˆΓ A hil. Proof: By induction on the structure of the given deduction. A true Γ ; Γ A true hyp ˆ ; ˆΓ A hil By hypothesis A hil ˆΓ A valid ; Γ A true vhyp ˆ ; ˆΓ A hil By hypothesis A hvalid ˆ.

Combinatory Modal Logic L9.11 ; A 1 true ; Γ A 1 true I ˆ ; A 1 hil ˆ ; ˆΓ A 1 hil By rule nec ; Γ B true, B hvalid; Γ A true ; Γ A true E ˆ, B hvalid; ˆΓ A hil ˆ ; ˆΓ B A hil ˆ ; ˆΓ B hil ˆ ; ˆΓ A hil By the modal deduction theorem By modus ponens ; Γ B true, B hvalid; Γ A poss ; Γ A poss E As in the previous case, with A instead of A in the conclusion. ; Γ A poss ; Γ A true I ˆ ; ˆΓ A hil ; Γ A true ; Γ A poss poss Here we need a new axiom schema A A hil (T ) ˆ ; ˆΓ A hil ˆ ; ˆΓ A hil By modus ponens

L9.12 Combinatory Modal Logic ; Γ B true ;, B true A poss ; Γ A poss E ˆ ; ˆΓ B hil ˆ ; B hil A hil ˆ ; B A hil ˆ ; ˆΓ (B A) hil (i) (ii) By the modal deduction theorem By rule nec At this point we need a new axiom schema (B A) ( B A) hil (K4 ) and we can proceed with the proof ˆ ; ˆΓ B A hil ˆ ; ˆΓ A hil By modus ponens By modus ponens The Hilbert system that can be read off from these proofs is the following. Inference Rules. A B hil A hil B hil mp A hil A hil nec Axioms. The names for the modal axioms below are not standard, although derived from standard notation. A A hil A B A hil (A B C) (A B) (A C) hil (I) (K) (S) A A hil (T ) ( A B) ( A B) hil (K4 ) A A hil (T ) (A B) ( A B) hil (K4 )

Combinatory Modal Logic L9.13 Theorem 7 (From Hilbert Proofs to Modal Natural Deduction) If A hil then A true Proof: By straightforward induction, proving all the axiom schemas directly via natural deduction. The usual presentation uses the same inference rules, but a slightly different set of axioms. Specifically, we replace ( A B) ( A B) hil (K4 ) (A B) ( A B) hil (K4 ) by (A B) ( A B) hil (K ) A A hil (4 ) (A B) ( A B) hil (K ) A A hil (4 ) It is easy to see that K and 4 implies K4, and that K and 4 implies K4, which means these for axioms are also complete with respect to modal natural deduction. We have proven them in an earlier lecture, so they are also sound. See also Exercise 5. 8 Modal Combinators This section is is speculative in the sense that no theorems relating combinatory reduction and λ-calculus reduction have been checked. We now extend the proof term assignment from earlier, using the more familiar second set of axioms. Inference Rules. H M : A B H M N : B H N : A mp H M : A H M : A nec

L9.14 Combinatory Modal Logic Axioms. The names for the modal axioms below are not standard, but derived from standard names. For example, Simpson [Sim94] calls ( A A) (A A) the axiom T ; we name the first conjunct T and the second conjunct T. Note that K and K do not have anything to do with the usual K combinator of intuitionistic combinatory logic, but with the axiom K of modal logic. H I : A A H K : A B A H S : (A B C) (A B) (A C) H T : A A H K : (A B) ( A B) H 4 : A A H T : A A H K : (A B) ( A B) H 4 : A A The reductions: I x x K x y x S x y z (x z) (y z) T u u K u w u w 4 u u K u (T x) T (u x) 4 (T (T x)) T x Bracket abstraction: (i) If ; Γ, x:a H M : C then ; Γ H [x]m : A C. (ii) If, u:a; Γ H M : C then ; Γ H [u]m : A C.

Combinatory Modal Logic L9.15 [x]x = I [x]m = K M if x M [x](m N) = S ([x]m) ([x]n) [x] M = K M [u]u = T [u]m = K M for u M [u](m N) = S ([u]m) ([[u]n) [u] M = K4 ( [u]m ) Observe that the case for [x] M is actually redundant with the second case, because x may not occur in M. Translation from natural deduction: (i) If ; Γ M : A then ; Γ H M : A. (ii) If ; Γ E A then ; Γ H E + : A. (x) = x (M N) = (M ) (N ) (λx. M) = [x]m (u) = u (box M) = (M ) (let box u = M in N) = ([u]n ) M (dia E) = E + (let dia x = M in F ) + = K4 [x]f + M (let box u = M in F ) + = ([u]f + ) M (M) + = T M

L9.16 Combinatory Modal Logic Exercises Exercise 1 Add conjunction A B and truth to the development of this lecture. (i) Add appropriate axioms to intuitionistic modal logic. (ii) Extend the deduction theorem (Theorem 5), showing the new cases. (iii) Extend the translation from natural deduction to Hilbert proofs (Theorem 6), showing the new cases. (iv) Extend the translation from Hilbert proofs to natural deductions by giving proof terms for the new axioms. (v) Name the new axioms schemas as combinators and give appropriate reductions. (vi) Show the new cases in bracket abstraction [x]m and [x]m. (vii) Show the new cases in the definition of M and E +. Exercise 2 Add disjunction A B and falsehood to the development of this lecture as in Exercise 1. Exercise 3 Give reduction rules directly for K4 and K4. Exercise 4 Assume we have a closed term M : A so that H reductions in M relate to combinatory reductions in M? M : A. How do (i) State and proof some form of correspondence for the non-modal intuitionistic case. (ii) Generalize the correspondence to the modal case. You may use the reductions you devise in Exercise 3 if appropriate. Exercise 5 You may carry out this exercise using Hilbert proofs or combinators. Please note any other axioms or combinators you need besides those mentioned. (i) Prove that K and 4 together can prove K4 and vice versa. (ii) Prove that K and 4 together can prove to K4 and vice versa.

Combinatory Modal Logic L9.17 References [Cur34] H. B. Curry. Functionality in combinatory logic. Proceedings of the National Academy of Sciences, U.S.A., 20:584 590, 1934. [HB34] David Hilbert and Paul Bernays. Grundlagen der Mathematik. Springer-Verlag, Berlin, 1934. [How80] W. A. Howard. The formulae-as-types notion of construction. In J. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 479 490. Academic Press, 1980. Hitherto unpublished note of 1969, rearranged, corrected, and annotated by Howard. [Sim94] [Sta86] Alex K. Simpson. The Proof Theory and Semantics of Intuitionistic Modal Logic. PhD thesis, University of Edinburgh, 1994. Richard Statman. On translating lambda terms into combinators: The basis problsm. In Proceedings of the First Symposium on Logic in Computer Science, pages 378 382, Cambridge, Massachusetts, June 1986. IEEE.

L9.18 Combinatory Modal Logic