src/HOL/Cardinals/Cardinal_Order_Relation.thy
author wenzelm
Mon, 24 Oct 2022 20:37:32 +0200
changeset 76371 1ac2416e8432
parent 75624 22d1c5f2b9f4
child 76946 5df58a471d9e
permissions -rw-r--r--
tuned signature (again, amending f32ac01aef5e), e.g. relevant for Isabelle/DOF;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49310
6e30078de4f0 renamed "Ordinals_and_Cardinals" to "Cardinals"
blanchet
parents: 48979
diff changeset
     1
(*  Title:      HOL/Cardinals/Cardinal_Order_Relation.thy
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     2
    Author:     Andrei Popescu, TU Muenchen
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     3
    Copyright   2012
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     4
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     5
Cardinal-order relations.
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     6
*)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     7
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
     8
section \<open>Cardinal-Order Relations\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     9
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    10
theory Cardinal_Order_Relation
68652
1e37b45ce3fb normalize imports
traytel
parents: 67613
diff changeset
    11
imports Wellorder_Constructions
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    12
begin
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    13
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    14
declare
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    15
  card_order_on_well_order_on[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    16
  card_of_card_order_on[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    17
  card_of_well_order_on[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    18
  Field_card_of[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    19
  card_of_Card_order[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    20
  card_of_Well_order[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    21
  card_of_least[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    22
  card_of_unique[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    23
  card_of_mono1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    24
  card_of_mono2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    25
  card_of_cong[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    26
  card_of_Field_ordLess[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    27
  card_of_Field_ordIso[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    28
  card_of_underS[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    29
  ordLess_Field[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    30
  card_of_empty[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    31
  card_of_empty1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    32
  card_of_image[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    33
  card_of_singl_ordLeq[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    34
  Card_order_singl_ordLeq[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    35
  card_of_Pow[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    36
  Card_order_Pow[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    37
  card_of_Plus1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    38
  Card_order_Plus1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    39
  card_of_Plus2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    40
  Card_order_Plus2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    41
  card_of_Plus_mono1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    42
  card_of_Plus_mono2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    43
  card_of_Plus_mono[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    44
  card_of_Plus_cong2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    45
  card_of_Plus_cong[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    46
  card_of_Un_Plus_ordLeq[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    47
  card_of_Times1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    48
  card_of_Times2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    49
  card_of_Times3[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    50
  card_of_Times_mono1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    51
  card_of_Times_mono2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    52
  card_of_ordIso_finite[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    53
  card_of_Times_same_infinite[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    54
  card_of_Times_infinite_simps[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    55
  card_of_Plus_infinite1[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    56
  card_of_Plus_infinite2[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    57
  card_of_Plus_ordLess_infinite[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    58
  card_of_Plus_ordLess_infinite_Field[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    59
  infinite_cartesian_product[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    60
  cardSuc_Card_order[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    61
  cardSuc_greater[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    62
  cardSuc_ordLeq[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    63
  cardSuc_ordLeq_ordLess[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    64
  cardSuc_mono_ordLeq[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    65
  cardSuc_invar_ordIso[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    66
  card_of_cardSuc_finite[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    67
  cardSuc_finite[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    68
  card_of_Plus_ordLeq_infinite_Field[simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    69
  curr_in[intro, simp]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    70
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    71
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
    72
subsection \<open>Cardinal of a set\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    73
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    74
lemma card_of_inj_rel: assumes INJ: "\<And>x y y'. \<lbrakk>(x,y) \<in> R; (x,y') \<in> R\<rbrakk> \<Longrightarrow> y = y'"
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    75
shows "|{y. \<exists>x. (x,y) \<in> R}| <=o |{x. \<exists>y. (x,y) \<in> R}|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    76
proof-
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    77
  let ?Y = "{y. \<exists>x. (x,y) \<in> R}"  let ?X = "{x. \<exists>y. (x,y) \<in> R}"
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    78
  let ?f = "\<lambda>y. SOME x. (x,y) \<in> R"
51764
67f05cb13e08 optimized proofs
traytel
parents: 49310
diff changeset
    79
  have "?f ` ?Y <= ?X" by (auto dest: someI)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    80
  moreover have "inj_on ?f ?Y"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    81
  unfolding inj_on_def proof(auto)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    82
    fix y1 x1 y2 x2
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    83
    assume *: "(x1, y1) \<in> R" "(x2, y2) \<in> R" and **: "?f y1 = ?f y2"
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    84
    hence "(?f y1,y1) \<in> R" using someI[of "\<lambda>x. (x,y1) \<in> R"] by auto
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
    85
    moreover have "(?f y2,y2) \<in> R" using * someI[of "\<lambda>x. (x,y2) \<in> R"] by auto
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    86
    ultimately show "y1 = y2" using ** INJ by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    87
  qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    88
  ultimately show "|?Y| <=o |?X|" using card_of_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    89
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    90
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    91
lemma card_of_unique2: "\<lbrakk>card_order_on B r; bij_betw f A B\<rbrakk> \<Longrightarrow> r =o |A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    92
using card_of_ordIso card_of_unique ordIso_equivalence by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    93
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    94
lemma internalize_card_of_ordLess2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    95
"( |A| <o |C| ) = (\<exists>B < C. |A| =o |B| \<and> |B| <o |C| )"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    96
using internalize_card_of_ordLess[of "A" "|C|"] Field_card_of[of C] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    97
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    98
lemma Card_order_omax:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    99
assumes "finite R" and "R \<noteq> {}" and "\<forall>r\<in>R. Card_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   100
shows "Card_order (omax R)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   101
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   102
  have "\<forall>r\<in>R. Well_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   103
  using assms unfolding card_order_on_def by simp
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   104
  thus ?thesis using assms apply - apply(drule omax_in) by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   105
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   106
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   107
lemma Card_order_omax2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   108
assumes "finite I" and "I \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   109
shows "Card_order (omax {|A i| | i. i \<in> I})"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   110
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   111
  let ?R = "{|A i| | i. i \<in> I}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   112
  have "finite ?R" and "?R \<noteq> {}" using assms by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   113
  moreover have "\<forall>r\<in>?R. Card_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   114
  using card_of_Card_order by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   115
  ultimately show ?thesis by(rule Card_order_omax)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   116
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   117
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   118
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   119
subsection \<open>Cardinals versus set operations on arbitrary sets\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   120
54481
5c9819d7713b compile
blanchet
parents: 54475
diff changeset
   121
lemma card_of_set_type[simp]: "|UNIV::'a set| <o |UNIV::'a set set|"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   122
using card_of_Pow[of "UNIV::'a set"] by simp
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   123
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   124
lemma card_of_Un1[simp]:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   125
shows "|A| \<le>o |A \<union> B| "
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   126
using inj_on_id[of A] card_of_ordLeq[of A _] by fastforce
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   127
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   128
lemma card_of_diff[simp]:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   129
shows "|A - B| \<le>o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   130
using inj_on_id[of "A - B"] card_of_ordLeq[of "A - B" _] by fastforce
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   131
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   132
lemma subset_ordLeq_strict:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   133
assumes "A \<le> B" and "|A| <o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   134
shows "A < B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   135
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   136
  {assume "\<not>(A < B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   137
   hence "A = B" using assms(1) by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   138
   hence False using assms(2) not_ordLess_ordIso card_of_refl by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   139
  }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   140
  thus ?thesis by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   141
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   142
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   143
corollary subset_ordLeq_diff:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   144
assumes "A \<le> B" and "|A| <o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   145
shows "B - A \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   146
using assms subset_ordLeq_strict by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   147
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   148
lemma card_of_empty4:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   149
"|{}::'b set| <o |A::'a set| = (A \<noteq> {})"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   150
proof(intro iffI notI)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   151
  assume *: "|{}::'b set| <o |A|" and "A = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   152
  hence "|A| =o |{}::'b set|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   153
  using card_of_ordIso unfolding bij_betw_def inj_on_def by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   154
  hence "|{}::'b set| =o |A|" using ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   155
  with * show False using not_ordLess_ordIso[of "|{}::'b set|" "|A|"] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   156
next
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   157
  assume "A \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   158
  hence "(\<not> (\<exists>f. inj_on f A \<and> f ` A \<subseteq> {}))"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   159
  unfolding inj_on_def by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   160
  thus "| {} | <o | A |"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   161
  using card_of_ordLess by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   162
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   163
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   164
lemma card_of_empty5:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   165
"|A| <o |B| \<Longrightarrow> B \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   166
using card_of_empty not_ordLess_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   167
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   168
lemma Well_order_card_of_empty:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   169
"Well_order r \<Longrightarrow> |{}| \<le>o r" by simp
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   170
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   171
lemma card_of_UNIV[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   172
"|A :: 'a set| \<le>o |UNIV :: 'a set|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   173
using card_of_mono1[of A] by simp
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   174
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   175
lemma card_of_UNIV2[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   176
"Card_order r \<Longrightarrow> (r :: 'a rel) \<le>o |UNIV :: 'a set|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   177
using card_of_UNIV[of "Field r"] card_of_Field_ordIso
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   178
      ordIso_symmetric ordIso_ordLeq_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   179
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   180
lemma card_of_Pow_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   181
assumes "|A| \<le>o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   182
shows "|Pow A| \<le>o |Pow B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   183
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   184
  obtain f where "inj_on f A \<and> f ` A \<le> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   185
  using assms card_of_ordLeq[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   186
  hence "inj_on (image f) (Pow A) \<and> (image f) ` (Pow A) \<le> (Pow B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   187
  by (auto simp add: inj_on_image_Pow image_Pow_mono)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   188
  thus ?thesis using card_of_ordLeq[of "Pow A"] by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   189
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   190
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   191
lemma ordIso_Pow_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   192
assumes "r \<le>o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   193
shows "|Pow(Field r)| \<le>o |Pow(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   194
using assms card_of_mono2 card_of_Pow_mono by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   195
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   196
lemma card_of_Pow_cong[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   197
assumes "|A| =o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   198
shows "|Pow A| =o |Pow B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   199
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   200
  obtain f where "bij_betw f A B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   201
  using assms card_of_ordIso[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   202
  hence "bij_betw (image f) (Pow A) (Pow B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   203
  by (auto simp add: bij_betw_image_Pow)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   204
  thus ?thesis using card_of_ordIso[of "Pow A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   205
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   206
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   207
lemma ordIso_Pow_cong[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   208
assumes "r =o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   209
shows "|Pow(Field r)| =o |Pow(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   210
using assms card_of_cong card_of_Pow_cong by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   211
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   212
corollary Card_order_Plus_empty1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   213
"Card_order r \<Longrightarrow> r =o |(Field r) <+> {}|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   214
using card_of_Plus_empty1 card_of_Field_ordIso ordIso_equivalence by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   215
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   216
corollary Card_order_Plus_empty2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   217
"Card_order r \<Longrightarrow> r =o |{} <+> (Field r)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   218
using card_of_Plus_empty2 card_of_Field_ordIso ordIso_equivalence by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   219
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   220
lemma Card_order_Un1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   221
shows "Card_order r \<Longrightarrow> |Field r| \<le>o |(Field r) \<union> B| "
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   222
using card_of_Un1 card_of_Field_ordIso ordIso_symmetric ordIso_ordLeq_trans by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   223
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   224
lemma card_of_Un2[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   225
shows "|A| \<le>o |B \<union> A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   226
using inj_on_id[of A] card_of_ordLeq[of A _] by fastforce
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   227
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   228
lemma Card_order_Un2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   229
shows "Card_order r \<Longrightarrow> |Field r| \<le>o |A \<union> (Field r)| "
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   230
using card_of_Un2 card_of_Field_ordIso ordIso_symmetric ordIso_ordLeq_trans by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   231
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   232
lemma Un_Plus_bij_betw:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   233
assumes "A Int B = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   234
shows "\<exists>f. bij_betw f (A \<union> B) (A <+> B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   235
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   236
  let ?f = "\<lambda> c. if c \<in> A then Inl c else Inr c"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   237
  have "bij_betw ?f (A \<union> B) (A <+> B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   238
  using assms by(unfold bij_betw_def inj_on_def, auto)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   239
  thus ?thesis by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   240
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   241
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   242
lemma card_of_Un_Plus_ordIso:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   243
assumes "A Int B = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   244
shows "|A \<union> B| =o |A <+> B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   245
using assms card_of_ordIso[of "A \<union> B"] Un_Plus_bij_betw[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   246
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   247
lemma card_of_Un_Plus_ordIso1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   248
"|A \<union> B| =o |A <+> (B - A)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   249
using card_of_Un_Plus_ordIso[of A "B - A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   250
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   251
lemma card_of_Un_Plus_ordIso2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   252
"|A \<union> B| =o |(A - B) <+> B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   253
using card_of_Un_Plus_ordIso[of "A - B" B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   254
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   255
lemma card_of_Times_singl1: "|A| =o |A \<times> {b}|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   256
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   257
  have "bij_betw fst (A \<times> {b}) A" unfolding bij_betw_def inj_on_def by force
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   258
  thus ?thesis using card_of_ordIso ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   259
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   260
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   261
corollary Card_order_Times_singl1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   262
"Card_order r \<Longrightarrow> r =o |(Field r) \<times> {b}|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   263
using card_of_Times_singl1[of _ b] card_of_Field_ordIso ordIso_equivalence by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   264
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   265
lemma card_of_Times_singl2: "|A| =o |{b} \<times> A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   266
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   267
  have "bij_betw snd ({b} \<times> A) A" unfolding bij_betw_def inj_on_def by force
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   268
  thus ?thesis using card_of_ordIso ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   269
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   270
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   271
corollary Card_order_Times_singl2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   272
"Card_order r \<Longrightarrow> r =o |{a} \<times> (Field r)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   273
using card_of_Times_singl2[of _ a] card_of_Field_ordIso ordIso_equivalence by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   274
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   275
lemma card_of_Times_assoc: "|(A \<times> B) \<times> C| =o |A \<times> B \<times> C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   276
proof -
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   277
  let ?f = "\<lambda>((a,b),c). (a,(b,c))"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   278
  have "A \<times> B \<times> C \<subseteq> ?f ` ((A \<times> B) \<times> C)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   279
  proof
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   280
    fix x assume "x \<in> A \<times> B \<times> C"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   281
    then obtain a b c where *: "a \<in> A" "b \<in> B" "c \<in> C" "x = (a, b, c)" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   282
    let ?x = "((a, b), c)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   283
    from * have "?x \<in> (A \<times> B) \<times> C" "x = ?f ?x" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   284
    thus "x \<in> ?f ` ((A \<times> B) \<times> C)" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   285
  qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   286
  hence "bij_betw ?f ((A \<times> B) \<times> C) (A \<times> B \<times> C)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   287
  unfolding bij_betw_def inj_on_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   288
  thus ?thesis using card_of_ordIso by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   289
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   290
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   291
corollary Card_order_Times3:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   292
"Card_order r \<Longrightarrow> |Field r| \<le>o |(Field r) \<times> (Field r)|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   293
  by (rule card_of_Times3)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   294
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   295
lemma card_of_Times_cong1[simp]:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   296
assumes "|A| =o |B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   297
shows "|A \<times> C| =o |B \<times> C|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   298
using assms by (simp add: ordIso_iff_ordLeq)
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   299
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   300
lemma card_of_Times_cong2[simp]:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   301
assumes "|A| =o |B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   302
shows "|C \<times> A| =o |C \<times> B|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   303
using assms by (simp add: ordIso_iff_ordLeq)
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   304
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   305
lemma card_of_Times_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   306
assumes "|A| \<le>o |B|" and "|C| \<le>o |D|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   307
shows "|A \<times> C| \<le>o |B \<times> D|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   308
using assms card_of_Times_mono1[of A B C] card_of_Times_mono2[of C D B]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   309
      ordLeq_transitive[of "|A \<times> C|"] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   310
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   311
corollary ordLeq_Times_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   312
assumes "r \<le>o r'" and "p \<le>o p'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   313
shows "|(Field r) \<times> (Field p)| \<le>o |(Field r') \<times> (Field p')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   314
using assms card_of_mono2[of r r'] card_of_mono2[of p p'] card_of_Times_mono by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   315
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   316
corollary ordIso_Times_cong1[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   317
assumes "r =o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   318
shows "|(Field r) \<times> C| =o |(Field r') \<times> C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   319
using assms card_of_cong card_of_Times_cong1 by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   320
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   321
corollary ordIso_Times_cong2:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   322
assumes "r =o r'"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   323
shows "|A \<times> (Field r)| =o |A \<times> (Field r')|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   324
using assms card_of_cong card_of_Times_cong2 by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   325
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   326
lemma card_of_Times_cong[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   327
assumes "|A| =o |B|" and "|C| =o |D|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   328
shows "|A \<times> C| =o |B \<times> D|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   329
using assms
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   330
by (auto simp add: ordIso_iff_ordLeq)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   331
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   332
corollary ordIso_Times_cong:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   333
assumes "r =o r'" and "p =o p'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   334
shows "|(Field r) \<times> (Field p)| =o |(Field r') \<times> (Field p')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   335
using assms card_of_cong[of r r'] card_of_cong[of p p'] card_of_Times_cong by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   336
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   337
lemma card_of_Sigma_mono2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   338
assumes "inj_on f (I::'i set)" and "f ` I \<le> (J::'j set)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   339
shows "|SIGMA i : I. (A::'j \<Rightarrow> 'a set) (f i)| \<le>o |SIGMA j : J. A j|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   340
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   341
  let ?LEFT = "SIGMA i : I. A (f i)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   342
  let ?RIGHT = "SIGMA j : J. A j"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   343
  obtain u where u_def: "u = (\<lambda>(i::'i,a::'a). (f i,a))" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   344
  have "inj_on u ?LEFT \<and> u `?LEFT \<le> ?RIGHT"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   345
  using assms unfolding u_def inj_on_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   346
  thus ?thesis using card_of_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   347
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   348
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   349
lemma card_of_Sigma_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   350
assumes INJ: "inj_on f I" and IM: "f ` I \<le> J" and
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   351
        LEQ: "\<forall>j \<in> J. |A j| \<le>o |B j|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   352
shows "|SIGMA i : I. A (f i)| \<le>o |SIGMA j : J. B j|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   353
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   354
  have "\<forall>i \<in> I. |A(f i)| \<le>o |B(f i)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   355
  using IM LEQ by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   356
  hence "|SIGMA i : I. A (f i)| \<le>o |SIGMA i : I. B (f i)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   357
  using card_of_Sigma_mono1[of I] by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   358
  moreover have "|SIGMA i : I. B (f i)| \<le>o |SIGMA j : J. B j|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   359
  using INJ IM card_of_Sigma_mono2 by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   360
  ultimately show ?thesis using ordLeq_transitive by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   361
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   362
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   363
lemma ordLeq_Sigma_mono1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   364
assumes "\<forall>i \<in> I. p i \<le>o r i"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   365
shows "|SIGMA i : I. Field(p i)| \<le>o |SIGMA i : I. Field(r i)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   366
using assms by (auto simp add: card_of_Sigma_mono1)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   367
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   368
lemma ordLeq_Sigma_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   369
assumes "inj_on f I" and "f ` I \<le> J" and
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   370
        "\<forall>j \<in> J. p j \<le>o r j"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   371
shows "|SIGMA i : I. Field(p(f i))| \<le>o |SIGMA j : J. Field(r j)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   372
using assms card_of_mono2 card_of_Sigma_mono
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   373
      [of f I J "\<lambda> i. Field(p i)" "\<lambda> j. Field(r j)"] by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   374
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   375
lemma ordIso_Sigma_cong1:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   376
assumes "\<forall>i \<in> I. p i =o r i"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   377
shows "|SIGMA i : I. Field(p i)| =o |SIGMA i : I. Field(r i)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   378
using assms by (auto simp add: card_of_Sigma_cong1)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   379
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   380
lemma ordLeq_Sigma_cong:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   381
assumes "bij_betw f I J" and
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   382
        "\<forall>j \<in> J. p j =o r j"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   383
shows "|SIGMA i : I. Field(p(f i))| =o |SIGMA j : J. Field(r j)|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   384
using assms card_of_cong card_of_Sigma_cong
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   385
      [of f I J "\<lambda> j. Field(p j)" "\<lambda> j. Field(r j)"] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   386
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   387
lemma card_of_UNION_Sigma2:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   388
assumes
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   389
"!! i j. \<lbrakk>{i,j} <= I; i ~= j\<rbrakk> \<Longrightarrow> A i Int A j = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   390
shows
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   391
"|\<Union>i\<in>I. A i| =o |Sigma I A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   392
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   393
  let ?L = "\<Union>i\<in>I. A i"  let ?R = "Sigma I A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   394
  have "|?L| <=o |?R|" using card_of_UNION_Sigma .
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   395
  moreover have "|?R| <=o |?L|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   396
  proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   397
    have "inj_on snd ?R"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   398
    unfolding inj_on_def using assms by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   399
    moreover have "snd ` ?R <= ?L" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   400
    ultimately show ?thesis using card_of_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   401
  qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   402
  ultimately show ?thesis by(simp add: ordIso_iff_ordLeq)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   403
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   404
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   405
corollary Plus_into_Times:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   406
assumes A2: "a1 \<noteq> a2 \<and> {a1,a2} \<le> A" and
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   407
        B2: "b1 \<noteq> b2 \<and> {b1,b2} \<le> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   408
shows "\<exists>f. inj_on f (A <+> B) \<and> f ` (A <+> B) \<le> A \<times> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   409
using assms by (auto simp add: card_of_Plus_Times card_of_ordLeq)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   410
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   411
corollary Plus_into_Times_types:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   412
assumes A2: "(a1::'a) \<noteq> a2" and  B2: "(b1::'b) \<noteq> b2"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   413
shows "\<exists>(f::'a + 'b \<Rightarrow> 'a * 'b). inj f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   414
using assms Plus_into_Times[of a1 a2 UNIV b1 b2 UNIV]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   415
by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   416
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   417
corollary Times_same_infinite_bij_betw:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   418
assumes "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   419
shows "\<exists>f. bij_betw f (A \<times> A) A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   420
using assms by (auto simp add: card_of_ordIso)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   421
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   422
corollary Times_same_infinite_bij_betw_types:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   423
assumes INF: "\<not>finite(UNIV::'a set)"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   424
shows "\<exists>(f::('a * 'a) => 'a). bij f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   425
using assms Times_same_infinite_bij_betw[of "UNIV::'a set"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   426
by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   427
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   428
corollary Times_infinite_bij_betw:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   429
assumes INF: "\<not>finite A" and NE: "B \<noteq> {}" and INJ: "inj_on g B \<and> g ` B \<le> A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   430
shows "(\<exists>f. bij_betw f (A \<times> B) A) \<and> (\<exists>h. bij_betw h (B \<times> A) A)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   431
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   432
  have "|B| \<le>o |A|" using INJ card_of_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   433
  thus ?thesis using INF NE
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   434
  by (auto simp add: card_of_ordIso card_of_Times_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   435
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   436
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   437
corollary Times_infinite_bij_betw_types:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   438
assumes INF: "\<not>finite(UNIV::'a set)" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   439
        BIJ: "inj(g::'b \<Rightarrow> 'a)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   440
shows "(\<exists>(f::('b * 'a) => 'a). bij f) \<and> (\<exists>(h::('a * 'b) => 'a). bij h)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   441
using assms Times_infinite_bij_betw[of "UNIV::'a set" "UNIV::'b set" g]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   442
by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   443
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   444
lemma card_of_Times_ordLeq_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   445
"\<lbrakk>\<not>finite C; |A| \<le>o |C|; |B| \<le>o |C|\<rbrakk>
61943
7fba644ed827 discontinued ASCII replacement syntax <*>;
wenzelm
parents: 60585
diff changeset
   446
 \<Longrightarrow> |A \<times> B| \<le>o |C|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   447
by(simp add: card_of_Sigma_ordLeq_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   448
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   449
corollary Plus_infinite_bij_betw:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   450
assumes INF: "\<not>finite A" and INJ: "inj_on g B \<and> g ` B \<le> A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   451
shows "(\<exists>f. bij_betw f (A <+> B) A) \<and> (\<exists>h. bij_betw h (B <+> A) A)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   452
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   453
  have "|B| \<le>o |A|" using INJ card_of_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   454
  thus ?thesis using INF
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   455
  by (auto simp add: card_of_ordIso)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   456
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   457
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   458
corollary Plus_infinite_bij_betw_types:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   459
assumes INF: "\<not>finite(UNIV::'a set)" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   460
        BIJ: "inj(g::'b \<Rightarrow> 'a)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   461
shows "(\<exists>(f::('b + 'a) => 'a). bij f) \<and> (\<exists>(h::('a + 'b) => 'a). bij h)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   462
using assms Plus_infinite_bij_betw[of "UNIV::'a set" g "UNIV::'b set"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   463
by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   464
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   465
lemma card_of_Un_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   466
assumes INF: "\<not>finite A" and LEQ: "|B| \<le>o |A|"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   467
shows "|A \<union> B| =o |A| \<and> |B \<union> A| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   468
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   469
  have "|A \<union> B| \<le>o |A <+> B|" by (rule card_of_Un_Plus_ordLeq)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   470
  moreover have "|A <+> B| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   471
  using assms by (metis card_of_Plus_infinite)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   472
  ultimately have "|A \<union> B| \<le>o |A|" using ordLeq_ordIso_trans by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   473
  hence "|A \<union> B| =o |A|" using card_of_Un1 ordIso_iff_ordLeq by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   474
  thus ?thesis using Un_commute[of B A] by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   475
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   476
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   477
lemma card_of_Un_infinite_simps[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   478
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |A \<union> B| =o |A|"
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   479
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |B \<union> A| =o |A|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   480
using card_of_Un_infinite by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   481
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   482
lemma card_of_Un_diff_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   483
assumes INF: "\<not>finite A" and LESS: "|B| <o |A|"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   484
shows "|A - B| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   485
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   486
  obtain C where C_def: "C = A - B" by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   487
  have "|A \<union> B| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   488
  using assms ordLeq_iff_ordLess_or_ordIso card_of_Un_infinite by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   489
  moreover have "C \<union> B = A \<union> B" unfolding C_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   490
  ultimately have 1: "|C \<union> B| =o |A|" by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   491
  (*  *)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   492
  {assume *: "|C| \<le>o |B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   493
   moreover
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   494
   {assume **: "finite B"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   495
    hence "finite C"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   496
    using card_of_ordLeq_finite * by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   497
    hence False using ** INF card_of_ordIso_finite 1 by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   498
   }
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   499
   hence "\<not>finite B" by auto
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   500
   ultimately have False
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   501
   using card_of_Un_infinite 1 ordIso_equivalence(1,3) LESS not_ordLess_ordIso by metis
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   502
  }
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   503
  hence 2: "|B| \<le>o |C|" using card_of_Well_order ordLeq_total by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   504
  {assume *: "finite C"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   505
    hence "finite B" using card_of_ordLeq_finite 2 by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   506
    hence False using * INF card_of_ordIso_finite 1 by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   507
  }
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   508
  hence "\<not>finite C" by auto
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   509
  hence "|C| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   510
  using  card_of_Un_infinite 1 2 ordIso_equivalence(1,3) by metis
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   511
  thus ?thesis unfolding C_def .
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   512
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   513
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   514
corollary Card_order_Un_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   515
assumes INF: "\<not>finite(Field r)" and CARD: "Card_order r" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   516
        LEQ: "p \<le>o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   517
shows "| (Field r) \<union> (Field p) | =o r \<and> | (Field p) \<union> (Field r) | =o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   518
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   519
  have "| Field r \<union> Field p | =o | Field r | \<and>
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   520
        | Field p \<union> Field r | =o | Field r |"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   521
  using assms by (auto simp add: card_of_Un_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   522
  thus ?thesis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   523
  using assms card_of_Field_ordIso[of r]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   524
        ordIso_transitive[of "|Field r \<union> Field p|"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   525
        ordIso_transitive[of _ "|Field r|"] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   526
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   527
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   528
corollary subset_ordLeq_diff_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   529
assumes INF: "\<not>finite B" and SUB: "A \<le> B" and LESS: "|A| <o |B|"
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   530
shows "\<not>finite (B - A)"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   531
using assms card_of_Un_diff_infinite card_of_ordIso_finite by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   532
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   533
lemma card_of_Times_ordLess_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   534
assumes INF: "\<not>finite C" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   535
        LESS1: "|A| <o |C|" and LESS2: "|B| <o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   536
shows "|A \<times> B| <o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   537
proof(cases "A = {} \<or> B = {}")
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   538
  assume Case1: "A = {} \<or> B = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   539
  hence "A \<times> B = {}" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   540
  moreover have "C \<noteq> {}" using
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   541
  LESS1 card_of_empty5 by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   542
  ultimately show ?thesis by(auto simp add:  card_of_empty4)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   543
next
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   544
  assume Case2: "\<not>(A = {} \<or> B = {})"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   545
  {assume *: "|C| \<le>o |A \<times> B|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   546
   hence "\<not>finite (A \<times> B)" using INF card_of_ordLeq_finite by blast
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   547
   hence 1: "\<not>finite A \<or> \<not>finite B" using finite_cartesian_product by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   548
   {assume Case21: "|A| \<le>o |B|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   549
    hence "\<not>finite B" using 1 card_of_ordLeq_finite by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   550
    hence "|A \<times> B| =o |B|" using Case2 Case21
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   551
    by (auto simp add: card_of_Times_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   552
    hence False using LESS2 not_ordLess_ordLeq * ordLeq_ordIso_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   553
   }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   554
   moreover
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   555
   {assume Case22: "|B| \<le>o |A|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   556
    hence "\<not>finite A" using 1 card_of_ordLeq_finite by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   557
    hence "|A \<times> B| =o |A|" using Case2 Case22
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   558
    by (auto simp add: card_of_Times_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   559
    hence False using LESS1 not_ordLess_ordLeq * ordLeq_ordIso_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   560
   }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   561
   ultimately have False using ordLeq_total card_of_Well_order[of A]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   562
   card_of_Well_order[of B] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   563
  }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   564
  thus ?thesis using ordLess_or_ordLeq[of "|A \<times> B|" "|C|"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   565
  card_of_Well_order[of "A \<times> B"] card_of_Well_order[of "C"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   566
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   567
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   568
lemma card_of_Times_ordLess_infinite_Field[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   569
assumes INF: "\<not>finite (Field r)" and r: "Card_order r" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   570
        LESS1: "|A| <o r" and LESS2: "|B| <o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   571
shows "|A \<times> B| <o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   572
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   573
  let ?C  = "Field r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   574
  have 1: "r =o |?C| \<and> |?C| =o r" using r card_of_Field_ordIso
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   575
  ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   576
  hence "|A| <o |?C|"  "|B| <o |?C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   577
  using LESS1 LESS2 ordLess_ordIso_trans by blast+
61943
7fba644ed827 discontinued ASCII replacement syntax <*>;
wenzelm
parents: 60585
diff changeset
   578
  hence  "|A \<times> B| <o |?C|" using INF
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   579
  card_of_Times_ordLess_infinite by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   580
  thus ?thesis using 1 ordLess_ordIso_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   581
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   582
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   583
lemma card_of_Un_ordLess_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   584
assumes INF: "\<not>finite C" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   585
        LESS1: "|A| <o |C|" and LESS2: "|B| <o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   586
shows "|A \<union> B| <o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   587
using assms card_of_Plus_ordLess_infinite card_of_Un_Plus_ordLeq
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   588
      ordLeq_ordLess_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   589
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   590
lemma card_of_Un_ordLess_infinite_Field[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   591
assumes INF: "\<not>finite (Field r)" and r: "Card_order r" and
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   592
        LESS1: "|A| <o r" and LESS2: "|B| <o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   593
shows "|A Un B| <o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   594
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   595
  let ?C  = "Field r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   596
  have 1: "r =o |?C| \<and> |?C| =o r" using r card_of_Field_ordIso
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   597
  ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   598
  hence "|A| <o |?C|"  "|B| <o |?C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   599
  using LESS1 LESS2 ordLess_ordIso_trans by blast+
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   600
  hence  "|A Un B| <o |?C|" using INF
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   601
  card_of_Un_ordLess_infinite by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   602
  thus ?thesis using 1 ordLess_ordIso_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   603
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   604
55174
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   605
lemma ordLeq_finite_Field:
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   606
assumes "r \<le>o s" and "finite (Field s)"
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   607
shows "finite (Field r)"
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   608
by (metis assms card_of_mono2 card_of_ordLeq_infinite)
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   609
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   610
lemma ordIso_finite_Field:
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   611
assumes "r =o s"
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   612
shows "finite (Field r) \<longleftrightarrow> finite (Field s)"
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   613
by (metis assms ordIso_iff_ordLeq ordLeq_finite_Field)
2e8fe898fa71 extended cardinals library
traytel
parents: 55102
diff changeset
   614
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   615
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   616
subsection \<open>Cardinals versus set operations involving infinite sets\<close>
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   617
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   618
lemma finite_iff_cardOf_nat:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   619
"finite A = ( |A| <o |UNIV :: nat set| )"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   620
using infinite_iff_card_of_nat[of A]
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   621
not_ordLeq_iff_ordLess[of "|A|" "|UNIV :: nat set|"]
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   622
by fastforce
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   623
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   624
lemma finite_ordLess_infinite2[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   625
assumes "finite A" and "\<not>finite B"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   626
shows "|A| <o |B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   627
using assms
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   628
finite_ordLess_infinite[of "|A|" "|B|"]
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   629
card_of_Well_order[of A] card_of_Well_order[of B]
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   630
Field_card_of[of A] Field_card_of[of B] by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   631
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   632
lemma infinite_card_of_insert:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   633
assumes "\<not>finite A"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   634
shows "|insert a A| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   635
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   636
  have iA: "insert a A = A \<union> {a}" by simp
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   637
  show ?thesis
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   638
  using infinite_imp_bij_betw2[OF assms] unfolding iA
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   639
  by (metis bij_betw_inv card_of_ordIso)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   640
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   641
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   642
lemma card_of_Un_singl_ordLess_infinite1:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   643
assumes "\<not>finite B" and "|A| <o |B|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   644
shows "|{a} Un A| <o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   645
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   646
  have "|{a}| <o |B|" using assms by auto
51764
67f05cb13e08 optimized proofs
traytel
parents: 49310
diff changeset
   647
  thus ?thesis using assms card_of_Un_ordLess_infinite[of B] by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   648
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   649
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   650
lemma card_of_Un_singl_ordLess_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   651
assumes "\<not>finite B"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   652
shows "( |A| <o |B| ) = ( |{a} Un A| <o |B| )"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   653
using assms card_of_Un_singl_ordLess_infinite1[of B A]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   654
proof(auto)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   655
  assume "|insert a A| <o |B|"
51764
67f05cb13e08 optimized proofs
traytel
parents: 49310
diff changeset
   656
  moreover have "|A| <=o |insert a A|" using card_of_mono1[of A "insert a A"] by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   657
  ultimately show "|A| <o |B|" using ordLeq_ordLess_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   658
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   659
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   660
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   661
subsection \<open>Cardinals versus lists\<close>
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   662
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   663
text\<open>The next is an auxiliary operator, which shall be used for inductive
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   664
proofs of facts concerning the cardinality of \<open>List\<close> :\<close>
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   665
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   666
definition nlists :: "'a set \<Rightarrow> nat \<Rightarrow> 'a list set"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   667
where "nlists A n \<equiv> {l. set l \<le> A \<and> length l = n}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   668
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   669
lemma lists_def2: "lists A = {l. set l \<le> A}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   670
using in_listsI by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   671
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
   672
lemma lists_UNION_nlists: "lists A = (\<Union>n. nlists A n)"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   673
unfolding lists_def2 nlists_def by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   674
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   675
lemma card_of_lists: "|A| \<le>o |lists A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   676
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   677
  let ?h = "\<lambda> a. [a]"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   678
  have "inj_on ?h A \<and> ?h ` A \<le> lists A"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   679
  unfolding inj_on_def lists_def2 by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   680
  thus ?thesis by (metis card_of_ordLeq)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   681
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   682
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   683
lemma nlists_0: "nlists A 0 = {[]}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   684
unfolding nlists_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   685
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   686
lemma nlists_not_empty:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   687
assumes "A \<noteq> {}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   688
shows "nlists A n \<noteq> {}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   689
proof(induct n, simp add: nlists_0)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   690
  fix n assume "nlists A n \<noteq> {}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   691
  then obtain a and l where "a \<in> A \<and> l \<in> nlists A n" using assms by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   692
  hence "a # l \<in> nlists A (Suc n)" unfolding nlists_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   693
  thus "nlists A (Suc n) \<noteq> {}" by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   694
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   695
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   696
lemma Nil_in_lists: "[] \<in> lists A"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   697
unfolding lists_def2 by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   698
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   699
lemma lists_not_empty: "lists A \<noteq> {}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   700
using Nil_in_lists by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   701
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   702
lemma card_of_nlists_Succ: "|nlists A (Suc n)| =o |A \<times> (nlists A n)|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   703
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   704
  let ?B = "A \<times> (nlists A n)"   let ?h = "\<lambda>(a,l). a # l"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   705
  have "inj_on ?h ?B \<and> ?h ` ?B \<le> nlists A (Suc n)"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   706
  unfolding inj_on_def nlists_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   707
  moreover have "nlists A (Suc n) \<le> ?h ` ?B"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   708
  proof(auto)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   709
    fix l assume "l \<in> nlists A (Suc n)"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   710
    hence 1: "length l = Suc n \<and> set l \<le> A" unfolding nlists_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   711
    then obtain a and l' where 2: "l = a # l'" by (auto simp: length_Suc_conv)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   712
    hence "a \<in> A \<and> set l' \<le> A \<and> length l' = n" using 1 by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   713
    thus "l \<in> ?h ` ?B"  using 2 unfolding nlists_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   714
  qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   715
  ultimately have "bij_betw ?h ?B (nlists A (Suc n))"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   716
  unfolding bij_betw_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   717
  thus ?thesis using card_of_ordIso ordIso_symmetric by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   718
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   719
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   720
lemma card_of_nlists_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   721
assumes "\<not>finite A"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   722
shows "|nlists A n| \<le>o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   723
proof(induct n)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   724
  have "A \<noteq> {}" using assms by auto
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   725
  thus "|nlists A 0| \<le>o |A|" by (simp add: nlists_0)
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   726
next
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   727
  fix n assume IH: "|nlists A n| \<le>o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   728
  have "|nlists A (Suc n)| =o |A \<times> (nlists A n)|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   729
  using card_of_nlists_Succ by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   730
  moreover
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   731
  {have "nlists A n \<noteq> {}" using assms nlists_not_empty[of A] by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   732
   hence "|A \<times> (nlists A n)| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   733
   using assms IH by (auto simp add: card_of_Times_infinite)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   734
  }
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   735
  ultimately show "|nlists A (Suc n)| \<le>o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   736
  using ordIso_transitive ordIso_iff_ordLeq by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   737
qed
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   738
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   739
lemma Card_order_lists: "Card_order r \<Longrightarrow> r \<le>o |lists(Field r) |"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   740
using card_of_lists card_of_Field_ordIso ordIso_ordLeq_trans ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   741
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61943
diff changeset
   742
lemma Union_set_lists: "\<Union>(set ` (lists A)) = A"
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61943
diff changeset
   743
  unfolding lists_def2
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61943
diff changeset
   744
proof(auto)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   745
  fix a assume "a \<in> A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   746
  hence "set [a] \<le> A \<and> a \<in> set [a]" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   747
  thus "\<exists>l. set l \<le> A \<and> a \<in> set l" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   748
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   749
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   750
lemma inj_on_map_lists:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   751
assumes "inj_on f A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   752
shows "inj_on (map f) (lists A)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   753
using assms Union_set_lists[of A] inj_on_mapI[of f "lists A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   754
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   755
lemma map_lists_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   756
assumes "f ` A \<le> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   757
shows "(map f) ` (lists A) \<le> lists B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   758
using assms unfolding lists_def2 by (auto, blast) (* lethal combination of methods :)  *)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   759
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   760
lemma map_lists_surjective:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   761
assumes "f ` A = B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   762
shows "(map f) ` (lists A) = lists B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   763
using assms unfolding lists_def2
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   764
proof (auto, blast)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   765
  fix l' assume *: "set l' \<le> f ` A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   766
  have "set l' \<le> f ` A \<longrightarrow> l' \<in> map f ` {l. set l \<le> A}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   767
  proof(induct l', auto)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   768
    fix l a
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   769
    assume "a \<in> A" and "set l \<le> A" and
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   770
           IH: "f ` (set l) \<le> f ` A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   771
    hence "set (a # l) \<le> A" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   772
    hence "map f (a # l) \<in> map f ` {l. set l \<le> A}" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   773
    thus "f a # map f l \<in> map f ` {l. set l \<le> A}" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   774
  qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   775
  thus "l' \<in> map f ` {l. set l \<le> A}" using * by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   776
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   777
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   778
lemma bij_betw_map_lists:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   779
assumes "bij_betw f A B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   780
shows "bij_betw (map f) (lists A) (lists B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   781
using assms unfolding bij_betw_def
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   782
by(auto simp add: inj_on_map_lists map_lists_surjective)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   783
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   784
lemma card_of_lists_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   785
assumes "|A| \<le>o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   786
shows "|lists A| \<le>o |lists B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   787
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   788
  obtain f where "inj_on f A \<and> f ` A \<le> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   789
  using assms card_of_ordLeq[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   790
  hence "inj_on (map f) (lists A) \<and> (map f) ` (lists A) \<le> (lists B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   791
  by (auto simp add: inj_on_map_lists map_lists_mono)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   792
  thus ?thesis using card_of_ordLeq[of "lists A"] by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   793
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   794
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   795
lemma ordIso_lists_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   796
assumes "r \<le>o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   797
shows "|lists(Field r)| \<le>o |lists(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   798
using assms card_of_mono2 card_of_lists_mono by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   799
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   800
lemma card_of_lists_cong[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   801
assumes "|A| =o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   802
shows "|lists A| =o |lists B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   803
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   804
  obtain f where "bij_betw f A B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   805
  using assms card_of_ordIso[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   806
  hence "bij_betw (map f) (lists A) (lists B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   807
  by (auto simp add: bij_betw_map_lists)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   808
  thus ?thesis using card_of_ordIso[of "lists A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   809
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   810
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   811
lemma card_of_lists_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   812
assumes "\<not>finite A"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   813
shows "|lists A| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   814
proof-
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   815
  have "|lists A| \<le>o |A|" unfolding lists_UNION_nlists
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   816
  by (rule card_of_UNION_ordLeq_infinite[OF assms _ ballI[OF card_of_nlists_infinite[OF assms]]])
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   817
    (metis infinite_iff_card_of_nat assms)
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   818
  thus ?thesis using card_of_lists ordIso_iff_ordLeq by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   819
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   820
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   821
lemma Card_order_lists_infinite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   822
assumes "Card_order r" and "\<not>finite(Field r)"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   823
shows "|lists(Field r)| =o r"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   824
using assms card_of_lists_infinite card_of_Field_ordIso ordIso_transitive by blast
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   825
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   826
lemma ordIso_lists_cong:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   827
assumes "r =o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   828
shows "|lists(Field r)| =o |lists(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   829
using assms card_of_cong card_of_lists_cong by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   830
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   831
corollary lists_infinite_bij_betw:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   832
assumes "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   833
shows "\<exists>f. bij_betw f (lists A) A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   834
using assms card_of_lists_infinite card_of_ordIso by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   835
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   836
corollary lists_infinite_bij_betw_types:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   837
assumes "\<not>finite(UNIV :: 'a set)"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   838
shows "\<exists>(f::'a list \<Rightarrow> 'a). bij f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   839
using assms assms lists_infinite_bij_betw[of "UNIV::'a set"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   840
using lists_UNIV by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   841
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   842
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents: 69712
diff changeset
   843
subsection \<open>Cardinals versus the finite powerset operator\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   844
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   845
lemma card_of_Fpow[simp]: "|A| \<le>o |Fpow A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   846
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   847
  let ?h = "\<lambda> a. {a}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   848
  have "inj_on ?h A \<and> ?h ` A \<le> Fpow A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   849
  unfolding inj_on_def Fpow_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   850
  thus ?thesis using card_of_ordLeq by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   851
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   852
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   853
lemma Card_order_Fpow: "Card_order r \<Longrightarrow> r \<le>o |Fpow(Field r) |"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   854
using card_of_Fpow card_of_Field_ordIso ordIso_ordLeq_trans ordIso_symmetric by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   855
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   856
lemma image_Fpow_surjective:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   857
assumes "f ` A = B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   858
shows "(image f) ` (Fpow A) = Fpow B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   859
using assms proof(unfold Fpow_def, auto)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   860
  fix Y assume *: "Y \<le> f ` A" and **: "finite Y"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   861
  hence "\<forall>b \<in> Y. \<exists>a. a \<in> A \<and> f a = b" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   862
  with bchoice[of Y "\<lambda>b a. a \<in> A \<and> f a = b"]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   863
  obtain g where 1: "\<forall>b \<in> Y. g b \<in> A \<and> f(g b) = b" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   864
  obtain X where X_def: "X = g ` Y" by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   865
  have "f ` X = Y \<and> X \<le> A \<and> finite X"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   866
  by(unfold X_def, force simp add: ** 1)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   867
  thus "Y \<in> (image f) ` {X. X \<le> A \<and> finite X}" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   868
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   869
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   870
lemma bij_betw_image_Fpow:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   871
assumes "bij_betw f A B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   872
shows "bij_betw (image f) (Fpow A) (Fpow B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   873
using assms unfolding bij_betw_def
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   874
by (auto simp add: inj_on_image_Fpow image_Fpow_surjective)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   875
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   876
lemma card_of_Fpow_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   877
assumes "|A| \<le>o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   878
shows "|Fpow A| \<le>o |Fpow B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   879
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   880
  obtain f where "inj_on f A \<and> f ` A \<le> B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   881
  using assms card_of_ordLeq[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   882
  hence "inj_on (image f) (Fpow A) \<and> (image f) ` (Fpow A) \<le> (Fpow B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   883
  by (auto simp add: inj_on_image_Fpow image_Fpow_mono)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   884
  thus ?thesis using card_of_ordLeq[of "Fpow A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   885
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   886
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   887
lemma ordIso_Fpow_mono:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   888
assumes "r \<le>o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   889
shows "|Fpow(Field r)| \<le>o |Fpow(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   890
using assms card_of_mono2 card_of_Fpow_mono by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   891
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   892
lemma card_of_Fpow_cong[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   893
assumes "|A| =o |B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   894
shows "|Fpow A| =o |Fpow B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   895
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   896
  obtain f where "bij_betw f A B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   897
  using assms card_of_ordIso[of A B] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   898
  hence "bij_betw (image f) (Fpow A) (Fpow B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   899
  by (auto simp add: bij_betw_image_Fpow)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   900
  thus ?thesis using card_of_ordIso[of "Fpow A"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   901
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   902
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   903
lemma ordIso_Fpow_cong:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   904
assumes "r =o r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   905
shows "|Fpow(Field r)| =o |Fpow(Field r')|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   906
using assms card_of_cong card_of_Fpow_cong by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   907
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   908
lemma card_of_Fpow_lists: "|Fpow A| \<le>o |lists A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   909
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   910
  have "set ` (lists A) = Fpow A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   911
  unfolding lists_def2 Fpow_def using finite_list finite_set by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   912
  thus ?thesis using card_of_ordLeq2[of "Fpow A"] Fpow_not_empty[of A] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   913
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   914
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   915
lemma card_of_Fpow_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   916
assumes "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   917
shows "|Fpow A| =o |A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   918
using assms card_of_Fpow_lists card_of_lists_infinite card_of_Fpow
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   919
      ordLeq_ordIso_trans ordIso_iff_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   920
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   921
corollary Fpow_infinite_bij_betw:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
   922
assumes "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   923
shows "\<exists>f. bij_betw f (Fpow A) A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   924
using assms card_of_Fpow_infinite card_of_ordIso by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   925
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   926
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   927
subsection \<open>The cardinal $\omega$ and the finite cardinals\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   928
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
   929
subsubsection \<open>First as well-orders\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   930
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   931
lemma Field_natLess: "Field natLess = (UNIV::nat set)"
56011
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   932
by(unfold Field_def natLess_def, auto)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   933
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   934
lemma natLeq_well_order_on: "well_order_on UNIV natLeq"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   935
using natLeq_Well_order Field_natLeq by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   936
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   937
lemma natLeq_wo_rel: "wo_rel natLeq"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   938
unfolding wo_rel_def using natLeq_Well_order .
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   939
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   940
lemma natLeq_ofilter_less: "ofilter natLeq {0 ..< n}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   941
by(auto simp add: natLeq_wo_rel wo_rel.ofilter_def,
56011
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   942
   simp add: Field_natLeq, unfold under_def natLeq_def, auto)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   943
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   944
lemma natLeq_ofilter_leq: "ofilter natLeq {0 .. n}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   945
by(auto simp add: natLeq_wo_rel wo_rel.ofilter_def,
56011
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   946
   simp add: Field_natLeq, unfold under_def natLeq_def, auto)
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   947
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   948
lemma natLeq_UNIV_ofilter: "wo_rel.ofilter natLeq UNIV"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
   949
using natLeq_wo_rel Field_natLeq wo_rel.Field_ofilter[of natLeq] by auto
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   950
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   951
lemma closed_nat_set_iff:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   952
assumes "\<forall>(m::nat) n. n \<in> A \<and> m \<le> n \<longrightarrow> m \<in> A"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   953
shows "A = UNIV \<or> (\<exists>n. A = {0 ..< n})"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   954
proof-
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   955
  {assume "A \<noteq> UNIV" hence "\<exists>n. n \<notin> A" by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   956
   moreover obtain n where n_def: "n = (LEAST n. n \<notin> A)" by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   957
   ultimately have 1: "n \<notin> A \<and> (\<forall>m. m < n \<longrightarrow> m \<in> A)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   958
   using LeastI_ex[of "\<lambda> n. n \<notin> A"] n_def Least_le[of "\<lambda> n. n \<notin> A"] by fastforce
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   959
   have "A = {0 ..< n}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   960
   proof(auto simp add: 1)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   961
     fix m assume *: "m \<in> A"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   962
     {assume "n \<le> m" with assms * have "n \<in> A" by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   963
      hence False using 1 by auto
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   964
     }
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   965
     thus "m < n" by fastforce
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   966
   qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   967
   hence "\<exists>n. A = {0 ..< n}" by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   968
  }
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   969
  thus ?thesis by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   970
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   971
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   972
lemma natLeq_ofilter_iff:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   973
"ofilter natLeq A = (A = UNIV \<or> (\<exists>n. A = {0 ..< n}))"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   974
proof(rule iffI)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   975
  assume "ofilter natLeq A"
56011
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   976
  hence "\<forall>m n. n \<in> A \<and> m \<le> n \<longrightarrow> m \<in> A" using natLeq_wo_rel
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   977
  by(auto simp add: natLeq_def wo_rel.ofilter_def under_def)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   978
  thus "A = UNIV \<or> (\<exists>n. A = {0 ..< n})" using closed_nat_set_iff by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   979
next
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   980
  assume "A = UNIV \<or> (\<exists>n. A = {0 ..< n})"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   981
  thus "ofilter natLeq A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   982
  by(auto simp add: natLeq_ofilter_less natLeq_UNIV_ofilter)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   983
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   984
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   985
lemma natLeq_under_leq: "under natLeq n = {0 .. n}"
56011
39d5043ce8a3 made natLe{q,ss} constants (yields smaller terms in composition)
traytel
parents: 55174
diff changeset
   986
unfolding under_def natLeq_def by auto
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   987
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   988
lemma natLeq_on_ofilter_less_eq:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   989
"n \<le> m \<Longrightarrow> wo_rel.ofilter (natLeq_on m) {0 ..< n}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   990
apply (auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   991
apply (simp add: Field_natLeq_on)
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
   992
by (auto simp add: under_def)
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   993
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   994
lemma natLeq_on_ofilter_iff:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   995
"wo_rel.ofilter (natLeq_on m) A = (\<exists>n \<le> m. A = {0 ..< n})"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   996
proof(rule iffI)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   997
  assume *: "wo_rel.ofilter (natLeq_on m) A"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
   998
  hence 1: "A \<le> {0..<m}"
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
   999
  by (auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def under_def Field_natLeq_on)
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1000
  hence "\<forall>n1 n2. n2 \<in> A \<and> n1 \<le> n2 \<longrightarrow> n1 \<in> A"
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1001
  using * by(fastforce simp add: natLeq_on_wo_rel wo_rel.ofilter_def under_def)
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1002
  hence "A = UNIV \<or> (\<exists>n. A = {0 ..< n})" using closed_nat_set_iff by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1003
  thus "\<exists>n \<le> m. A = {0 ..< n}" using 1 atLeastLessThan_less_eq by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1004
next
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1005
  assume "(\<exists>n\<le>m. A = {0 ..< n})"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1006
  thus "wo_rel.ofilter (natLeq_on m) A" by (auto simp add: natLeq_on_ofilter_less_eq)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1007
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1008
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1009
corollary natLeq_on_ofilter:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1010
"ofilter(natLeq_on n) {0 ..< n}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1011
by (auto simp add: natLeq_on_ofilter_less_eq)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1012
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1013
lemma natLeq_on_ofilter_less:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1014
"n < m \<Longrightarrow> ofilter (natLeq_on m) {0 .. n}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1015
by(auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def,
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1016
   simp add: Field_natLeq_on, unfold under_def, auto)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1017
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1018
lemma natLeq_on_ordLess_natLeq: "natLeq_on n <o natLeq"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1019
using Field_natLeq Field_natLeq_on[of n]
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1020
      finite_ordLess_infinite[of "natLeq_on n" natLeq]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1021
      natLeq_Well_order natLeq_on_Well_order[of n] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1022
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1023
lemma natLeq_on_injective:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1024
"natLeq_on m = natLeq_on n \<Longrightarrow> m = n"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1025
using Field_natLeq_on[of m] Field_natLeq_on[of n]
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1026
      atLeastLessThan_injective[of m n, unfolded atLeastLessThan_def] by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1027
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1028
lemma natLeq_on_injective_ordIso:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1029
"(natLeq_on m =o natLeq_on n) = (m = n)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1030
proof(auto simp add: natLeq_on_Well_order ordIso_reflexive)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1031
  assume "natLeq_on m =o natLeq_on n"
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1032
  then obtain f where "bij_betw f {x. x<m} {x. x<n}"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63040
diff changeset
  1033
  using Field_natLeq_on unfolding ordIso_def iso_def[abs_def] by auto
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1034
  thus "m = n" using atLeastLessThan_injective2[of f m n]
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1035
    unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by blast
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1036
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1037
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1038
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1039
subsubsection \<open>Then as cardinals\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1040
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1041
lemma ordIso_natLeq_infinite1:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1042
"|A| =o natLeq \<Longrightarrow> \<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1043
using ordIso_symmetric ordIso_imp_ordLeq infinite_iff_natLeq_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1044
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1045
lemma ordIso_natLeq_infinite2:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1046
"natLeq =o |A| \<Longrightarrow> \<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1047
using ordIso_imp_ordLeq infinite_iff_natLeq_ordLeq by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1048
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1049
lemma ordIso_natLeq_on_imp_finite:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1050
"|A| =o natLeq_on n \<Longrightarrow> finite A"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1051
unfolding ordIso_def iso_def[abs_def]
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1052
by (auto simp: Field_natLeq_on bij_betw_finite)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1053
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1054
lemma natLeq_on_Card_order: "Card_order (natLeq_on n)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1055
proof(unfold card_order_on_def,
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1056
      auto simp add: natLeq_on_Well_order, simp add: Field_natLeq_on)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1057
  fix r assume "well_order_on {x. x < n} r"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1058
  thus "natLeq_on n \<le>o r"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1059
  using finite_atLeastLessThan natLeq_on_well_order_on
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1060
        finite_well_order_on_ordIso ordIso_iff_ordLeq by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1061
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1062
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1063
corollary card_of_Field_natLeq_on:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1064
"|Field (natLeq_on n)| =o natLeq_on n"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1065
using Field_natLeq_on natLeq_on_Card_order
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1066
      Card_order_iff_ordIso_card_of[of "natLeq_on n"]
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1067
      ordIso_symmetric[of "natLeq_on n"] by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1068
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1069
corollary card_of_less:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1070
"|{0 ..< n}| =o natLeq_on n"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1071
using Field_natLeq_on card_of_Field_natLeq_on
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1072
unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by auto
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1073
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1074
lemma natLeq_on_ordLeq_less_eq:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1075
"((natLeq_on m) \<le>o (natLeq_on n)) = (m \<le> n)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1076
proof
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1077
  assume "natLeq_on m \<le>o natLeq_on n"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1078
  then obtain f where "inj_on f {x. x < m} \<and> f ` {x. x < m} \<le> {x. x < n}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1079
  unfolding ordLeq_def using
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1080
    embed_inj_on[OF natLeq_on_Well_order[of m], of "natLeq_on n", unfolded Field_natLeq_on]
72126
5de9a5fbf2ec adjustments for fewer WO assumptions
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
  1081
     embed_Field Field_natLeq_on by blast
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1082
  thus "m \<le> n" using atLeastLessThan_less_eq2
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1083
    unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1084
next
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1085
  assume "m \<le> n"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1086
  hence "inj_on id {0..<m} \<and> id ` {0..<m} \<le> {0..<n}" unfolding inj_on_def by auto
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1087
  hence "|{0..<m}| \<le>o |{0..<n}|" using card_of_ordLeq by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1088
  thus "natLeq_on m \<le>o natLeq_on n"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1089
  using card_of_less ordIso_ordLeq_trans ordLeq_ordIso_trans ordIso_symmetric by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1090
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1091
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1092
lemma natLeq_on_ordLeq_less:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1093
"((natLeq_on m) <o (natLeq_on n)) = (m < n)"
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1094
using not_ordLeq_iff_ordLess[OF natLeq_on_Well_order natLeq_on_Well_order, of n m]
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1095
   natLeq_on_ordLeq_less_eq[of n m] by linarith
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1096
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1097
lemma ordLeq_natLeq_on_imp_finite:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1098
assumes "|A| \<le>o natLeq_on n"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1099
shows "finite A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1100
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1101
  have "|A| \<le>o |{0 ..< n}|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1102
  using assms card_of_less ordIso_symmetric ordLeq_ordIso_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1103
  thus ?thesis by (auto simp add: card_of_ordLeq_finite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1104
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1105
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1106
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1107
subsubsection \<open>"Backward compatibility" with the numeric cardinal operator for finite sets\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1108
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1109
lemma finite_card_of_iff_card2:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1110
assumes FIN: "finite A" and FIN': "finite B"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1111
shows "( |A| \<le>o |B| ) = (card A \<le> card B)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1112
using assms card_of_ordLeq[of A B] inj_on_iff_card_le[of A B] by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1113
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1114
lemma finite_imp_card_of_natLeq_on:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1115
assumes "finite A"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1116
shows "|A| =o natLeq_on (card A)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1117
proof-
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1118
  obtain h where "bij_betw h A {0 ..< card A}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1119
  using assms ex_bij_betw_finite_nat by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1120
  thus ?thesis using card_of_ordIso card_of_less ordIso_equivalence by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1121
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1122
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1123
lemma finite_iff_card_of_natLeq_on:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1124
"finite A = (\<exists>n. |A| =o natLeq_on n)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1125
using finite_imp_card_of_natLeq_on[of A]
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1126
by(auto simp add: ordIso_natLeq_on_imp_finite)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1127
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1128
lemma finite_card_of_iff_card:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1129
assumes FIN: "finite A" and FIN': "finite B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1130
shows "( |A| =o |B| ) = (card A = card B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1131
using assms card_of_ordIso[of A B] bij_betw_iff_card[of A B] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1132
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1133
lemma finite_card_of_iff_card3:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1134
assumes FIN: "finite A" and FIN': "finite B"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1135
shows "( |A| <o |B| ) = (card A < card B)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1136
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1137
  have "( |A| <o |B| ) = (~ ( |B| \<le>o |A| ))" by simp
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1138
  also have "... = (~ (card B \<le> card A))"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1139
  using assms by(simp add: finite_card_of_iff_card2)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1140
  also have "... = (card A < card B)" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1141
  finally show ?thesis .
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1142
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1143
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1144
lemma card_Field_natLeq_on:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1145
"card(Field(natLeq_on n)) = n"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1146
using Field_natLeq_on card_atLeastLessThan by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1147
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1148
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1149
subsection \<open>The successor of a cardinal\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1150
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1151
lemma embed_implies_ordIso_Restr:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1152
assumes WELL: "Well_order r" and WELL': "Well_order r'" and EMB: "embed r' r f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1153
shows "r' =o Restr r (f ` (Field r'))"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1154
using assms embed_implies_iso_Restr Well_order_Restr unfolding ordIso_def by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1155
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1156
lemma cardSuc_Well_order[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1157
"Card_order r \<Longrightarrow> Well_order(cardSuc r)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1158
using cardSuc_Card_order unfolding card_order_on_def by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1159
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1160
lemma Field_cardSuc_not_empty:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1161
assumes "Card_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1162
shows "Field (cardSuc r) \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1163
proof
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1164
  assume "Field(cardSuc r) = {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1165
  hence "|Field(cardSuc r)| \<le>o r" using assms Card_order_empty[of r] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1166
  hence "cardSuc r \<le>o r" using assms card_of_Field_ordIso
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1167
  cardSuc_Card_order ordIso_symmetric ordIso_ordLeq_trans by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1168
  thus False using cardSuc_greater not_ordLess_ordLeq assms by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1169
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1170
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1171
lemma cardSuc_mono_ordLess[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1172
assumes CARD: "Card_order r" and CARD': "Card_order r'"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1173
shows "(cardSuc r <o cardSuc r') = (r <o r')"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1174
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1175
  have 0: "Well_order r \<and> Well_order r' \<and> Well_order(cardSuc r) \<and> Well_order(cardSuc r')"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1176
  using assms by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1177
  thus ?thesis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1178
  using not_ordLeq_iff_ordLess not_ordLeq_iff_ordLess[of r r']
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1179
  using cardSuc_mono_ordLeq[of r' r] assms by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1180
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1181
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1182
lemma cardSuc_natLeq_on_Suc:
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1183
"cardSuc(natLeq_on n) =o natLeq_on(Suc n)"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1184
proof-
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1185
  obtain r r' p where r_def: "r = natLeq_on n" and
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1186
                      r'_def: "r' = cardSuc(natLeq_on n)"  and
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1187
                      p_def: "p = natLeq_on(Suc n)" by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1188
  (* Preliminary facts:  *)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1189
  have CARD: "Card_order r \<and> Card_order r' \<and> Card_order p" unfolding r_def r'_def p_def
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1190
  using cardSuc_ordLess_ordLeq natLeq_on_Card_order cardSuc_Card_order by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1191
  hence WELL: "Well_order r \<and> Well_order r' \<and>  Well_order p"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1192
  unfolding card_order_on_def by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1193
  have FIELD: "Field r = {0..<n} \<and> Field p = {0..<(Suc n)}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1194
  unfolding r_def p_def Field_natLeq_on atLeast_0 atLeastLessThan_def lessThan_def by simp
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1195
  hence FIN: "finite (Field r)" by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1196
  have "r <o r'" using CARD unfolding r_def r'_def using cardSuc_greater by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1197
  hence "|Field r| <o r'" using CARD card_of_Field_ordIso ordIso_ordLess_trans by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1198
  hence LESS: "|Field r| <o |Field r'|"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1199
  using CARD card_of_Field_ordIso ordLess_ordIso_trans ordIso_symmetric by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1200
  (* Main proof: *)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1201
  have "r' \<le>o p" using CARD unfolding r_def r'_def p_def
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1202
  using natLeq_on_ordLeq_less cardSuc_ordLess_ordLeq by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1203
  moreover have "p \<le>o r'"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1204
  proof-
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1205
    {assume "r' <o p"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1206
     then obtain f where 0: "embedS r' p f" unfolding ordLess_def by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1207
     let ?q = "Restr p (f ` Field r')"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1208
     have 1: "embed r' p f" using 0 unfolding embedS_def by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1209
     hence 2: "f ` Field r' < {0..<(Suc n)}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1210
     using WELL FIELD 0 by (auto simp add: embedS_iff)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1211
     have "wo_rel.ofilter p (f ` Field r')" using embed_Field_ofilter 1 WELL by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1212
     then obtain m where "m \<le> Suc n" and 3: "f ` (Field r') = {0..<m}"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1213
     unfolding p_def by (auto simp add: natLeq_on_ofilter_iff)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1214
     hence 4: "m \<le> n" using 2 by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1215
     (*  *)
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1216
     have "bij_betw f (Field r') (f ` (Field r'))"
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1217
     using WELL embed_inj_on[OF _ 1] unfolding bij_betw_def by blast
54581
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1218
     moreover have "finite(f ` (Field r'))" using 3 finite_atLeastLessThan[of 0 m] by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1219
     ultimately have 5: "finite (Field r') \<and> card(Field r') = card (f ` (Field r'))"
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1220
     using bij_betw_same_card bij_betw_finite by metis
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1221
     hence "card(Field r') \<le> card(Field r)" using 3 4 FIELD by force
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1222
     hence "|Field r'| \<le>o |Field r|" using FIN 5 finite_card_of_iff_card2 by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1223
     hence False using LESS not_ordLess_ordLeq by auto
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1224
    }
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1225
    thus ?thesis using WELL CARD by fastforce
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1226
  qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1227
  ultimately show ?thesis using ordIso_iff_ordLeq unfolding r'_def p_def by blast
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1228
qed
1502a1f707d9 eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents: 54578
diff changeset
  1229
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1230
lemma card_of_Plus_ordLeq_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1231
assumes C: "\<not>finite C" and A: "|A| \<le>o |C|" and B: "|B| \<le>o |C|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1232
shows "|A <+> B| \<le>o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1233
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1234
  let ?r = "cardSuc |C|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1235
  have "Card_order ?r \<and> \<not>finite (Field ?r)" using assms by simp
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1236
  moreover have "|A| <o ?r" and "|B| <o ?r" using A B by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1237
  ultimately have "|A <+> B| <o ?r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1238
  using card_of_Plus_ordLess_infinite_Field by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1239
  thus ?thesis using C by simp
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1240
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1241
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1242
lemma card_of_Un_ordLeq_infinite[simp]:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1243
assumes C: "\<not>finite C" and A: "|A| \<le>o |C|" and B: "|B| \<le>o |C|"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1244
shows "|A Un B| \<le>o |C|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1245
using assms card_of_Plus_ordLeq_infinite card_of_Un_Plus_ordLeq
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1246
ordLeq_transitive by metis
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1247
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1248
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1249
subsection \<open>Others\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1250
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1251
lemma under_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1252
assumes "Well_order r" and "(i,j) \<in> r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1253
shows "under r i \<subseteq> under r j"
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1254
using assms unfolding under_def order_on_defs
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1255
trans_def by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1256
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1257
lemma underS_under:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1258
assumes "i \<in> Field r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1259
shows "underS r i = under r i - {i}"
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1260
using assms unfolding underS_def under_def by auto
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1261
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1262
lemma relChain_under:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1263
assumes "Well_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1264
shows "relChain r (\<lambda> i. under r i)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1265
using assms unfolding relChain_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1266
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1267
lemma card_of_infinite_diff_finite:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1268
assumes "\<not>finite A" and "finite B"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1269
shows "|A - B| =o |A|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1270
by (metis assms card_of_Un_diff_infinite finite_ordLess_infinite2)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1271
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1272
lemma infinite_card_of_diff_singl:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1273
assumes "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1274
shows "|A - {a}| =o |A|"
52544
0c4b140cff00 tuned spelling
traytel
parents: 51764
diff changeset
  1275
by (metis assms card_of_infinite_diff_finite finite.emptyI finite_insert)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1276
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1277
lemma card_of_vimage:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1278
assumes "B \<subseteq> range f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1279
shows "|B| \<le>o |f -` B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1280
apply(rule surj_imp_ordLeq[of _ f])
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1281
using assms by (metis Int_absorb2 image_vimage_eq order_refl)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1282
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1283
lemma surj_card_of_vimage:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1284
assumes "surj f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1285
shows "|B| \<le>o |f -` B|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1286
by (metis assms card_of_vimage subset_UNIV)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1287
54794
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1288
lemma infinite_Pow:
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1289
assumes "\<not> finite A"
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1290
shows "\<not> finite (Pow A)"
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1291
proof-
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1292
  have "|A| \<le>o |Pow A|" by (metis card_of_Pow ordLess_imp_ordLeq)
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1293
  thus ?thesis by (metis assms finite_Pow_iff)
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1294
qed
e279c2ceb54c reduced cardinals dependencies of (co)datatypes
traytel
parents: 54581
diff changeset
  1295
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1296
(* bounded powerset *)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1297
definition Bpow where
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1298
"Bpow r A \<equiv> {X . X \<subseteq> A \<and> |X| \<le>o r}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1299
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1300
lemma Bpow_empty[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1301
assumes "Card_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1302
shows "Bpow r {} = {{}}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1303
using assms unfolding Bpow_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1304
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1305
lemma singl_in_Bpow:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1306
assumes rc: "Card_order r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1307
and r: "Field r \<noteq> {}" and a: "a \<in> A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1308
shows "{a} \<in> Bpow r A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1309
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1310
  have "|{a}| \<le>o r" using r rc by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1311
  thus ?thesis unfolding Bpow_def using a by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1312
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1313
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1314
lemma ordLeq_card_Bpow:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1315
assumes rc: "Card_order r" and r: "Field r \<noteq> {}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1316
shows "|A| \<le>o |Bpow r A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1317
proof-
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1318
  have "inj_on (\<lambda> a. {a}) A" unfolding inj_on_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1319
  moreover have "(\<lambda> a. {a}) ` A \<subseteq> Bpow r A"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1320
  using singl_in_Bpow[OF assms] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1321
  ultimately show ?thesis unfolding card_of_ordLeq[symmetric] by blast
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1322
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1323
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1324
lemma infinite_Bpow:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1325
assumes rc: "Card_order r" and r: "Field r \<noteq> {}"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1326
and A: "\<not>finite A"
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1327
shows "\<not>finite (Bpow r A)"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1328
using ordLeq_card_Bpow[OF rc r]
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1329
by (metis A card_of_ordLeq_infinite)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1330
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1331
definition Func_option where
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1332
 "Func_option A B \<equiv>
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1333
  {f. (\<forall> a. f a \<noteq> None \<longleftrightarrow> a \<in> A) \<and> (\<forall> a \<in> A. case f a of Some b \<Rightarrow> b \<in> B |None \<Rightarrow> True)}"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1334
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1335
lemma card_of_Func_option_Func:
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1336
"|Func_option A B| =o |Func A B|"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1337
proof (rule ordIso_symmetric, unfold card_of_ordIso[symmetric], intro exI)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1338
  let ?F = "\<lambda> f a. if a \<in> A then Some (f a) else None"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1339
  show "bij_betw ?F (Func A B) (Func_option A B)"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1340
  unfolding bij_betw_def unfolding inj_on_def proof(intro conjI ballI impI)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1341
    fix f g assume f: "f \<in> Func A B" and g: "g \<in> Func A B" and eq: "?F f = ?F g"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1342
    show "f = g"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1343
    proof(rule ext)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1344
      fix a
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1345
      show "f a = g a"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1346
      proof(cases "a \<in> A")
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1347
        case True
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1348
        have "Some (f a) = ?F f a" using True by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1349
        also have "... = ?F g a" using eq unfolding fun_eq_iff by(rule allE)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1350
        also have "... = Some (g a)" using True by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1351
        finally have "Some (f a) = Some (g a)" .
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1352
        thus ?thesis by simp
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1353
      qed(insert f g, unfold Func_def, auto)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1354
    qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1355
  next
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1356
    show "?F ` Func A B = Func_option A B"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1357
    proof safe
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1358
      fix f assume f: "f \<in> Func_option A B"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61952
diff changeset
  1359
      define g where [abs_def]: "g a = (case f a of Some b \<Rightarrow> b | None \<Rightarrow> undefined)" for a
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1360
      have "g \<in> Func A B"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1361
      using f unfolding g_def Func_def Func_option_def by force+
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1362
      moreover have "f = ?F g"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1363
      proof(rule ext)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1364
        fix a show "f a = ?F g a"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1365
        using f unfolding Func_option_def g_def by (cases "a \<in> A") force+
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1366
      qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1367
      ultimately show "f \<in> ?F ` (Func A B)" by blast
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1368
    qed(unfold Func_def Func_option_def, auto)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1369
  qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1370
qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1371
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1372
(* partial-function space: *)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1373
definition Pfunc where
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1374
"Pfunc A B \<equiv>
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1375
 {f. (\<forall>a. f a \<noteq> None \<longrightarrow> a \<in> A) \<and>
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1376
     (\<forall>a. case f a of None \<Rightarrow> True | Some b \<Rightarrow> b \<in> B)}"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1377
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1378
lemma Func_Pfunc:
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1379
"Func_option A B \<subseteq> Pfunc A B"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1380
unfolding Func_option_def Pfunc_def by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1381
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1382
lemma Pfunc_Func_option:
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1383
"Pfunc A B = (\<Union>A' \<in> Pow A. Func_option A' B)"
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1384
proof safe
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1385
  fix f assume f: "f \<in> Pfunc A B"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1386
  show "f \<in> (\<Union>A'\<in>Pow A. Func_option A' B)"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1387
  proof (intro UN_I)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1388
    let ?A' = "{a. f a \<noteq> None}"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1389
    show "?A' \<in> Pow A" using f unfolding Pow_def Pfunc_def by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1390
    show "f \<in> Func_option ?A' B" using f unfolding Func_option_def Pfunc_def by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1391
  qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1392
next
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1393
  fix f A' assume "f \<in> Func_option A' B" and "A' \<subseteq> A"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1394
  thus "f \<in> Pfunc A B" unfolding Func_option_def Pfunc_def by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1395
qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1396
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1397
lemma card_of_Func_mono:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1398
fixes A1 A2 :: "'a set" and B :: "'b set"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1399
assumes A12: "A1 \<subseteq> A2" and B: "B \<noteq> {}"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1400
shows "|Func A1 B| \<le>o |Func A2 B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1401
proof-
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1402
  obtain bb where bb: "bb \<in> B" using B by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61952
diff changeset
  1403
  define F where [abs_def]: "F f1 a =
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61952
diff changeset
  1404
    (if a \<in> A2 then (if a \<in> A1 then f1 a else bb) else undefined)" for f1 :: "'a \<Rightarrow> 'b" and a
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1405
  show ?thesis unfolding card_of_ordLeq[symmetric] proof(intro exI[of _ F] conjI)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1406
    show "inj_on F (Func A1 B)" unfolding inj_on_def proof safe
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1407
      fix f g assume f: "f \<in> Func A1 B" and g: "g \<in> Func A1 B" and eq: "F f = F g"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1408
      show "f = g"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1409
      proof(rule ext)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1410
        fix a show "f a = g a"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1411
        proof(cases "a \<in> A1")
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1412
          case True
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1413
          thus ?thesis using eq A12 unfolding F_def fun_eq_iff
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1414
          by (elim allE[of _ a]) auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1415
        qed(insert f g, unfold Func_def, fastforce)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1416
      qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1417
    qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1418
  qed(insert bb, unfold Func_def F_def, force)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1419
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1420
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1421
lemma card_of_Func_option_mono:
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1422
fixes A1 A2 :: "'a set" and B :: "'b set"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1423
assumes A12: "A1 \<subseteq> A2" and B: "B \<noteq> {}"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1424
shows "|Func_option A1 B| \<le>o |Func_option A2 B|"
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1425
by (metis card_of_Func_mono[OF A12 B] card_of_Func_option_Func
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1426
  ordIso_ordLeq_trans ordLeq_ordIso_trans ordIso_symmetric)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1427
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1428
lemma card_of_Pfunc_Pow_Func_option:
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1429
assumes "B \<noteq> {}"
61943
7fba644ed827 discontinued ASCII replacement syntax <*>;
wenzelm
parents: 60585
diff changeset
  1430
shows "|Pfunc A B| \<le>o |Pow A \<times> Func_option A B|"
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1431
proof-
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1432
  have "|Pfunc A B| =o |\<Union>A' \<in> Pow A. Func_option A' B|" (is "_ =o ?K")
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1433
    unfolding Pfunc_Func_option by(rule card_of_refl)
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1434
  also have "?K \<le>o |Sigma (Pow A) (\<lambda> A'. Func_option A' B)|" using card_of_UNION_Sigma .
61943
7fba644ed827 discontinued ASCII replacement syntax <*>;
wenzelm
parents: 60585
diff changeset
  1435
  also have "|Sigma (Pow A) (\<lambda> A'. Func_option A' B)| \<le>o |Pow A \<times> Func_option A B|"
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1436
    apply(rule card_of_Sigma_mono1) using card_of_Func_option_mono[OF _ assms] by auto
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1437
  finally show ?thesis .
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1438
qed
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1439
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1440
lemma Bpow_ordLeq_Func_Field:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1441
assumes rc: "Card_order r" and r: "Field r \<noteq> {}" and A: "\<not>finite A"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1442
shows "|Bpow r A| \<le>o |Func (Field r) A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1443
proof-
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1444
  let ?F = "\<lambda> f. {x | x a. f a = x \<and> a \<in> Field r}"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1445
  {fix X assume "X \<in> Bpow r A - {{}}"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1446
   hence XA: "X \<subseteq> A" and "|X| \<le>o r"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1447
   and X: "X \<noteq> {}" unfolding Bpow_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1448
   hence "|X| \<le>o |Field r|" by (metis Field_card_of card_of_mono2)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1449
   then obtain F where 1: "X = F ` (Field r)"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1450
   using card_of_ordLeq2[OF X] by metis
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61952
diff changeset
  1451
   define f where [abs_def]: "f i = (if i \<in> Field r then F i else undefined)" for i
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1452
   have "\<exists> f \<in> Func (Field r) A. X = ?F f"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1453
   apply (intro bexI[of _ f]) using 1 XA unfolding Func_def f_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1454
  }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1455
  hence "Bpow r A - {{}} \<subseteq> ?F ` (Func (Field r) A)" by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1456
  hence "|Bpow r A - {{}}| \<le>o |Func (Field r) A|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1457
  by (rule surj_imp_ordLeq)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1458
  moreover
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1459
  {have 2: "\<not>finite (Bpow r A)" using infinite_Bpow[OF rc r A] .
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1460
   have "|Bpow r A| =o |Bpow r A - {{}}|"
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1461
     by (metis 2 infinite_card_of_diff_singl ordIso_symmetric)
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1462
  }
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1463
  ultimately show ?thesis by (metis ordIso_ordLeq_trans)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1464
qed
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1465
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1466
lemma empty_in_Func[simp]:
52545
d2ad6eae514f Func -> Func_option, Ffunc -> Func (avoids dependence of codatatypes on the option type)
traytel
parents: 52544
diff changeset
  1467
"B \<noteq> {} \<Longrightarrow> (\<lambda>x. undefined) \<in> Func {} B"
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1468
unfolding Func_def by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1469
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1470
lemma Func_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1471
assumes "B1 \<subseteq> B2"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1472
shows "Func A B1 \<subseteq> Func A B2"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1473
using assms unfolding Func_def by force
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1474
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1475
lemma Pfunc_mono[simp]:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1476
assumes "A1 \<subseteq> A2" and "B1 \<subseteq> B2"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1477
shows "Pfunc A B1 \<subseteq> Pfunc A B2"
59166
4e43651235b2 recovered metis proof after 115965966e15 (Odd clash of type variables!?);
wenzelm
parents: 58889
diff changeset
  1478
using assms unfolding Pfunc_def
4e43651235b2 recovered metis proof after 115965966e15 (Odd clash of type variables!?);
wenzelm
parents: 58889
diff changeset
  1479
apply safe
4e43651235b2 recovered metis proof after 115965966e15 (Odd clash of type variables!?);
wenzelm
parents: 58889
diff changeset
  1480
apply (case_tac "x a", auto)
4e43651235b2 recovered metis proof after 115965966e15 (Odd clash of type variables!?);
wenzelm
parents: 58889
diff changeset
  1481
apply (metis in_mono option.simps(5))
4e43651235b2 recovered metis proof after 115965966e15 (Odd clash of type variables!?);
wenzelm
parents: 58889
diff changeset
  1482
done
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1483
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1484
lemma card_of_Func_UNIV_UNIV:
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1485
"|Func (UNIV::'a set) (UNIV::'b set)| =o |UNIV::('a \<Rightarrow> 'b) set|"
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1486
using card_of_Func_UNIV[of "UNIV::'b set"] by auto
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1487
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1488
lemma ordLeq_Func:
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1489
assumes "{b1,b2} \<subseteq> B" "b1 \<noteq> b2"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1490
shows "|A| \<le>o |Func A B|"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1491
unfolding card_of_ordLeq[symmetric] proof(intro exI conjI)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1492
  let ?F = "\<lambda> aa a. if a \<in> A then (if a = aa then b1 else b2) else undefined"
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1493
  show "inj_on ?F A" using assms unfolding inj_on_def fun_eq_iff by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1494
  show "?F ` A \<subseteq> Func A B" using assms unfolding Func_def by auto
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1495
qed
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1496
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1497
lemma infinite_Func:
54578
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1498
assumes A: "\<not>finite A" and B: "{b1,b2} \<subseteq> B" "b1 \<noteq> b2"
9387251b6a46 eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
traytel
parents: 54481
diff changeset
  1499
shows "\<not>finite (Func A B)"
54475
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1500
using ordLeq_Func[OF B] by (metis A card_of_ordLeq_finite)
b4d644be252c moved theorems out of LFP
blanchet
parents: 54473
diff changeset
  1501
55102
761e40ce91bc whitespace tuning
blanchet
parents: 55087
diff changeset
  1502
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1503
subsection \<open>Infinite cardinals are limit ordinals\<close>
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1504
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1505
lemma card_order_infinite_isLimOrd:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1506
assumes c: "Card_order r" and i: "\<not>finite (Field r)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1507
shows "isLimOrd r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1508
proof-
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1509
  have 0: "wo_rel r" and 00: "Well_order r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1510
  using c unfolding card_order_on_def wo_rel_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1511
  hence rr: "Refl r" by (metis wo_rel.REFL)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1512
  show ?thesis unfolding wo_rel.isLimOrd_def[OF 0] wo_rel.isSuccOrd_def[OF 0] proof safe
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1513
    fix j assume j: "j \<in> Field r" and jm: "\<forall>i\<in>Field r. (i, j) \<in> r"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61952
diff changeset
  1514
    define p where "p = Restr r (Field r - {j})"
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1515
    have fp: "Field p = Field r - {j}"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1516
    unfolding p_def apply(rule Refl_Field_Restr2[OF rr]) by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1517
    have of: "ofilter r (Field p)" unfolding wo_rel.ofilter_def[OF 0] proof safe
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1518
      fix a x assume a: "a \<in> Field p" and "x \<in> under r a"
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1519
      hence x: "(x,a) \<in> r" "x \<in> Field r" unfolding under_def Field_def by auto
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1520
      moreover have a: "a \<noteq> j" "a \<in> Field r" "(a,j) \<in> r" using a jm  unfolding fp by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1521
      ultimately have "x \<noteq> j" using j jm  by (metis 0 wo_rel.max2_def wo_rel.max2_equals1)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1522
      thus "x \<in> Field p" using x unfolding fp by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1523
    qed(unfold p_def Field_def, auto)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1524
    have "p <o r" using j ofilter_ordLess[OF 00 of] unfolding fp p_def[symmetric] by auto
55056
b5c94200d081 renamed '_FP' files to 'BNF_' files
blanchet
parents: 55023
diff changeset
  1525
    hence 2: "|Field p| <o r" using c by (metis BNF_Cardinal_Order_Relation.ordLess_Field)
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1526
    have "|Field p| =o |Field r|" unfolding fp using i by (metis infinite_card_of_diff_singl)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1527
    also have "|Field r| =o r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1528
    using c by (metis card_of_unique ordIso_symmetric)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1529
    finally have "|Field p| =o r" .
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1530
    with 2 show False by (metis not_ordLess_ordIso)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1531
  qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1532
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1533
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1534
lemma insert_Chain:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1535
assumes "Refl r" "C \<in> Chains r" and "i \<in> Field r" and "\<And>j. j \<in> C \<Longrightarrow> (j,i) \<in> r \<or> (i,j) \<in> r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1536
shows "insert i C \<in> Chains r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1537
using assms unfolding Chains_def by (auto dest: refl_onD)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1538
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1539
lemma Collect_insert: "{R j |j. j \<in> insert j1 J} = insert (R j1) {R j |j. j \<in> J}"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1540
by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1541
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1542
lemma Field_init_seg_of[simp]:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1543
"Field init_seg_of = UNIV"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1544
unfolding Field_def init_seg_of_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1545
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1546
lemma refl_init_seg_of[intro, simp]: "refl init_seg_of"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1547
unfolding refl_on_def Field_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1548
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1549
lemma regularCard_all_ex:
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1550
assumes r: "Card_order r"   "regularCard r"
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1551
and As: "\<And> i j b. b \<in> B \<Longrightarrow> (i,j) \<in> r \<Longrightarrow> P i b \<Longrightarrow> P j b"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1552
and Bsub: "\<forall> b \<in> B. \<exists> i \<in> Field r. P i b"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1553
and cardB: "|B| <o r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1554
shows "\<exists> i \<in> Field r. \<forall> b \<in> B. P i b"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1555
proof-
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1556
  let ?As = "\<lambda>i. {b \<in> B. P i b}"
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 66453
diff changeset
  1557
  have "\<exists>i \<in> Field r. B \<le> ?As i"
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1558
  apply(rule regularCard_UNION) using assms unfolding relChain_def by auto
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1559
  thus ?thesis by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1560
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1561
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1562
lemma relChain_stabilize:
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1563
assumes rc: "relChain r As" and AsB: "(\<Union>i \<in> Field r. As i) \<subseteq> B" and Br: "|B| <o r"
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1564
and ir: "\<not>finite (Field r)" and cr: "Card_order r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1565
shows "\<exists> i \<in> Field r. As (succ r i) = As i"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1566
proof(rule ccontr, auto)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1567
  have 0: "wo_rel r" and 00: "Well_order r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1568
  unfolding wo_rel_def by (metis card_order_on_well_order_on cr)+
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1569
  have L: "isLimOrd r" using ir cr by (metis card_order_infinite_isLimOrd)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1570
  have AsBs: "(\<Union>i \<in> Field r. As (succ r i)) \<subseteq> B"
69712
dc85b5b3a532 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 68652
diff changeset
  1571
  using AsB L apply safe by (metis "0" UN_I subsetD wo_rel.isLimOrd_succ)
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1572
  assume As_s: "\<forall>i\<in>Field r. As (succ r i) \<noteq> As i"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1573
  have 1: "\<forall>i j. (i,j) \<in> r \<and> i \<noteq> j \<longrightarrow> As i \<subset> As j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1574
  proof safe
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1575
    fix i j assume 1: "(i, j) \<in> r" "i \<noteq> j" and Asij: "As i = As j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1576
    hence rij: "(succ r i, j) \<in> r" by (metis "0" wo_rel.succ_smallest)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1577
    hence "As (succ r i) \<subseteq> As j" using rc unfolding relChain_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1578
    moreover
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1579
    {have "(i,succ r i) \<in> r" apply(rule wo_rel.succ_in[OF 0])
55023
38db7814481d get rid of 'rel' locale, to facilitate inclusion of 'Order_Relation_More_FP' into 'Order_Relation'
blanchet
parents: 54989
diff changeset
  1580
     using 1 unfolding aboveS_def by auto
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1581
     hence "As i \<subset> As (succ r i)" using As_s rc rij unfolding relChain_def Field_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1582
    }
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1583
    ultimately show False unfolding Asij by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1584
  qed (insert rc, unfold relChain_def, auto)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1585
  hence "\<forall> i \<in> Field r. \<exists> a. a \<in> As (succ r i) - As i"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1586
  using wo_rel.succ_in[OF 0] AsB
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1587
  by(metis 0 card_order_infinite_isLimOrd cr ir psubset_imp_ex_mem
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1588
            wo_rel.isLimOrd_aboveS wo_rel.succ_diff)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1589
  then obtain f where f: "\<forall> i \<in> Field r. f i \<in> As (succ r i) - As i" by metis
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1590
  have "inj_on f (Field r)" unfolding inj_on_def proof safe
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1591
    fix i j assume ij: "i \<in> Field r" "j \<in> Field r" and fij: "f i = f j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1592
    show "i = j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1593
    proof(cases rule: wo_rel.cases_Total3[OF 0], safe)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1594
      assume "(i, j) \<in> r" and ijd: "i \<noteq> j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1595
      hence rij: "(succ r i, j) \<in> r" by (metis "0" wo_rel.succ_smallest)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1596
      hence "As (succ r i) \<subseteq> As j" using rc unfolding relChain_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1597
      thus "i = j" using ij ijd fij f by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1598
    next
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1599
      assume "(j, i) \<in> r" and ijd: "i \<noteq> j"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1600
      hence rij: "(succ r j, i) \<in> r" by (metis "0" wo_rel.succ_smallest)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1601
      hence "As (succ r j) \<subseteq> As i" using rc unfolding relChain_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1602
      thus "j = i" using ij ijd fij f by fastforce
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1603
    qed(insert ij, auto)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1604
  qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1605
  moreover have "f ` (Field r) \<subseteq> B" using f AsBs by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1606
  moreover have "|B| <o |Field r|" using Br cr by (metis card_of_unique ordLess_ordIso_trans)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1607
  ultimately show False unfolding card_of_ordLess[symmetric] by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1608
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1609
55102
761e40ce91bc whitespace tuning
blanchet
parents: 55087
diff changeset
  1610
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1611
subsection \<open>Regular vs. stable cardinals\<close>
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1612
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1613
lemma stable_regularCard:
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1614
assumes cr: "Card_order r" and ir: "\<not>finite (Field r)" and st: "stable r"
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1615
shows "regularCard r"
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1616
unfolding regularCard_def proof safe
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1617
  fix K assume K: "K \<subseteq> Field r" and cof: "cofinal K r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1618
  have "|K| \<le>o r" using K by (metis card_of_Field_ordIso card_of_mono1 cr ordLeq_ordIso_trans)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1619
  moreover
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1620
  {assume Kr: "|K| <o r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1621
   then obtain f where "\<forall> a \<in> Field r. f a \<in> K \<and> a \<noteq> f a \<and> (a, f a) \<in> r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1622
   using cof unfolding cofinal_def by metis
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1623
   hence "Field r \<subseteq> (\<Union>a \<in> K. underS r a)" unfolding underS_def by auto
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1624
   hence "r \<le>o |\<Union>a \<in> K. underS r a|" using cr
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1625
   by (metis Card_order_iff_ordLeq_card_of card_of_mono1 ordLeq_transitive)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 59166
diff changeset
  1626
   also have "|\<Union>a \<in> K. underS r a| \<le>o |SIGMA a: K. underS r a|" by (rule card_of_UNION_Sigma)
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1627
   also
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1628
   {have "\<forall> a \<in> K. |underS r a| <o r" using K by (metis card_of_underS cr subsetD)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1629
    hence "|SIGMA a: K. underS r a| <o r" using st Kr unfolding stable_def by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1630
   }
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1631
   finally have "r <o r" .
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1632
   hence False by (metis ordLess_irreflexive)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1633
  }
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1634
  ultimately show "|K| =o r" by (metis ordLeq_iff_ordLess_or_ordIso)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1635
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1636
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1637
lemma stable_natLeq: "stable natLeq"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1638
proof(unfold stable_def, safe)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1639
  fix A :: "'a set" and F :: "'a \<Rightarrow> 'a set"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1640
  assume "|A| <o natLeq" and "\<forall>a\<in>A. |F a| <o natLeq"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1641
  hence "finite A \<and> (\<forall>a \<in> A. finite(F a))"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1642
  by (auto simp add: finite_iff_ordLess_natLeq)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1643
  hence "finite(Sigma A F)" by (simp only: finite_SigmaI[of A F])
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1644
  thus "|Sigma A F | <o natLeq"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1645
  by (auto simp add: finite_iff_ordLess_natLeq)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1646
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1647
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1648
corollary regularCard_natLeq: "regularCard natLeq"
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1649
using stable_regularCard[OF natLeq_Card_order _ stable_natLeq] Field_natLeq by simp
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1650
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1651
lemma stable_cardSuc:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1652
assumes CARD: "Card_order r" and INF: "\<not>finite (Field r)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1653
shows "stable(cardSuc r)"
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1654
using infinite_cardSuc_regularCard regularCard_stable
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1655
by (metis CARD INF cardSuc_Card_order cardSuc_finite)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1656
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1657
lemma stable_ordIso1:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1658
assumes ST: "stable r" and ISO: "r' =o r"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1659
shows "stable r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1660
proof(unfold stable_def, auto)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1661
  fix A::"'b set" and F::"'b \<Rightarrow> 'b set"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1662
  assume "|A| <o r'" and "\<forall>a \<in> A. |F a| <o r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1663
  hence "( |A| <o r) \<and> (\<forall>a \<in> A. |F a| <o r)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1664
  using ISO ordLess_ordIso_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1665
  hence "|SIGMA a : A. F a| <o r" using assms stable_elim by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1666
  thus "|SIGMA a : A. F a| <o r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1667
  using ISO ordIso_symmetric ordLess_ordIso_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1668
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1669
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1670
lemma stable_ordIso2:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1671
assumes ST: "stable r" and ISO: "r =o r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1672
shows "stable r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1673
using assms stable_ordIso1 ordIso_symmetric by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1674
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1675
lemma stable_ordIso:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1676
assumes "r =o r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1677
shows "stable r = stable r'"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1678
using assms stable_ordIso1 stable_ordIso2 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1679
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1680
lemma stable_nat: "stable |UNIV::nat set|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1681
using stable_natLeq card_of_nat stable_ordIso by auto
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1682
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1683
text\<open>Below, the type of "A" is not important -- we just had to choose an appropriate
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1684
   type to make "A" possible. What is important is that arbitrarily large
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1685
   infinite sets of stable cardinality exist.\<close>
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1686
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1687
lemma infinite_stable_exists:
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1688
assumes CARD: "\<forall>r \<in> R. Card_order (r::'a rel)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1689
shows "\<exists>(A :: (nat + 'a set)set).
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1690
          \<not>finite A \<and> stable |A| \<and> (\<forall>r \<in> R. r <o |A| )"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1691
proof-
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1692
  have "\<exists>(A :: (nat + 'a set)set).
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1693
          \<not>finite A \<and> stable |A| \<and> |UNIV::'a set| <o |A|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1694
  proof(cases "finite (UNIV::'a set)")
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1695
    assume Case1: "finite (UNIV::'a set)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1696
    let ?B = "UNIV::nat set"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1697
    have "\<not>finite(?B <+> {})" using finite_Plus_iff by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1698
    moreover
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1699
    have "stable |?B|" using stable_natLeq card_of_nat stable_ordIso1 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1700
    hence "stable |?B <+> {}|" using stable_ordIso card_of_Plus_empty1 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1701
    moreover
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1702
    have "\<not>finite(Field |?B| ) \<and> finite(Field |UNIV::'a set| )" using Case1 by simp
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1703
    hence "|UNIV::'a set| <o |?B|" by (simp add: finite_ordLess_infinite)
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1704
    hence "|UNIV::'a set| <o |?B <+> {}|" using card_of_Plus_empty1 ordLess_ordIso_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1705
    ultimately show ?thesis by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1706
  next
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1707
    assume Case1: "\<not>finite (UNIV::'a set)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1708
    hence *: "\<not>finite(Field |UNIV::'a set| )" by simp
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1709
    let ?B = "Field(cardSuc |UNIV::'a set| )"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1710
    have 0: "|?B| =o |{} <+> ?B|" using card_of_Plus_empty2 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1711
    have 1: "\<not>finite ?B" using Case1 card_of_cardSuc_finite by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1712
    hence 2: "\<not>finite({} <+> ?B)" using 0 card_of_ordIso_finite by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1713
    have "|?B| =o cardSuc |UNIV::'a set|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1714
    using card_of_Card_order cardSuc_Card_order card_of_Field_ordIso by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1715
    moreover have "stable(cardSuc |UNIV::'a set| )"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1716
    using stable_cardSuc * card_of_Card_order by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1717
    ultimately have "stable |?B|" using stable_ordIso by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1718
    hence 3: "stable |{} <+> ?B|" using stable_ordIso 0 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1719
    have "|UNIV::'a set| <o cardSuc |UNIV::'a set|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1720
    using card_of_Card_order cardSuc_greater by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1721
    moreover have "|?B| =o  cardSuc |UNIV::'a set|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1722
    using card_of_Card_order cardSuc_Card_order  card_of_Field_ordIso by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1723
    ultimately have "|UNIV::'a set| <o |?B|"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1724
    using ordIso_symmetric ordLess_ordIso_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1725
    hence "|UNIV::'a set| <o |{} <+> ?B|" using 0 ordLess_ordIso_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1726
    thus ?thesis using 2 3 by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1727
  qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1728
  thus ?thesis using CARD card_of_UNIV2 ordLeq_ordLess_trans by blast
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1729
qed
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1730
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1731
corollary infinite_regularCard_exists:
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1732
assumes CARD: "\<forall>r \<in> R. Card_order (r::'a rel)"
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1733
shows "\<exists>(A :: (nat + 'a set)set).
55087
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1734
          \<not>finite A \<and> regularCard |A| \<and> (\<forall>r \<in> R. r <o |A| )"
252c7fec4119 renamed 'regular' to 'regularCard' to avoid clashes (e.g. in Meson_Test)
blanchet
parents: 55056
diff changeset
  1735
using infinite_stable_exists[OF CARD] stable_regularCard by (metis Field_card_of card_of_card_order_on)
54980
7e0573a490ee basic ordinal arithmetic and cardinals library extension (not relevant for BNFs)
traytel
parents: 54794
diff changeset
  1736
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
  1737
end