CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te - - PDF document

cpsc 121 mode els of computation
SMART_READER_LITE
LIVE PREVIEW

CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te - - PDF document

CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te Logic Statements 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


slide-1
SLIDE 1

CPSC 121: Mode

Un Rewriting Predicat

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

els of Computation

nit 6 te Logic Statements

lleville and Steve Wolfman lleville and Steve Wolfman

Pre-Class Learning Pre-Class Learning

By the start of class you s By the start of class, you s

Determine the negation of a Given a quantified statemen Given a quantified statemen the rule to create an equiva De Morgan’s and contrapos Prove and disprove quantifi “challenge” method (Epp, 4t Apply universal instantiation Apply universal instantiation universal modus tollens to p correspond to the rules’ pre by the premises.

Unit 6 - Rewriting Predicate Logic Statements

Goals Goals

hould be able to: hould be able to:

any quantified statement. nt and an equivalence rule apply nt and an equivalence rule, apply lent statement (particularly the sitive rules). ed statements using the th edition, page 119). n universal modus ponens and n, universal modus ponens, and predicate logic statements that mises to infer statements implied

2

slide-2
SLIDE 2

Quiz 6 Feedback Quiz 6 Feedback

Overall: Overall: Issues: Open-ended question:

p q

Unit 6 - Rewriting Predicate Logic Statements 3

In-Class Learning G In-Class Learning G

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

Explore alternate forms of p the logical equivalences you g q y negation of quantifiers (a ge Morgan’s Law).

Unit 6 - Rewriting Predicate Logic Statements

  • als
  • als

u should be able to: u should be able to:

predicate logic statements using u have already learned plus y p eneralized form of the De

4

slide-3
SLIDE 3

Related to CPSC 12

?Related to CPSC 12 ? ?

How can we convince ou

does what it's supposed

?

We continue discussing h predicate logic statements algorithm correctness

?

algorithm correctness.

? ? ?

Unit 5 - Predicate Logic

21 Big Questions

?

21 Big Questions

? ?

urselves that an algorithm to do?

?

how to prove various types of s that arise when we discuss ?

? ? ?

5

Outline Outline

Thinking of quantifiers d R les and Transformations Rules and Transformations The challenge method.

g

Unit 6 - Rewriting Predicate Logic Statements

ifferently. s

6

slide-4
SLIDE 4

Relation between Relation between ,

Suppose D contains value Suppose D contains value What does x

D, P(x) re

It's the same as It s the same as P(x1) ^ P(x2) ^ ... ^ P Similarly, y, y D, P(x) ≡ P(x1) v P(

Thinking of quantifiers this

g q

Negation Universal instantiation Universal Modus Ponens, T

Unit 6 - Rewriting Predicate Logic Statements

˄ ˅ , ˄, ˅

s x1 x2 xn s x1, x2, ..., xn ally mean?

P(xn). (x2) v ... v P(xn)

way explains y p

Tollens

7

Negation Negation

~ x

D, P(x) ≡ ~(P(x1) ^ ≡ ~P(x1) v ≡ x D, ~

~ x

D, P(x) ≡ ~(P(x1) v ≡ ~P(x1) ^ ( ) ≡ x D, ~

Unit 6 - Rewriting Predicate Logic Statements

^ P(x2) ^ ... ^ P(xn)) ~P(x2) v ... v ~P(xn) ~P(x) v P(x2) v ... v P(xn)) ~P(x2) ^ ... ^ ~P(xn) ( ) ( ) ~P(x)

8

slide-5
SLIDE 5

Negation Negation

What can we do with the n What can we do with the n

~ c R+ n0 N n N, n A It cannot be moved inward A. It cannot be moved inward B. It can only move across o generalized De Morgan’s la quantifier.

  • C. It can only be moved acro

because a negation can't a because a negation can t a

  • D. It could be moved across

quantifiers. q E. None of the above.

Unit 6 - Rewriting Predicate Logic Statements

negation in: negation in:

n ≥ n0 → f(n) ≤ cg(n) ? d. ne quantifier because the aw can only handle one

  • ss all three quantifiers

appear between quantifiers appear between quantifiers.

  • ne, two or all three

9

Negation Negation

Which of the following are equ ~∃n0 ∈ Z0, ∀n ∈ Z0, n

  • A. ∀n0 ∈ Z0, ~∀n ∈ Z0, n
  • B. ∀n0 ∈ Z0, ∃n ∈ Z0, ~
  • C. ∀n0 ∈ Z0, ∃n ∈ Z0, ~
  • D. ∃n0 ∈ Z0, ∀n ∈ Z0, ~

, ,

  • E. ∀n0 ∈ Z0, ∃n ∈ Z0, n

