The λ-calculus and Curry s Paradox Drew McDermott , revised

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

A Little Deductive Logic

A Little Deductive Logic

Propositional Logic Review

Supplementary Logic Notes CSE 321 Winter 2009

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

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Lecture 7. Logic. Section1: Statement Logic.

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

cis32-ai lecture # 18 mon-3-apr-2006

Class 29 - November 3 Semantics for Predicate Logic

Manual of Logical Style

Church s undecidability result

Introduction to Metalogic

Notation for Logical Operators:

3 The Semantics of the Propositional Calculus

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP 2600: Formal Methods for Software Engineeing

Introduction to Logic and Axiomatic Set Theory

o is a type symbol. There are no other type symbols.

Victoria Gitman and Thomas Johnstone. New York City College of Technology, CUNY

Proof strategies, or, a manual of logical style

Propositional Logics and their Algebraic Equivalents

Handout on Logic, Axiomatic Methods, and Proofs MATH Spring David C. Royster UNC Charlotte

Propositional Logic: Syntax

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Introduction to lambda calculus Part 2

Chapter 2: The Logic of Quantified Statements

Logic. Propositional Logic: Syntax

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

Propositions as Types

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

Chapter 1 Elementary Logic

Propositional Logic: Logical Agents (Part I)

Gödel s Incompleteness Theorems

Proof Rules for Correctness Triples

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics

The semantics of propositional logic

Introduction to Logic

DEFINITE DESCRIPTIONS: LANGUAGE, LOGIC, AND ELIMINATION

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Existence and Predication in Free Logics. Secretaria de Estado de Educação do Distrito Federal, Brasil

Classical Propositional Logic

Chapter 1. Logic and Proof

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

Lecture 15 The Second Incompleteness Theorem. Michael Beeson

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Lecture 9. Model theory. Consistency, independence, completeness, categoricity of axiom systems. Expanded with algebraic view.

Arguments and Proofs. 1. A set of sentences (the premises) 2. A sentence (the conclusion)

KRIPKE S THEORY OF TRUTH 1. INTRODUCTION

Lectures on The Lambda Calculus (I)

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

LIN1032 Formal Foundations for Linguistics

Modal Logic XX. Yanjing Wang

Notes on Propositional and First-Order Logic (CPSC 229 Class Notes, January )

Natural Deduction for Propositional Logic

Propositional Logic: Deductive Proof & Natural Deduction Part 1

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16)

Propositional Logic: Review

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

Axiomatic set theory. Chapter Why axiomatic set theory?

First-Degree Entailment

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

Logic. Propositional Logic: Syntax. Wffs

Set Theory History. Martin Bunder. September 2015

4 Derivations in the Propositional Calculus

MAI0203 Lecture 7: Inference and Predicate Calculus

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Draft of February 2019 please do not cite without permission. A new modal liar 1 T. Parent

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

Classical First-Order Logic

Propositional Logic Not Enough

Propositional Logic: Logical Agents (Part I)

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4

Warm-Up Problem. Write a Resolution Proof for. Res 1/32

22c:145 Artificial Intelligence

Structural Induction

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Proof. Theorems. Theorems. Example. Example. Example. Part 4. The Big Bang Theory

INTRODUCTION TO LOGIC 8 Identity and Definite Descriptions

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT

First Order Logic: Syntax and Semantics

Propositional Logic. Spring Propositional Logic Spring / 32

Logic, Sets, and Proofs

UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane Philosophy 142

Propositional and Predicate Logic

Infinite Truth-Functional Logic

Lecture Notes on Combinatory Modal Logic

1. Propositional Calculus

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Truth, Subderivations and the Liar. Why Should I Care about the Liar Sentence? Uses of the Truth Concept - (i) Disquotation.

cse541 LOGIC FOR COMPUTER SCIENCE

5. And. 5.1 The conjunction

CHAPTER 0: BACKGROUND (SPRING 2009 DRAFT)

Propositional and Predicate Logic

Proof Techniques (Review of Math 271)

Transcription:

