natural deduction cs 270 math foundations of cs jeremy johnson

24
Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Upload: wendy-griffin

Post on 04-Jan-2016

224 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Natural Deduction

CS 270 Math Foundations of CSJeremy Johnson

Page 2: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Outline

1. An example1. Validity by truth table2. Validity by proof

2. What’s a proof1. Proof checker

3. Rules of natural deduction4. Provable equivalence5. Soundness and Completeness

Page 3: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

An Example

• If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station.

• If it is raining and Jane does not have here umbrella with her, then she will get wet. Jane is not wet. It is raining. Therefore, Jane has her umbrella with her.

Page 4: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

An Example

• If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station.

• p = the train arrives late• q = there are taxis at the station• r = John is late for his meeting.• [a sequent]

Page 5: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

An Example

• p = it is raining• q = Jane has her umbrella• r = Jane gets wet.

• If it is raining and Jane does not have here umbrella with her, then she will get wet. Jane is not wet. It is raining. Therefore, Jane has her umbrella with her.

Page 6: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Validity by Truth Table

p q r q r pq (pq)r

F F F T T F T

F F T T F F T

F T F F T F T

F T T F F F T

T F F T T T F

T F T T F T T

T T F F T F T

T T T F F F T

Page 7: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Proof

• By applying rules of inference to a set of formulas, called premises, we derive additional formulas and may infer a conclusion from the premises

• A sequent is 1,…,n • Premises 1,…,n

• Conclusion • The sequent is valid if a proof for it can be

found

Page 8: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Proof

• A proof is a sequence of formulas that are either premises or follow from the application of a rule to previous formulas

• Each formula must be labeled by it’s justification, i.e. the rule that was applied along with pointers to the formulas that the rule was applied to

• It is relatively straightforward to check to see if a proof is valid

Page 9: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Validity by Deduction

1 premise

2 premise

3 premise

4 assumption

5 ,4

6 r e 1,5

7 e 6,2

8 q 4-7

9 q e 8

Page 10: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Rules of Natural Deduction

• Natural deduction uses a set of rules formally introduced by Gentzen in 1934

• The rules follow a “natural” way of reasoning about

• Introduction rules• Introduce logical operators from premises

• Elimination rules• Eliminate logical operators from premise

producing a conclusion without the operator

Page 11: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Conjunction Rules

• Introduction Rule

• Elimination Rule

i

e1

e2

Page 12: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Implication Rules

• Introduction Rule

Assume and show

• Elimination Rule (Modus Ponens)

e

… i

Page 13: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Disjunction Rules

• Introduction Rule

• Elimination Rule (proof by case analysis)

i1

e

i2

Page 14: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Negation Rules

• Introduce the symbol ( to encode a contradiction

• Bottom elimination can prove anything

• Elimination Rule

e

e.

Page 15: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Negation Rules

• Introduction Rule

leads to a contradiction

• Double negation

e

… i

Page 16: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Proof by Contradiction

• Derived Rule

Assume and derive a a contradiction • Derived rules can be used like the basic

rules and serve as a short cut (macro)• Sometimes used as a negation elimination

rule instead of double negation

… PBC

Page 17: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Law of the Excluded Middle

• [derived rule LEM]

1 (p p) assumption

2 Assumption

3 (p p) ,4

4 e 3,15 p 2-4

6 p p ,4

7 e 6,1

8 (p p) 1-7

9 p p e 8

Page 18: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

ProofLab

• The ProofLab tool from the Logic and Proofs course from the CMU online learning initiative allows you to experiment with natural deduction proofs

Page 19: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

ProofLab

Page 20: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Provable Equivalence

• and are provably equivalent, , iff the sequents and are both valid

• Alternatively iff the sequent is valid

• A valid sequent with no premises is a tautology

Page 21: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

De Morgan’s Law

(P Q) P Q

1 (P Q) premise

2 assumption

3 P Q i1 2

4 e 1,3

5 P 2-4

6 Q

7 P Q i2 6

8 e 1,7

9 -8

10 P Q i 5,9

Page 22: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

De Morgan’s Law

(P Q) P Q

1 P Q premise

2 e1 1

3 e2 1

4 assumption

5 P assumption

6 e 2,5

7 Q i2 6

8 e 3,7

9 e 4,5-6, 7-8

10 (P Q) i 4-9

Page 23: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Semantic Entailment

• If for all valuations (assignments of variables to truth values) for which all 1,…,n evaluate to true, also evaluates to true then the semantic entailment relation 1,…,n holds

Page 24: Natural Deduction CS 270 Math Foundations of CS Jeremy Johnson

Soundness and Completeness

• 1,…,n holds iff 1,…,n is valid

• In particular, , a tautology, is valid. I.E. is a tautology iff is provable

• Soundness – you can not prove things that are not true in the truth table sense

• Completeness – you can prove anything that is true in the truth table sense