1 / 34

Lecture Coursework 2 AGAIN

Lecture Coursework 2 AGAIN. Rectangle Game.

weldon
Download Presentation

Lecture Coursework 2 AGAIN

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture Coursework 2 AGAIN

  2. Rectangle Game • Look at proof of matchsticksA rectangular board is divided into m columns by n rows.The area of the board is nxm.Each player takes turns to cut the board along a line.The smaller piece is discarded.The game ends with a 1 by 1 board,And the player whose turn it is to move is the loser.

  3. Game a. A move in the component game is modelled by the assignment m := n • where n < m <=2n. Do not forget this is actually two statements (n < m and m <=2n) • If you draw out the first few states of the game you can make a hypothesis about what are the losing states. A hint is, it is like a power of 2. In fact a big hint is given is part b of this question regarding mex numbers.

  4. Winning & Losing Positions • A winning position is a position from which there is a move to a losing position. • A losing position is a position from which every move is to a winning position. • Thus you need to combine your conjecture about a winning/losing position with the statement that n < m <=2n, so rewrite m as your hypothesis. • The trick with induction is to show the (n+1)th case in terms of the nth case. • What is the “ith + 1” losing position, what the “ith” losing position?

  5. Sum Game 1 • The sum game consists of two component games. Clearly if the board is square, and the opponent goes first, we can win by simply copying their move. • E.g. if position (x, x), the opponent moves to (x, y) then we move to (y, y). • This part of the question is about what happens when the board is not square.

  6. Sum Game 2 • This is a sum game.The component games are copies of the same game.The position in a component game is given by m (a positive integer).A move in the game is to replace m by a number n such thatn < m <= 2n

  7. Symmetry • Clearly one winning strategy is the following.If the board is squareI.e. the number of rows = the number of columnsThen just copy the opponents moves.Similar to the daisy game.But what if we are not in a position to make the board square.In this case we need mex numbers.

  8. Mex Numbers • Draw a graph of the problemA successor is a state which we can move to from the current state.There maybe one or more successors from the current state.The final state has no moves, as it is the final state.This is given mex number 0A given state has mex number which is the smallest natural number not included in the mex numbers of the successor states.Show diagram in my book. • What are the patterns in the mex numbers?The strategy is to get symmetry with the mex numbers.This is how to play the sum game.

  9. Mex Numbers • Complete the table in the question about mex numbers. • The table is written in 4 parts, there is good reason for this. • A move from the highest position in a part of the table (e.g. 1, 3, 7, 15) can only move to the same part of the table. • As there is regularity in the state transition diagram, there will be regularity in the mex numbers.

  10. Regularity In Mex Numbers • Check that there is regularity in the mex numbers. • If you are really not sure you can add a few more states to confirm what you think. • If you remember from the lecture when mex numbers were introduced, the underlying graph of the state transition diagram had no regularity so we had to generate the mex numbers by hand (see figures 4.4 to 4.6 of the APS book on the shared drive).

  11. Winning and losing positions • A winning position is a position from which there is a losing positionwe can move to.A losing position is a position from which ever position is to awinning position.A winner always wants to push a loser to a losing position, so theloser has no choice but to push to a winning position.Write down an inductive hypothesis about winning/losing positions.Show the tableTalk about similarities with matchstick game.

  12. Mex Numbers 1 • The idea of mex numbers is to be able to make a move so that they are the same in both games. Thus if the mex number of the left game is 7 and the mex number of the right game is 4, then we can move the left game into a position with a mex number of 4 (and by the definition of mex numbers, this will always exist).

  13. Mex Numbers 2 • If the mex numbers are the same, then we are in a losing position. • In the table, in all but the last case, the left and right positions fall in different parts of the table in section b. • In the last entry in the table (i.e. position (21, 19)) we can restore the “squareness” of the board by moving L19 to give a position (19, 19).

  14. Disjunction – Or • True when one of the pair is true (p or q)PropertiesIdempotence p or p = pSymmetry p or q = q or pAssociativity p or (q or r) = (p or q) or r Allows us to omit parenthesesDistributivity p or (q = r) = p or q = p or rExcluded middle  p or not p

  15. Golden rule 7.2 • (p or q) = p = q = (p and q)(this is a definition of and)and has equal precedence as or.Giving one precedence over the other obscures symmetries in theiralgebraic properties.The golden rule can be read in 3 different ways.

  16. Truth table • p q |   p or q = p |    p and q = q0 0     10 1     01 0     11 1     1

  17. De Morgan • not ( p and q) =  not p or not qnot ( p or q) = not p and not q

  18. Implication • Definition of only if p <- q = p = p or q p <- q = q = p and qthese are the same, via the golden rule.

  19. Turning the arrows around • Definition of ifp -> q = q = (p or q)p -> q = p = (p and q)these are the same, via the golden rule.

  20. If and only-if. • Definitions of only-if • 1.      p <- q = p = p v q • 2.      p <- q = q = p ^ q • Definitions of if • 1.      p -> q = q = p v q • 2.      p -> q = p = p ^ q

  21. Leibniz (equals for equals) • If two expressions are equal x y, and F is any function,Then F(x) = F(y) • (p=q)^q becomes p^q • (p!=q)^q becomes !p^q • Show via truth table. • Note that these are special cases of “equals for equals”.

  22. Return to Knights and Knaves • Knights tell the truth, and knaves lieTruth table of knights and knaves. P4A says I am same type as BIs there gold on the islandThis is exactly the same process as before.

  23. Formulating questions p3 my book • You are at a fork in the road, you want to know if the gold is to the left or the right.Let Q be the question to be posed.The response to the question will be A = QLet L denote, "the gold can be found by following the left fork"The requirement is that L is the same are the response to Q.i.e. we require L=(A=Q){but as equality is associative}(L = A) = QSo the question Q posed is L=AI.e. "is the value of 'the gold can be found by following the left fork'equal to the value of 'you are a knight'"

  24. A=(A=B) • A says I am the same type as B • Question is “is (A is a knight) = (A is the same type as B)” • Get yes if B is a knight, no if B is a knave. • We cannot tell anything about A

  25. Equals for Equals p6 my book • There are three natives A B C.C says "A and B are both the same type".Formulate a question, that when posed to A determines if C is tellingthe truth.Let A be the statement A is a "knight".Let Q be the unknown question.The response we want is C (i.e. if C is true then C is a knight).By the previous section, Q = (A=C) i.e. we replace L by C.C's statement is A=B, so now we know C = (A=B) by equality.So Q = (A = (A=B)) which simplifies to Q = B, so the question to beposed is "is B a knight". Show the formal working from book p 69

  26. A B C A B C 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1

  27. Portia's Casket • How do we write the portrait is in one and only one casket?The truth of the portrait being in the gold casket is indicated by thesilver inscription.The inscriptions on the silver casketa. the inscription on the gold casket is true, if this inscription is trueb. the inscription on the gold casket is false, if this inscription is truec. if the inscription on the gold casket is true, this inscription is falsed. if the inscription on the gold casket is false, this inscription is falsesee p 8

  28. variable names • ig the inscription on the gold casket is trueis the inscription on the silver casket is truepg the portrait is in the gold casketps the portrait is in the silver casket.Each of these will end up with a true/false value at the end.Only one of pg and ps can be true.

  29. 3 Induction The first part is to complete the table. This should give you no problems, but if you do get stuck please ask me or email me. Remember a weight 3^i can be placed on the left, right of the scales or on the table (i.e. there is a choice of 3 positions for each weight). We only have a single weight of each of 3^i (if we had an unlimited supply of each of these weights, the problem would be trivial as 3^0 = 1, so we could weigh anything with n weights of 1 unit).

  30. As with all induction proofs, we need to write the n+1 case in terms of the n th case. • This is given as a hint in the question i.e. ½ (3^(n+1) – 1) = ½ (3^(n) – 1) + 3^n. • If you are really stuck then you can start to build up a table of values. • n ½ (3^(n) – 1) weights • 0 0 0 • 1 1 1 • 2 4 1,3 • 3 13 1,3,9 • … … …

  31. We can look for patterns • Weight left right • 5 1,3,5 9 • 6 3,6 9 • 7 3,7 1,9 • 8 1,8 9 • 9 9 9 • 10 10 1,9 • 11 1,11 3,9 • 12 12 3,9 • 13 13 1,3,9 • There are lots of interesting symmetries in this table, • Take a while to study it.

  32. For the inductive step • Note that the question says divide the range of numbers into 3. • For the inductive step we assume • ½ (3^n – 1) < w <= ½ (3^(n+1) – 1) • We can rewrite the right hand side as ½ (3^n – 1) + 3^n (this hint is given in the question). Thus we can rewrite the expression as • ½ (3^n – 1) < w <= ½ (3^n – 1) + 3^n

  33. These 3 ranges are • ½ (3^n – 1) < w <= 3^n • w = 3^n • 3^n < w <= ½ (3^n – 1) + 3^n • These 3 separate cases cover the case above. • Now try and solve each of these cases separately. • Clearly if the number is 3^n, we can measure this directly with a single weight. • The trick is when the weight is less than this number or greater than this number. • Think about placing the weight 3 on the same side of the scales as 3^n or on opposite sides.

More Related