lecture coursework 2 again. rectangle game look at proof of matchsticks a rectangular board is...

34
Lecture Coursework 2 AGAIN

Upload: alfred-townsend

Post on 19-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

Lecture Coursework 2 AGAIN

Page 2: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

Rectangle Game• Look at proof of matchsticks

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

Page 3: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 4: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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?

Page 5: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 6: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 7: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 8: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

Mex Numbers• Draw a graph of the problem

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

Page 9: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 10: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 11: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 12: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 13: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 14: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 15: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 16: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

Truth table

•p q | p or q = p | p and q = q0 0 10 1 01 0 11 1 1

Page 17: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

De Morgan

•not ( p and q) = not p or not qnot ( p or q) = not p and not q

Page 18: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

Implication

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

Page 19: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 20: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 21: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 22: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 23: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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'"

Page 24: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 25: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 26: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

A B CA B C 0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Page 27: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 28: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 29: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 30: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

• 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• … … …

Page 31: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 32: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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

Page 33: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board

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.

Page 34: Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board