ivalent to: > n0 → F(a1, a2, n). n > n0 → F(a1, a2, n). (n > n0) → F(a1, a2, n). (n > n0 → F(a1, a2, n)). (n > n0 → F(a1, a2, n)). ( (

1, 2,

)) > n0 ∧ ~F(a1, a2, n).

10

slide-6
SLIDE 6

Exercise Exercise

Let A be the set of amoeba Let A be the set of amoeba

amoeba x is amoeba y's pa

Use logical equivalences to Use logical equivalences to

translations of “an amoeba logically equivalent: logically equivalent:

x A, y A, Parent(y, x) y (y ) x A, y A, Parent(x, y)

Unit 6 - Rewriting Predicate Logic Statements

ae and Parent(x y) be true if ae, and Parent(x,y) be true if arent.

  • show that these two
  • show that these two

a has only one parent” are

(z A, Parent(z, x) → y = z) ( ( ) y ) (~z A, Parent(z, x) y ≠ z)

11

Outline Outline

Thinking of quantifiers diffe R les and Transformatio Rules and Transformatio The challenge method.

g

Unit 6 - Rewriting Predicate Logic Statements

erently.

  • ns
  • ns

12

slide-7
SLIDE 7

Universal Instantiatio Universal Instantiatio

If a is an element of D the If a is an element of D the

x D, P(x) P(a)

Proving it is a valid inferen

Suppose x D, P(x) is true pp , ( ) Hence P(x1) P(x2) ... P If a = xi is an element of D, t P(xi).

Unit 6 - Rewriting Predicate Logic Statements

  • n
  • n

n: n: ce:

e. P(xn) holds. then by specialization we have

13

Is Existential Instantiat Is Existential Instantiat

Consider an existential ins Consider an existential ins

x D, P(x) a D a D P(a) A. This argument is valid: P(a B Thi t i i lid P B. This argument is invalid: P

  • C. This argument is invalid: P
  • D. This argument is invalid fo

Unit 6 - Rewriting Predicate Logic Statements

tion a Valid Rule? tion a Valid Rule?

stantiation rule: stantiation rule:

a) is true. P( ) i f l P(a) is false. P(a) might be false.

  • r another reason.

14

slide-8
SLIDE 8

Existential Generaliz Existential Generaliz

If a is an element of D the If a is an element of D the

P(a) x D, P(x)

Proving it is a valid inferen

Suppose P(a) is true and a Hence P(x1) v … v P(xi) v .. Therefore x D, P(x) is t

Unit 6 - Rewriting Predicate Logic Statements

zation zation

n: n: ce:

= xi . v P(xn) holds. rue.

15

Universal Generaliza Universal Generaliza

If y is a non-specific (arb If y is a non-specific (arb

P(y) for a non-specific y x D, P(x)

Proving it is a valid inferen

Suppose P(y) is true a non- Since y can be anyone of th P(x1) … P(xn) holds. Th f D P( ) i t Therefore x D, P(x) is tr

Unit 6 - Rewriting Predicate Logic Statements

ation ation

bitrary) element of D then: bitrary) element of D then: ce:

specific y D he elements of D, rue.

16

slide-9
SLIDE 9

Universal Modus Po Universal Modus Po

If a is an element of D then

x D, P(x) → Q(x) P(a) Q(a)

Proof:

  • 1. x D, P(x) → Q(x)
  • 2. P(a)
  • 3. P(a) → Q(a)
  • 4. Q(a)

The proof for universal mo

Unit 6 - Rewriting Predicate Logic Statements

  • nens/Tollens
  • nens/Tollens

n:

premise premise 1, universal instantiation 3, modus ponens

  • dus tollens is similar.

17

Is Existential Modus Is Existential Modus

Is this rule valid? Is this rule valid?

x D, P(x) → Q(x) P(a) P(a) Q(a)

  • A. This argument is valid, and

B. The argument is valid, but Q( ) i ht b f l so Q(a) might be false.

  • C. This argument is invalid be

D This argument is invalid be

  • D. This argument is invalid be

and Q(a) can be false. E. The argument is invalid fo e a gu e s a d o

Unit 6 - Rewriting Predicate Logic Statements

s Ponens Valid? s Ponens Valid?

d Q(a) is true. t the 1st premise can not be true; ecause Q(a) is false. ecause the premises can be true ecause the premises can be true

  • r another reason.
  • a o

e easo

18

slide-10
SLIDE 10

Logical Equivalence Logical Equivalence

Applying logical equivalenc Applying logical equivalenc

Suppose we have

  • x D P(x) → Q(x)
  • x D, P(x) → Q(x)

and we know that

  • P(x) → Q(x) ≡ ~P(x) v Q

( ) ( ) ( ) Can we infer

  • x D, ~P(x) v Q(x) ?

Can we infer D P( ) Q( ) ?

  • ~x D, P(x) v Q(x) ?

