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

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

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

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

CSC Discrete Math I, Spring Propositional Logic

Propositional Logic Review

Logic for Computer Science - Week 5 Natural Deduction

Natural Deduction for Propositional Logic

A Little Deductive Logic

A Little Deductive Logic

Deduction by Daniel Bonevac. Chapter 3 Truth Trees

Truth-Functional Logic

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Compound Propositions

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

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.

02 Propositional Logic

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

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Natural deduction for truth-functional logic

Manual of Logical Style

3 The Semantics of the Propositional Calculus

PROPOSITIONAL CALCULUS

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

Deductive Systems. Lecture - 3

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

15414/614 Optional Lecture 1: Propositional Logic

Propositional Logic. Spring Propositional Logic Spring / 32

Introduction to Metalogic

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

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

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Discrete Structures of Computer Science Propositional Logic III Rules of Inference

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

Manual of Logical Style (fresh version 2018)

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

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

1 Tautologies, contradictions and contingencies

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

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

THE LOGIC OF COMPOUND STATEMENTS

Artificial Intelligence. Propositional logic

PUZZLE. You meet A, B, and C in the land of knights and knaves. A says Either B and I are both knights or we are both knaves.

Propositional Logic: Syntax

PHI Propositional Logic Lecture 2. Truth Tables

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

4 Derivations in the Propositional Calculus

Advanced Topics in LP and FP

Artificial Intelligence Chapter 7: Logical Agents

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

HANDOUT AND SET THEORY. Ariyadi Wijaya

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Chapter 1: The Logic of Compound Statements. January 7, 2008

FORMAL PROOFS DONU ARAPURA

Supplementary Logic Notes CSE 321 Winter 2009

Language of Propositional Logic

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

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

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

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

1.1 Statements and Compound Statements

Logic. Propositional Logic: Syntax

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

Chapter 4, Logic using Propositional Calculus Handout

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

Propositional Logic. Fall () Propositional Logic Fall / 30

PHIL12A Section answers, 28 Feb 2011

The Logic of Compound Statements cont.

Section 1.2: Propositional Logic

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Logik für Informatiker Proofs in propositional logic

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

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

6. THE OFFICIAL INFERENCE RULES

Notes on Quantum Logic

Logic and Proofs. (A brief summary)

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

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

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Logic, Sets, and Proofs

Proofs. Joe Patten August 10, 2018

Propositional Logic: Deductive Proof & Natural Deduction Part 1

03 Propositional Logic II

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Part Two: The Basic Components of the SOFL Specification Language

Intermediate Logic. Natural Deduction for TFL

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

Propositional Logic: Review

Artificial Intelligence. Propositional Logic. Copyright 2011 Dieter Fensel and Florian Fischer

Logik für Informatiker Logic for computer scientists

CITS2211 Discrete Structures Proofs

CSC242: Intro to AI. Lecture 11. Tuesday, February 26, 13

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

Proof Worksheet 2, Math 187 Fall 2017 (with solutions)

Chapter 4: Classical Propositional Semantics

Unit I LOGIC AND PROOFS. B. Thilaka Applied Mathematics

Notes on Inference and Deduction

Propositional Logic: Models and Proofs