The λ-calculus and Curry s Paradox Drew McDermott drew.mcdermott@yale.edu 2015-09-23, revised 2015-10-24 The λ-calculus was invented by Alonzo Church, building on earlier work by Gottlob Frege and Moses Schönfinkel. It can be considered from several vantage points: 1. As a model of computation 2. As a way to add computation to formal logic 3. As a tool for understanding the foundations of mathematics Church was interested in all three, but we ll focus on the second topic, following the lead of Richard Montague, who used a complex modal logic with λ-conversion in his extremely influential work on the semantics of natural language. This will be our focus for much of the course. For now, let s just think about the predicate calculus; we won t even need quantifiers. In propositional logic, letters denote arbitrary truth-valued propositions, which are then combined into familiar constructions: P ( not P ), P Q ( P and Q ), and P Q ( P or Q or both ). P Q is a useful abbreviation for P Q, usually read as if P then Q or P only if Q. In predicate calculus, we add structure to propositions. An atomic formula is a proposition of the form p(t 1,..., t k ), where p is a predicate symbol and each t i is a term. In the simplest formulation, terms are just variables or constants, as in q(x, a). (Items in this font are vocabulary items from a particular theory. Variables, such as x, are usually bound by quantifiers, which we re not focusing on.) For many purposes, we begin to need more complex terms, of the form f(t 1,..., t k ), such as cons, as in heirs(henry viii, cons(mary i, cons(edward vi, cons(elizabeth i, nil)))) The term cons(x, l) denotes the list l but with one more element, x, tacked onto the front. It s important for computer-science students to realize that that s all there is to it: the term does not denote a computation wherein a procedure called cons is called to do something to the results of computation x and computation l. (Similarly, married(henry viii, catherine of aragon) 1

denotes T or F, not a procedure for checking whether Henvry VIII was actually married to his first wife, or if the marriage didn t count, as Henry eventually claimed.) We introduce computation into the system by providing axioms concerning the equality relation, =(x, y), but syntactically sugared as x = y. (One such axiom is that x = x, but we re missing the For all x part until we have quantifiers.) Whether we need special inference rules for equality depends on exactly how we organize things, but it will be convenient to introduce the rule of substitution of equals for equals: If you can infer t = u from premises Γ, where t and u are arbitrry terms, and you can infer α[t] from Γ, where α[t] is an arbitrary formula with an occurrence of t as a term, then you can infer α[u], where α[u] has that occurrence replaced by u. Symbolically: Γ t = u Γ α[t] Γ α[u] where Γ... means that... can be inferred using premises Γ. This is where the λ-calculus comes in. It s a way of describing functions in a computational sense, as transformations of terms into other terms. It introduces a new kind of term, called a λ-expression, whose abstract syntax is λvt, where v is a variable and t is a term. There are several possible ways to write this in surface syntax. I ll write it with a dot after the v and often put parentheses around it. We already have terms of the form f(t,...), but in the λ-calculus all functions have exactly one variable, so the application of f to t is written f t. This sort of function application associates to the left, so fa 1 a 2 means (f a 1 ) a 2. For this to make sense, f must be the sort of thing denoted by a λ-expression of the form (λx 1.λx 2.e), that is, a function of one argument whose value is itself a function of one argument. 1 Such a function is said to be curried, implying that one has a two-argument function in mind that it really is. 2 1 Why resort to the clumsy phrase must be the sort of thing denoted by? Why not just say f must be a λ-expression? Because f might be a variable that might eventually be replaced by a λ-expression; or a function application that might reduce to a λ-expression (see below). 2 Because we started with n-argument functions and now have functions that take just one, it looks like we re allowing two different notations for function application into the language? That s probably a bad idea, so what follows may be seen as a digression into a version of predicate calculus in which everything is curried. Or you can put parentheses around every argument in the λ-calculus, writing f 1f 2 t as f 1(f 2)(t). (This actually what a curried-function application looks like in Scala.) Another possible tactic is to treat 2

