31
snick snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville and others 1

Snick snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

snick

snack

CPSC 121: Models of Computation2010 Winter Term 2

Rewriting Predicate Logic Statements

Steve Wolfman, based on notes by Patrice Belleville and others

1

Page 2: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Outline

• Prereqs, Learning Goals, and Quiz Notes

• Reminder about the Challenge Method

• Generalized De Morgan’s Law

• Brief Problems and Discussion

• Next Lecture Notes

2

Page 3: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Learning Goals: Pre-Class

By the start of class, you should be able to:– Determine the negation of any quantified statement.– Given a quantified statement and an equivalence rule,

apply the rule to create an equivalent statement (particularly the De Morgan’s and contrapositive rules).

– Prove and disprove quantified statements using the “challenge” method (Epp, 3d edition, page 99).

– Apply universal instantiation, universal modus ponens, and universal modus tollens to predicate logic statements that correspond to the rules’ premises to infer statements implied by the premises.

3

Page 4: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Learning Goals: In-Class

By the end of this unit, you should be able to:– Explore alternate forms of predicate logic

statements using the logical equivalences you have already learned plus negation of quantifiers (a generalized form of De Morgan’s Law).

4

Page 5: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Quiz 6 Notes

5

Page 6: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Outline

• Prereqs, Learning Goals, and Quiz Notes

• Reminder about the Challenge Method

• Generalized De Morgan’s Law

• Brief Problems and Discussion

• Next Lecture Notes

6

Page 7: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Reminder: Challenge Method

A predicate logic statement is like a game with two players: • you (trying to prove the statement true) • your adversary (trying to prove it false).

The two of you pick values for the quantified variables working from the outside (left) in.

Your adversary picks the values of universally quantified variables.

You pick the values of existentially quantified variables.

7

Page 8: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Challenge Method Continued

If there’s a strategy for you such that no strategy of the adversary’s can beat you, the statement is true.

If there’s a strategy for the adversary such that no strategy of yours can beat the adversary, the statement is false.

8

Page 9: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

What does it mean to say:“I have a winning strategy at Nim”?

9

Page 10: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Outline

• Prereqs, Learning Goals, and Quiz Notes

• Reminder about the Challenge Method

• Generalized De Morgan’s Law

• Brief Problems and Discussion

• Next Lecture Notes

10

Page 11: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

De Morgan’s Law and Negating Quantifiers

Consider the statement:

x Z+, Odd(x) Even(x)

This is essentially an infinitely big AND:

(Odd(1) Even(1)) (Odd(2) Even(2)) (Odd(3) Even(3)) ...

What happens if we negate it?11

Page 12: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

De Morgan’s Law and Negating Quantifiers

Consider the statement:

x Z+, x*x = x.

This is essentially an infinitely big OR:

(1*1 = 1) (2*2 = 2) (3*3 = 3) ...

What happens if we negate it?

12

Page 13: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Generalized De Morgan’s (for Quantifiers)

~x, P(x) = x, ~P(x)

~x, P(x) = x, ~P(x)

(The quantifier changes when a negation moves across it.)

13

Page 14: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

De Morgan’s with Multiple Quantifiers

What can we do with the negation on a statement like:~n0 Z0, n Z0, n > n0 Faster(a1, a2, n)

a. The negation cannot be moved inward.b. The negation can only move across one quantifier

because the Generalized De Morgan’s rule only handles one quantifier.

c. The negation could be moved across the existential or across both of the quantifiers.

d. The negation must be moved across both quantifiers because a negation cannot appear between quantifiers.

e. None of these.

14

Page 15: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Outline

• Prereqs, Learning Goals, and Quiz Notes

• Reminder about the Challenge Method

• Generalized De Morgan’s Law

• Brief Problems and Discussion

• Next Lecture Notes

15

Page 16: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Which Logical Equivalences Apply?

Which propositional logic equivalences apply to predicate logic? (Answers taken from your quiz notes.)a. Modus ponens, modus tollens, and De Morgan's

(not all equivalences!)

b. ~(P(x) Q(x)) P(x) ~Q(X)

c. Commutative, Associative, and “definition of conditional”

d. All propositional logic equivalences apply to predicate logic.

e. Some other answer is correct.16

Page 17: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Problem: Lists (aka Arrays)

Let Length(a, len) mean that list a has the length len. Let A be the set of all arrays.

