Logic for Computer Science Handout Week 8 DERIVED RULE MODUS TOLLENS DERIVED RULE RAA DERIVED RULE TND

Similar documents
Propositional Logic: Deductive Proof & Natural Deduction Part 1

15414/614 Optional Lecture 1: Propositional Logic

Natural Deduction for Propositional Logic

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

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax

Propositional Logic: Syntax

Learning Goals of CS245 Logic and Computation

MAI0203 Lecture 7: Inference and Predicate Calculus

A Little Deductive Logic

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

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

A Little Deductive Logic

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

Predicate Calculus. Lila Kari. University of Waterloo. Predicate Calculus CS245, Logic and Computation 1 / 59

Advanced Topics in LP and FP

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

Propositional Logic: Review

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:

Logic for Computer Science - Week 4 Natural Deduction

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

A Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35

First Order Logic: Syntax and Semantics

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

A Logic Primer. Stavros Tripakis University of California, Berkeley

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014

Propositional Logic Not Enough

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

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

Ling 130 Notes: Predicate Logic and Natural Deduction

8. Reductio ad absurdum

Ling 130 Notes: Syntax and Semantics of Propositional Logic

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

03 Propositional Logic II

Intermediate Logic. Natural Deduction for TFL

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Logic for Computer Science - Week 5 Natural Deduction

06 From Propositional to Predicate Logic

Propositional Language - Semantics

Inference in Propositional Logic

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

THE LOGIC OF COMPOUND STATEMENTS

CS 730/730W/830: Intro AI

First Order Logic (1A) Young W. Lim 11/18/13

Topic #3 Predicate Logic. Predicate Logic

We have seen that the symbols,,, and can guide the logical

Mathematical Logic Part Three

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

Artificial Intelligence Knowledge Representation I

HANDOUT AND SET THEORY. Ariyadi Wijaya

Predicate Logic: Sematics Part 1

Resolution (14A) Young W. Lim 8/15/14

Logic. Stephen G. Ware CSCI 4525 / 5525

Section 1.3: Valid and Invalid Arguments

Exercise Set 1 Solutions Math 2020 Due: January 30, Find the truth tables of each of the following compound statements.