The main rule of the λ-calculus is β-conversion: Some subterm (λv.t)t is transformed to t[t /v], that is, every occurrence of v replaced by t (sometimes written t[v:=t ]). This may seem like a fairly trivial thing to do, but, because every occurrence of v is replaced by t, it allows for the proliferation of occurrences of t. An occurrence of a term of the form (λv.t)t is called a redex (for reducible expression ). When a redex is β-converted, the new term replaces it in the λ term it s a subterm of. Several caveats are in order. The only occurrences of v that are actually replaced are those that are free in t. An occurrence of a variable v is free in a term if it doesn t occur inside the scope of a binding of v. Currently the only variable binder we have is λ. More subtly, in making the replacement, one must be careful that no occurrence of a variable free in t becomes bound. See the textbook for examples. If necessary, variables in t are renamed to avoid such collisions (a process Church called α-conversion, in case you re keeping score). We connect the λ-calculus to the predicate calculus by interpreting β- convertibility as a form of equality. That is, if term t 1 can be converted to t 2 via a series of β-conversions, then we can infer t 1 = t 2 : t 1 β t 2 t 1 = t 2 (t 1 β t 2 is read, t 1 is β-reducible to t 2.) We can use the conclusion of this rule as a premise to our equality-substitution rule. There s a lot more to be said about logic and about the λ-calculus, but we re already in trouble. We need two more inference rules, modus ponens: and reductio ad absurdum: α α β β Γ, α α Γ α If from the assumption that something is false you can derive a contradiction, then you can infer that it is true. functions that really take n > 1 arguments as a function of one argument, an n-tuple. Then f(x 1,..., x n) is syntactic sugar that saves us from actually having to deconstruct tuples. (This is how Haskell and ML construe uncurried multi-argument functions on the rare occasions when they indulge in them.) Of course, this idea requires us to introduce tuples into our ontology, which we have no other reason to do. 3

The trouble that arises is called Curry s Paradox, after Haskell B. Curry, an American logician who studied with David Hilbert and Paul Bernays. 3 We start by assuming the term ((λx.(xx) 0 = 1)(λx.(xx) 0 = 1)) in order to derive a contradiction from it. Use the β-equality-substitution rule to infer (((λx.(xx) 0 = 1)(λx.(xx) 0 = 1)) 0 = 1) which, by the rules of propositional logic, is the same as ((λx.(xx) 0 = 1)(λx(xx) 0 = 1)) (0 = 1) But the first conjunct is the negation of our assumption! reductio ad absurdum, we may conclude Hence, by Then, by β-conversion: ((λx.(xx) 0 = 1)(λx(xx) 0 = 1)) ((λx.(xx) 0 = 1)(λx.(xx) 0 = 1)) 0 = 1 Fianlly, by modus ponens: 0 = 1 Got that? It helps if we introduce the abbreviation R to stand for the key term (λx.(xx) 0 = 1). Then RR β ((RR) 0 = 1). The first phase was to assume (RR) and derive ((RR) 0 = 1), which is equivalent to (RR) (0 = 1), a contradiction. Hence, RR. But β-converting again, we can infer (RR) 0 = 1, and hence (via modus ponens) 0 = 1. Clearly, there is something wrong with a term X that is equivalent to X A, where A is some arbitrary proposition. (Replace 0=1 by any proposition you like.) The usual diagnosis is that R contains the subterm (xx), that is, that the term x is applied to itself. The cure is type theory. 3 Curry worked in the area of combinatory logic rather than the λ-calculus, although the two are closely related. The programming language Haskell perhaps should have been called Alonzo. By the way, currying was also named after Curry, but by programminglanguage researchers, decades after the idea was employed by Schönfinkel, Church, and, eventually, Curry, whose name apparently lends itself to term coinage better than most. 4

Type theory was invented by Bertrand Russell in order to cure Russell s Paradox, a similar problem in set theory. The idea is to label terms with types, and allow the term f t only if f has type a b and t has type a (in which case f t itself has typed b). There s no way for the variable x to have both the type a b and the type a for any a or b, so xx is untypeable 4 and hence the paradox cannot get started. 5 Sources: Wikipedia URL = https://en.wikipedia.org/wiki/curry%27s paradox and J.C. Beall 2013 Curry s Paradox, in Edward N. Zalta (ed.) The Stanford Encyclopedia of Philosophy, (Spring 2013 Edition), URL = http://plato.stanford.edu/archives/spr2013/entries/curry-paradox/ 4 Okay, this is too simple. But it ll do for now. But what does untypeable mean? Does it mean that xx is syntactically ill-formed? Or does it mean that xx is syntactically okay, but meaningless? It s safer to go with the first alternative, but the second will work, too. 5 Of course, making theories consistent by removing bugs as they pop up works no better than making programs bug-free using the same method. 5