A picture of the 15-puzzle is shown inFigure3.5along with the configuration after the 12-block is moved into the holebelow.. Prizes were offered for its solution, but it is doubtful that
Trang 1Quy nạp 1 Trần Vĩnh Đức
HUST
Ngày 21 tháng 1 năm 2014
1Tham khảo: E.Lehman, T Leighton, A Meyer, Mathematics for CS
Trang 7Chứng minh.
▶ Bước cơ sở: P(0) đúng vì 03− 0 = 0 chia hết cho 3.
▶ Bước quy nạp: Ta sẽ chứng minh rằng, với mọi n ∈ N, mệnh
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
Trang 9Đặt P(n) là mệnh đề
”Trong mọi tập gồm n con ngựa, các con ngựa đều cùng màu.”
Chứng minh Sai.
▶ Bước cơ sở: P(1) đúng vì chỉ có một con ngựa.
▶ Bước quy nạp: Giả sử P(n) đúng để chứng minh P(n + 1)
đúng.
Xét tập gồm n + 1 con ngựa {h1, h2, · · · , hn+1}
▶ Các con h1 , h2, , hn có cùng màu (giả thiết quy nạp).
▶ Các con h2 , h3, , hn+1 có cùng màu (giả thiết quy nạp) Vậy
màu(h1) = màu(h2, , hn) = màu(hn+1).
Vậy các con ngựa {h1, h2, · · · , hn+1} đều cùng màu Có nghĩa
rằng P(n + 1) đúng.
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
Trang 11Ví dụ
Có nhiều nhất bao nhiêu miền Ln tạo bởi n đường thẳng?
1.2 LINES IN THE PLANE 5
(A pizza with Swiss
cheese?)
A region is convex
if it includes all
line segments
be-tween any two of its
points (That’s not
(Each line extends infinitely in both directions.) Sure, we think, L, = 2”; of course! Adding a new line simply doubles the number of regions Unfortunately this is wrong We could achieve the doubling if the nth line would split each old region in two; certainly it can split an old region in at most two pieces, since each old region is convex (A straight line can split a convex region into at most two new regions, which will also be convex.) But when we add the third line-the thick one in the diagram below- we soon find that it can split at most three of the old regions,
no matter how we’ve placed the first two lines:
Thus L3 = 4 + 3 = 7 is the best we can do.
And after some thought we realize the appropriate generalization The nth line (for n > 0) increases the number of regions by k if and only if it splits k of the old regions, and it splits k old regions if and only if it hits the previous lines in k- 1 different places Two lines can intersect in at most one point Therefore the new line can intersect the n- 1 old lines in at most n- 1 different points, and we must have k 6 n We have established the upper bound
Trang 13Ví dụ
2.6 Courtyard Tiling
Induction served purely as a proof technique in the preceding examples But induction
sometimes can serve as a more general reasoning tool.
MIT recently constructed a new computer science building As the project went further
and further over budget, there were some radical fundraising ideas One plan was to
install a big courtyard with dimensions 2n⇥ 2n:
2n
2n
One of the central squares would be occupied by a statue of a wealthy potential donor.
Let’s call him “Bill” (In the special case n = 0, the whole courtyard consists of a single
central square; otherwise, there are four central squares.) A complication was that the
building’s unconventional architect, Frank Gehry, insisted that only special L-shaped tiles
be used:
A courtyard meeting these constraints exsists, at least for n = 2:
B
For larger values of n, is there a way to tile a 2n⇥ 2ncourtyard with L-shaped tiles and a
statue in the center? Let’s try to prove that this is so.
Theorem 15. For all n 0 there exists a tiling of a 2n⇥ 2n courtyard with Bill in a central
2n
2n
One of the central squares would be occupied by a statue of a wealthy potential donor
Let’s call him “Bill” (In the special case n = 0, the whole courtyard consists of a singlecentral square; otherwise, there are four central squares.) A complication was that thebuilding’s unconventional architect, Frank Gehry, insisted that only special L-shaped tiles
Với mọi n, luôn có cách lát gạch một sân 2n× 2n chỉ để lại một ô
trống ở giữa (để đặt tượng Bill).
Trang 14Chứng minh thử.
Xét P(n) là mệnh đề
”Có cách lát gạch sân 2n× 2n để lại một ô ở giữa.”
▶ Bước cơ sở: P(0) đúng vì chỉ có một ô dành cho Bill.
▶ Bước quy nạp: !
Trang 15Base case: P (0) is true because Bill fills the whole courtyard.
Inductive step: Assume that there is a tiling of a 2n⇥ 2ncourtyard with Bill in the centerfor some n 0 We must prove that there is a way to tile a 2n+1⇥ 2n+1courtyard with Bill
a tiling of the remainder
This advice may sound bizzare: “If you can’t prove something, try to prove somethingmore grand!” But for induction arguments, this makes sense In the inductive step, whereyou have to prove P (n) ) P (n + 1), you’re in better shape because you can assume P (n),which is now a more general, more useful statement Let’s see how this plays out in thecase of courtyard tiling
Proof (successful attempt) The proof is by induction Let P (n) be the proposition that forevery location of Bill in a 2n⇥ 2ncourtyard, there exists a tiling of the remainder.Base case: P (0) is true because Bill fills the whole courtyard
Inductive step: Asume that P (n) is true for some n 0; that is, for every location of Bill in
a 2n⇥ 2ncourtyard, there exists a tiling of the remainder Divide the 2n+1⇥ 2n+1courtyardinto four quadrants, each 2n⇥ 2n One quadrant contains Bill (B in the diagram below) Place a temporary Bill (X in the diagram) in each of the three central squares lying outside
this quadrant:
X
X X B
Trang 1715-Puzzle“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
252624
2221
87
43
(a)
252624
2221:
23
87
43
(b)Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b)
262524
2221
87
43
Figure 3.6 The desired final configuration for the 15-puzzle Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order A picture of the 15-puzzle is shown inFigure3.5along with the configuration after the 12-block is moved into the holebelow The desired final configuration is shown in Figure3.6
The 15-puzzle became very popular in North America and Europe and is stillsold in game and puzzle shops today Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from theconfiguration in Figure3.5(a) to the configuration in Figure3.6by only movingone block at a time into an adjacent hole The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that theanalogous task for the much easier 8-puzzle cannot be performed Both proofs, ofcourse, make use of the Invariant Method
⇒
“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
252624
2221
87
43
(a)
252624
2221:
23
87
43
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b)
262524
2221
87
43
Figure 3.6 The desired final configuration for the 15-puzzle Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order A picture of the 15-puzzle is shown inFigure3.5along with the configuration after the 12-block is moved into the holebelow The desired final configuration is shown in Figure3.6
The 15-puzzle became very popular in North America and Europe and is stillsold in game and puzzle shops today Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from theconfiguration in Figure3.5(a) to the configuration in Figure3.6by only movingone block at a time into an adjacent hole The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that theanalogous task for the much easier 8-puzzle cannot be performed Both proofs, ofcourse, make use of the Invariant Method
Chuyển hợp lệ: di chuyển một số sang ô trống cạnh nó.
Trang 1822 21
8 7
4 3
(a)
25 26 24
22 21 :
23
8 7
4 3
(b) Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
26 25 24
22 21
8 7
4 3
Figure 3.6 The desired final configuration for the 15-puzzle Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order A picture of the 15-puzzle is shown in
Figure 3.5 along with the configuration after the 12-block is moved into the hole
below The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still
sold in game and puzzle shops today Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the
configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving
one block at a time into an adjacent hole The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the
analogous task for the much easier 8-puzzle cannot be performed Both proofs, of
course, make use of the Invariant Method.
sang
“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
25 26 24
22 21
8 7
4 3
(a)
25 26 24
22 21 :
23
8 7
4 3
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
26 25 24
22 21
8 7
4 3
Figure 3.6 The desired final configuration for the 15-puzzle Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order A picture of the 15-puzzle is shown in Figure 3.5 along with the configuration after the 12-block is moved into the hole below The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still sold in game and puzzle shops today Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving one block at a time into an adjacent hole The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the analogous task for the much easier 8-puzzle cannot be performed Both proofs, of course, make use of the Invariant Method.
không?
Trang 198-Puzzle“mcs-ftl” — 2010/9/8 — 0:40 — page 60 — #66
Chapter 3 Induction
60
GH
FED
CBA
(a)
G
H
FED
CBA
CBA
(c)Figure 3.7 The 8-Puzzle in its initial configuration (a) and after one (b) andtwo (c) possible moves
3.3.4 The 8-Puzzle
In the 8-Puzzle, there are 8 lettered tiles (A–H) and a blank square arranged in a
3⇥ 3 grid Any lettered tile adjacent to the blank square can be slid into the blank.For example, a sequence of two moves is illustrated in Figure3.7
In the initial configuration shown in Figure3.7(a), the G and H tiles are out oforder We can find a way of swapping G and H so that they are in the right order,but then other letters may be out of order Can you find a sequence of moves thatputs these two letters in correct order, but returns every other tile to its originalposition? Some experimentation suggests that the answer is probably “no,” and wewill prove that is so by finding an invariant, namely, a property of the puzzle that isalways maintained, no matter how you move the tiles around If we can then showthat putting all the tiles in the correct order would violate the invariant, then we canconclude that the puzzle cannot be solved
Theorem 3.3.3 No sequence of legal moves transforms the configuration in ure3.7(a) into the configuration in Figure3.8
Fig-We’ll build up a sequence of observations, stated as lemmas Once we achieve
a critical mass, we’ll assemble these observations into a complete proof of rem3.3.3
Theo-Define a row move as a move in which a tile slides horizontally and a columnmove as one in which the tile slides vertically Assume that tiles are read top-to-bottom and left-to-right like English text, that is, the natural order, defined asfollows: So when we say that two tiles are “out of order”, we mean that the largerletter precedes the smaller letter in this natural order
Our difficulty is that one pair of tiles (the G and H) is out of order initially Animmediate observation is that row moves alone are of little value in addressing this
Trang 20CBA
(a)
G
H
FED
CBA
CBA
(c)Figure 3.7 The 8-Puzzle in its initial configuration (a) and after one (b) and
two (c) possible moves
3.3.4 The 8-Puzzle
In the 8-Puzzle, there are 8 lettered tiles (A–H) and a blank square arranged in a
3⇥ 3 grid Any lettered tile adjacent to the blank square can be slid into the blank
For example, a sequence of two moves is illustrated in Figure3.7
In the initial configuration shown in Figure3.7(a), the G and H tiles are out of
order We can find a way of swapping G and H so that they are in the right order,
but then other letters may be out of order Can you find a sequence of moves that
puts these two letters in correct order, but returns every other tile to its original
position? Some experimentation suggests that the answer is probably “no,” and we
will prove that is so by finding an invariant, namely, a property of the puzzle that is
always maintained, no matter how you move the tiles around If we can then show
that putting all the tiles in the correct order would violate the invariant, then we can
conclude that the puzzle cannot be solved
Theorem 3.3.3 No sequence of legal moves transforms the configuration in
Fig-ure3.7(a) into the configuration in Figure3.8
We’ll build up a sequence of observations, stated as lemmas Once we achieve
a critical mass, we’ll assemble these observations into a complete proof of
Theo-rem3.3.3
Define a row move as a move in which a tile slides horizontally and a column
move as one in which the tile slides vertically Assume that tiles are read
top-to-bottom and left-to-right like English text, that is, the natural order, defined as
follows: So when we say that two tiles are “out of order”, we mean that the larger
letter precedes the smaller letter in this natural order
Our difficulty is that one pair of tiles (the G and H) is out of order initially An
immediate observation is that row moves alone are of little value in addressing this
sang
“mcs-ftl” — 2010/9/8 — 0:40 — page 61 — #67
H G
FED
CBA
Figure 3.8 The desired final configuration of the 8-puzzle
9
765
432
problem:
Lemma 3.3.4 A row move does not change the order of the tiles
Proof A row move moves a tile from cell i to cell i C 1 or vice versa This tiledoes not change its order with respect to any other tile Since no other tile moves,there is no change in the order of any of the other pairs of tiles ⌅Let’s turn to column moves This is the more interesting case, since here theorder can change For example, the column move in Figure3.9changes the relativeorder of the pairs G; H / and G; E/
Lemma 3.3.5 A column move changes the relative order of exactly two pairs oftiles
Proof Sliding a tile down moves it after the next two tiles in the order Sliding atile up moves it before the previous two tiles in the order Either way, the relativeorder changes between the moved tile and each of the two tiles it crosses Therelative order between any other pair of tiles does not change ⌅These observations suggest that there are limitations on how tiles can be swapped.Some such limitation may lead to the invariant we need In order to reason aboutswaps more precisely, let’s define a term referring to a pair of items that are out oforder:
Định lý
Không tồn tại dãy chuyển cho bài toán trên.