不變式和第二數學歸納法
Good proofs are:
- correct
- complete
- clear
- brief
- elegant
- well-organized
- inorder
introduction:
Legal Move:slide a letter into adjacent square?
A | B | C |
---|---|---|
D | E | F |
H | G |
to
A | B | C |
---|---|---|
D | E | F |
G | H |
Thm:
there is no sequence of legal moves to invert G &H and return all other letters to original position
不變式(invariant)
引理一:(Lemma1)
橫向移動不改變字母的相對順序。
A row move does not change the order
Proof: In a row move, we move an item from cell i into an adjacent cell i-1 or i+1 .Nothing else moves.Hence the order of items is preserved.
引理二:(Lemma2)
A column move changes the relative order of precisely 2 pairs of items
Proof: In a column move, we move an item from cell i into an blank spot i-3 or i+3 .
When an item moves three positions,It changes relative order with two other items.(i-1,i-2 or i+1,i+2)
Def:一對字母,記作L1和L2,他們表示兩個顛倒的字母,叫做一對逆序。也就是如果字母表中L1在L2前面,那麼在拼圖中L2會出現在L1後面。
(A pair of letters of items,call L1 and L2.they form an inversion,also known as an inverted pair,if L1 precedes L2 in the alphabet,but L1 appears after L2 in the puzzle)
A | B | C |
---|---|---|
D | E | F |
H | G |
1 inversion
to
A | B | C |
---|---|---|
D | E | F |
G | H |
0 inversion
conclusion: 1 inversion can never get 0 inversion
引理三:(Lemma3)
在一次移動中,逆序對的數量一次只能增加或者減少兩個或者保持不變。
during a move,the number of inversion can only increase by two ,decrease by two or stay same.
Pf:
Row move : no changes (by lemma1)
column move: 2 pairs change order(by lemma2)
A. both pairs were inorderinversions ↑2
B. both pairs were invertedinversions ↓2
C. one pair was invertedinversions stays same
推論:(corollary)
在一次移動中,奇偶性(的意思是偶數和奇數)。逆序對的數量的奇偶性不會改變。
during a move,the parity ( even/odd)and the oddness of the number of inversions dose not change.
Pf:
加上或者減去2不會改變它的奇偶性
adding or subtracting 2does not change the pairty.
引理四:(Lemma4)
在可以達到的狀態中(即可達狀態),從
in every state or configuration reachable from
A | B | C |
---|---|---|
D | E | F |
H | G |
逆序對的數量會保持爲奇數。
the parity of the number of inversions is odd
Pf: by induction.
P(n):After any sequence of n moves from
A | B | C |
---|---|---|
D | E | F |
H | G |
Base Case:
n = 0 haven’t move.#inversions = 1 pairty is odd.
Inductive Step:
For n 0 show P(n)P(n+1)
Consider any sequence of n+1 moves
By I.H(P(n)),we know that the parity after moves is odd
By corl 1,we know parity of #inversions does not change during the pairty after is oddP(n+1)
Thm:
there is no sequence of legal moves to invert G &H and return all other letters to original position
Pf of Thm:
The pairty of #inversions in desired state is even(0).By lemma 4 ,the desired state can not be reached from the start state ,because its parity is odd.that cannot be reached form
A | B | C |
---|---|---|
D | E | F |
H | G |
第二數學歸納法
(Strong Induction Axiom)
Let P(n) be any precticate.If P(0) is true & is true,then is true
Unstacking Game example
數論Number theory
study of the integers 0,1,2,3…
Def: m | a(m divides a) a能被m整除
if a=km
3 | 6 a=0=0.m m|0