I

f th lid?

Is any of these valid?

Unit 6 - Rewriting Predicate Logic Statements

es es

ces to predicate logic: ces to predicate logic:

(x) ( )

19

Logical Equivalence Logical Equivalence

Which propositional logic e Which propositional logic e

predicate logic?

A De Morgan's

  • A. De Morgan s

B. ~(P(x) → Q(x)) ≡ P(x) ~Q

  • C. Commutative, Associative

, conditional”

  • D. All propositional logic equ

l i b t h t b logic, but… we have to be parts of the logical equivale statement. E. None of the above.

Unit 6 - Rewriting Predicate Logic Statements

es es

equivalences apply to equivalences apply to

Q(x) e, and the “definition of , ivalences apply to predicate t f ll “li ” th sure to carefully “line up” the ence with the parts of the logical

20

slide-11
SLIDE 11

Applying Rules of In Applying Rules of In

Suppose a and b are elem Suppose a and b are elem

P(a) x D P(x) → y D Q( x D, P(x) → y D, Q( Can we infer A.Q(a, b) ? ( , ) B.y D, Q(a, y) ?

What if we have

P(a) x D, P(x) → y D, Q Can we infer A.Q(a, b) ? B.y D, Q(a, y) ?

Unit 6 - Rewriting Predicate Logic Statements

ference ference

ments of D and we know ments of D and we know

(x y) (x,y) Q(x,y)

21

Rules of Inference Rules of Inference

Which rules of inference ap

A. Modus ponens and modus B. All rules apply, but only if t quantifiers, not existential q C All rules apply but only if t

  • C. All rules apply, but only if t

quantifiers, not universal q

  • D. All rules apply, but… we h
  • D. All rules apply, but… we h
  • f the rule with correct logi

E. None of the above.

Unit 6 - Rewriting Predicate Logic Statements

pply to predicate logic?

s tollens only. they follow universal quantifiers. they follow existential they follow existential uantifiers. have to be sure to match the parts have to be sure to match the parts cal statements.

22

slide-12
SLIDE 12

Outline Outline

Thinking of quantifiers diffe R les and Transformations Rules and Transformations The challenge method.

g

Unit 6 - Rewriting Predicate Logic Statements

erently. s

23

The Challenge Meth The Challenge Meth

A predicate logic statemen A predicate logic statemen

players.

you (trying to prove the stat you (trying to prove the stat your adversary (trying to pro

The two of you pick values The two of you pick values

working from the left to righ

You pick the values of exist p Your adversary picks the va variables

Unit 6 - Rewriting Predicate Logic Statements

hod hod

nt is like a game with two nt is like a game with two

ement true) ement true)

  • ve it false).

s for the quantified variables s for the quantified variables ht (i.e. inwards).

entially quantified variables. y q alues of universally quantified

24

slide-13
SLIDE 13

The Challenge Meth The Challenge Meth

The Challenge method (co The Challenge method (co

If there is a strategy that allo statement is true. If there is a strategy for you always win, then the statem

What does it mean to

a winning strategy

Unit 6 - Rewriting Predicate Logic Statements

hod hod

  • ntinued):
  • ntinued):
  • ws you to always win, then the

r adversary that allows him/her to ment is false.

have at Nim?

25

The Challenge Meth The Challenge Meth

Example 1:

x Z n Z

Example 1: x

Z, n Z

How would we say this in E How would we prove this th

Example 2: n

N, x N p ,

How would we say this in E How would we prove this th

Unit 6 - Rewriting Predicate Logic Statements

hod hod

Z+ 2x < n Z , 2x < n

nglish? eorem?

N, n < 2x ,

nglish? eorem?

26

slide-14
SLIDE 14

Unit 6: Rewriting pre statements statements

Example 3:

x N n N

Example 3: x

N, n N

How would we say this in E How would we prove this th p

How do we prove a statem

Unit 6 - Rewriting Predicate Logic Statements

edicate logic

N n < 2x N, n < 2x

nglish? eorem?

ment is false?

27

Reading for Quiz 7 Reading for Quiz 7

O li

i #7 i d M d

Online quiz #7 is due Mond

5:00pm.

R

di f th i

Readings for the quiz:

Epp, 4th edition: 4.1, 4.6, Th Epp 3rd edition: 3 1 3 6 Th Epp, 3rd edition: 3.1, 3.6, Th Rosen, 6th edition: 1.6, 1.7. Rosen 7th edition: 1 7 1 8 Rosen 7th edition: 1.7, 1.8,

Unit 6 - Rewriting Predicate Logic Statements

d O t b 22 d t day October 22nd at

heorem 4.4.1 heorem 3 4 1 heorem 3.4.1. 3.4 (theorem 2 only). 4 1 (theorem 2 only) 4.1 (theorem 2 only).

28