Transcription:

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 1/33 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 Instructor: Carlos Varela Rensselaer Polytechnic Institute Spring 2018

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 2/33 Sentential logic Goal: to become familiar with propositional logic proofs. Boolean constants conjunctions conditionals disjunctions negations biconditionals recursive proof methods proof heuristics

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 3/33 Sentential logic Sentential logic is concerned with zero-order sentences: either a Boolean term, say, (zero < S zero), or the result of applying one of the five sentential connectives (not, and, or, if, iff) to other zero-order sentences.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 4/33 Working with the Boolean constants We can derive true any time by applying the nullary method true-intro: > (! true-intro ) Theorem : true The constant false can only be derived if the assumption base is inconsistent. Applying the binary method absurd to p and ( p) will derive false: > assume A assume (~ A) (! absurd A (~ A)) Theorem : (if A (if (not A) false ))

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 5/33 Working with the Boolean constants Finally, we can derive ( false) at any time through the nullary method false-elim: > (! false-elim ) Theorem : ( not false )

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 6/33 Using conjunctions The unary method left-and takes a conjunction (p & q) that is present in the assumption base, and produces the conclusion p: assert p := (A & B) > (! left-and p) Theorem : A There is a similar unary method, right-and, that does the same thing for the right component of a conjunction: If (p & q) is in the assumption base, (!right-and (p & q)) will produce the conclusion q.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 7/33 Deriving conjunctions Given any two sentences p and q in the assumption base, the binary method call (!both p q) will produce the conclusion (p & q). As an example that uses all three methods dealing with conjunctions, consider the derivation of (D & A) from the premises (A & B) and (C & D): assert A-and-B := ( A & B) assert C-and-D := ( C & D) > (! both (! right-and C-and-D ) (! left-and A-and-B )) Theorem : (and D A)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 8/33 Using conditionals: modus ponens Starting from two premises of the form (p ==> q) and p, modus ponens yields the conclusion q, thereby detaching ( eliminating ) the conditional connective. In Athena, modus ponens is performed by the primitive binary method mp. When the first argument to mp is of the form (p ==> q), the second argument is p, and both arguments are in the assumption base, mp will derive q. For instance, assuming that (A ==> B) and A are both in the assumption base, we have: > (! mp (A ==> B) A) Theorem: B

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 9/33 Using conditionals: modus tollens Given two premises of the form (p ==> q) and ( generates the conclusion ( p). q), modus tollens In Athena, modus tollens is performed by the binary method mt. When the first argument to mt is a conditional (p ==> q), the second is ( q), and both are in the assumption base, mt will derive ( p). For instance, assuming that (A ==> B) and ( B) are both in the assumption base, we have: > (! mt (A ==> B) (~ B)) Theorem: ( not A)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 10/33 Deriving conditionals with assume The standard way of proving a conditional (p ==> q) is to assume the antecedent p (i.e., to add p to the current assumption base) and proceed to derive the consequent q. In Athena, conditional deductions are written: assume p D, where D is a proof that derives q from the augmented assumption base. A proof of (A ==> A): > assume A (! claim A) Theorem: (if A A) We refer to p and D as the hypothesis (or assumption) and the body of the conditional deduction, respectively.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 11/33 Deriving conditionals with assume To evaluate a deduction of the form assume p D (1) in an assumption base β: We add p to β and go on to evaluate the body D in the augmented assumption base β {p}. The fact that D is evaluated in β {p} means that the assumption p can be freely used anywhere within its scope, that is, anywhere inside D. If and when the evaluation of D in β {p} produces a conclusion q, we return the conditional (p ==> q) as the result of (1).

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 12/33 Deriving conditionals with assume The body D is said to be a subproof (or subdeduction) of the conditional proof (1). Subproofs can be nested inside one another assume p. assume q. This subproof is in the scope of both q and p. Here we are in the scope of p but outside the scope of q

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 13/33 Deriving conditionals with assume For instance, in the following proof the body (!claim A) is in the scope of both the inner assumption B and the outer assumption A: > assume A assume B (! claim A) Theorem : (if A (if B A)) Evaluating this proof in any assumption base β whatsoever will successfully produce the result (A ==> B ==> A). That is the case for all and only those sentences that are tautologies. A tautology is precisely a sentence that can be derived from every assumption base. Or alternatively, from the empty assumption base.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 14/33 Deriving conditionals with assume Consider next this implication: ((A ==> B ==> C) ==> (B ==> A ==> C)). The following proof derives it: > assume hyp := (A == > B == > C) assume B assume A let {B=>C := (! mp hyp A)} conclude C (! mp B=>C B) Theorem : (if (if A (if B C)) (if B (if A C )))

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 15/33 Using disjunctions: Reasoning by cases Suppose we are trying to derive some goal p. If the assumption base contains a disjunction (p 1 p 2 ), we can often put that disjunction to use as follows: We know that p 1 holds or p 2 holds. If we can show that p 1 implies the goal p and that p 2 also implies p, then we can conclude p. For, if p 1 holds, then p follows from the implication (p 1 ==> p), p 1, and modus ponens; while, if p 2 holds, then p follows from (p 2 ==> p), p 2, and modus ponens. This type of reasoning (called case analysis, or reasoning by cases ) is pervasive, both in mathematics and in real life.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 16/33 Using disjunctions: Reasoning by cases In Athena, reasoning by cases is carried out by the ternary method cases. The first argument of this method must be a disjunction, say (p 1 p 2 ); while the second and third arguments must be conditionals of the form (p 1 ==> p) and (p 2 ==> p) If all three sentences are in the assumption base, then the conclusion p is produced as the result, e.g.: assert (C1 C2), (C1 ==> B), (C2 ==> B) > conclude B (! cases (C1 C2) (C1 ==> B) (C2 ==> B)) Theorem: B

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 17/33 Using disjunctions: Reasoning by cases We know that for any given p, either p or ( p) holds; this is the law of the excluded middle. Therefore, if we can show that a goal q follows both from p and from ( p), we should be able to conclude q. This is done with the binary method two-cases, which takes two premises of the form (p ==> q) and ( For example: assert (A ==> B), (~ A ==> B) p ==> q) and derives q. > (! two-cases (A ==> B) (~ A ==> B)) Theorem: B

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 18/33 Deriving disjunctions To derive a disjunction (p q) we can derive the left component, p, or the right component q. If we have p in the assumption base, then (p q) can be derived by applying the binary method left-either to p and q: (!left-either p q). Or if q is in the assumption base, then (!right-either p q) > (! left-either (A == > A) B) Theorem : (or (if A A) B) > (! right-either B (A == > A)) Theorem : (or B (if A A))

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 19/33 Deriving disjunctions Athena offers a third, more versatile mechanism for disjunction introduction, the binary method either. If either p or q is in the assumption base, then (!either p q) derives the disjunction (p q). Otherwise, if neither argument is in the assumption base, either fails. We can also use the logical equivalence between a disjunction (p q) and the conditional ( p ==> q) to derive a disjunction using the prior techniques to derive conditional sentences.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 20/33 Using negations The only primitive method for negation elimination is dn, which stands for double negation. It is a unary method whose argument must be of the form ( p). If that sentence is in the assumption base, then the call will produce the conclusion p. > assume h := (~ ~ A) (! dn h) (!dn ( p)) Theorem : (if ( not ( not A)) A) There are two other primitive methods that require some of its arguments to be negations: mt and absurd.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 21/33 Deriving negations: Proof by contradiction Proof by contradiction is one of the most useful and common forms of deductive reasoning. The basic idea is to establish a negation ( assuming p p) by showing that this assumption (perhaps in tandem with other working assumptions) leads to an absurdity, namely, to false. which entitles us to reject the hypothesis p and conclude the desired ( p).

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 22/33 Deriving negations: Proof by contradiction The binary method by-contradiction is one way to perform this type of reasoning in Athena. The first argument to by-contradiction is simply the sentence we are trying to establish, typically a negation ( p). The second argument must be the conditional (p ==> false), essentially stating that the hypothesis p leads to an absurdity. If that conditional is in the assumption base, then the desired conclusion ( p) will be produced.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 23/33 Deriving negations: Proof by contradiction Suppose the assumption base contains the premises (A ==> B & C) and ( B), and we want to derive ( A). We can reason by contradiction as follows: Suppose A holds. Then, by the first premise and modus ponens, we would have (B & C), and hence, by conjunction elimination, B. But this contradicts the second premise, ( B), which allows us to reject the hypothesis A, inferring ( A).

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 24/33 Deriving negations: Proof by contradiction In Athena, this proof can be written as follows: assert premise-1 := ( A == > B & C) assert premise-2 := (~ B) > (! by-contradiction (~ A) assume A let { p1 := conclude ( B & C) (! mp premise-1 A); _ := conclude B (! left-and p1 )} (! absurd B premise-2 )) Theorem : (not A)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 25/33 Deriving negations: Proof by contradiction As another example, here is a proof that derives ( (A ==> B)): ( B) from assert premise := (~ (A == > B)) > (! by-contradiction (~ B) assume B let {A==>B := assume A (! claim B)} (! absurd A==>B premise )) Theorem : (not B)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 26/33 Deriving negations: Proof by contradiction The most direct way to derive false is to apply the binary method absurd to two contradictory sentences of the form q and ( q) in the assumption base. > (! absurd A (~ A)) Theorem : false Therefore, a proof of ( logical structure: p) by contradiction often has the following (! by-contradiction (~ p) assume p let { p1 := conclude q D1; p2 := conclude (~ q) D2} (! absurd p1 p2 ))

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 27/33 Proof by contradiction If the sentence p we want to establish by contradiction is not a negation, recall every sentence p is equivalent to the double negation ( p). We can simply infer ( p) by assuming ( p) and deriving a contradiction. After that, we can eliminate the double negation sign with dn. For example, suppose from A and ( (A & assert premise-1 := (~ ( A & ~ B)) assert premise-2 := A B)), we want to derive B: > let {--B := (! by-contradiction (~ ~ B) assume (~ B) (! absurd (! both A (~ B)) premise-1 ))} (! dn --B ) Theorem : B

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 28/33 Proof by contradiction by-contradiction offers a shortcut: When the conclusion p to be established is not in the explicit form of a negation, it suffices to establish the conditional p ==> false). ( We can then apply by-contradiction directly to p and this conditional: (! by-contradiction p (~ p ==> false )) and the desired p will be obtained. > (! by-contradiction B assume (~ B) (! absurd (! both A (~ B)) premise-1 )) Theorem : B

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 29/33 Proof by contradiction There are two other auxiliary methods for reasoning by contradiction: 1. The unary method from-false derives any given sentence, provided that the assumption base contains false. That is, (!from-false p) will produce the theorem p whenever the assumption base contains false. This captures the principle that everything follows from false. 2. The ternary method from-complements derives any given sentence p provided that the assumption base contains two complementary sentences q and q. Specifically, (!from-complements p q q) will derive p provided that both q and q are in the assumption base. Such an application can be read as: Infer p from the complements q and q.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 30/33 Using biconditionals There are two elimination methods for biconditionals, left-iff and right-iff. For any given biconditional (p <==> q) in the assumption base, the method call (!left-iff (p <==> q)) will produce the conclusion (p ==> q), while (!right-iff (p <==> q)) will yield (q ==> p), e.g.: assert bc := ( A <== > B) > (! left-iff bc) Theorem : (if A B) > (! right-iff bc) Theorem : (if B A)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 31/33 Deriving biconditionals The introduction method for biconditionals is equiv. Given two conditionals (p ==> q) and (q ==> p) in the assumption base, the call (!equiv (p ==> q) (q ==> p)) will derive the biconditional (p <==> q): assert (A ==> B), (B ==> A) > (! equiv (A ==> B) (B ==> A)) Theorem : (iff A B)

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 32/33 Putting it all together Suppose we are given the following two premises: assert premise-1 := ( A & B (A == > C)) assert premise-2 := ( C <== > ~ E) and our task is to write a proof D that derives the conditional ( B ==> A ==> E) from the two premises.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 4.1-4.8 p. 33/33 Putting it all together assert premise-1 := ( A & B (A == > C)) assert premise-2 := ( C <== > ~ E) assume -B := (~ B) assume A conclude -E := (~ E) (! cases premise-1 assume (A & B) (! from-complements -E B -B) assume A=> C := (A == > C) let { C=>-E := (! left-iff premise-2 ); C := (! mp A=>C A)} (! mp C=>-E C))