Problem: Use logical equivalence to show that these translations of “an array has exactly one length” are logically equivalent:

a A, len Z0, Length(a,len) (len2 Z0, Length(a, len2) len = len2).

a A, len Z0, Length(a,len) (~len2 Z0, Length(a, len2) lenlen2).

17

Page 18: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Outline

• Prereqs, Learning Goals, and Quiz Notes

• Reminder about the Challenge Method

• Generalized De Morgan’s Law

• Brief Problems and Discussion

• Next Lecture Notes

18

Page 19: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Learning Goals: In-Class

By the start of class, you should be able to:– Explore alternate forms of predicate logic

statements using the logical equivalences you have already learned plus negation of quantifiers (a generalized form of De Morgan’s Law).

19

Page 20: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Learning Goals: Pre-Class

Be able for each proof strategy below to:– Identify the form of statement the strategy can prove.– Sketch the structure of a proof that uses the strategy.

Strategies: constructive/non-constructive proofs of existence ("witness"), disproof by counterexample, exhaustive proof, generalizing from the generic particular ("WLOG"), direct proof ("antecedent assumption"), proof by contradiction, and proof by cases.

Alternate names are listed for some techniques.20

Page 21: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Lecture Prerequisites

In the “Textbook and References” section of the course website:– Reread the “Quantified Statements” sections

– Read the “Proof Techniques” sections

Complete the open-book, untimed quiz on Vista that’s due before the next lecture!

21

Page 22: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

snick

snack

More problems to solve...

(on your own or if we have time)

22

Page 23: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Why Voting?

A voting system is software. It describes how to compute a winner from the raw data of marked

ballots... When [voters, candidates, and strategists] are able to use the system to defeat the overall will of the voters, blame is properly

laid on the system itself.

- William Poundstone, Gaming the Vote

We now play with Arrow’s Impossibility Theorem because it’s a fascinating proof. But.. Poundstone would remind

us that there are systems not subject to this theorem!

Page 24: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Informal Definition: “Independence of Irrelevant Alternatives” (IIA)

Philosopher Sidney Morgenbesser is ordering dessert. The waiter says they have apple and blueberry pie. Morgenbesser asks for apple.

The waiter comes back out and says “Oh, we have cherry as well!”

“In that case,” says Morgenbesser, “I’ll take the blueberry.”

> but > > Huh??

Page 25: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Formal Definition: “Independence of Irrelevant Alternatives” (IIA)

If under a particular set of votes, society prefers A to B, society must still prefer A to B if voters rearrange their preferences but maintain their relative rankings of A and B.

Page 26: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

General Definition: “Pareto (In)Efficiency”

If a change in the solution can make everyone better off, then the solution is “Pareto inefficient”. (Used beyond elections!)

EDCBA

Candidate (“option”) VoterKey:

Question: Which of these is not Pareto Efficient?

Page 27: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Formal Voting Definition: “Pareto Efficiency”

For any two candidates A and B, if everyone prefers candidate A to candidate B, society must prefer A to B.

Candidate (“option”) VoterKey:

Page 28: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Formal Definition: “Dictatorship”

In a dictatorship, no matter how everyone votes, society’s preference order precisely follows one voter’s preference order (even if no one knows who that person is).

All hail 4!

Page 29: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Arrow’s Impossibility Theorem

Arrows Theorem shows, for any voting system*, if the system exhibits IIA and Pareto efficiency, then it’s a dictatorship.

Let V be the set of all voting systems and IIA(v), PE(v), and D(v) describe the three properties.

Problem: Prove using logical equivalences that “there’s no such thing as a fair voting system”.

29

*Technically: ranking-based systems on elections with 2 voters and 3

candidates.

Page 30: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Arrow’s Impossibility Theorem

Which can you prove?a.~x V, IIA(v) PE(v) ~D(v).b.x V, IIA(v) PE(v) ~D(v).c.x V, D(v) IIA(v) PE(v).

d.x V, D(v).e.None of these.

30

Page 31: Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville

Problem: Bosses

Top(x): x is the president

Report(x, y): x reports (directly) to y

P: the set of all people in the organization

Imagine a hierarchical organization in which everyone has exactly one boss except the president.

Let the domain of all variables be P. Which of these statements is true in any such organization?

x P, y P, Top(x) Report(x, y)

y P, x P, Top(x) Report(x, y)A. The first one.B. The second one.C. BothD. NeitherE. Not enough info31