src/HOL/Isar_examples/MutilatedCheckerboard.thy
changeset 23373 ead82c82da9e
parent 22273 9785397cc344
child 23746 a455e69c31cc
equal deleted inserted replaced
23372:0035be079bee 23373:ead82c82da9e
    41   next
    41   next
    42     case (Un a t)
    42     case (Un a t)
    43     show "(a Un t) Un u : ?T"
    43     show "(a Un t) Un u : ?T"
    44     proof -
    44     proof -
    45       have "a Un (t Un u) : ?T"
    45       have "a Un (t Un u) : ?T"
       
    46 	using `a : A`
    46       proof (rule tiling.Un)
    47       proof (rule tiling.Un)
    47         show "a : A" .
       
    48         from `(a Un t) Int u = {}` have "t Int u = {}" by blast
    48         from `(a Un t) Int u = {}` have "t Int u = {}" by blast
    49         then show "t Un u: ?T" by (rule Un)
    49         then show "t Un u: ?T" by (rule Un)
    50         have "a <= - t" .
    50         from `a <= - t` and `(a Un t) Int u = {}`
    51         with `(a Un t) Int u = {}` show "a <= - (t Un u)" by blast
    51 	show "a <= - (t Un u)" by blast
    52       qed
    52       qed
    53       also have "a Un (t Un u) = (a Un t) Un u"
    53       also have "a Un (t Un u) = (a Un t) Un u"
    54         by (simp only: Un_assoc)
    54         by (simp only: Un_assoc)
    55       finally show ?thesis .
    55       finally show ?thesis .
    56     qed
    56     qed
   199   using t
   199   using t
   200 proof induct
   200 proof induct
   201   show "?F {}" by (rule finite.emptyI)
   201   show "?F {}" by (rule finite.emptyI)
   202   fix a t assume "?F t"
   202   fix a t assume "?F t"
   203   assume "a : domino" then have "?F a" by (rule domino_finite)
   203   assume "a : domino" then have "?F a" by (rule domino_finite)
   204   then show "?F (a Un t)" by (rule finite_UnI)
   204   from this and `?F t` show "?F (a Un t)" by (rule finite_UnI)
   205 qed
   205 qed
   206 
   206 
   207 lemma tiling_domino_01:
   207 lemma tiling_domino_01:
   208   assumes t: "t : tiling domino"  (is "t : ?T")
   208   assumes t: "t : tiling domino"  (is "t : ?T")
   209   shows "card (evnodd t 0) = card (evnodd t 1)"
   209   shows "card (evnodd t 0) = card (evnodd t 1)"
   221   proof -
   221   proof -
   222     fix b :: nat assume "b < 2"
   222     fix b :: nat assume "b < 2"
   223     have "?e (a Un t) b = ?e a b Un ?e t b" by (rule evnodd_Un)
   223     have "?e (a Un t) b = ?e a b Un ?e t b" by (rule evnodd_Un)
   224     also obtain i j where e: "?e a b = {(i, j)}"
   224     also obtain i j where e: "?e a b = {(i, j)}"
   225     proof -
   225     proof -
       
   226       from `a \<in> domino` and `b < 2`
   226       have "EX i j. ?e a b = {(i, j)}" by (rule domino_singleton)
   227       have "EX i j. ?e a b = {(i, j)}" by (rule domino_singleton)
   227       then show ?thesis by (blast intro: that)
   228       then show ?thesis by (blast intro: that)
   228     qed
   229     qed
   229     also have "... Un ?e t b = insert (i, j) (?e t b)" by simp
   230     also have "... Un ?e t b = insert (i, j) (?e t b)" by simp
   230     also have "card ... = Suc (card (?e t b))"
   231     also have "card ... = Suc (card (?e t b))"
   231     proof (rule card_insert_disjoint)
   232     proof (rule card_insert_disjoint)
   232       show "finite (?e t b)"
   233       from `t \<in> tiling domino` have "finite t"
   233         by (rule evnodd_finite, rule tiling_domino_finite)
   234 	by (rule tiling_domino_finite)
       
   235       then show "finite (?e t b)"
       
   236         by (rule evnodd_finite)
   234       from e have "(i, j) : ?e a b" by simp
   237       from e have "(i, j) : ?e a b" by simp
   235       with at show "(i, j) ~: ?e t b" by (blast dest: evnoddD)
   238       with at show "(i, j) ~: ?e t b" by (blast dest: evnoddD)
   236     qed
   239     qed
   237     finally show "?thesis b" .
   240     finally show "?thesis b" .
   238   qed
   241   qed