Logic for Computer Science - Week 5 Natural Deduction

Similar documents
Logic for Computer Science - Week 4 Natural Deduction

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

Natural Deduction for Propositional Logic

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

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/33

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

03 Propositional Logic II

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

Overview. I Review of natural deduction. I Soundness and completeness. I Semantics of propositional formulas. I Soundness proof. I Completeness proof.

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

Propositional Logic: Deductive Proof & Natural Deduction Part 1

CS 512, Spring 2016, Handout 02 Natural Deduction, and Examples of Natural Deduction, in Propositional Logic

Proof strategies, or, a manual of logical style

Manual of Logical Style (fresh version 2018)

In this chapter, we specify a deductive apparatus for PL.

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Propositional Logics and their Algebraic Equivalents

Logic, Sets, and Proofs

Propositional natural deduction

15414/614 Optional Lecture 1: Propositional Logic

Introduction to Metalogic

Intermediate Logic. Natural Deduction for TFL

The semantics of propositional logic

Advanced Topics in LP and FP

Proving Things. Why prove things? Proof by Substitution, within Logic. Rules of Inference: applying Logic. Using Assumptions.

Logic for Computer Science - Week 2 The Syntax of Propositional Logic

Section 1.2: Propositional Logic

Language of Propositional Logic

(p == train arrives late) (q == there are taxis) (r == If p and not q, then r. Not r. p. Therefore, q. Propositional Logic

The Logic of Compound Statements cont.

1.1 Statements and Compound Statements

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

Formal (natural) deduction in propositional logic

Propositional logic. Programming and Modal Logic

PHIL12A Section answers, 28 Feb 2011

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.

Supplementary Logic Notes CSE 321 Winter 2009

Lecture 11: Measuring the Complexity of Proofs

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Tecniche di Verifica. Introduction to Propositional Logic

cse541 LOGIC FOR COMPUTER SCIENCE

Logical Agents. September 14, 2004

Deductive Systems. Lecture - 3

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

4 Derivations in the Propositional Calculus

FORMAL PROOFS DONU ARAPURA

Propositional Logic: Syntax

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

CHAPTER 11. Introduction to Intuitionistic Logic

Manual of Logical Style

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

Today s Lecture 2/25/10. Truth Tables Continued Introduction to Proofs (the implicational rules of inference)

Proposition logic and argument. CISC2100, Spring 2017 X.Zhang

Where are my glasses?

PHIL012. SYMBOLIC LOGIC PROPOSITIONAL LOGIC DERIVATIONS

Natural deduction for truth-functional logic

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

Logic As Algebra COMP1600 / COMP6260. Dirk Pattinson Australian National University. Semester 2, 2017

Logic and Proofs. (A brief summary)

Logic. Propositional Logic: Syntax

Propositional Logic. Spring Propositional Logic Spring / 32

Inference in Propositional Logic

Lecture Notes on Sequent Calculus

Section 1.3: Valid and Invalid Arguments

CS 3110: Proof Strategy and Examples. 1 Propositional Logic Proof Strategy. 2 A Proof Walkthrough

Learning Goals of CS245 Logic and Computation

1 IPL and Heyting Prelattices

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Math 267a - Propositional Proof Complexity. Lecture #1: 14 January 2002

MACM 101 Discrete Mathematics I. Exercises on Propositional Logic. Due: Tuesday, September 29th (at the beginning of the class)

Propositional logic. Programming and Modal Logic

Introduction: What Is Modal Logic?

Notes on Inference and Deduction

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Propositional Logic. Fall () Propositional Logic Fall / 30

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC

02 Propositional Logic

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

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:

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Proof Theoretical Studies on Semilattice Relevant Logics

Chapter 4: Classical Propositional Semantics

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Compound Propositions

CSE 20 DISCRETE MATH. Fall

What is the decimal (base 10) representation of the binary number ? Show your work and place your final answer in the box.

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Implementing Proof Systems for the Intuitionistic Propositional Logic

185.A09 Advanced Mathematical Logic

A Little Deductive Logic

means is a subset of. So we say A B for sets A and B if x A we have x B holds. BY CONTRAST, a S means that a is a member of S.

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Logic Overview, I. and T T T T F F F T F F F F

Lecture 4: Proposition, Connectives and Truth Tables

Logic. Propositional Logic: Syntax. Wffs

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

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

Transcription:

Logic for Computer Science - Week 5 Natural Deduction Ștefan Ciobâcă November 30, 2017 1 An Alternative View of Implication and Double Implication So far, we have understood as a shorthand of However, there is an alternative view that is equally correct In the alternative view, we note that the set PL of propositional formulae depends on a set C of connectives Our definition so far was that the set of connectives is C = {,, } The alternative definition is that there exist several logics PL C, where C {,,,,,, } The new connectives and are nullary connectives, in that they do not take any arguments ( is unary, the other are binary) In fact, is a formula that is false in any truth assignment and is a formula that is true in any truth assignment Definition 11 Let C {,,,,,, } be a set of logical connectives The set PL C of propositional formulae with connectives in C is the only set of strings that: 1 (Base case) A PL C (any propositional variable is a formula); 2 (Inductive case) if, PL C, then: (a) if C, then PL C ; (b) if C, then ( ) PL C ; (c) if C, then ( ) PL C ; (d) if C, then ( ) PL C ; (e) if C, then ( ) PL C ; (f) if C, then PL C ; (g) if C, then PL C ; 3 (Minimality Condition) No other string belongs to PL C 1

We adopt the previous rules regarding brackets All existing definitions (truth assignment, satisfiability, equivalence, etc) can be carried over easily to ( ) ( ) the new definition of formulae Note that ˆτ( ) = ˆτ + ˆτ, ˆτ = 0 ( ) and ˆτ = 1 for any truth assignment τ and any formulae, PL C We retrieve our previous definition of PL by setting C = {,, } That is, PL = PL {,, } Definition 12 A set C of connectives is adequate if for any formula PL, there exists a formula PL C such that For example, C = {, } is adequate, since we can get rid of using the equivalence ( ) The set C = {, } is also adequate However, the set C = {, } is not adequate, since there is no formula PL C equivalent to p Exercise 11 Show that C = {, } is adequate (hint: show that any connective can be expressed using just and ) 2 Natural Deduction Natural deduction is our first example of proof system Proof systems are abundent in theoretical computer science and it is important to get a good understanding of them 21 Motivation Suppose you had to show that p q, p = ( q You ) could proceed ( as follows: ) suppose τ is a truth assignment such that ˆτ p q = 1 and that ˆτ p = 1 ( ) ( ) ( ) ( ) We show that ˆτ q = 1 But 1 = ˆτ p = ˆτ p and so ˆτ o = 0 We also ( ) ( ) ( ) ( ) ( ) ( ) have that 1 = ˆτ p q = ˆτ p + ˆτ q = 0+ ˆτ q = ˆτ q Therefore ˆτ q = 1, what we had to show The problem with such a proof is that a human being can check it in principle Could we have proof checkable by computers? We could, and natural deduction is such an example 22 Inference Rules Definition 21 A proof system is a set of inference rules Definition 22 An inference rule is of the form: Hypothesis 1 Hypothesis n Name Conclusion, 2

where to the left of the line we have the rule name, above the line there are several (0, 1 or more) hypotheses and under the line is the conclusion The hypotheses and conclusion are usually formulae 23 Rules for There are several inference rules for each connective The simplest inferece rules are for : i e1 e2 The first rule tells us intuitively that if we know to be true and to be true (ie, if the hypotheses are true), then we also know the formula to be true (ie, the conclusion is also true) The name of the inference rule is i, read as introduction The name introduction refers to the fact that appears in the conclusion, but not the hypotheses The second rule tells us intuitively that if we know the formula to be true, then we also know to be true This is the first elimination rule for, hence the name e1 Elimination comes from the fact that appears in the hypotheses, but not the conclusion The second elimination rule for is similar But what do we do with inference rules? 24 Formal Proofs Definition 23 A formal proof of starting with,, n is a sequence of formulae ψ 1, ψ 2,, ψ m such that for all 1 i m: 1 ψ i {,, n }, or, 2 ψ i is the conclusion of an inference rule whose hypotheses can be found among ψ 1,, ψ i 1, and such that ψ n = For example, we have that (p q) r, p q, r, q, r q is a formal proof of r q from (p q) r However, it helps to organize the formal proof as follows: 1 (p q) r; (premiss) 2 p q; ( e1, 1) 3 r; ( e2, 1) 4 q; ( e2, 2) 5 r q ( i, 3, 4) 3

As written, the formal proof has, in addition to the list of formulae in it, the name of the inference rule applied and the lines at which the hypotheses of the inference rule can be found Here is another formal proof of (p q) r from p q and r p: 1 p q; (premiss) 2 r p; (premiss) 3 r; ( e1, 2) 4 (p q) r ( i, 1, 3) Exercise 21 Give a formal proof of p r from (q r) q and q q 25 Sequents Definition 24 A sequent is a tuple,, n, of formulae, written as,, n The symbol is read as turnstyle See google images for turnstyle : https://wwwgooglecom/search?hl= en&site=imghp&tbm=isch&source=hp&q=turnstyle The name sequent is the wrong English translation of the word Sequenz from an early paper on logic in German It should have been sequence, but the wrong translation stuck and it has become an integral concept of logic today Definition 25 A sequent,, n is valid if there exists a formal proof of from,, n For example, we have already seen that (p q) r q r and that p q, r p (p q) r are valid sequents Note the graphical resemblance of sequents to logical consequence, but recall that they mean two different things 26 More Inference Rules Inference rules for natural deduction come in two flavours: elimination rules and introduction rules Each logical connective usually has an introduction rule and an elimination rule, but this is not strictly required (for example, has two elimination rules) Here are the introduction rules for : i1 i2 We will see the elimination rule for later, as it is more complicated Let us see an example that makes use of the new rules, by giving a formal proof of the sequent p q (r q) (r p): 1 p q; (premiss) 4

2 q; ( e2, 1) 3 r q; ( i2, 2) 4 (r q) (r p) ( i1, 3) Exercise 22 Prove the validity of the sequent p q, r p (r r ) 27 Elimination of Implication The rule for eliminating implication is the following: e In fact, this rule goes back to antiquity and is so famous that it has a latin name: modus ponens Here is an example of the rule in practice: 1 p r q; (premiss) 2 p r; (premiss) 3 p; ( e1, 2) 4 r q; ( e, 1, 3) 5 q ( e2, 4) The above is a proof of the sequent p r q, p r q 28 Rules for Double Negation There are two rules that play a special role: i e These rules allow to eliminate and respectively introduce double negation freely Here is a formal proof of the sequent (p q) r ( p r) that makes use of the new inference rules: 1 (p q) r; (premiss) 2 r; ( e2, 1) 3 p q; ( e1, 1) 4 p; ( e1, 3) 5

5 p; ( i, 4) 6 r; ( e, 2) 7 p r; ( i, 5, 6) 8 ( p r) ( i, 7) We will see later that in fact the i is derivable, and that the rule e is derivable, is we allow for the law of excluded middle (and vice-versa) 29 The Rule for Introducing Implication What would be a good rule for the introduction of the implication? If up to the present moment the hypotheses of the rules were all formulae, we will now allow hypotheses that are formal proofs themselves: i The hypotheses that must be formal proofs will be placed in a box In the rule above, there is only one hypothesis, namely a formal proof The formal proof must start from, which is called an assumption (similar to premisses) and must end with If we can produce such a formal proof of from, then the inference rule i allows to conclude Here is an example of a formal proof of the sequent p q, q r p r that makes use of i: 1 p q premiss 2 q r premiss 3 p assumption 4 q e, 1, 3 5 r e, 2, 4 6 p r i, 3 5 Note that inside the box (the subproof) we may use the assumption and any outer premiss However, it is not allowed to use, outside of the box, formulae that are derived within the box, except as prescribed by the inference rules For example, the following formal proof is wrong: 6

1 p q premiss 2 q r premiss 3 p assumption 4 q e, 1, 3 5 r e, 2, 4 6 p q WRONG APPLICATION OF i, 3,4 We may also have nested boxes p (q r): Here is a formal proof of p q r 1 p q r premiss 2 p assumption 3 q assumption 4 p q i, 2, 3 5 r e, 1, 4 6 q r i, 3 5 7 p (q r) i, 2,6 Exercise 23 Give a formal proof of p (q r) p q r 210 The Rule for Eliminating Disjunction Here is the rule e: e Similarly to the rule for introducing introduction, it has other proofs as hypotheses The intuition behind the rule is the following: suppose you hold that is true That means that is true or is true, but you do not know which one You make a formal proof of from and a formal proof of from Then, no matter which of or holds, you are guaranteed that holds Here is a formal proof of (p q) r (p r) (q r) that makes use of the new rule: 7

1 (p q) r premiss 2 p q e1 3 r e2 4 p assumption 5 p r i, 3, 4 6 (p r) (q r) i1, 5 7 q assumption 8 q r i, 7, 3 9 (p r) (q r) i2, 8 10 (p r) (q r) e, 2,4 6,7 9 211 The Rules for Negation and Here are the rules for introducing and eliminating negation: i e Let us start with the intuition behind the rule for eliminating If you hold both and, you also hold Recall that is a formula that is false in any truth assignment But it is impossible to hold Of course, but it may be useful in a proof It play the role of a contradiction The rule for introducing also makes use of : suppose you want to prove holds You assume and derive a contradiction, that is you make a formal proof of starting from Here is a formal proof of p (p q) making use of the rules above: 1 p premiss 2 p q assumption 3 p e1, 2 4 e, 3, 1 5 (p q) i, 2 4 There is another rule, for eliminating : it tells us that if we hold, then we hold any other formula as well (eg, if we hold 1 = 2, we also hold 10 = 15): e Here is an example of its use (a proof of the sequent p q q q): 8

1 p p premiss 2 p e1, 1 3 p e2, 1 4 e, 2, 3 5 q q e, 4 212 The Copy Rule There is one more rule needed for technical reasons: copy The rule says that if you hold, then you hold Here is an example of a formal proof of p (q p) where we need it: 1 p assumption 2 q assumption 3 p copy, 1 4 q p i, 2 3 5 p (q p) i, 1 4 We may use this rule to copy within a subproof another formula that is in scope 3 Derived Rules Here is an inference rule called modus tollens: MT And here is a formal proof of p q q p that makes use of the new rule: 1 p q premiss 2 q assumption 3 p MT, 1, 2 4 q p i, 2 3 However, we do not need the rule, because we can simulate it by applications of other rules We can show that for any,, there exists a formal proof of, : 9

1 premiss 2 premiss 3 assumption 4 e, 1, 3 5 e, 4, 2 6 i, 3 5 Such a rule that can be simulated by applications of other rules is called a derived rule Exercise 31 Show that the rule for introducing is derivable Exercise 32 Show that the law of excluded middle is derivable: LEM Exercise 33 Show that the rule e is derivable using the LEM (ie you may use LEM, but not e) 4 Soundness and Completeness A (good) proof system needs to have two important properties: 1 anything it proves must be true; 2 it can prove anything that is true The first property is called soundness and the second property is called completeness Natural deduction has both: Theorem 41 (Soundness of Natural Deduction) If there is a formal proof of the sequent,, n, then,, n = That is, if a sequent can be derived syntactically using the inference rules of natural deduction, then the corresponding logical consequence holds as well Theorem 42 (Completeness of Natural Deduction) If,, n =, then there is a formal proof of the sequent,, n In fact, the theorems above mean that and = are interchangable, even if they have different definitions 10

Exercise 41 We write if there are formal proofs of both and Prove, using the soundness and completeness theorems, that if and only if 5 Summary of Inference Rules Base rules: i e1 e2 i1 i2 e e i e i c e e copy Derived rules: i LEM MT Exercise 51 Prove that Proof By Contradiction (PBC) is a derived rule: PBC 11