1 cs 1502 formal methods in computer science lecture notes 11

19
1 CS 1502 Formal Methods CS 1502 Formal Methods in Computer Science in Computer Science Lecture Notes 11 Lecture Notes 11

Upload: sharlene-fields

Post on 24-Dec-2015

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

11

CS 1502 Formal Methods in CS 1502 Formal Methods in Computer ScienceComputer Science

Lecture Notes 11Lecture Notes 11

Page 2: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

22

ExampleExample

Infer A Infer A C from A C from A B and B B and B C. C.

AA B B B B C C A A C C

This argument is known as the Transitivity This argument is known as the Transitivity of the Biconditional.of the Biconditional.

Page 3: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

33

Using ResolutionUsing Resolution

A A B is ( B is (A A B) B) ( (B B A) A)

B B C is ( C is (B B C) C) ( (C C B) B)

(A (A C) is ( C) is (A A C ) C ) (A (A C) C)

{A, B} {B,A}

{B, C} {C, B}

{A, C} {A, C}

Resolution Proof: In Lecture

Page 4: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

44

Using FitchUsing Fitch

Page 5: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

55

Law of Excluded MiddleLaw of Excluded Middle

P P PP

A Tautology

Page 6: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

66

Exercise 6.33 (in the pdf solution)Exercise 6.33 (in the pdf solution)

Page 7: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

77

Exercise 6.33 (shorter version)Exercise 6.33 (shorter version)

Page 8: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

88

Using DeMorgan’s, with Taut Con doing the Using DeMorgan’s, with Taut Con doing the work for youwork for you

Page 9: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

99

Using DeMorgan’s, butwe do the work…(turnsout to be redundant)

Page 10: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1010

Law of Excluded MiddleLaw of Excluded Middle

P P PP

Use with V-Elim in Proofs!

To introduce it: Use Taut Con, if the rules allow Otherwise, insert proof 6.33

Page 11: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1111

Exercise 8.53 Exercise 8.53 (on LPL Web site)(on LPL Web site)

Note:Fitchlinesafterline 4And 11wereeatenby adobe.They shouldbe there.

Page 12: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1212

ExampleExample

Prove this argument is valid from no Prove this argument is valid from no premises.premises.

(P (P Q) Q) ( (P P Q) Q)

Logical truth

Page 13: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1313

ExampleExample

Page 14: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1414

Prove this argumentProve this argument

Horned(unicorn) Horned(unicorn) (Elusive(unicorn) (Elusive(unicorn) Dangerous(unicorn)) Dangerous(unicorn)) (Elusive(unicorn) (Elusive(unicorn) Mythical(unicorn)) Mythical(unicorn)) Rare(unicorn) Rare(unicorn) Mammal(unicorn) Mammal(unicorn) Rare(unicorn)Rare(unicorn)

Horned(unicorn) Horned(unicorn) Mammal(unicorn) Mammal(unicorn)

Proof is on the next slide; Go through it for practice on your own.Proof is on the next slide; Go through it for practice on your own.

Page 15: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1515

1. Horned(unicorn) (Elusive(unicorn) Dangerous(unicorn) 2. (Elusive(unicorn) Mythical(unicorn)) Rare(unicorn) 3. Mammal(unicorn) Rare(unicorn)

4. Horned(unicorn)

5. Elusive(unicorn) Dangerous(unicorn) Elim 1,4 6. Elusive(unicorn) Elim 5 7. Elusive(unicorn) Mythical(unicorn) Intro 8. Rare(unicorn) Elim 2,7 9. Mammal(unicorn) 10. Rare(unicorn) Elim 3,9 11. Intro 8,10

12. Mammal(unicorn) Intro 9-11

13. Horned(unicorn) Mammal(unicorn) Intro 4-12

Page 16: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1616

Informal Proof ExampleInformal Proof Example

Prove there exists irrational numbers b Prove there exists irrational numbers b and c such that band c such that bcc is rational. is rational.Proof:Proof:Consider Consider = = 2222. This number is either rational . This number is either rational or irrational. If or irrational. If is rational we are finished since is rational we are finished since b = c = b = c = 2 . 2 .

Assume Assume is irrational. Consider is irrational. Consider 2 2 = 2. Again = 2. Again we are finished since b = we are finished since b = and c = and c = 2.2.

Page 17: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1717

English Translation EGsEnglish Translation EGsP P Q Q

If P then Q If P then Q (If you are human then you are a mammal)(If you are human then you are a mammal)

P implies Q P implies Q (Being a human implies being a mammal)(Being a human implies being a mammal)

If P, Q If P, Q (If you are human, you are a mammal)(If you are human, you are a mammal)

P only if Q P only if Q (You’ll live a long time only if you eat veggies)(You’ll live a long time only if you eat veggies)

P is sufficient for Q P is sufficient for Q (Knowing you’re living a long time is (Knowing you’re living a long time is sufficient to know you eat veggies)sufficient to know you eat veggies)

Q is necessary for P Q is necessary for P (Eating veggies is necessary to live a (Eating veggies is necessary to live a long time)long time)

Q if PQ if P (You are a mammal if you are human) (You are a mammal if you are human)

Page 18: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1818

P P Q Q

Home(max) Home(max) Library(claire) Library(claire) Large(b) Large(b) Cube(b) Cube(b)

If not P then QIf not P then QIf Max is not home, then Claire is at the libraryIf Max is not home, then Claire is at the library

If b is not large, then it is a cubeIf b is not large, then it is a cube

Unless P, QUnless P, QUnless Max is at home, Claire is at the libraryUnless Max is at home, Claire is at the library

Unless b is large, b is a cubeUnless b is large, b is a cube

Q, unless PQ, unless P

Claire is at the library unless Max is homeClaire is at the library unless Max is home

B is a cube unless b is largeB is a cube unless b is large

Why not Why not for last two? (section 7.3 and lecture) for last two? (section 7.3 and lecture)

Page 19: 1 CS 1502 Formal Methods in Computer Science Lecture Notes 11

1919

Lecture: look at related questions on Lecture: look at related questions on Assignment 3, in 7.12 and 7.15Assignment 3, in 7.12 and 7.15