author | wenzelm |
Sun, 30 Jul 2000 13:03:49 +0200 | |
changeset 9475 | b24516d96847 |
parent 8814 | 0a5edcbe0695 |
child 9596 | 6d6bf351b2cc |
permissions | -rw-r--r-- |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
1 |
(* Title: HOL/Isar_examples/MutilatedCheckerboard.thy |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
2 |
ID: $Id$ |
7385 | 3 |
Author: Markus Wenzel, TU Muenchen (Isar document) |
4 |
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
|
5 |
*) |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
6 |
|
7761 | 7 |
header {* The Mutilated Checker Board Problem *}; |
8 |
||
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
9 |
theory MutilatedCheckerboard = Main:; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
10 |
|
7968 | 11 |
text {* |
12 |
The Mutilated Checker Board Problem, formalized inductively. See |
|
13 |
\cite{paulson-mutilated-board} and |
|
14 |
\url{http://isabelle.in.tum.de/library/HOL/Induct/Mutil.html} for the |
|
15 |
original tactic script version. |
|
16 |
*}; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
17 |
|
7761 | 18 |
subsection {* Tilings *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
19 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
20 |
consts |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
21 |
tiling :: "'a set set => 'a set set"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
22 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
23 |
inductive "tiling A" |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
24 |
intrs |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
25 |
empty: "{} : tiling A" |
8814 | 26 |
Un: "a : A ==> t : tiling A ==> a <= - t |
7800 | 27 |
==> a Un t : tiling A"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
28 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
29 |
|
7800 | 30 |
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
|
31 |
|
7761 | 32 |
lemma tiling_Un: |
7800 | 33 |
"t : tiling A --> u : tiling A --> t Int u = {} |
34 |
--> t Un u : tiling A"; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
35 |
proof; |
7480 | 36 |
assume "t : tiling A" (is "_ : ?T"); |
37 |
thus "u : ?T --> t Int u = {} --> t Un u : ?T" (is "?P t"); |
|
9475 | 38 |
proof (induct (stripped) t); |
39 |
assume "u : ?T" "{} Int u = {}" |
|
40 |
thus "{} Un u : ?T" by simp; |
|
41 |
next |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
42 |
fix a t; |
7480 | 43 |
assume "a : A" "t : ?T" "?P t" "a <= - t"; |
9475 | 44 |
assume "u : ?T" "(a Un t) Int u = {}"; |
45 |
have hyp: "t Un u: ?T"; by (blast!); |
|
46 |
have "a <= - (t Un u)"; by (blast!); |
|
47 |
with _ hyp; have "a Un (t Un u) : ?T"; by (rule tiling.Un); |
|
48 |
also; have "a Un (t Un u) = (a Un t) Un u"; |
|
49 |
by (simp only: Un_assoc); |
|
50 |
finally; show "... : ?T"; .; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
51 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
52 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
53 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
54 |
|
7874 | 55 |
subsection {* Basic properties of ``below'' *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
56 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
57 |
constdefs |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
58 |
below :: "nat => nat set" |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
59 |
"below n == {i. i < n}"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
60 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
61 |
lemma below_less_iff [iff]: "(i: below k) = (i < k)"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
62 |
by (simp add: below_def); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
63 |
|
7385 | 64 |
lemma below_0: "below 0 = {}"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
65 |
by (simp add: below_def); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
66 |
|
7761 | 67 |
lemma Sigma_Suc1: |
8814 | 68 |
"m = n + 1 ==> below m <*> B = ({n} <*> B) Un (below n <*> B)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
69 |
by (simp add: below_def less_Suc_eq) blast; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
70 |
|
7761 | 71 |
lemma Sigma_Suc2: |
8814 | 72 |
"m = n + 2 ==> A <*> below m = (A <*> {n}) Un (A <*> {n + 1}) Un (A <*> below n)"; |
73 |
by (auto simp add: below_def) arith; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
74 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
75 |
lemmas Sigma_Suc = Sigma_Suc1 Sigma_Suc2; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
76 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
77 |
|
7874 | 78 |
subsection {* Basic properties of ``evnodd'' *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
79 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
80 |
constdefs |
7385 | 81 |
evnodd :: "(nat * nat) set => nat => (nat * nat) set" |
8814 | 82 |
"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
|
83 |
|
7761 | 84 |
lemma evnodd_iff: |
8814 | 85 |
"(i, j): evnodd A b = ((i, j): A & (i + j) mod #2 = b)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
86 |
by (simp add: evnodd_def); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
87 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
88 |
lemma evnodd_subset: "evnodd A b <= A"; |
7385 | 89 |
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
|
90 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
91 |
lemma evnoddD: "x : evnodd A b ==> x : A"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
92 |
by (rule subsetD, rule evnodd_subset); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
93 |
|
7385 | 94 |
lemma evnodd_finite: "finite A ==> finite (evnodd A b)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
95 |
by (rule finite_subset, rule evnodd_subset); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
96 |
|
7385 | 97 |
lemma evnodd_Un: "evnodd (A Un B) b = evnodd A b Un evnodd B b"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
98 |
by (unfold evnodd_def) blast; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
99 |
|
7385 | 100 |
lemma evnodd_Diff: "evnodd (A - B) b = evnodd A b - evnodd B b"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
101 |
by (unfold evnodd_def) blast; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
102 |
|
7385 | 103 |
lemma evnodd_empty: "evnodd {} b = {}"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
104 |
by (simp add: evnodd_def); |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
105 |
|
7385 | 106 |
lemma evnodd_insert: "evnodd (insert (i, j) C) b = |
8814 | 107 |
(if (i + j) mod #2 = b |
7761 | 108 |
then insert (i, j) (evnodd C b) else evnodd C b)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
109 |
by (simp add: evnodd_def) blast; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
110 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
111 |
|
7761 | 112 |
subsection {* Dominoes *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
113 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
114 |
consts |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
115 |
domino :: "(nat * nat) set set"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
116 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
117 |
inductive domino |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
118 |
intrs |
7385 | 119 |
horiz: "{(i, j), (i, j + 1)} : domino" |
120 |
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
|
121 |
|
7800 | 122 |
lemma dominoes_tile_row: |
8703 | 123 |
"{i} <*> below (2 * n) : tiling domino" |
7480 | 124 |
(is "?P n" is "?B n : ?T"); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
125 |
proof (induct n); |
7480 | 126 |
show "?P 0"; by (simp add: below_0 tiling.empty); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
127 |
|
7480 | 128 |
fix n; assume hyp: "?P n"; |
8703 | 129 |
let ?a = "{i} <*> {2 * n + 1} Un {i} <*> {2 * n}"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
130 |
|
8814 | 131 |
have "?B (Suc n) = ?a Un ?B n"; |
132 |
by (auto simp add: Sigma_Suc Un_assoc); |
|
7480 | 133 |
also; have "... : ?T"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
134 |
proof (rule tiling.Un); |
7761 | 135 |
have "{(i, 2 * n), (i, 2 * n + 1)} : domino"; |
136 |
by (rule domino.horiz); |
|
7480 | 137 |
also; have "{(i, 2 * n), (i, 2 * n + 1)} = ?a"; by blast; |
7385 | 138 |
finally; show "... : domino"; .; |
7480 | 139 |
from hyp; show "?B n : ?T"; .; |
9475 | 140 |
show "?a <= - ?B n"; by blast; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
141 |
qed; |
7480 | 142 |
finally; show "?P (Suc n)"; .; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
143 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
144 |
|
7761 | 145 |
lemma dominoes_tile_matrix: |
8703 | 146 |
"below m <*> below (2 * n) : tiling domino" |
7480 | 147 |
(is "?P m" is "?B m : ?T"); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
148 |
proof (induct m); |
7480 | 149 |
show "?P 0"; by (simp add: below_0 tiling.empty); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
150 |
|
7480 | 151 |
fix m; assume hyp: "?P m"; |
8703 | 152 |
let ?t = "{m} <*> below (2 * n)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
153 |
|
7480 | 154 |
have "?B (Suc m) = ?t Un ?B m"; by (simp add: Sigma_Suc); |
155 |
also; have "... : ?T"; |
|
7385 | 156 |
proof (rule tiling_Un [rulify]); |
7480 | 157 |
show "?t : ?T"; by (rule dominoes_tile_row); |
158 |
from hyp; show "?B m : ?T"; .; |
|
159 |
show "?t Int ?B m = {}"; by blast; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
160 |
qed; |
7480 | 161 |
finally; show "?P (Suc m)"; .; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
162 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
163 |
|
7761 | 164 |
lemma domino_singleton: |
8814 | 165 |
"d : domino ==> b < 2 ==> EX i j. evnodd d b = {(i, j)}"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
166 |
proof -; |
7565 | 167 |
assume b: "b < 2"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
168 |
assume "d : domino"; |
7480 | 169 |
thus ?thesis (is "?P d"); |
8297 | 170 |
proof induct; |
7565 | 171 |
from b; have b_cases: "b = 0 | b = 1"; by arith; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
172 |
fix i j; |
7385 | 173 |
note [simp] = evnodd_empty evnodd_insert mod_Suc; |
7480 | 174 |
from b_cases; show "?P {(i, j), (i, j + 1)}"; by rule auto; |
175 |
from b_cases; show "?P {(i, j), (i + 1, j)}"; by rule auto; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
176 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
177 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
178 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
179 |
lemma domino_finite: "d: domino ==> finite d"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
180 |
proof (induct set: domino); |
7434 | 181 |
fix i j :: nat; |
7385 | 182 |
show "finite {(i, j), (i, j + 1)}"; by (intro Finites.intrs); |
183 |
show "finite {(i, j), (i + 1, j)}"; by (intro Finites.intrs); |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
184 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
185 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
186 |
|
7761 | 187 |
subsection {* Tilings of dominoes *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
188 |
|
7761 | 189 |
lemma tiling_domino_finite: |
190 |
"t : tiling domino ==> finite t" (is "t : ?T ==> ?F t"); |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
191 |
proof -; |
7480 | 192 |
assume "t : ?T"; |
193 |
thus "?F t"; |
|
8297 | 194 |
proof induct; |
7480 | 195 |
show "?F {}"; by (rule Finites.emptyI); |
196 |
fix a t; assume "?F t"; |
|
197 |
assume "a : domino"; hence "?F a"; by (rule domino_finite); |
|
198 |
thus "?F (a Un t)"; by (rule finite_UnI); |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
199 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
200 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
201 |
|
7761 | 202 |
lemma tiling_domino_01: |
203 |
"t : tiling domino ==> card (evnodd t 0) = card (evnodd t 1)" |
|
7480 | 204 |
(is "t : ?T ==> ?P t"); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
205 |
proof -; |
7480 | 206 |
assume "t : ?T"; |
207 |
thus "?P t"; |
|
8297 | 208 |
proof induct; |
7480 | 209 |
show "?P {}"; by (simp add: evnodd_def); |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
210 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
211 |
fix a t; |
7480 | 212 |
let ?e = evnodd; |
213 |
assume "a : domino" "t : ?T" |
|
214 |
and hyp: "card (?e t 0) = card (?e t 1)" |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
215 |
and "a <= - t"; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
216 |
|
7761 | 217 |
have card_suc: |
218 |
"!!b. b < 2 ==> card (?e (a Un t) b) = Suc (card (?e t b))"; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
219 |
proof -; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
220 |
fix b; assume "b < 2"; |
9475 | 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 a b = {(i, j)}"; |
|
223 |
proof -; |
|
224 |
have "EX i j. ?e a b = {(i, j)}"; by (rule domino_singleton); |
|
225 |
thus ?thesis; by blast; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
226 |
qed; |
9475 | 227 |
also; have "... Un ?e t b = insert (i, j) (?e t b)"; by simp; |
228 |
also; have "card ... = Suc (card (?e t b))"; |
|
229 |
proof (rule card_insert_disjoint); |
|
230 |
show "finite (?e t b)"; |
|
231 |
by (rule evnodd_finite, rule tiling_domino_finite); |
|
232 |
have "(i, j) : ?e a b"; by (simp!); |
|
233 |
thus "(i, j) ~: ?e t b"; by (blast! dest: evnoddD); |
|
234 |
qed; |
|
235 |
finally; show "?thesis b"; .; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
236 |
qed; |
7480 | 237 |
hence "card (?e (a Un t) 0) = Suc (card (?e t 0))"; by simp; |
238 |
also; from hyp; have "card (?e t 0) = card (?e t 1)"; .; |
|
7761 | 239 |
also; from card_suc; have "Suc ... = card (?e (a Un t) 1)"; |
240 |
by simp; |
|
7480 | 241 |
finally; show "?P (a Un t)"; .; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
242 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
243 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
244 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
245 |
|
7761 | 246 |
subsection {* Main theorem *}; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
247 |
|
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
248 |
constdefs |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
249 |
mutilated_board :: "nat => nat => (nat * nat) set" |
7761 | 250 |
"mutilated_board m n == |
8703 | 251 |
below (2 * (m + 1)) <*> below (2 * (n + 1)) |
7761 | 252 |
- {(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
|
253 |
|
7385 | 254 |
theorem mutil_not_tiling: "mutilated_board m n ~: tiling domino"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
255 |
proof (unfold mutilated_board_def); |
7480 | 256 |
let ?T = "tiling domino"; |
8703 | 257 |
let ?t = "below (2 * (m + 1)) <*> below (2 * (n + 1))"; |
7480 | 258 |
let ?t' = "?t - {(0, 0)}"; |
259 |
let ?t'' = "?t' - {(2 * m + 1, 2 * n + 1)}"; |
|
7761 | 260 |
|
7480 | 261 |
show "?t'' ~: ?T"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
262 |
proof; |
7480 | 263 |
have t: "?t : ?T"; by (rule dominoes_tile_matrix); |
264 |
assume t'': "?t'' : ?T"; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
265 |
|
7480 | 266 |
let ?e = evnodd; |
7761 | 267 |
have fin: "finite (?e ?t 0)"; |
268 |
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
|
269 |
|
7385 | 270 |
note [simp] = evnodd_iff evnodd_empty evnodd_insert evnodd_Diff; |
7480 | 271 |
have "card (?e ?t'' 0) < card (?e ?t' 0)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
272 |
proof -; |
7800 | 273 |
have "card (?e ?t' 0 - {(2 * m + 1, 2 * n + 1)}) |
274 |
< card (?e ?t' 0)"; |
|
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
275 |
proof (rule card_Diff1_less); |
8674 | 276 |
from _ fin; show "finite (?e ?t' 0)"; |
9475 | 277 |
by (rule finite_subset) auto; |
7480 | 278 |
show "(2 * m + 1, 2 * n + 1) : ?e ?t' 0"; by simp; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
279 |
qed; |
7480 | 280 |
thus ?thesis; by simp; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
281 |
qed; |
7480 | 282 |
also; have "... < card (?e ?t 0)"; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
283 |
proof -; |
7480 | 284 |
have "(0, 0) : ?e ?t 0"; by simp; |
7761 | 285 |
with fin; have "card (?e ?t 0 - {(0, 0)}) < card (?e ?t 0)"; |
286 |
by (rule card_Diff1_less); |
|
7480 | 287 |
thus ?thesis; by simp; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
288 |
qed; |
7800 | 289 |
also; from t; have "... = card (?e ?t 1)"; |
290 |
by (rule tiling_domino_01); |
|
7480 | 291 |
also; have "?e ?t 1 = ?e ?t'' 1"; by simp; |
7761 | 292 |
also; from t''; have "card ... = card (?e ?t'' 0)"; |
293 |
by (rule tiling_domino_01 [RS sym]); |
|
7874 | 294 |
finally; have "... < ..."; .; thus False; ..; |
7382
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
295 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
296 |
qed; |
33c01075d343
The Mutilated Chess Board Problem -- Isar'ized version of HOL/Inductive/Mutil;
wenzelm
parents:
diff
changeset
|
297 |
|
7383 | 298 |
end; |