author popescua Tue May 28 16:56:49 2013 +0200 (2013-05-28) changeset 52203 055c392e79cf parent 52200 6324f30e23b6 child 52204 a3bad3bb9276
fixed broken Cardinals and BNF due to Order_Union
```     1.1 --- a/src/HOL/Cardinals/Constructions_on_Wellorders.thy	Tue May 28 13:22:06 2013 +0200
1.2 +++ b/src/HOL/Cardinals/Constructions_on_Wellorders.thy	Tue May 28 16:56:49 2013 +0200
1.3 @@ -188,376 +188,7 @@
1.4    qed
1.5  qed
1.6
1.7 -
1.8 -subsection {* Ordinal-like sum of two (disjoint) well-orders *}
1.9 -
1.10 -text{* This is roughly obtained by ``concatenating" the two well-orders -- thus, all elements
1.11 -of the first will be smaller than all elements of the second.  This construction
1.12 -only makes sense if the fields of the two well-order relations are disjoint. *}
1.13 -
1.14 -definition Osum :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a rel"  (infix "Osum" 60)
1.15 -where
1.16 -"r Osum r' = r \<union> r' \<union> {(a,a'). a \<in> Field r \<and> a' \<in> Field r'}"
1.17 -
1.18 -abbreviation Osum2 :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a rel" (infix "\<union>o" 60)
1.19 -where "r \<union>o r' \<equiv> r Osum r'"
1.20 -
1.21 -lemma Field_Osum: "Field(r Osum r') = Field r \<union> Field r'"
1.22 -unfolding Osum_def Field_def by blast
1.23 -
1.24 -lemma Osum_Refl:
1.25 -assumes FLD: "Field r Int Field r' = {}" and
1.26 -        REFL: "Refl r" and REFL': "Refl r'"
1.27 -shows "Refl (r Osum r')"
1.28 -using assms  (* Need first unfold Field_Osum, only then Osum_def *)
1.29 -unfolding refl_on_def  Field_Osum unfolding Osum_def by blast
1.30 -
1.31 -lemma Osum_trans:
1.32 -assumes FLD: "Field r Int Field r' = {}" and
1.33 -        TRANS: "trans r" and TRANS': "trans r'"
1.34 -shows "trans (r Osum r')"
1.35 -proof(unfold trans_def, auto)
1.36 -  fix x y z assume *: "(x, y) \<in> r \<union>o r'" and **: "(y, z) \<in> r \<union>o r'"
1.37 -  show  "(x, z) \<in> r \<union>o r'"
1.38 -  proof-
1.39 -    {assume Case1: "(x,y) \<in> r"
1.40 -     hence 1: "x \<in> Field r \<and> y \<in> Field r" unfolding Field_def by auto
1.41 -     have ?thesis
1.42 -     proof-
1.43 -       {assume Case11: "(y,z) \<in> r"
1.44 -        hence "(x,z) \<in> r" using Case1 TRANS trans_def[of r] by blast
1.45 -        hence ?thesis unfolding Osum_def by auto
1.46 -       }
1.47 -       moreover
1.48 -       {assume Case12: "(y,z) \<in> r'"
1.49 -        hence "y \<in> Field r'" unfolding Field_def by auto
1.50 -        hence False using FLD 1 by auto
1.51 -       }
1.52 -       moreover
1.53 -       {assume Case13: "z \<in> Field r'"
1.54 -        hence ?thesis using 1 unfolding Osum_def by auto
1.55 -       }
1.56 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.57 -     qed
1.58 -    }
1.59 -    moreover
1.60 -    {assume Case2: "(x,y) \<in> r'"
1.61 -     hence 2: "x \<in> Field r' \<and> y \<in> Field r'" unfolding Field_def by auto
1.62 -     have ?thesis
1.63 -     proof-
1.64 -       {assume Case21: "(y,z) \<in> r"
1.65 -        hence "y \<in> Field r" unfolding Field_def by auto
1.66 -        hence False using FLD 2 by auto
1.67 -       }
1.68 -       moreover
1.69 -       {assume Case22: "(y,z) \<in> r'"
1.70 -        hence "(x,z) \<in> r'" using Case2 TRANS' trans_def[of r'] by blast
1.71 -        hence ?thesis unfolding Osum_def by auto
1.72 -       }
1.73 -       moreover
1.74 -       {assume Case23: "y \<in> Field r"
1.75 -        hence False using FLD 2 by auto
1.76 -       }
1.77 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.78 -     qed
1.79 -    }
1.80 -    moreover
1.81 -    {assume Case3: "x \<in> Field r \<and> y \<in> Field r'"
1.82 -     have ?thesis
1.83 -     proof-
1.84 -       {assume Case31: "(y,z) \<in> r"
1.85 -        hence "y \<in> Field r" unfolding Field_def by auto
1.86 -        hence False using FLD Case3 by auto
1.87 -       }
1.88 -       moreover
1.89 -       {assume Case32: "(y,z) \<in> r'"
1.90 -        hence "z \<in> Field r'" unfolding Field_def by blast
1.91 -        hence ?thesis unfolding Osum_def using Case3 by auto
1.92 -       }
1.93 -       moreover
1.94 -       {assume Case33: "y \<in> Field r"
1.95 -        hence False using FLD Case3 by auto
1.96 -       }
1.97 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.98 -     qed
1.99 -    }
1.100 -    ultimately show ?thesis using * unfolding Osum_def by blast
1.101 -  qed
1.102 -qed
1.103 -
1.104 -lemma Osum_Preorder:
1.105 -"\<lbrakk>Field r Int Field r' = {}; Preorder r; Preorder r'\<rbrakk> \<Longrightarrow> Preorder (r Osum r')"
1.106 -unfolding preorder_on_def using Osum_Refl Osum_trans by blast
1.107 -
1.108 -lemma Osum_antisym:
1.109 -assumes FLD: "Field r Int Field r' = {}" and
1.110 -        AN: "antisym r" and AN': "antisym r'"
1.111 -shows "antisym (r Osum r')"
1.112 -proof(unfold antisym_def, auto)
1.113 -  fix x y assume *: "(x, y) \<in> r \<union>o r'" and **: "(y, x) \<in> r \<union>o r'"
1.114 -  show  "x = y"
1.115 -  proof-
1.116 -    {assume Case1: "(x,y) \<in> r"
1.117 -     hence 1: "x \<in> Field r \<and> y \<in> Field r" unfolding Field_def by auto
1.118 -     have ?thesis
1.119 -     proof-
1.120 -       have "(y,x) \<in> r \<Longrightarrow> ?thesis"
1.121 -       using Case1 AN antisym_def[of r] by blast
1.122 -       moreover
1.123 -       {assume "(y,x) \<in> r'"
1.124 -        hence "y \<in> Field r'" unfolding Field_def by auto
1.125 -        hence False using FLD 1 by auto
1.126 -       }
1.127 -       moreover
1.128 -       have "x \<in> Field r' \<Longrightarrow> False" using FLD 1 by auto
1.129 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.130 -     qed
1.131 -    }
1.132 -    moreover
1.133 -    {assume Case2: "(x,y) \<in> r'"
1.134 -     hence 2: "x \<in> Field r' \<and> y \<in> Field r'" unfolding Field_def by auto
1.135 -     have ?thesis
1.136 -     proof-
1.137 -       {assume "(y,x) \<in> r"
1.138 -        hence "y \<in> Field r" unfolding Field_def by auto
1.139 -        hence False using FLD 2 by auto
1.140 -       }
1.141 -       moreover
1.142 -       have "(y,x) \<in> r' \<Longrightarrow> ?thesis"
1.143 -       using Case2 AN' antisym_def[of r'] by blast
1.144 -       moreover
1.145 -       {assume "y \<in> Field r"
1.146 -        hence False using FLD 2 by auto
1.147 -       }
1.148 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.149 -     qed
1.150 -    }
1.151 -    moreover
1.152 -    {assume Case3: "x \<in> Field r \<and> y \<in> Field r'"
1.153 -     have ?thesis
1.154 -     proof-
1.155 -       {assume "(y,x) \<in> r"
1.156 -        hence "y \<in> Field r" unfolding Field_def by auto
1.157 -        hence False using FLD Case3 by auto
1.158 -       }
1.159 -       moreover
1.160 -       {assume Case32: "(y,x) \<in> r'"
1.161 -        hence "x \<in> Field r'" unfolding Field_def by blast
1.162 -        hence False using FLD Case3 by auto
1.163 -       }
1.164 -       moreover
1.165 -       have "\<not> y \<in> Field r" using FLD Case3 by auto
1.166 -       ultimately show ?thesis using ** unfolding Osum_def by blast
1.167 -     qed
1.168 -    }
1.169 -    ultimately show ?thesis using * unfolding Osum_def by blast
1.170 -  qed
1.171 -qed
1.172 -
1.173 -lemma Osum_Partial_order:
1.174 -"\<lbrakk>Field r Int Field r' = {}; Partial_order r; Partial_order r'\<rbrakk> \<Longrightarrow>
1.175 - Partial_order (r Osum r')"
1.176 -unfolding partial_order_on_def using Osum_Preorder Osum_antisym by blast
1.177 -
1.178 -lemma Osum_Total:
1.179 -assumes FLD: "Field r Int Field r' = {}" and
1.180 -        TOT: "Total r" and TOT': "Total r'"
1.181 -shows "Total (r Osum r')"
1.182 -using assms
1.183 -unfolding total_on_def  Field_Osum unfolding Osum_def by blast
1.184 -
1.185 -lemma Osum_Linear_order:
1.186 -"\<lbrakk>Field r Int Field r' = {}; Linear_order r; Linear_order r'\<rbrakk> \<Longrightarrow>
1.187 - Linear_order (r Osum r')"
1.188 -unfolding linear_order_on_def using Osum_Partial_order Osum_Total by blast
1.189 -
1.190 -lemma Osum_wf:
1.191 -assumes FLD: "Field r Int Field r' = {}" and
1.192 -        WF: "wf r" and WF': "wf r'"
1.193 -shows "wf (r Osum r')"
1.194 -unfolding wf_eq_minimal2 unfolding Field_Osum
1.195 -proof(intro allI impI, elim conjE)
1.196 -  fix A assume *: "A \<subseteq> Field r \<union> Field r'" and **: "A \<noteq> {}"
1.197 -  obtain B where B_def: "B = A Int Field r" by blast
1.198 -  show "\<exists>a\<in>A. \<forall>a'\<in>A. (a', a) \<notin> r \<union>o r'"
1.199 -  proof(cases "B = {}")
1.200 -    assume Case1: "B \<noteq> {}"
1.201 -    hence "B \<noteq> {} \<and> B \<le> Field r" using B_def by auto
1.202 -    then obtain a where 1: "a \<in> B" and 2: "\<forall>a1 \<in> B. (a1,a) \<notin> r"
1.203 -    using WF  unfolding wf_eq_minimal2 by metis
1.204 -    hence 3: "a \<in> Field r \<and> a \<notin> Field r'" using B_def FLD by auto
1.205 -    (*  *)
1.206 -    have "\<forall>a1 \<in> A. (a1,a) \<notin> r Osum r'"
1.207 -    proof(intro ballI)
1.208 -      fix a1 assume **: "a1 \<in> A"
1.209 -      {assume Case11: "a1 \<in> Field r"
1.210 -       hence "(a1,a) \<notin> r" using B_def ** 2 by auto
1.211 -       moreover
1.212 -       have "(a1,a) \<notin> r'" using 3 by (auto simp add: Field_def)
1.213 -       ultimately have "(a1,a) \<notin> r Osum r'"
1.214 -       using 3 unfolding Osum_def by auto
1.215 -      }
1.216 -      moreover
1.217 -      {assume Case12: "a1 \<notin> Field r"
1.218 -       hence "(a1,a) \<notin> r" unfolding Field_def by auto
1.219 -       moreover
1.220 -       have "(a1,a) \<notin> r'" using 3 unfolding Field_def by auto
1.221 -       ultimately have "(a1,a) \<notin> r Osum r'"
1.222 -       using 3 unfolding Osum_def by auto
1.223 -      }
1.224 -      ultimately show "(a1,a) \<notin> r Osum r'" by blast
1.225 -    qed
1.226 -    thus ?thesis using 1 B_def by auto
1.227 -  next
1.228 -    assume Case2: "B = {}"
1.229 -    hence 1: "A \<noteq> {} \<and> A \<le> Field r'" using * ** B_def by auto
1.230 -    then obtain a' where 2: "a' \<in> A" and 3: "\<forall>a1' \<in> A. (a1',a') \<notin> r'"
1.231 -    using WF' unfolding wf_eq_minimal2 by metis
1.232 -    hence 4: "a' \<in> Field r' \<and> a' \<notin> Field r" using 1 FLD by blast
1.233 -    (*  *)
1.234 -    have "\<forall>a1' \<in> A. (a1',a') \<notin> r Osum r'"
1.235 -    proof(unfold Osum_def, auto simp add: 3)
1.236 -      fix a1' assume "(a1', a') \<in> r"
1.237 -      thus False using 4 unfolding Field_def by blast
1.238 -    next
1.239 -      fix a1' assume "a1' \<in> A" and "a1' \<in> Field r"
1.240 -      thus False using Case2 B_def by auto
1.241 -    qed
1.242 -    thus ?thesis using 2 by blast
1.243 -  qed
1.244 -qed
1.245 -
1.246 -lemma Osum_minus_Id:
1.247 -assumes TOT: "Total r" and TOT': "Total r'" and
1.248 -        NID: "\<not> (r \<le> Id)" and NID': "\<not> (r' \<le> Id)"
1.249 -shows "(r Osum r') - Id \<le> (r - Id) Osum (r' - Id)"
1.250 -proof-
1.251 -  {fix a a' assume *: "(a,a') \<in> (r Osum r')" and **: "a \<noteq> a'"
1.252 -   have "(a,a') \<in> (r - Id) Osum (r' - Id)"
1.253 -   proof-
1.254 -     {assume "(a,a') \<in> r \<or> (a,a') \<in> r'"
1.255 -      with ** have ?thesis unfolding Osum_def by auto
1.256 -     }
1.257 -     moreover
1.258 -     {assume "a \<in> Field r \<and> a' \<in> Field r'"
1.259 -      hence "a \<in> Field(r - Id) \<and> a' \<in> Field (r' - Id)"
1.260 -      using assms Total_Id_Field by blast
1.261 -      hence ?thesis unfolding Osum_def by auto
1.262 -     }
1.263 -     ultimately show ?thesis using * unfolding Osum_def by blast
1.264 -   qed
1.265 -  }
1.266 -  thus ?thesis by(auto simp add: Osum_def)
1.267 -qed
1.268 -
1.269 -lemma wf_Int_Times:
1.270 -assumes "A Int B = {}"
1.271 -shows "wf(A \<times> B)"
1.272 -proof(unfold wf_def mem_Sigma_iff, intro impI allI)
1.273 -  fix P x
1.274 -  assume *: "\<forall>x. (\<forall>y. y \<in> A \<and> x \<in> B \<longrightarrow> P y) \<longrightarrow> P x"
1.275 -  moreover have "\<forall>y \<in> A. P y" using assms * by blast
1.276 -  ultimately show "P x" using * by (case_tac "x \<in> B") blast+
1.277 -qed
1.278 -
1.279 -lemma Osum_minus_Id1:
1.280 -assumes "r \<le> Id"
1.281 -shows "(r Osum r') - Id \<le> (r' - Id) \<union> (Field r \<times> Field r')"
1.282 -proof-
1.283 -  let ?Left = "(r Osum r') - Id"
1.284 -  let ?Right = "(r' - Id) \<union> (Field r \<times> Field r')"
1.285 -  {fix a::'a and b assume *: "(a,b) \<notin> Id"
1.286 -   {assume "(a,b) \<in> r"
1.287 -    with * have False using assms by auto
1.288 -   }
1.289 -   moreover
1.290 -   {assume "(a,b) \<in> r'"
1.291 -    with * have "(a,b) \<in> r' - Id" by auto
1.292 -   }
1.293 -   ultimately
1.294 -   have "(a,b) \<in> ?Left \<Longrightarrow> (a,b) \<in> ?Right"
1.295 -   unfolding Osum_def by auto
1.296 -  }
1.297 -  thus ?thesis by auto
1.298 -qed
1.299 -
1.300 -lemma Osum_minus_Id2:
1.301 -assumes "r' \<le> Id"
1.302 -shows "(r Osum r') - Id \<le> (r - Id) \<union> (Field r \<times> Field r')"
1.303 -proof-
1.304 -  let ?Left = "(r Osum r') - Id"
1.305 -  let ?Right = "(r - Id) \<union> (Field r \<times> Field r')"
1.306 -  {fix a::'a and b assume *: "(a,b) \<notin> Id"
1.307 -   {assume "(a,b) \<in> r'"
1.308 -    with * have False using assms by auto
1.309 -   }
1.310 -   moreover
1.311 -   {assume "(a,b) \<in> r"
1.312 -    with * have "(a,b) \<in> r - Id" by auto
1.313 -   }
1.314 -   ultimately
1.315 -   have "(a,b) \<in> ?Left \<Longrightarrow> (a,b) \<in> ?Right"
1.316 -   unfolding Osum_def by auto
1.317 -  }
1.318 -  thus ?thesis by auto
1.319 -qed
1.320 -
1.321 -lemma Osum_wf_Id:
1.322 -assumes TOT: "Total r" and TOT': "Total r'" and
1.323 -        FLD: "Field r Int Field r' = {}" and
1.324 -        WF: "wf(r - Id)" and WF': "wf(r' - Id)"
1.325 -shows "wf ((r Osum r') - Id)"
1.326 -proof(cases "r \<le> Id \<or> r' \<le> Id")
1.327 -  assume Case1: "\<not>(r \<le> Id \<or> r' \<le> Id)"
1.328 -  have "Field(r - Id) Int Field(r' - Id) = {}"
1.329 -  using FLD mono_Field[of "r - Id" r]  mono_Field[of "r' - Id" r']
1.330 -            Diff_subset[of r Id] Diff_subset[of r' Id] by blast
1.331 -  thus ?thesis
1.332 -  using Case1 Osum_minus_Id[of r r'] assms Osum_wf[of "r - Id" "r' - Id"]
1.333 -        wf_subset[of "(r - Id) \<union>o (r' - Id)" "(r Osum r') - Id"] by auto
1.334 -next
1.335 -  have 1: "wf(Field r \<times> Field r')"
1.336 -  using FLD by (auto simp add: wf_Int_Times)
1.337 -  assume Case2: "r \<le> Id \<or> r' \<le> Id"
1.338 -  moreover
1.339 -  {assume Case21: "r \<le> Id"
1.340 -   hence "(r Osum r') - Id \<le> (r' - Id) \<union> (Field r \<times> Field r')"
1.341 -   using Osum_minus_Id1[of r r'] by simp
1.342 -   moreover
1.343 -   {have "Domain(Field r \<times> Field r') Int Range(r' - Id) = {}"
1.344 -    using FLD unfolding Field_def by blast
1.345 -    hence "wf((r' - Id) \<union> (Field r \<times> Field r'))"
1.346 -    using 1 WF' wf_Un[of "Field r \<times> Field r'" "r' - Id"]
1.347 -    by (auto simp add: Un_commute)
1.348 -   }
1.349 -   ultimately have ?thesis by (auto simp add: wf_subset)
1.350 -  }
1.351 -  moreover
1.352 -  {assume Case22: "r' \<le> Id"
1.353 -   hence "(r Osum r') - Id \<le> (r - Id) \<union> (Field r \<times> Field r')"
1.354 -   using Osum_minus_Id2[of r' r] by simp
1.355 -   moreover
1.356 -   {have "Range(Field r \<times> Field r') Int Domain(r - Id) = {}"
1.357 -    using FLD unfolding Field_def by blast
1.358 -    hence "wf((r - Id) \<union> (Field r \<times> Field r'))"
1.359 -    using 1 WF wf_Un[of "r - Id" "Field r \<times> Field r'"]
1.360 -    by (auto simp add: Un_commute)
1.361 -   }
1.362 -   ultimately have ?thesis by (auto simp add: wf_subset)
1.363 -  }
1.364 -  ultimately show ?thesis by blast
1.365 -qed
1.366 -
1.367 -lemma Osum_Well_order:
1.368 -assumes FLD: "Field r Int Field r' = {}" and
1.369 -        WELL: "Well_order r" and WELL': "Well_order r'"
1.370 -shows "Well_order (r Osum r')"
1.371 -proof-
1.372 -  have "Total r \<and> Total r'" using WELL WELL'
1.373 -  by (auto simp add: order_on_defs)
1.374 -  thus ?thesis using assms unfolding well_order_on_def
1.375 -  using Osum_Linear_order Osum_wf_Id by blast
1.376 -qed
1.377 +(* More facts on ordinal sum: *)
1.378
1.379  lemma Osum_embed:
1.380  assumes FLD: "Field r Int Field r' = {}" and
```