Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 121: Models of Computation 2016W2

Similar presentations


Presentation on theme: "CPSC 121: Models of Computation 2016W2"— Presentation transcript:

1 CPSC 121: Models of Computation 2016W2
Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville and others TODO (future terms): update term

2 Outline Prereqs, Learning Goals, and Quiz Notes
Reminder about the Challenge Method Generalized De Morgan’s Law Brief Problems and Discussion Next Lecture Notes

3 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.

4 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). Discuss point of learning goals.

5 Quiz 6 Notes What’s in a name? y  B, x  C, P(y)  Q(x). x  B, y  C, P(x)  Q(y). TODO: update quiz notes Nothing. We can rename the variables as long as the names don’t “clash” with other names and we still use the variables in the same way: same result! Same as with identifiers in programming. [2012S2: this DESTROYED students, less than 50% correct.]

6 Quiz 6 Notes x  D, Q(x)  [(y  D, P(x, y))  ~(y  D, P(x, y))].
For what value of R(x) is this the same as: x  D, Q(x)  [R(x)  ~R(x)]? R(x)  y  D, P(x, y) R(x)  y  D, P(x, y) R(x)  P(x, y) None of these, but there is such an R(x). None of these, and there is no such R(x). TODO: update quiz notes None of these because the insides of the parens (the “quantified on y” bits) are not the same. [2012S2: this DESTROYED students, less than 50% correct.]

7 Outline Prereqs, Learning Goals, and Quiz Notes
Reminder about the Challenge Method Generalized De Morgan’s Law Brief Problems and Discussion Next Lecture Notes

8 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. array doubling pre/post conditions

9 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. array doubling pre/post conditions

10 What does it mean to say: “I have a winning strategy at Nim”?
2011W1: In the summer, Steve chatted with past ACM president Barbara Simons, and she said that she had the game Dr. Nim when she was growing up 

11 Is  the same as ? You’re playing on the side of truth*. Which of these will likely be easier to prove? xS,yS,Supes(x,y). xS,yS,Supes(x,y).  version  version Neither, since they’re logically equivalent. It’s impossible to tell. *Also justice and the Canadian Way.

12 Outline Prereqs, Learning Goals, and Quiz Notes
Reminder about the Challenge Method Generalized De Morgan’s Law Brief Problems and Discussion Next Lecture Notes

13 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?

14 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?

15 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.) P(x) could be anything, of course! It can be a “helper predicate”.

16 De Morgan’s with Multiple Quantifiers
Which of the following is equivalent to: ~n0  Z0, n  Z0, n > n0  F(a1, a2, n). n0  Z0, ~n  Z0, n > n0  F(a1, a2, n). n0  Z0, n  Z0, ~(n > n0)  F(a1, a2, n). n0  Z0, n  Z0, ~(n > n0  F(a1, a2, n)). n0  Z0, n  Z0, ~(n > n0  F(a1, a2, n)). n0  Z0, n  Z0, n > n0  ~F(a1, a2, n). A, c, and e are all correct. Hee-hee 

17 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 Which Logical Equivalences Apply?
All of them! But… we have to be sure to carefully “line up” the parts of the logical equivalence with the parts of the logical statement.

19 Problem: Lists (aka Arrays)
Let Length(a, len) mean that list a has the length len. Let A be the set of all arrays. (This is a predicate, not the function we used last time!) Problem: Use logical equivalence to show that these translations of “an array has exactly one length” are logically equivalent: a  A, len  N, Length(a,len)  (len2  N, Length(a, len2)  len = len2). a  A, len  N, Length(a,len)  (~len2  N, Length(a, len2)  lenlen2).

20 Outline Prereqs, Learning Goals, and Quiz Notes
Reminder about the Challenge Method Generalized De Morgan’s Law Brief Problems and Discussion Next Lecture Notes

21 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). Discuss point of learning goals.

22 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.

23 Lecture Prerequisites
In the “Textbook and References” section of the course website: Reread the “Rewriting Predicate Logic” sections Read the “Proof Techniques” sections Complete the open-book, untimed, online quiz that is due before class.

24 (on your own or if we have time)
More problems to solve... (on your own or if we have time)

25 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!

26 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??

27 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. 1CADEB 2BADCE 3ACDEB 4AEBCD 5DECBA SA...B 1EACBD 2CEBAD 3ABCDE 4CAEBD 5DBECA SA...B

28 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!) Question: Which of these is not Pareto Efficient? Key: Candidate (“option”) Voter A B C D E

29 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. Key: Candidate (“option”) Voter

30 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). 1CADEB 2BADCE 3ACDEB 4AEBCD 5DECBA SAEBCD 1EACBD 2CEBAD 3ABCDE 4CAEBD 5DBECA SCAEBD All hail 4!

31 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”. Technically: comparison/ranking-based voting system applied to an election with at least two voters and at least three candidates. *Technically: ranking-based systems on elections with  2 voters and  3 candidates.

32 Arrow’s Impossibility Theorem
Which can you prove? ~v  V, IIA(v)  PE(v)  ~D(v). v  V, IIA(v)  PE(v)  ~D(v). v  V, D(v)  IIA(v)  PE(v). v  V, D(v). None of these. Technically: comparison/ranking-based voting system applied to an election with at least two voters and at least three candidates.

33 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) The first one is known to be true in any such organization. Note: the second one isn’t known to be true or false on every organization. It’s true if the organization has only 1 or 2 levels in its hierarchy (a one-person shop or “flat” hierarchy). After some discussion with students, I realized the CLEAREST way to talk about this with them is to discuss axiomatization (though not the quickest way!). We can axiomatize this domain by noting the following, although this is NOT how I’d explain it to students: Report is anti-reflexive, anti-symmetric, and anti-transitive. The operation that is the closure over report is also anti-reflexive and anti-symmetric (though it is, by the process of closure, transitive). An individual is the president iff there is no one they report to. LIKELY: some one unique person is the president (no degenerate organizations that are either empty or infinitely high with no top; no forests allowed) From these axioms, we can prove the first statement (trivially, using the third one). We CANNOT prove or disprove the second statement (and indeed for any org with only a president or only a pres and their direct employees, that statement is true, while it’s false in all other cases). The first one. The second one. Both Neither Not enough info


Download ppt "CPSC 121: Models of Computation 2016W2"

Similar presentations


Ads by Google