src/HOL/Cardinals/Ordinal_Arithmetic.thy
changeset 61605 1bf7b186542e
parent 61068 6cb92c2a5ece
child 62390 842917225d56
equal deleted inserted replaced
61604:bb20f11dd842 61605:1bf7b186542e
   496   fixes r s
   496   fixes r s
   497   assumes rWELL: "Well_order r"
   497   assumes rWELL: "Well_order r"
   498   and     sWELL: "Well_order s"
   498   and     sWELL: "Well_order s"
   499 begin
   499 begin
   500 
   500 
   501 interpretation r!: wo_rel r by unfold_locales (rule rWELL)
   501 interpretation r: wo_rel r by unfold_locales (rule rWELL)
   502 interpretation s!: wo_rel s by unfold_locales (rule sWELL)
   502 interpretation s: wo_rel s by unfold_locales (rule sWELL)
   503 
   503 
   504 abbreviation "SUPP \<equiv> support r.zero (Field s)"
   504 abbreviation "SUPP \<equiv> support r.zero (Field s)"
   505 abbreviation "FINFUNC \<equiv> FinFunc r s"
   505 abbreviation "FINFUNC \<equiv> FinFunc r s"
   506 lemmas FINFUNCD = FinFuncD[of _ r s]
   506 lemmas FINFUNCD = FinFuncD[of _ r s]
   507 
   507 
  1132   let ?f = "map_sum id f"
  1132   let ?f = "map_sum id f"
  1133   from *(1) have "inj_on ?f (Field ?L)" unfolding Field_osum inj_on_def by fastforce
  1133   from *(1) have "inj_on ?f (Field ?L)" unfolding Field_osum inj_on_def by fastforce
  1134   moreover
  1134   moreover
  1135   from *(2,4) have "compat ?L ?R ?f" unfolding compat_def osum_def map_prod_def by fastforce
  1135   from *(2,4) have "compat ?L ?R ?f" unfolding compat_def osum_def map_prod_def by fastforce
  1136   moreover
  1136   moreover
  1137   interpret t!: wo_rel t by unfold_locales (rule t)
  1137   interpret t: wo_rel t by unfold_locales (rule t)
  1138   interpret rt!: wo_rel ?R by unfold_locales (rule osum_Well_order[OF r t])
  1138   interpret rt: wo_rel ?R by unfold_locales (rule osum_Well_order[OF r t])
  1139   from *(3) have "ofilter ?R (?f ` Field ?L)"
  1139   from *(3) have "ofilter ?R (?f ` Field ?L)"
  1140     unfolding t.ofilter_def rt.ofilter_def Field_osum image_Un image_image under_def
  1140     unfolding t.ofilter_def rt.ofilter_def Field_osum image_Un image_image under_def
  1141     by (auto simp: osum_def intro!: imageI) (auto simp: Field_def)
  1141     by (auto simp: osum_def intro!: imageI) (auto simp: Field_def)
  1142   ultimately have "embed ?L ?R ?f" using embed_iff_compat_inj_on_ofilter[of ?L ?R ?f]
  1142   ultimately have "embed ?L ?R ?f" using embed_iff_compat_inj_on_ofilter[of ?L ?R ?f]
  1143     by (auto intro: osum_Well_order r s t)
  1143     by (auto intro: osum_Well_order r s t)
  1198   from *(1) have "inj_on ?f (Field ?L)" unfolding Field_oprod inj_on_def by fastforce
  1198   from *(1) have "inj_on ?f (Field ?L)" unfolding Field_oprod inj_on_def by fastforce
  1199   moreover
  1199   moreover
  1200   from *(2,4) the_inv_into_f_f[OF *(1)] have "compat ?L ?R ?f" unfolding compat_def oprod_def
  1200   from *(2,4) the_inv_into_f_f[OF *(1)] have "compat ?L ?R ?f" unfolding compat_def oprod_def
  1201     by auto (metis well_order_on_domain t, metis well_order_on_domain s)
  1201     by auto (metis well_order_on_domain t, metis well_order_on_domain s)
  1202   moreover
  1202   moreover
  1203   interpret t!: wo_rel t by unfold_locales (rule t)
  1203   interpret t: wo_rel t by unfold_locales (rule t)
  1204   interpret rt!: wo_rel ?R by unfold_locales (rule oprod_Well_order[OF r t])
  1204   interpret rt: wo_rel ?R by unfold_locales (rule oprod_Well_order[OF r t])
  1205   from *(3) have "ofilter ?R (?f ` Field ?L)"
  1205   from *(3) have "ofilter ?R (?f ` Field ?L)"
  1206     unfolding t.ofilter_def rt.ofilter_def Field_oprod under_def
  1206     unfolding t.ofilter_def rt.ofilter_def Field_oprod under_def
  1207     by (auto simp: oprod_def image_iff) (fast | metis r well_order_on_domain)+
  1207     by (auto simp: oprod_def image_iff) (fast | metis r well_order_on_domain)+
  1208   ultimately have "embed ?L ?R ?f" using embed_iff_compat_inj_on_ofilter[of ?L ?R ?f]
  1208   ultimately have "embed ?L ?R ?f" using embed_iff_compat_inj_on_ofilter[of ?L ?R ?f]
  1209     by (auto intro: oprod_Well_order r s t)
  1209     by (auto intro: oprod_Well_order r s t)
  1275 
  1275 
  1276 lemma oexp_monoR:
  1276 lemma oexp_monoR:
  1277   assumes "oone <o r" "s <o t"
  1277   assumes "oone <o r" "s <o t"
  1278   shows   "r ^o s <o r ^o t" (is "?L <o ?R")
  1278   shows   "r ^o s <o r ^o t" (is "?L <o ?R")
  1279 proof -
  1279 proof -
  1280   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1280   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1281   interpret rt!: wo_rel2 r t by unfold_locales (rule r, rule t)
  1281   interpret rt: wo_rel2 r t by unfold_locales (rule r, rule t)
  1282   interpret rexpt!: wo_rel "r ^o t" by unfold_locales (rule rt.oexp_Well_order)
  1282   interpret rexpt: wo_rel "r ^o t" by unfold_locales (rule rt.oexp_Well_order)
  1283   interpret r!: wo_rel r by unfold_locales (rule r)
  1283   interpret r: wo_rel r by unfold_locales (rule r)
  1284   interpret s!: wo_rel s by unfold_locales (rule s)
  1284   interpret s: wo_rel s by unfold_locales (rule s)
  1285   interpret t!: wo_rel t by unfold_locales (rule t)
  1285   interpret t: wo_rel t by unfold_locales (rule t)
  1286   have "Field r \<noteq> {}" by (metis assms(1) internalize_ordLess not_psubset_empty)
  1286   have "Field r \<noteq> {}" by (metis assms(1) internalize_ordLess not_psubset_empty)
  1287   moreover
  1287   moreover
  1288   { assume "Field r = {r.zero}"
  1288   { assume "Field r = {r.zero}"
  1289     hence "r = {(r.zero, r.zero)}" using refl_onD[OF r.REFL, of r.zero] unfolding Field_def by auto
  1289     hence "r = {(r.zero, r.zero)}" using refl_onD[OF r.REFL, of r.zero] unfolding Field_def by auto
  1290     hence "r =o oone" by (metis oone_ordIso ordIso_symmetric)
  1290     hence "r =o oone" by (metis oone_ordIso ordIso_symmetric)
  1386 
  1386 
  1387 lemma oexp_monoL:
  1387 lemma oexp_monoL:
  1388   assumes "r \<le>o s"
  1388   assumes "r \<le>o s"
  1389   shows   "r ^o t \<le>o s ^o t"
  1389   shows   "r ^o t \<le>o s ^o t"
  1390 proof -
  1390 proof -
  1391   interpret rt!: wo_rel2 r t by unfold_locales (rule r, rule t)
  1391   interpret rt: wo_rel2 r t by unfold_locales (rule r, rule t)
  1392   interpret st!: wo_rel2 s t by unfold_locales (rule s, rule t)
  1392   interpret st: wo_rel2 s t by unfold_locales (rule s, rule t)
  1393   interpret r!: wo_rel r by unfold_locales (rule r)
  1393   interpret r: wo_rel r by unfold_locales (rule r)
  1394   interpret s!: wo_rel s by unfold_locales (rule s)
  1394   interpret s: wo_rel s by unfold_locales (rule s)
  1395   interpret t!: wo_rel t by unfold_locales (rule t)
  1395   interpret t: wo_rel t by unfold_locales (rule t)
  1396   show ?thesis
  1396   show ?thesis
  1397   proof (cases "t = {}")
  1397   proof (cases "t = {}")
  1398     case True thus ?thesis using r s unfolding ordLeq_def2 underS_def by auto
  1398     case True thus ?thesis using r s unfolding ordLeq_def2 underS_def by auto
  1399   next
  1399   next
  1400     case False thus ?thesis
  1400     case False thus ?thesis
  1451 
  1451 
  1452 lemma ordLeq_oexp2:
  1452 lemma ordLeq_oexp2:
  1453   assumes "oone <o r"
  1453   assumes "oone <o r"
  1454   shows   "s \<le>o r ^o s"
  1454   shows   "s \<le>o r ^o s"
  1455 proof -
  1455 proof -
  1456   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1456   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1457   interpret r!: wo_rel r by unfold_locales (rule r)
  1457   interpret r: wo_rel r by unfold_locales (rule r)
  1458   interpret s!: wo_rel s by unfold_locales (rule s)
  1458   interpret s: wo_rel s by unfold_locales (rule s)
  1459   from assms well_order_on_domain[OF r] obtain x where
  1459   from assms well_order_on_domain[OF r] obtain x where
  1460     x: "x \<in> Field r" "r.zero \<in> Field r" "x \<noteq> r.zero"
  1460     x: "x \<in> Field r" "r.zero \<in> Field r" "x \<noteq> r.zero"
  1461     unfolding ordLess_def oone_def embedS_def[abs_def] bij_betw_def embed_def under_def
  1461     unfolding ordLess_def oone_def embedS_def[abs_def] bij_betw_def embed_def under_def
  1462     by (auto simp: image_def)
  1462     by (auto simp: image_def)
  1463        (metis (lifting) equals0D mem_Collect_eq r.zero_in_Field singletonI)
  1463        (metis (lifting) equals0D mem_Collect_eq r.zero_in_Field singletonI)
  1509   assumes "wo_rel.max_fun_diff (s +o t) (case_sum f1 g1) (case_sum f2 g2) = Inl x"
  1509   assumes "wo_rel.max_fun_diff (s +o t) (case_sum f1 g1) (case_sum f2 g2) = Inl x"
  1510     "case_sum f1 g1 \<noteq> case_sum f2 g2"
  1510     "case_sum f1 g1 \<noteq> case_sum f2 g2"
  1511     "case_sum f1 g1 \<in> FinFunc r (s +o t)" "case_sum f2 g2 \<in> FinFunc r (s +o t)"
  1511     "case_sum f1 g1 \<in> FinFunc r (s +o t)" "case_sum f2 g2 \<in> FinFunc r (s +o t)"
  1512   shows "wo_rel.max_fun_diff s f1 f2 = x" (is ?P) "g1 = g2" (is ?Q)
  1512   shows "wo_rel.max_fun_diff s f1 f2 = x" (is ?P) "g1 = g2" (is ?Q)
  1513 proof -
  1513 proof -
  1514   interpret st!: wo_rel "s +o t" by unfold_locales (rule osum_Well_order[OF s t])
  1514   interpret st: wo_rel "s +o t" by unfold_locales (rule osum_Well_order[OF s t])
  1515   interpret s!: wo_rel s by unfold_locales (rule s)
  1515   interpret s: wo_rel s by unfold_locales (rule s)
  1516   interpret rst!: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1516   interpret rst: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1517   from assms(1) have *: "st.isMaxim {a \<in> Field (s +o t). case_sum f1 g1 a \<noteq> case_sum f2 g2 a} (Inl x)"
  1517   from assms(1) have *: "st.isMaxim {a \<in> Field (s +o t). case_sum f1 g1 a \<noteq> case_sum f2 g2 a} (Inl x)"
  1518     using rst.isMaxim_max_fun_diff[OF assms(2-4)] by simp
  1518     using rst.isMaxim_max_fun_diff[OF assms(2-4)] by simp
  1519   hence "s.isMaxim {a \<in> Field s. f1 a \<noteq> f2 a} x"
  1519   hence "s.isMaxim {a \<in> Field s. f1 a \<noteq> f2 a} x"
  1520     unfolding st.isMaxim_def s.isMaxim_def Field_osum by (auto simp: osum_def)
  1520     unfolding st.isMaxim_def s.isMaxim_def Field_osum by (auto simp: osum_def)
  1521   thus ?P unfolding s.max_fun_diff_def by (rule s.maxim_equality)
  1521   thus ?P unfolding s.max_fun_diff_def by (rule s.maxim_equality)
  1533   assumes "wo_rel.max_fun_diff (s +o t) (case_sum f1 g1) (case_sum f2 g2) = Inr x"
  1533   assumes "wo_rel.max_fun_diff (s +o t) (case_sum f1 g1) (case_sum f2 g2) = Inr x"
  1534     "case_sum f1 g1 \<noteq> case_sum f2 g2"
  1534     "case_sum f1 g1 \<noteq> case_sum f2 g2"
  1535     "case_sum f1 g1 \<in> FinFunc r (s +o t)" "case_sum f2 g2 \<in> FinFunc r (s +o t)"
  1535     "case_sum f1 g1 \<in> FinFunc r (s +o t)" "case_sum f2 g2 \<in> FinFunc r (s +o t)"
  1536   shows "wo_rel.max_fun_diff t g1 g2 = x" (is ?P) "g1 \<noteq> g2" (is ?Q)
  1536   shows "wo_rel.max_fun_diff t g1 g2 = x" (is ?P) "g1 \<noteq> g2" (is ?Q)
  1537 proof -
  1537 proof -
  1538   interpret st!: wo_rel "s +o t" by unfold_locales (rule osum_Well_order[OF s t])
  1538   interpret st: wo_rel "s +o t" by unfold_locales (rule osum_Well_order[OF s t])
  1539   interpret t!: wo_rel t by unfold_locales (rule t)
  1539   interpret t: wo_rel t by unfold_locales (rule t)
  1540   interpret rst!: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1540   interpret rst: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1541   from assms(1) have *: "st.isMaxim {a \<in> Field (s +o t). case_sum f1 g1 a \<noteq> case_sum f2 g2 a} (Inr x)"
  1541   from assms(1) have *: "st.isMaxim {a \<in> Field (s +o t). case_sum f1 g1 a \<noteq> case_sum f2 g2 a} (Inr x)"
  1542     using rst.isMaxim_max_fun_diff[OF assms(2-4)] by simp
  1542     using rst.isMaxim_max_fun_diff[OF assms(2-4)] by simp
  1543   hence "t.isMaxim {a \<in> Field t. g1 a \<noteq> g2 a} x"
  1543   hence "t.isMaxim {a \<in> Field t. g1 a \<noteq> g2 a} x"
  1544     unfolding st.isMaxim_def t.isMaxim_def Field_osum by (auto simp: osum_def)
  1544     unfolding st.isMaxim_def t.isMaxim_def Field_osum by (auto simp: osum_def)
  1545   thus ?P ?Q unfolding t.max_fun_diff_def fun_eq_iff
  1545   thus ?P ?Q unfolding t.max_fun_diff_def fun_eq_iff
  1546     by (auto intro: t.maxim_equality simp: t.isMaxim_def)
  1546     by (auto intro: t.maxim_equality simp: t.isMaxim_def)
  1547 qed
  1547 qed
  1548 
  1548 
  1549 lemma oexp_osum: "r ^o (s +o t) =o (r ^o s) *o (r ^o t)" (is "?R =o ?L")
  1549 lemma oexp_osum: "r ^o (s +o t) =o (r ^o s) *o (r ^o t)" (is "?R =o ?L")
  1550 proof (rule ordIso_symmetric)
  1550 proof (rule ordIso_symmetric)
  1551   interpret rst!: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1551   interpret rst: wo_rel2 r "s +o t" by unfold_locales (rule r, rule osum_Well_order[OF s t])
  1552   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1552   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1553   interpret rt!: wo_rel2 r t by unfold_locales (rule r, rule t)
  1553   interpret rt: wo_rel2 r t by unfold_locales (rule r, rule t)
  1554   let ?f = "\<lambda>(f, g). case_sum f g"
  1554   let ?f = "\<lambda>(f, g). case_sum f g"
  1555   have "bij_betw ?f (Field ?L) (Field ?R)"
  1555   have "bij_betw ?f (Field ?L) (Field ?R)"
  1556   unfolding bij_betw_def rst.Field_oexp rs.Field_oexp rt.Field_oexp Field_oprod proof (intro conjI)
  1556   unfolding bij_betw_def rst.Field_oexp rs.Field_oexp rt.Field_oexp Field_oprod proof (intro conjI)
  1557     show "inj_on ?f (FinFunc r s \<times> FinFunc r t)" unfolding inj_on_def
  1557     show "inj_on ?f (FinFunc r s \<times> FinFunc r t)" unfolding inj_on_def
  1558       by (auto simp: fun_eq_iff split: sum.splits)
  1558       by (auto simp: fun_eq_iff split: sum.splits)
  1579 
  1579 
  1580 lemma rev_curr_FinFunc:
  1580 lemma rev_curr_FinFunc:
  1581   assumes Field: "Field r \<noteq> {}"
  1581   assumes Field: "Field r \<noteq> {}"
  1582   shows "rev_curr ` (FinFunc r (s *o t)) = FinFunc (r ^o s) t"
  1582   shows "rev_curr ` (FinFunc r (s *o t)) = FinFunc (r ^o s) t"
  1583 proof safe
  1583 proof safe
  1584   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1584   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1585   interpret rst!: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1585   interpret rst: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1586   fix g assume g: "g \<in> FinFunc r (s *o t)"
  1586   fix g assume g: "g \<in> FinFunc r (s *o t)"
  1587   hence "finite (rst.SUPP (rev_curr g))" "\<forall>x \<in> Field t. finite (rs.SUPP (rev_curr g x))"
  1587   hence "finite (rst.SUPP (rev_curr g))" "\<forall>x \<in> Field t. finite (rs.SUPP (rev_curr g x))"
  1588     unfolding FinFunc_def Field_oprod rs.Field_oexp Func_def fin_support_def support_def
  1588     unfolding FinFunc_def Field_oprod rs.Field_oexp Func_def fin_support_def support_def
  1589       rs.zero_oexp[OF Field] rev_curr_def by (auto simp: fun_eq_iff rs.const_def elim!: finite_surj)
  1589       rs.zero_oexp[OF Field] rev_curr_def by (auto simp: fun_eq_iff rs.const_def elim!: finite_surj)
  1590   with g show "rev_curr g \<in> FinFunc (r ^o s) t"
  1590   with g show "rev_curr g \<in> FinFunc (r ^o s) t"
  1591     unfolding FinFunc_def Field_oprod rs.Field_oexp Func_def
  1591     unfolding FinFunc_def Field_oprod rs.Field_oexp Func_def
  1592     by (auto simp: rev_curr_def fin_support_def)
  1592     by (auto simp: rev_curr_def fin_support_def)
  1593 next
  1593 next
  1594   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1594   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1595   interpret rst!: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1595   interpret rst: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1596   fix fg assume *: "fg \<in> FinFunc (r ^o s) t"
  1596   fix fg assume *: "fg \<in> FinFunc (r ^o s) t"
  1597   let ?g = "\<lambda>(a, b). if (a, b) \<in> Field (s *o t) then fg b a else undefined"
  1597   let ?g = "\<lambda>(a, b). if (a, b) \<in> Field (s *o t) then fg b a else undefined"
  1598   show "fg \<in> rev_curr ` FinFunc r (s *o t)"
  1598   show "fg \<in> rev_curr ` FinFunc r (s *o t)"
  1599   proof (rule image_eqI[of _ _ ?g])
  1599   proof (rule image_eqI[of _ _ ?g])
  1600     show "fg = rev_curr ?g"
  1600     show "fg = rev_curr ?g"
  1629   assumes Field: "Field r \<noteq> {}" and "f \<noteq> g" "f \<in> FinFunc r (s *o t)" "g \<in> FinFunc r (s *o t)"
  1629   assumes Field: "Field r \<noteq> {}" and "f \<noteq> g" "f \<in> FinFunc r (s *o t)" "g \<in> FinFunc r (s *o t)"
  1630   defines "m \<equiv> wo_rel.max_fun_diff t (rev_curr f) (rev_curr g)"
  1630   defines "m \<equiv> wo_rel.max_fun_diff t (rev_curr f) (rev_curr g)"
  1631   shows "wo_rel.max_fun_diff (s *o t) f g =
  1631   shows "wo_rel.max_fun_diff (s *o t) f g =
  1632     (wo_rel.max_fun_diff s (rev_curr f m) (rev_curr g m), m)"
  1632     (wo_rel.max_fun_diff s (rev_curr f m) (rev_curr g m), m)"
  1633 proof -
  1633 proof -
  1634   interpret st!: wo_rel "s *o t" by unfold_locales (rule oprod_Well_order[OF s t])
  1634   interpret st: wo_rel "s *o t" by unfold_locales (rule oprod_Well_order[OF s t])
  1635   interpret s!: wo_rel s by unfold_locales (rule s)
  1635   interpret s: wo_rel s by unfold_locales (rule s)
  1636   interpret t!: wo_rel t by unfold_locales (rule t)
  1636   interpret t: wo_rel t by unfold_locales (rule t)
  1637   interpret r_st!: wo_rel2 r "s *o t" by unfold_locales (rule r, rule oprod_Well_order[OF s t])
  1637   interpret r_st: wo_rel2 r "s *o t" by unfold_locales (rule r, rule oprod_Well_order[OF s t])
  1638   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1638   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1639   interpret rst!: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1639   interpret rst: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1640   from fun_unequal_in_support[OF assms(2), of "Field (s *o t)" "Field r" "Field r"] assms(3,4)
  1640   from fun_unequal_in_support[OF assms(2), of "Field (s *o t)" "Field r" "Field r"] assms(3,4)
  1641     have diff1: "rev_curr f \<noteq> rev_curr g"
  1641     have diff1: "rev_curr f \<noteq> rev_curr g"
  1642       "rev_curr f \<in> FinFunc (r ^o s) t" "rev_curr g \<in> FinFunc (r ^o s) t" using rev_curr_FinFunc[OF Field]
  1642       "rev_curr f \<in> FinFunc (r ^o s) t" "rev_curr g \<in> FinFunc (r ^o s) t" using rev_curr_FinFunc[OF Field]
  1643     unfolding fun_eq_iff rev_curr_def[abs_def] FinFunc_def support_def Field_oprod
  1643     unfolding fun_eq_iff rev_curr_def[abs_def] FinFunc_def support_def Field_oprod
  1644     by auto fast
  1644     by auto fast
  1666 qed
  1666 qed
  1667 
  1667 
  1668 lemma oexp_oexp: "(r ^o s) ^o t =o r ^o (s *o t)" (is "?R =o ?L")
  1668 lemma oexp_oexp: "(r ^o s) ^o t =o r ^o (s *o t)" (is "?R =o ?L")
  1669 proof (cases "r = {}")
  1669 proof (cases "r = {}")
  1670   case True
  1670   case True
  1671   interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1671   interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1672   interpret rst!: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1672   interpret rst: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1673   show ?thesis
  1673   show ?thesis
  1674   proof (cases "s = {} \<or> t = {}")
  1674   proof (cases "s = {} \<or> t = {}")
  1675     case True with `r = {}` show ?thesis
  1675     case True with `r = {}` show ?thesis
  1676       by (auto simp: oexp_empty[OF oexp_Well_order[OF Well_order_empty s]]
  1676       by (auto simp: oexp_empty[OF oexp_Well_order[OF Well_order_empty s]]
  1677         intro!: ordIso_transitive[OF ordIso_symmetric[OF oone_ordIso] oone_ordIso]
  1677         intro!: ordIso_transitive[OF ordIso_symmetric[OF oone_ordIso] oone_ordIso]
  1685 next
  1685 next
  1686   case False
  1686   case False
  1687   hence Field: "Field r \<noteq> {}" by (metis Field_def Range_empty_iff Un_empty)
  1687   hence Field: "Field r \<noteq> {}" by (metis Field_def Range_empty_iff Un_empty)
  1688   show ?thesis
  1688   show ?thesis
  1689   proof (rule ordIso_symmetric)
  1689   proof (rule ordIso_symmetric)
  1690     interpret r_st!: wo_rel2 r "s *o t" by unfold_locales (rule r, rule oprod_Well_order[OF s t])
  1690     interpret r_st: wo_rel2 r "s *o t" by unfold_locales (rule r, rule oprod_Well_order[OF s t])
  1691     interpret rs!: wo_rel2 r s by unfold_locales (rule r, rule s)
  1691     interpret rs: wo_rel2 r s by unfold_locales (rule r, rule s)
  1692     interpret rst!: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1692     interpret rst: wo_rel2 "r ^o s" t by unfold_locales (rule oexp_Well_order[OF r s], rule t)
  1693     have bij: "bij_betw rev_curr (Field ?L) (Field ?R)"
  1693     have bij: "bij_betw rev_curr (Field ?L) (Field ?R)"
  1694     unfolding bij_betw_def r_st.Field_oexp rst.Field_oexp Field_oprod proof (intro conjI)
  1694     unfolding bij_betw_def r_st.Field_oexp rst.Field_oexp Field_oprod proof (intro conjI)
  1695       show "inj_on rev_curr (FinFunc r (s *o t))"
  1695       show "inj_on rev_curr (FinFunc r (s *o t))"
  1696         unfolding inj_on_def FinFunc_def Func_def Field_oprod rs.Field_oexp rev_curr_def[abs_def]
  1696         unfolding inj_on_def FinFunc_def Func_def Field_oprod rs.Field_oexp rev_curr_def[abs_def]
  1697         by (auto simp: fun_eq_iff) metis
  1697         by (auto simp: fun_eq_iff) metis