Logical Structures in Natural Language: Propositional Logic II (Truth Tables and Reasoning

Introduction to Sets and Logic (MATH 1190)

Propositional Logic. Spring Propositional Logic Spring / 32

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Propositional Logic. Fall () Propositional Logic Fall / 30

Discrete Mathematics. Instructor: Sourav Chakraborty. Lecture 4: Propositional Logic and Predicate Lo

Language of Propositional Logic


Logic: The Big Picture

Propositional Logic. Argument Forms. Ioan Despi. University of New England. July 19, 2013

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

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Artificial Intelligence Knowledge Representation I

Formal (natural) deduction in propositional logic

For all For every For each For any There exists at least one There exists There is Some

Section 1.1 Propositions

Classical First-Order Logic

Propositional logic. Programming and Modal Logic

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

Chapter 1 Elementary Logic

Recall that the expression x > 3 is not a proposition. Why?

Chapter 2: The Logic of Quantified Statements

How to determine if a statement is true or false. Fuzzy logic deal with statements that are somewhat vague, such as: this paint is grey.

Mathematical Logic Part Three

Marie Duží

8. Reductio ad absurdum

1. Propositional Calculus

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

Introduction to Metalogic

Knowledge Representation and Reasoning

GS03/4023: Validation and Verification Predicate Logic Jonathan P. Bowen Anthony Hall

LIN1032 Formal Foundations for Linguistics

Section Summary. Predicates Variables Quantifiers. Negating Quantifiers. Translating English to Logic Logic Programming (optional)

Formal Logic. Critical Thinking

Notation for Logical Operators:

THE LOGIC OF COMPOUND STATEMENTS

First-Order Logic. Announcements. General Logic. PL Review: Truth Tables. First-Order Logic. PL Review: Inference Rules

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

The proposition p is called the hypothesis or antecedent. The proposition q is called the conclusion or consequence.

First Order Logic (1A) Young W. Lim 11/5/13

Propositional logic. Programming and Modal Logic

Mat 243 Exam 1 Review

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Logic and Proofs. (A brief summary)

Transcription:

Logic for Computer Science Handout Week 8 DERIVED RULE MODUS TOLLENS We have last week completed the introduction of a calculus, which is sound and complete. That is, we can syntactically establish the validity of a sequent H X by a natural deduction proof using the calculus rules if and only if the corresponding consequence relation H = X can be established by truth tables. Since the calculus is complete, derived rules are not necessary to prove something, but sometimes proofs can be made easier/shorter using derived rules. The first derived rule we will consider is called modus tollens. X Y Y X MT (modus tollens) This rule can derived by showing that the sequent X Y, Y X is valid. 1. X Y premise 2. Y premise 3. X assumption 4. Y e 1, 3 5. e 4, 2 6. X i 3 5 DERIVED RULE RAA RAA stands for reductio ad absurdum and means you prove a statement by assuming the opposite and bring that to a contradiction. It is a standard proof technique in mathematics. It is also called indirect proof or proof by contradiction. And can be derived by: The rule is: X. X RAA 1. X assumption.. 100. e?,? 101. X i 1 100 102. X e 101 DERIVED RULE TND The Latin name of TND is tertium non datur and in English it is called law of excluded middle. It corresponds to the semantical property that any formula X must be interpreted to either T or F, hence X X is always T. X X TND The law of the excluded middle can be proved by showing that the sequent X X is valid. c Manfred Kerber 49 Logic for Computer Science, 2005

1. (X X) assumption 2. X assumption 3. X X i 1 2 4. e 3, 1 5. X i 2 4 6. X X i 2 5 7. e 6, 1 8. (X X) i 1 7 9. X X e 8 APPLICATION OF A DERIVED RULE Prove that the sequent A B A B is valid. 1. A B premise 2. A A TND 3. A assumption 4. A B i 1 3 5. A assumption 6. B e 1, 5 7. A B i 2 6 8. A B e 2, 3 4, 5 7 SUMMARY PROPOSITIONAL LOGIC REMEMBER: Syntax, semantics, proof rules for propositional logic Expressiveness: formulae composed by connectives from atomic formulae. Concept of tautology, satisfiability, and unsatisfiability Concept of consequence relation established by truthtables. Concept of theorem as syntactic equivalent to tautology validity of sequents as syntactic equivalent to consequence relation, established by natural deduction proofs. The proof rules form a sound and complete calculus EXAMPLE HOARE LOGIC Let P be the program if (x = 0 x = 1) x = x x x else x = 0. c Manfred Kerber 50 Logic for Computer Science, 2005

( ) P ( x = 0 ) How can we establish its correctness? 1. 0 = 0 GF 2. x = 0 x x x = 0 GF 3. x = 1 x x x = 0 GF 4. x = 0 x = 1 assumption 5. x = 0 assumption 6. x x x = 0 e 5, 2 7. x = 1 assumption 8. x x x = 0 e 7, 3 9. x x x = 0 e 4, 5 6, 7 8 10. x = 0 x = 1 x x x = 0 i 4 9 11. ( x x x = 0 ) x = x x x ( x = 0 ) Assign 12. ( x = 0 x = 1 ) x = x x x ( x = 0 ) Implied 10, 11 13. (x = 0 x = 1) assumption 14. 0 = 0 weaken1 15. (x = 0 x = 1) 0 = 0 i 13 14 16. ( 0 = 0 ) x = 0 ( x = 0 ) Assign 17. ( (x = 0 x = 1) ) x = 0 ( x = 0 ) Implied16, 15 18. ( ) if (x = 0 x = 1) x = x x x else x = 0 ( x = 0 ) If 12, 17 PART III FIRST-ORDER LOGIC (ADD QUANTIFICATION ) With propositional logic we can express facts such as 0 = 0, which we needed in the proof of the validity of the Hoare triple ( ) if (x = 0 x = 1) x = x x x else x = 0 ( x = 0 ). Similarly we may need facts such as 1 = 1, 2 = 2, 3 = 3 and so on. In order to be able to be more concise we would like to say: Every number is equal to itself. Likewise we want to be able to express facts such as Every human being is mortal If the input is any pair a, b of numbers and b is not zero, then the program P computes the remainder of the division of a by b., or There is an entry x in the data base with salary(x) 50, 000. Forall x is x 0 = 0. How can we express that every member of the School of Computer Science has an e-mail address? Has email(m.kerber, M.Kerber@cs.bham.ac.uk)... c Manfred Kerber 51 Logic for Computer Science, 2005

How to express that these are all and no one is forgotten? Write: xmember(x, school of CS) ( yhas email(x,y))) Read: For every x if x is a member of the School of CS then there is a y so that x has e-mail address y. ALTERNATIVE MOTIVATION KNOWLEDGE REPRESEN- TATION How to express Everybody loves somebody? Write: x y Loves(x, y) Read: For every x there is a y such that x loves y. How to express Somebody loves everybody? Write: x y Loves(x, y) Read: There is an x such that for every y, x loves y. How to express Somebody loves somebody? Write: x y Loves(x, y) Read: There is an x such that there is a y with x loves y. How to express Everybody loves everybody? Write: x y Loves(x, y) Read: For all x and for all y holds that x loves y. SYNTAX OF FIRST-ORDER LOGIC Recall, primitive terms are variables or constant symbols. We typically denote variables by x, y, and z (or x 1, x 2, x 3,... and so on). That is we assume for the definition of a concrete logical language (pairwise disjoint sets): a set of constant symbols C (normally C non-empty) a set of variables var (this set is assumed to be infinite, since we don t want to run out of variables) a set of function symbols F a set of predicate symbols P (P non-empty) TERMS Terms are defined as follows: Any constant symbol in C is a term. Any variable in var is a term. If t 1,..., t n are terms and f F has arity n, then f(t 1,..., t n ) is a term. Nothing else is a term. Example Given: c Manfred Kerber 52 Logic for Computer Science, 2005

