CPSC 121: Mode els of Computation Un nit 4 Propositiona l Logic - - PDF document

cpsc 121 mode els of computation
SMART_READER_LITE
LIVE PREVIEW

CPSC 121: Mode els of Computation Un nit 4 Propositiona l Logic - - PDF document

CPSC 121: Mode els of Computation Un nit 4 Propositiona l Logic Proofs Based on slides by Patrice Be Based on slides by Patrice Be lleville and Steve Wolfman lleville and Steve Wolfman Pre-Class Learning Pre-Class Learning Goals Goals


slide-1
SLIDE 1

CPSC 121: Mode

Un Propositiona

Based on slides by Patrice Be Based on slides by Patrice Be

els of Computation

nit 4 l Logic Proofs

lleville and Steve Wolfman lleville and Steve Wolfman

Pre-Class Learning Pre-Class Learning

By the start of this class yo By the start of this class yo

Use truth tables to establish inference. Given a rule of inference an that correspond to the rule's t t t i li d b a new statement implied by

Unit 4 - Propositional Proofs

Goals Goals

  • u should be able to
  • u should be able to

h or refute the validity of a rule of nd propositional logic statements s premises, apply the rule to infer th i i l t t t the original statements.

2

slide-2
SLIDE 2

Quiz 4 Feedback: Quiz 4 Feedback:

Overall: Overall: Issues: We will discuss the open-e

p

Unit 4 - Propositional Proofs

ended question soon. q

3

In-Class Learning G In-Class Learning G

By the end of this unit you By the end of this unit, you

Determine whether or not a and explain why it is valid o p y Explore the consequences o statements by application of l i ll i d t rules, especially in order to desired form. Devise and attempt multiple Devise and attempt multiple for proving a propositional lo

  • r premises.

Unit 4 - Propositional Proofs

  • als
  • als

u should be able to u should be able to

propositional logic proof is valid, r invalid.

  • f a set of propositional logic

f equivalence and inference t t t i t massage statements into a e different appropriate strategies e different, appropriate strategies

  • gic statement follows from a list

4

slide-3
SLIDE 3

Where We Are in Th Where We Are in Th

Theory: Theory:

How can we convince ourse what it's supposed to do? pp

In general

We need to prove that it wo p

We have done a few proof

p

Now we will learn Now we will learn

How to decide if a proof is v How to write proofs in Engli

  • e p oo s

g

Unit 4 - Propositional Proofs

he Big Stories he Big Stories

elves that an algorithm does rks.

fs last week.

valid in a formal setting. sh. s

5

What is Proof? What is Proof?

A rigorous formal argumen A rigorous formal argumen

truth of a proposition, given premises. premises.

In other words:

A proof is used to convince A proof is used to convince truth of a conditional propos Every step must be well just

Writing a proof is a bit like

you do it step by step, and make sure that you underst previous steps.

Unit 4 - Propositional Proofs

nt that demonstrates the nt that demonstrates the n the truth of the proof’s

  • ther people (or yourself) of the
  • ther people (or yourself) of the

sition. tified.

writing a function:

and how each step relates to the

6

slide-4
SLIDE 4

Things we'd like to p Things we d like to p

We can build a combinatio We can build a combinatio

truth table.

We can build any digital lo We can build any digital lo

NOR gates.

The maximum number of s The maximum number of s

students is n(n-1)/2.

No general algorithm exist No general algorithm exist

fewer than n log2n compar

There are problems that no There are problems that no

Unit 4 - Propositional Proofs

prove prove

  • nal circuit matching any
  • nal circuit matching any

gic circuit using only 2-input gic circuit using only 2-input swaps we need to order n swaps we need to order n s to sort n values using s to sort n values using risons.

  • algorithm can solve
  • algorithm can solve.

7

What is a Propositio What is a Propositio

A propositional logic proof A propositional logic proof

propositions, where each p

a premise a premise the result of applying a logic inference to one or more ea

and whose last proposition

These are good starting po

simpler than the more free p later

Only a limited number of ch

Unit 4 - Propositional Proofs

  • nal Logic Proof
  • nal Logic Proof

consists of a sequence of consists of a sequence of proposition is one of

cal equivalence or a rule of arlier propositions.

n is the conclusion.

  • int, because they are

e-form proofs we will discuss p

  • ices at each step.

8

slide-5
SLIDE 5

Meaning of Proof Meaning of Proof

Suppose you W Suppose you

proved this:

Premise 1 W

A

Premise-1 Premise-2

B

... Premise-n

B C

  • ∴Conclusion

D E

Unit 4 - Propositional Proofs

