author | huffman |
Sat, 27 Feb 2010 21:38:24 -0800 | |
changeset 35467 | 561d8e98d9d3 |
parent 33026 | 8f35633c4922 |
child 35416 | d8d7d1b785af |
permissions | -rw-r--r-- |
33026 | 1 |
(* Title: HOL/Isar_Examples/Mutilated_Checkerboard.thy |
7385 | 2 |
Author: Markus Wenzel, TU Muenchen (Isar document) |
31758 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory (original scripts) |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
4 |
*) |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
5 |
|
10007 | 6 |
header {* The Mutilated Checker Board Problem *} |
7761 | 7 |
|
31758 | 8 |
theory Mutilated_Checkerboard |
9 |
imports Main |
|
10 |
begin |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
11 |
|
7968 | 12 |
text {* |
13 |
The Mutilated Checker Board Problem, formalized inductively. See |
|
14 |
\cite{paulson-mutilated-board} and |
|
15 |
\url{http://isabelle.in.tum.de/library/HOL/Induct/Mutil.html} for the |
|
16 |
original tactic script version. |
|
10007 | 17 |
*} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
18 |
|
10007 | 19 |
subsection {* Tilings *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
20 |
|
23746 | 21 |
inductive_set |
10007 | 22 |
tiling :: "'a set set => 'a set set" |
23746 | 23 |
for A :: "'a set set" |
24 |
where |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
25 |
empty: "{} : tiling A" |
23746 | 26 |
| Un: "a : A ==> t : tiling A ==> a <= - t ==> a Un t : tiling A" |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
27 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
28 |
|
10007 | 29 |
text "The union of two disjoint tilings is a tiling." |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
30 |
|
7761 | 31 |
lemma tiling_Un: |
18153 | 32 |
assumes "t : tiling A" and "u : tiling A" and "t Int u = {}" |
33 |
shows "t Un u : tiling A" |
|
10408 | 34 |
proof - |
35 |
let ?T = "tiling A" |
|
18153 | 36 |
from `t : ?T` and `t Int u = {}` |
37 |
show "t Un u : ?T" |
|
10408 | 38 |
proof (induct t) |
11987 | 39 |
case empty |
18153 | 40 |
with `u : ?T` show "{} Un u : ?T" by simp |
9475 | 41 |
next |
11987 | 42 |
case (Un a t) |
10408 | 43 |
show "(a Un t) Un u : ?T" |
44 |
proof - |
|
45 |
have "a Un (t Un u) : ?T" |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32456
diff
changeset
|
46 |
using `a : A` |
10408 | 47 |
proof (rule tiling.Un) |
18153 | 48 |
from `(a Un t) Int u = {}` have "t Int u = {}" by blast |
49 |
then show "t Un u: ?T" by (rule Un) |
|
23373 | 50 |
from `a <= - t` and `(a Un t) Int u = {}` |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32456
diff
changeset
|
51 |
show "a <= - (t Un u)" by blast |
10408 | 52 |
qed |
53 |
also have "a Un (t Un u) = (a Un t) Un u" |
|
54 |
by (simp only: Un_assoc) |
|
55 |
finally show ?thesis . |
|
56 |
qed |
|
10007 | 57 |
qed |
58 |
qed |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
59 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
60 |
|
10007 | 61 |
subsection {* Basic properties of ``below'' *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
62 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
63 |
constdefs |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
64 |
below :: "nat => nat set" |
10007 | 65 |
"below n == {i. i < n}" |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
66 |
|
10007 | 67 |
lemma below_less_iff [iff]: "(i: below k) = (i < k)" |
68 |
by (simp add: below_def) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
69 |
|
10007 | 70 |
lemma below_0: "below 0 = {}" |
71 |
by (simp add: below_def) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
72 |
|
7761 | 73 |
lemma Sigma_Suc1: |
10007 | 74 |
"m = n + 1 ==> below m <*> B = ({n} <*> B) Un (below n <*> B)" |
75 |
by (simp add: below_def less_Suc_eq) blast |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
76 |
|
7761 | 77 |
lemma Sigma_Suc2: |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
78 |
"m = n + 2 ==> A <*> below m = |
10007 | 79 |
(A <*> {n}) Un (A <*> {n + 1}) Un (A <*> below n)" |
13187 | 80 |
by (auto simp add: below_def) |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
81 |
|
10007 | 82 |
lemmas Sigma_Suc = Sigma_Suc1 Sigma_Suc2 |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
83 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
84 |
|
10007 | 85 |
subsection {* Basic properties of ``evnodd'' *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
86 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
87 |
constdefs |
7385 | 88 |
evnodd :: "(nat * nat) set => nat => (nat * nat) set" |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
89 |
"evnodd A b == A Int {(i, j). (i + j) mod 2 = b}" |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
90 |
|
7761 | 91 |
lemma evnodd_iff: |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
92 |
"(i, j): evnodd A b = ((i, j): A & (i + j) mod 2 = b)" |
10007 | 93 |
by (simp add: evnodd_def) |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
94 |
|
10007 | 95 |
lemma evnodd_subset: "evnodd A b <= A" |
96 |
by (unfold evnodd_def, rule Int_lower1) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
97 |
|
10007 | 98 |
lemma evnoddD: "x : evnodd A b ==> x : A" |
99 |
by (rule subsetD, rule evnodd_subset) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
100 |
|
10007 | 101 |
lemma evnodd_finite: "finite A ==> finite (evnodd A b)" |
102 |
by (rule finite_subset, rule evnodd_subset) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
103 |
|
10007 | 104 |
lemma evnodd_Un: "evnodd (A Un B) b = evnodd A b Un evnodd B b" |
105 |
by (unfold evnodd_def) blast |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
106 |
|
10007 | 107 |
lemma evnodd_Diff: "evnodd (A - B) b = evnodd A b - evnodd B b" |
108 |
by (unfold evnodd_def) blast |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
109 |
|
10007 | 110 |
lemma evnodd_empty: "evnodd {} b = {}" |
111 |
by (simp add: evnodd_def) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
112 |
|
7385 | 113 |
lemma evnodd_insert: "evnodd (insert (i, j) C) b = |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
114 |
(if (i + j) mod 2 = b |
10007 | 115 |
then insert (i, j) (evnodd C b) else evnodd C b)" |
32456
341c83339aeb
tuned the simp rules for Int involving insert and intervals.
nipkow
parents:
31758
diff
changeset
|
116 |
by (simp add: evnodd_def) |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
117 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
118 |
|
10007 | 119 |
subsection {* Dominoes *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
120 |
|
23746 | 121 |
inductive_set |
10007 | 122 |
domino :: "(nat * nat) set set" |
23746 | 123 |
where |
10408 | 124 |
horiz: "{(i, j), (i, j + 1)} : domino" |
23746 | 125 |
| vertl: "{(i, j), (i + 1, j)} : domino" |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
126 |
|
7800 | 127 |
lemma dominoes_tile_row: |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
128 |
"{i} <*> below (2 * n) : tiling domino" |
11987 | 129 |
(is "?B n : ?T") |
10007 | 130 |
proof (induct n) |
11987 | 131 |
case 0 |
132 |
show ?case by (simp add: below_0 tiling.empty) |
|
133 |
next |
|
134 |
case (Suc n) |
|
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
135 |
let ?a = "{i} <*> {2 * n + 1} Un {i} <*> {2 * n}" |
10007 | 136 |
have "?B (Suc n) = ?a Un ?B n" |
137 |
by (auto simp add: Sigma_Suc Un_assoc) |
|
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
138 |
moreover have "... : ?T" |
10007 | 139 |
proof (rule tiling.Un) |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
140 |
have "{(i, 2 * n), (i, 2 * n + 1)} : domino" |
10007 | 141 |
by (rule domino.horiz) |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
142 |
also have "{(i, 2 * n), (i, 2 * n + 1)} = ?a" by blast |
10007 | 143 |
finally show "... : domino" . |
11987 | 144 |
show "?B n : ?T" by (rule Suc) |
10007 | 145 |
show "?a <= - ?B n" by blast |
146 |
qed |
|
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
147 |
ultimately show ?case by simp |
10007 | 148 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
149 |
|
7761 | 150 |
lemma dominoes_tile_matrix: |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
151 |
"below m <*> below (2 * n) : tiling domino" |
11987 | 152 |
(is "?B m : ?T") |
10007 | 153 |
proof (induct m) |
11987 | 154 |
case 0 |
155 |
show ?case by (simp add: below_0 tiling.empty) |
|
156 |
next |
|
157 |
case (Suc m) |
|
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
158 |
let ?t = "{m} <*> below (2 * n)" |
10007 | 159 |
have "?B (Suc m) = ?t Un ?B m" by (simp add: Sigma_Suc) |
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
160 |
moreover have "... : ?T" |
10408 | 161 |
proof (rule tiling_Un) |
10007 | 162 |
show "?t : ?T" by (rule dominoes_tile_row) |
11987 | 163 |
show "?B m : ?T" by (rule Suc) |
10007 | 164 |
show "?t Int ?B m = {}" by blast |
165 |
qed |
|
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
166 |
ultimately show ?case by simp |
10007 | 167 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
168 |
|
7761 | 169 |
lemma domino_singleton: |
18241 | 170 |
assumes d: "d : domino" and "b < 2" |
171 |
shows "EX i j. evnodd d b = {(i, j)}" (is "?P d") |
|
172 |
using d |
|
173 |
proof induct |
|
174 |
from `b < 2` have b_cases: "b = 0 | b = 1" by arith |
|
175 |
fix i j |
|
176 |
note [simp] = evnodd_empty evnodd_insert mod_Suc |
|
177 |
from b_cases show "?P {(i, j), (i, j + 1)}" by rule auto |
|
178 |
from b_cases show "?P {(i, j), (i + 1, j)}" by rule auto |
|
10007 | 179 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
180 |
|
18153 | 181 |
lemma domino_finite: |
18241 | 182 |
assumes d: "d: domino" |
18153 | 183 |
shows "finite d" |
18241 | 184 |
using d |
18192 | 185 |
proof induct |
186 |
fix i j :: nat |
|
22273 | 187 |
show "finite {(i, j), (i, j + 1)}" by (intro finite.intros) |
188 |
show "finite {(i, j), (i + 1, j)}" by (intro finite.intros) |
|
10007 | 189 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
190 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
191 |
|
10007 | 192 |
subsection {* Tilings of dominoes *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
193 |
|
7761 | 194 |
lemma tiling_domino_finite: |
18241 | 195 |
assumes t: "t : tiling domino" (is "t : ?T") |
18153 | 196 |
shows "finite t" (is "?F t") |
18241 | 197 |
using t |
18153 | 198 |
proof induct |
22273 | 199 |
show "?F {}" by (rule finite.emptyI) |
18153 | 200 |
fix a t assume "?F t" |
201 |
assume "a : domino" then have "?F a" by (rule domino_finite) |
|
23373 | 202 |
from this and `?F t` show "?F (a Un t)" by (rule finite_UnI) |
10007 | 203 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
204 |
|
7761 | 205 |
lemma tiling_domino_01: |
18241 | 206 |
assumes t: "t : tiling domino" (is "t : ?T") |
18153 | 207 |
shows "card (evnodd t 0) = card (evnodd t 1)" |
18241 | 208 |
using t |
18153 | 209 |
proof induct |
210 |
case empty |
|
211 |
show ?case by (simp add: evnodd_def) |
|
212 |
next |
|
213 |
case (Un a t) |
|
214 |
let ?e = evnodd |
|
215 |
note hyp = `card (?e t 0) = card (?e t 1)` |
|
216 |
and at = `a <= - t` |
|
217 |
have card_suc: |
|
218 |
"!!b. b < 2 ==> card (?e (a Un t) b) = Suc (card (?e t b))" |
|
219 |
proof - |
|
220 |
fix b :: nat assume "b < 2" |
|
221 |
have "?e (a Un t) b = ?e a b Un ?e t b" by (rule evnodd_Un) |
|
222 |
also obtain i j where e: "?e a b = {(i, j)}" |
|
10007 | 223 |
proof - |
23373 | 224 |
from `a \<in> domino` and `b < 2` |
18153 | 225 |
have "EX i j. ?e a b = {(i, j)}" by (rule domino_singleton) |
226 |
then show ?thesis by (blast intro: that) |
|
10007 | 227 |
qed |
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
228 |
moreover have "... Un ?e t b = insert (i, j) (?e t b)" by simp |
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
229 |
moreover have "card ... = Suc (card (?e t b))" |
18153 | 230 |
proof (rule card_insert_disjoint) |
23373 | 231 |
from `t \<in> tiling domino` have "finite t" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32456
diff
changeset
|
232 |
by (rule tiling_domino_finite) |
23373 | 233 |
then show "finite (?e t b)" |
234 |
by (rule evnodd_finite) |
|
18153 | 235 |
from e have "(i, j) : ?e a b" by simp |
236 |
with at show "(i, j) ~: ?e t b" by (blast dest: evnoddD) |
|
237 |
qed |
|
26813
6a4d5ca6d2e5
Rephrased calculational proofs to avoid problems with HO unification
berghofe
parents:
23746
diff
changeset
|
238 |
ultimately show "?thesis b" by simp |
10007 | 239 |
qed |
18153 | 240 |
then have "card (?e (a Un t) 0) = Suc (card (?e t 0))" by simp |
241 |
also from hyp have "card (?e t 0) = card (?e t 1)" . |
|
242 |
also from card_suc have "Suc ... = card (?e (a Un t) 1)" |
|
243 |
by simp |
|
244 |
finally show ?case . |
|
10007 | 245 |
qed |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
246 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
247 |
|
10007 | 248 |
subsection {* Main theorem *} |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
249 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
250 |
constdefs |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
251 |
mutilated_board :: "nat => nat => (nat * nat) set" |
7761 | 252 |
"mutilated_board m n == |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
253 |
below (2 * (m + 1)) <*> below (2 * (n + 1)) |
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
254 |
- {(0, 0)} - {(2 * m + 1, 2 * n + 1)}" |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
255 |
|
10007 | 256 |
theorem mutil_not_tiling: "mutilated_board m n ~: tiling domino" |
257 |
proof (unfold mutilated_board_def) |
|
258 |
let ?T = "tiling domino" |
|
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
259 |
let ?t = "below (2 * (m + 1)) <*> below (2 * (n + 1))" |
10007 | 260 |
let ?t' = "?t - {(0, 0)}" |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
261 |
let ?t'' = "?t' - {(2 * m + 1, 2 * n + 1)}" |
7761 | 262 |
|
10007 | 263 |
show "?t'' ~: ?T" |
264 |
proof |
|
265 |
have t: "?t : ?T" by (rule dominoes_tile_matrix) |
|
266 |
assume t'': "?t'' : ?T" |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
267 |
|
10007 | 268 |
let ?e = evnodd |
269 |
have fin: "finite (?e ?t 0)" |
|
270 |
by (rule evnodd_finite, rule tiling_domino_finite, rule t) |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
271 |
|
10007 | 272 |
note [simp] = evnodd_iff evnodd_empty evnodd_insert evnodd_Diff |
273 |
have "card (?e ?t'' 0) < card (?e ?t' 0)" |
|
274 |
proof - |
|
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
275 |
have "card (?e ?t' 0 - {(2 * m + 1, 2 * n + 1)}) |
10007 | 276 |
< card (?e ?t' 0)" |
277 |
proof (rule card_Diff1_less) |
|
10408 | 278 |
from _ fin show "finite (?e ?t' 0)" |
10007 | 279 |
by (rule finite_subset) auto |
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
280 |
show "(2 * m + 1, 2 * n + 1) : ?e ?t' 0" by simp |
10007 | 281 |
qed |
18153 | 282 |
then show ?thesis by simp |
10007 | 283 |
qed |
284 |
also have "... < card (?e ?t 0)" |
|
285 |
proof - |
|
286 |
have "(0, 0) : ?e ?t 0" by simp |
|
287 |
with fin have "card (?e ?t 0 - {(0, 0)}) < card (?e ?t 0)" |
|
288 |
by (rule card_Diff1_less) |
|
18153 | 289 |
then show ?thesis by simp |
10007 | 290 |
qed |
291 |
also from t have "... = card (?e ?t 1)" |
|
292 |
by (rule tiling_domino_01) |
|
293 |
also have "?e ?t 1 = ?e ?t'' 1" by simp |
|
294 |
also from t'' have "card ... = card (?e ?t'' 0)" |
|
295 |
by (rule tiling_domino_01 [symmetric]) |
|
18153 | 296 |
finally have "... < ..." . then show False .. |
10007 | 297 |
qed |
298 |
qed |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
299 |
|
10007 | 300 |
end |