C = {john, mary, 1, 2, 3} F = P = {, Loves} var = {x 1, x 2, x 3, x 4,...} The only terms are john, mary, 1, 2, 3, x 1, x 2, x 3,... ATOMIC FORMULAE Atomic Formulae are defined as before: If P is a predicate symbol in P taking n arguments and t 1, t 2,..., t n are terms (generated from (C, var, F)) then P (t 1, t 2,..., t n ) is an atomic formula. Nothing else is an atomic formula. Example Loves(john, mary), Loves(x, mary), Loves(john, y),loves(x, y), Loves(father(x), mother(y)),... FORMULAE OF FIRST-ORDER LOGIC Formulae are defined as follows: Every atomic formula is a formula. (called bottom ) and (call top ) are formulae. If X and Y are formulae then ( X), (X Y), (X Y), and (X Y) are formulae. If X is a formula and z a variable then ( z X) and ( z X) are formulae. Nothing else is a formula. Example Loves(john, mary), x(loves(john, x) ( y Loves(x, y))), x y(loves(x, y) Loves(y, x)) EXAMPLES FOR FIRST-ORDER FORMULA Let be C = {john, mary}, var = {x, x 0, y,...}, F = {,, }, and P = {Loves, Human, Mortal, <}. Some formulae are: Loves(john, john) x(human(x) Mortal(x)) x y(loves(x, y) Loves(y, x)) c Manfred Kerber 53 Logic for Computer Science, 2005

x(loves(x, john) ( y Loves(y, x))) x yloves(x, y) x y z ((Loves(x, y) Loves(y, z)) ( Loves(x, z))) x1 x = x ɛ δ x x x 0 < δ f(x) f(x 0 ) < ɛ QUESTION: How do these formulae translate into English? TRANSLATE TO FIRST-ORDER LOGIC [Howard Pospesel: Arguments: 279, 291, and 293] If Sam loves everybody then Sam loves himself. If God was not created by anything then it is false that God created everything. If only doctors and hospital administrators are eligible and Mrs Miller is eligible then Mrs Miller is a doctor or a hospital administrator. You may fool all the people some of the time; you can even fool some of the people all the time; but you can t fool all of the people all the time. [Abraham Lincoln] Use P (x) standing for x is a person, T (y) for y is a moment of time, and Fool(x, y) for x can be fooled at y. Note there is an ambiguity in the sentence: You may fool all the people some of the time. There are two possible ways to interpret it: There are times when you may fool all the people. You may fool any person some of the time. What is the difference? REMEMBER: We have introduced the syntax of first-order logic and translations from natural language into first-order logic. New concept quantifiers to bind variables: (for for all, for every ) and (for there is, there is at least one, exists ) Next unit: semantics and calculus. c Manfred Kerber 54 Logic for Computer Science, 2005