What does it mean? What does it mean?

A. Premises 1 to n can be true B Premises 1 to n are true

  • B. Premises 1 to n are true
  • C. Conclusion can be true

D. Conclusion is true

  • E. None of the above.

9

Meaning of Proof Meaning of Proof

What does this

A.

What does this

argument mean?

B

Premise-1 P i 2

B.

Premise-2 ...

C.

Premise-n

  • D.

∴Conclusion

E.

Unit 4 - Propositional Proofs

Premise-1 ˄ … ˄ Premise-n ˄ Conclusion P i 1 ˅ ˅ P i ˅ Premise-1 ˅ … ˅ Premise-n ˅ Conclusion Premise-1 ˄ … ˄ Premise-n → Conclusion Conclusion Premise-1 ˄ … ˄ Premise-n ↔ Conclusion None of the above.

10

slide-6
SLIDE 6

Why do we want val Why do we want val

~p ~p______

∴ ~(p v q) a.

This is valid by generaliza

b.

This is valid because any also true. Thi i lid b h

c.

This is valid by some othe

d.

This is invalid because w t b t ( ) i f l true but ~(p v q) is false.

e.

None of these.

id rules? id rules?

ation (p ⇒ p v q). ytime ~p is true, ~(p v q) is l er rule. hen p = F and q = T, ~p is

13

Basic Rules of Infere Basic Rules of Infere

Modus Ponens:

p → q p q p q

Generalization:

p p

Generalization:

p p p ˅ q q → p

Conjunction:

p q p ˄ q

Transitivity:

p → q q → r p → r p

Contradiction:

p → F ~p

Unit 4 - Propositional Proofs

ence ence

Modus Tollens:

p → q p q ~q ~p

Specialization:

p ˄ q p ˄ q

Specialization:

p ˄ q p ˄ q p q

Elimination:

p ˅ q p ˅ q ~p ~q q p

Proof by cases:

p ˅ q p → r q → r q r

14

slide-7
SLIDE 7

Onnagata Problem fr Onnagata Problem fr

Critique the following argu Critique the following argu

by Julian Baggini on logica

Premise 1: If women are to Premise 1: If women are to women then men must be to men, and vice versa. Premise 2: And yet, if the o too close to femininity to po too close to masculinity to p too close to masculinity to p Conclusion: Therefore, the women are not too close to

Note: onnagata are male a

characters in kabuki theatr

Unit 4 - Propositional Proofs

rom Online Quiz #4 rom Online Quiz #4

ment drawn from an article ment, drawn from an article al fallacies.

  • close to femininity to portray
  • close to femininity to portray
  • o close to masculinity to play
  • nnagata are correct, women are

rtray women and yet men are not play men play men. e onnagata are incorrect, and femininity to portray women.

actors portraying female re.

15

Onnagata Problem Onnagata Problem

Which definitions should we Which definitions should we

a) w = women, m = men, f =

  • nnagata, c = correct
  • nnagata, c

correct b) w = women are too close close to masculinity, pw = men portray men, o = onna c) w = women are too close m = men are too close to m m = men are too close to m

  • nnagata are correct

d) None of these, but anothe ) , e) None of these, and this pr with propositional logic.

Unit 4 - Propositional Proofs

e use? e use?

femininity, m = masculinity, o = to femininity, m = men are too women portray women, pm = agata are correct to femininity to portray women, masculinity to portray men o = masculinity to portray men, o = er set of definitions works well. roblem cannot be modeled well

16

slide-8
SLIDE 8

Onnagata Problem Onnagata Problem

Which of these is not an ac

the statements?

  • A. w ↔ m
  • B. (w → m) ∧ (m → w)
  • C. o → (w ∧ ~m)
  • D. ~o ∧ ~w
  • E. All of these are accurate tr

S th t i

So, the argument is:

Unit 4 - Propositional Proofs

ccurate translation of one of

anslations.

17

Onnagata Problem Onnagata Problem

Do the two premises con Do the two premises con

p1 ˄ p2 ≡ F)?

A Yes A. Yes B. No

  • C. Not enough information

g

Is the argument valid? What can we prove? What can we prove?

We can prove that the On We can not prove that wo p femininity to portray wome

  • What other scenario is

Unit 4 - Propositional Proofs

tradict each other (that is is tradict each other (that is, is

to tell

A: Yes B: No C:?

nagata are wrong. men are not too close to en. consistent with the premises?

18

slide-9
SLIDE 9

Onnagata Problem Onnagata Problem

Do the two premises con Do the two premises con

p1 ˄ p2 ≡ F)?

A Yes A. Yes B. No

  • C. Not enough information

g

Is the argument valid?

g

A: Yes B: No C: ?

Unit 4 - Propositional Proofs

tradict each other (that is is tradict each other (that is, is

to tell

19

Onnagata Problem Onnagata Problem

What can we prove? What can we prove? Can we prove that the On

A Yes

  • A. Yes
  • B. No
  • C. Not enough information
  • C. Not enough information

Can we prove that wome

femininity to portray wom y p y

  • A. Yes
  • B. No
  • C. Not enough information

What other scenario is co

Unit 4 - Propositional Proofs

nnagata are wrong. en are not too close to men?

  • nsistent with the premises?

20

slide-10
SLIDE 10

Proof Strategies Proof Strategies

Look at the information you Look at the information you

Is there irrelevant informatio Is there critical information y Is there critical information y

Work backwards from the

Especially if you have made Especially if you have made a step or two.

Don't be afraid of inferring

g you are not quite sure whe get to the conclusion you w

Unit 4 - Propositional Proofs

u have u have

  • n you can ignore?

you should focus on? you should focus on?

end

e some progress but are missing e some progress but are missing

new propositions, even if p p , ether or not they will help you want.

21

Proof strategies (con Proof strategies (con

If you are not sure of the c

between between

trying to find an example tha using the place where your g p y the counterexample trying to prove it, using your it th f you write the proof.

Unit 4 - Propositional Proofs

ntinued) ntinued)

  • nclusion, alternate

at shows the statement is false, proof failed to help you design p p y g r failed counterexample to help

22

slide-11
SLIDE 11

Example Example

To prove: Wha To prove:

~(q ∨ r)

Wha

A. ~

(u ∧ q) ↔ s ~s → ~p

B.

s

s → p___ ∴ ~p

s

  • C. D

~

  • D. A

E N

  • E. N

Unit 4 - Propositional Proofs

at will the strategy be? at will the strategy be?

Derive ~u so you can derive ~s s Derive u ∧ q so you can get

s

Derive ~s by deriving first ~(u ∧ q) (u ∧ q) Any of the above will work None of the above will work None of the above will work

23

Example (cont') Example (cont )

Proof:

  • 1. ~(q ∨ r)

Premise 2 (u ∧ q) ↔ s Premise

  • 2. (u ∧ q) ↔ s

Premise

  • 3. ~s → ~p

Premise

  • 4. ~q ∧ ~r

De Morgan’s (1)

  • 5. ~q

Specialization (4)

  • 6. ((u ∧ q) → s) ∧ Bicond (2)

(s → (u ∧ q)) (s → (u ∧ q))

  • 7. s → (u ∧ q)

Specialization (6)

  • 8. ????

????

  • 9. ~(u ∧ q)

????

  • 10. ~s

Modus tollens (7, 9)

  • 11. ~p

Modus ponens (3,10) p p ( , )

Unit 4 - Propositional Proofs

~(q ∨ r) (u ∧ q) ↔ s

What is in step 8?

~s → ~p___ ∴ ~p

What is in step 8?

A.

u ∧ q

  • B. ~u ∨ ~q
  • C. s
  • D. ~s
  • E. None of the above

24

slide-12
SLIDE 12

Example (cont') Example (cont )

Proof:

  • 1. ~(q ∨ r)

Premise 2 (u ∧ q) ↔ s Premise

  • 2. (u ∧ q) ↔ s

Premise

  • 3. ~s → ~p

Premise

  • 4. ~q ∧ ~r

De Morgan’s (1)

  • 5. ~q

Specialization (4)

  • 6. ((u ∧ q) → s) ∧ Bicond (2)

(s → (u ∧ q)) (s → (u ∧ q))

  • 7. s → (u ∧ q)

Specialization (6)

  • 8. ????

????

  • 9. ~(u ∧ q)

????

  • 10. ~s

Modus tollens (7, 9)

  • 11. ~p

Modus ponens (3,10) p p ( , )

Unit 4 - Propositional Proofs

~(q ∨ r) (u ∧ q) ↔ s

Which rule was used

~s → ~p___ ∴ ~p

Which rule was used

in step 8?

A.

modus ponens

B De Morgan's

  • B. De Morgan s
  • C. modus tollens
  • D. generalization

E N f th b

  • E. None of the above

25

Example (cont') Example (cont )

Proof:

  • 1. ~(q ∨ r)

Premise 2 (u ∧ q) ↔ s Premise

  • 2. (u ∧ q) ↔ s

Premise

  • 3. ~s → ~p

Premise

  • 4. ~q ∧ ~r

De Morgan’s (1)

  • 5. ~q

Specialization (4)

  • 6. ((u ∧ q) → s) ∧ Bicond (2)

(s → (u ∧ q)) (s → (u ∧ q))

  • 7. s → (u ∧ q)

Specialization (6)

  • 8. ????

????

  • 9. ~(u ∧ q)

????

  • 10. ~s

Modus tollens (7, 9)

  • 11. ~p

Modus ponens (3,10) p p ( , )

Unit 4 - Propositional Proofs

~(q ∨ r) (u ∧ q) ↔ s

Which rule was used

~s → ~p___ ∴ ~p

Which rule was used

in step 9?

A.

modus ponens

B De Morgan's

  • B. De Morgan s
  • C. modus tollens
  • D. generalization

E N f th b

  • E. None of the above

26

slide-13
SLIDE 13

Another Example Another Example

Prove the following argume Prove the following argume

p p → r p → r p → (q ˅ ~r) ~q ˅ ~s q ∴ s

Unit 4 - Propositional Proofs

ent: ent:

27

Limitations of Truth T Limitations of Truth T

Why can we not just use tr Why can we not just use tr

propositional logic theorem

A

No reason; truth tables

  • A. No reason; truth tables
  • B. Truth tables scale poo

C Rules of inference and

  • C. Rules of inference and

prove theorems that c tables tables.

  • D. Truth tables require in

inference can be applie inference can be applie

Unit 4 - Propositional Proofs

Tables Tables

ruth tables to prove ruth tables to prove ms? s are enough s are enough.

  • rly to large problems.

d equivalence rules can d equivalence rules can cannot be proven with truth nsight to use, while rules of ed mechanically ed mechanically.

28

slide-14
SLIDE 14

Limitations of Logica Limitations of Logica

Why not use logical equiva Why not use logical equiva

conclusions follow from the A No reason; logical equ

  • A. No reason; logical equ
  • B. Logical equivalences

problems problems.

  • C. Rules of inference and

theorems that cannot b theorems that cannot b equivalences. D Logical equivalences

  • D. Logical equivalences

rules of inference can

Unit 4 - Propositional Proofs

al Equivalences al Equivalences

alences to prove that the alences to prove that the e premises? uivalences are enough uivalences are enough. scale poorly to large d truth tables can prove be proven with logical be proven with logical require insight to use while require insight to use, while be applied mechanically.

29

One More Remark One More Remark

Consider the following: Consider the following:

George is rich If George is rich then he will p If George is rich then he will p ∴ George will pay your tuition

Is this argument valid? Is this argument valid?

  • A. Yes

B No

  • B. No
  • C. Not enough information

Sh

ld t iti

Should you pay your tuition

that George will pay it for y

Unit 4 - Propositional Proofs

ay your tuition ay your tuition .

n to tell h ld n, or should you assume you? Why?

30

slide-15
SLIDE 15

Exercises Exercises

Prove that the following argum

Prove that the following argum

p → q q → (r ^ s) q → (r s) ~r v (~t v u) p ^ t p ∴ u

Given the following premises,

p → q p v ~q v r (r ^ ~p) v s v ~p ~r

Unit 4 - Propositional Proofs

ment is valid: ment is valid: what can you prove?

31

Further Exercises Further Exercises

Hercule Poirot has been as Hercule Poirot has been as

  • ut who closed the lid of hi

cat inside. Poirot interroga cat inside. Poirot interroga Akilna and Eiluj. One and o in the piano. Plus, one alw

Eiluj: I did not put the cat in less than $60 to help him st Akilna: Eiluj did it. Urquhart

Who put the cat in the pian

Unit 4 - Propositional Proofs

sked by Lord Maabo to find sked by Lord Maabo to find is piano after dumping the tes two of the servants, tes two of the servants,

  • nly one of them put the cat

ways lies and one never lies.

the piano. Urquhart gave me tudy. $ paid her $50 to help him study.

no?

32

slide-16
SLIDE 16

Reading for Next Le Reading for Next Le

Online quiz #5 is tentativel Online quiz #5 is tentativel

at 5:00pm

Assigned reading for the q Assigned reading for the q

Epp, 4th edition: 3.1, 3.3 Epp 3rd edition: 2 1 2 3 Epp, 3rd edition: 2.1, 2.3 Rosen, 6th edition: 1.3, R h di i 1 4 Rosen, 7th edition: 1.4,

Unit 4 - Propositional Proofs

ecture ecture

y due Monday October 8th y due Monday, October 8th uiz: uiz: 3 3 1.4 1.5

33