src/ZF/Cardinal.thy
author wenzelm
Fri, 09 Oct 2015 20:26:03 +0200
changeset 61378 3e04c9ca001a
parent 60770 240563fbf41d
child 61394 6142b282b164
permissions -rw-r--r--
discontinued specific HTML syntax;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/Cardinal.thy
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
13328
703de709a64b better document preparation
paulson
parents: 13269
diff changeset
     4
*)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
     5
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
     6
section\<open>Cardinal Numbers Without the Axiom of Choice\<close>
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
     7
26056
6a0801279f4c Made theory names in ZF disjoint from HOL theory names to allow loading both developments
krauss
parents: 24893
diff changeset
     8
theory Cardinal imports OrderType Finite Nat_ZF Sum begin
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
     9
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    10
definition
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    11
  (*least ordinal operator*)
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    12
   Least    :: "(i=>o) => i"    (binder "LEAST " 10)  where
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    13
     "Least(P) == THE i. Ord(i) & P(i) & (\<forall>j. j<i \<longrightarrow> ~P(j))"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    14
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    15
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    16
  eqpoll   :: "[i,i] => o"     (infixl "eqpoll" 50)  where
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    17
    "A eqpoll B == \<exists>f. f \<in> bij(A,B)"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    18
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    19
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    20
  lepoll   :: "[i,i] => o"     (infixl "lepoll" 50)  where
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    21
    "A lepoll B == \<exists>f. f \<in> inj(A,B)"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    22
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    23
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    24
  lesspoll :: "[i,i] => o"     (infixl "lesspoll" 50)  where
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    25
    "A lesspoll B == A lepoll B & ~(A eqpoll B)"
832
ad50a9e74eaf Added Krzysztof's constants lesspoll and Finite
lcp
parents: 753
diff changeset
    26
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    27
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    28
  cardinal :: "i=>i"           ("|_|")  where
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
    29
    "|A| == (LEAST i. i eqpoll A)"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    30
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    31
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    32
  Finite   :: "i=>o"  where
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    33
    "Finite(A) == \<exists>n\<in>nat. A eqpoll n"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    34
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    35
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 21524
diff changeset
    36
  Card     :: "i=>o"  where
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    37
    "Card(i) == (i = |i|)"
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
    38
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 16417
diff changeset
    39
notation (xsymbols)
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 16417
diff changeset
    40
  eqpoll    (infixl "\<approx>" 50) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 16417
diff changeset
    41
  lepoll    (infixl "\<lesssim>" 50) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 16417
diff changeset
    42
  lesspoll  (infixl "\<prec>" 50) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 16417
diff changeset
    43
  Least     (binder "\<mu>" 10)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    44
14565
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14153
diff changeset
    45
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
    46
subsection\<open>The Schroeder-Bernstein Theorem\<close>
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
    47
text\<open>See Davey and Priestly, page 106\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    48
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    49
(** Lemma: Banach's Decomposition Theorem **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    50
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    51
lemma decomp_bnd_mono: "bnd_mono(X, %W. X - g``(Y - f``W))"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    52
by (rule bnd_monoI, blast+)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    53
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    54
lemma Banach_last_equation:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    55
    "g \<in> Y->X
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    56
     ==> g``(Y - f`` lfp(X, %W. X - g``(Y - f``W))) =
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    57
         X - lfp(X, %W. X - g``(Y - f``W))"
59788
6f7b6adac439 prefer local fixes;
wenzelm
parents: 58871
diff changeset
    58
apply (rule_tac P = "%u. v = X-u" for v
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    59
       in decomp_bnd_mono [THEN lfp_unfold, THEN ssubst])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    60
apply (simp add: double_complement  fun_is_rel [THEN image_subset])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    61
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    62
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    63
lemma decomposition:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    64
     "[| f \<in> X->Y;  g \<in> Y->X |] ==>
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    65
      \<exists>XA XB YA YB. (XA \<inter> XB = 0) & (XA \<union> XB = X) &
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    66
                      (YA \<inter> YB = 0) & (YA \<union> YB = Y) &
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    67
                      f``XA=YA & g``YB=XB"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    68
apply (intro exI conjI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    69
apply (rule_tac [6] Banach_last_equation)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    70
apply (rule_tac [5] refl)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    71
apply (assumption |
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    72
       rule  Diff_disjoint Diff_partition fun_is_rel image_subset lfp_subset)+
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    73
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    74
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    75
lemma schroeder_bernstein:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    76
    "[| f \<in> inj(X,Y);  g \<in> inj(Y,X) |] ==> \<exists>h. h \<in> bij(X,Y)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    77
apply (insert decomposition [of f X Y g])
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    78
apply (simp add: inj_is_fun)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    79
apply (blast intro!: restrict_bij bij_disjoint_Un intro: bij_converse_bij)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
    80
(* The instantiation of exI to @{term"restrict(f,XA) \<union> converse(restrict(g,YB))"}
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    81
   is forced by the context!! *)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    82
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    83
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    84
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    85
(** Equipollence is an equivalence relation **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    86
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
    87
lemma bij_imp_eqpoll: "f \<in> bij(A,B) ==> A \<approx> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    88
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    89
apply (erule exI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    90
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    91
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    92
(*A eqpoll A*)
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
    93
lemmas eqpoll_refl = id_bij [THEN bij_imp_eqpoll, simp]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    94
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    95
lemma eqpoll_sym: "X \<approx> Y ==> Y \<approx> X"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    96
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    97
apply (blast intro: bij_converse_bij)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    98
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
    99
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   100
lemma eqpoll_trans [trans]:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   101
    "[| X \<approx> Y;  Y \<approx> Z |] ==> X \<approx> Z"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   102
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   103
apply (blast intro: comp_bij)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   104
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   105
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   106
(** Le-pollence is a partial ordering **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   107
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   108
lemma subset_imp_lepoll: "X<=Y ==> X \<lesssim> Y"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   109
apply (unfold lepoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   110
apply (rule exI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   111
apply (erule id_subset_inj)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   112
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   113
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
   114
lemmas lepoll_refl = subset_refl [THEN subset_imp_lepoll, simp]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   115
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
   116
lemmas le_imp_lepoll = le_imp_subset [THEN subset_imp_lepoll]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   117
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   118
lemma eqpoll_imp_lepoll: "X \<approx> Y ==> X \<lesssim> Y"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   119
by (unfold eqpoll_def bij_def lepoll_def, blast)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   120
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   121
lemma lepoll_trans [trans]: "[| X \<lesssim> Y;  Y \<lesssim> Z |] ==> X \<lesssim> Z"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   122
apply (unfold lepoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   123
apply (blast intro: comp_inj)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   124
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   125
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   126
lemma eq_lepoll_trans [trans]: "[| X \<approx> Y;  Y \<lesssim> Z |] ==> X \<lesssim> Z"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   127
 by (blast intro: eqpoll_imp_lepoll lepoll_trans)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   128
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   129
lemma lepoll_eq_trans [trans]: "[| X \<lesssim> Y;  Y \<approx> Z |] ==> X \<lesssim> Z"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   130
 by (blast intro: eqpoll_imp_lepoll lepoll_trans)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   131
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   132
(*Asymmetry law*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   133
lemma eqpollI: "[| X \<lesssim> Y;  Y \<lesssim> X |] ==> X \<approx> Y"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   134
apply (unfold lepoll_def eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   135
apply (elim exE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   136
apply (rule schroeder_bernstein, assumption+)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   137
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   138
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   139
lemma eqpollE:
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   140
    "[| X \<approx> Y; [| X \<lesssim> Y; Y \<lesssim> X |] ==> P |] ==> P"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   141
by (blast intro: eqpoll_imp_lepoll eqpoll_sym)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   142
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   143
lemma eqpoll_iff: "X \<approx> Y \<longleftrightarrow> X \<lesssim> Y & Y \<lesssim> X"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   144
by (blast intro: eqpollI elim!: eqpollE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   145
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   146
lemma lepoll_0_is_0: "A \<lesssim> 0 ==> A = 0"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   147
apply (unfold lepoll_def inj_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   148
apply (blast dest: apply_type)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   149
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   150
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   151
(*@{term"0 \<lesssim> Y"}*)
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
   152
lemmas empty_lepollI = empty_subsetI [THEN subset_imp_lepoll]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   153
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   154
lemma lepoll_0_iff: "A \<lesssim> 0 \<longleftrightarrow> A=0"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   155
by (blast intro: lepoll_0_is_0 lepoll_refl)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   156
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   157
lemma Un_lepoll_Un:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   158
    "[| A \<lesssim> B; C \<lesssim> D; B \<inter> D = 0 |] ==> A \<union> C \<lesssim> B \<union> D"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   159
apply (unfold lepoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   160
apply (blast intro: inj_disjoint_Un)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   161
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   162
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   163
(*A eqpoll 0 ==> A=0*)
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
   164
lemmas eqpoll_0_is_0 = eqpoll_imp_lepoll [THEN lepoll_0_is_0]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   165
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   166
lemma eqpoll_0_iff: "A \<approx> 0 \<longleftrightarrow> A=0"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   167
by (blast intro: eqpoll_0_is_0 eqpoll_refl)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   168
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   169
lemma eqpoll_disjoint_Un:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   170
    "[| A \<approx> B;  C \<approx> D;  A \<inter> C = 0;  B \<inter> D = 0 |]
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   171
     ==> A \<union> C \<approx> B \<union> D"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   172
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   173
apply (blast intro: bij_disjoint_Un)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   174
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   175
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   176
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   177
subsection\<open>lesspoll: contributions by Krzysztof Grabczewski\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   178
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   179
lemma lesspoll_not_refl: "~ (i \<prec> i)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   180
by (simp add: lesspoll_def)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   181
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   182
lemma lesspoll_irrefl [elim!]: "i \<prec> i ==> P"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   183
by (simp add: lesspoll_def)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   184
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   185
lemma lesspoll_imp_lepoll: "A \<prec> B ==> A \<lesssim> B"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   186
by (unfold lesspoll_def, blast)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   187
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   188
lemma lepoll_well_ord: "[| A \<lesssim> B; well_ord(B,r) |] ==> \<exists>s. well_ord(A,s)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   189
apply (unfold lepoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   190
apply (blast intro: well_ord_rvimage)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   191
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   192
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   193
lemma lepoll_iff_leqpoll: "A \<lesssim> B \<longleftrightarrow> A \<prec> B | A \<approx> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   194
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   195
apply (blast intro!: eqpollI elim!: eqpollE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   196
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   197
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   198
lemma inj_not_surj_succ:
47042
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   199
  assumes fi: "f \<in> inj(A, succ(m))" and fns: "f \<notin> surj(A, succ(m))" 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   200
  shows "\<exists>f. f \<in> inj(A,m)"
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   201
proof -
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   202
  from fi [THEN inj_is_fun] fns 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   203
  obtain y where y: "y \<in> succ(m)" "\<And>x. x\<in>A \<Longrightarrow> f ` x \<noteq> y"
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   204
    by (auto simp add: surj_def)
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   205
  show ?thesis
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   206
    proof 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   207
      show "(\<lambda>z\<in>A. if f`z = m then y else f`z) \<in> inj(A, m)" using y fi
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   208
        by (simp add: inj_def) 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   209
           (auto intro!: if_type [THEN lam_type] intro: Pi_type dest: apply_funtype)
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   210
      qed
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   211
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   212
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   213
(** Variations on transitivity **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   214
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   215
lemma lesspoll_trans [trans]:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   216
      "[| X \<prec> Y; Y \<prec> Z |] ==> X \<prec> Z"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   217
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   218
apply (blast elim!: eqpollE intro: eqpollI lepoll_trans)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   219
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   220
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   221
lemma lesspoll_trans1 [trans]:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   222
      "[| X \<lesssim> Y; Y \<prec> Z |] ==> X \<prec> Z"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   223
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   224
apply (blast elim!: eqpollE intro: eqpollI lepoll_trans)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   225
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   226
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   227
lemma lesspoll_trans2 [trans]:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   228
      "[| X \<prec> Y; Y \<lesssim> Z |] ==> X \<prec> Z"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   229
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   230
apply (blast elim!: eqpollE intro: eqpollI lepoll_trans)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   231
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   232
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   233
lemma eq_lesspoll_trans [trans]:
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   234
      "[| X \<approx> Y; Y \<prec> Z |] ==> X \<prec> Z"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   235
  by (blast intro: eqpoll_imp_lepoll lesspoll_trans1)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   236
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   237
lemma lesspoll_eq_trans [trans]:
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   238
      "[| X \<prec> Y; Y \<approx> Z |] ==> X \<prec> Z"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   239
  by (blast intro: eqpoll_imp_lepoll lesspoll_trans2)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   240
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   241
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   242
(** LEAST -- the least number operator [from HOL/Univ.ML] **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   243
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   244
lemma Least_equality:
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   245
    "[| P(i);  Ord(i);  !!x. x<i ==> ~P(x) |] ==> (\<mu> x. P(x)) = i"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   246
apply (unfold Least_def)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   247
apply (rule the_equality, blast)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   248
apply (elim conjE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   249
apply (erule Ord_linear_lt, assumption, blast+)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   250
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   251
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   252
lemma LeastI: 
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   253
  assumes P: "P(i)" and i: "Ord(i)" shows "P(\<mu> x. P(x))"
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   254
proof -
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   255
  { from i have "P(i) \<Longrightarrow> P(\<mu> x. P(x))"
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   256
      proof (induct i rule: trans_induct)
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   257
        case (step i) 
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   258
        show ?case
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   259
          proof (cases "P(\<mu> a. P(a))")
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   260
            case True thus ?thesis .
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   261
          next
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   262
            case False
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   263
            hence "\<And>x. x \<in> i \<Longrightarrow> ~P(x)" using step
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   264
              by blast
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   265
            hence "(\<mu> a. P(a)) = i" using step
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   266
              by (blast intro: Least_equality ltD) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   267
            thus ?thesis using step.prems
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   268
              by simp 
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   269
          qed
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   270
      qed
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   271
  }
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   272
  thus ?thesis using P .
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   273
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   274
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   275
text\<open>The proof is almost identical to the one above!\<close>
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   276
lemma Least_le: 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   277
  assumes P: "P(i)" and i: "Ord(i)" shows "(\<mu> x. P(x)) \<le> i"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   278
proof -
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   279
  { from i have "P(i) \<Longrightarrow> (\<mu> x. P(x)) \<le> i"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   280
      proof (induct i rule: trans_induct)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   281
        case (step i) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   282
        show ?case
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   283
          proof (cases "(\<mu> a. P(a)) \<le> i")
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   284
            case True thus ?thesis .
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   285
          next
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   286
            case False
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   287
            hence "\<And>x. x \<in> i \<Longrightarrow> ~ (\<mu> a. P(a)) \<le> i" using step
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   288
              by blast
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   289
            hence "(\<mu> a. P(a)) = i" using step
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   290
              by (blast elim: ltE intro: ltI Least_equality lt_trans1)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   291
            thus ?thesis using step
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   292
              by simp 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   293
          qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   294
      qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   295
  }
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   296
  thus ?thesis using P .
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   297
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   298
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   299
(*LEAST really is the smallest*)
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   300
lemma less_LeastE: "[| P(i);  i < (\<mu> x. P(x)) |] ==> Q"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   301
apply (rule Least_le [THEN [2] lt_trans2, THEN lt_irrefl], assumption+)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   302
apply (simp add: lt_Ord)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   303
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   304
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   305
(*Easier to apply than LeastI: conclusion has only one occurrence of P*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   306
lemma LeastI2:
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   307
    "[| P(i);  Ord(i);  !!j. P(j) ==> Q(j) |] ==> Q(\<mu> j. P(j))"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   308
by (blast intro: LeastI )
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   309
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   310
(*If there is no such P then LEAST is vacuously 0*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   311
lemma Least_0:
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   312
    "[| ~ (\<exists>i. Ord(i) & P(i)) |] ==> (\<mu> x. P(x)) = 0"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   313
apply (unfold Least_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   314
apply (rule the_0, blast)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   315
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   316
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   317
lemma Ord_Least [intro,simp,TC]: "Ord(\<mu> x. P(x))"
47042
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   318
proof (cases "\<exists>i. Ord(i) & P(i)")
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   319
  case True 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   320
  then obtain i where "P(i)" "Ord(i)"  by auto
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   321
  hence " (\<mu> x. P(x)) \<le> i"  by (rule Least_le) 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   322
  thus ?thesis
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   323
    by (elim ltE)
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   324
next
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   325
  case False
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   326
  hence "(\<mu> x. P(x)) = 0"  by (rule Least_0)
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   327
  thus ?thesis
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   328
    by auto
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   329
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   330
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   331
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   332
subsection\<open>Basic Properties of Cardinals\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   333
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   334
(*Not needed for simplification, but helpful below*)
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   335
lemma Least_cong: "(!!y. P(y) \<longleftrightarrow> Q(y)) ==> (\<mu> x. P(x)) = (\<mu> x. Q(x))"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   336
by simp
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   337
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   338
(*Need AC to get @{term"X \<lesssim> Y ==> |X| \<le> |Y|"};  see well_ord_lepoll_imp_Card_le
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   339
  Converse also requires AC, but see well_ord_cardinal_eqE*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   340
lemma cardinal_cong: "X \<approx> Y ==> |X| = |Y|"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   341
apply (unfold eqpoll_def cardinal_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   342
apply (rule Least_cong)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   343
apply (blast intro: comp_bij bij_converse_bij)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   344
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   345
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   346
(*Under AC, the premise becomes trivial; one consequence is ||A|| = |A|*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   347
lemma well_ord_cardinal_eqpoll:
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   348
  assumes r: "well_ord(A,r)" shows "|A| \<approx> A"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   349
proof (unfold cardinal_def)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   350
  show "(\<mu> i. i \<approx> A) \<approx> A"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   351
    by (best intro: LeastI Ord_ordertype ordermap_bij bij_converse_bij bij_imp_eqpoll r) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   352
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   353
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   354
(* @{term"Ord(A) ==> |A| \<approx> A"} *)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   355
lemmas Ord_cardinal_eqpoll = well_ord_Memrel [THEN well_ord_cardinal_eqpoll]
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   356
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   357
lemma Ord_cardinal_idem: "Ord(A) \<Longrightarrow> ||A|| = |A|"
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   358
 by (rule Ord_cardinal_eqpoll [THEN cardinal_cong])
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   359
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   360
lemma well_ord_cardinal_eqE:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   361
  assumes woX: "well_ord(X,r)" and woY: "well_ord(Y,s)" and eq: "|X| = |Y|"
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   362
shows "X \<approx> Y"
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   363
proof -
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   364
  have "X \<approx> |X|" by (blast intro: well_ord_cardinal_eqpoll [OF woX] eqpoll_sym)
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   365
  also have "... = |Y|" by (rule eq)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   366
  also have "... \<approx> Y" by (rule well_ord_cardinal_eqpoll [OF woY])
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   367
  finally show ?thesis .
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   368
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   369
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   370
lemma well_ord_cardinal_eqpoll_iff:
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   371
     "[| well_ord(X,r);  well_ord(Y,s) |] ==> |X| = |Y| \<longleftrightarrow> X \<approx> Y"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   372
by (blast intro: cardinal_cong well_ord_cardinal_eqE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   373
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   374
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   375
(** Observations from Kunen, page 28 **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   376
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   377
lemma Ord_cardinal_le: "Ord(i) ==> |i| \<le> i"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   378
apply (unfold cardinal_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   379
apply (erule eqpoll_refl [THEN Least_le])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   380
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   381
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   382
lemma Card_cardinal_eq: "Card(K) ==> |K| = K"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   383
apply (unfold Card_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   384
apply (erule sym)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   385
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   386
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   387
(* Could replace the  @{term"~(j \<approx> i)"}  by  @{term"~(i \<preceq> j)"}. *)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   388
lemma CardI: "[| Ord(i);  !!j. j<i ==> ~(j \<approx> i) |] ==> Card(i)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   389
apply (unfold Card_def cardinal_def)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   390
apply (subst Least_equality)
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   391
apply (blast intro: eqpoll_refl)+
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   392
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   393
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   394
lemma Card_is_Ord: "Card(i) ==> Ord(i)"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   395
apply (unfold Card_def cardinal_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   396
apply (erule ssubst)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   397
apply (rule Ord_Least)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   398
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   399
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   400
lemma Card_cardinal_le: "Card(K) ==> K \<le> |K|"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   401
apply (simp (no_asm_simp) add: Card_is_Ord Card_cardinal_eq)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   402
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   403
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   404
lemma Ord_cardinal [simp,intro!]: "Ord(|A|)"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   405
apply (unfold cardinal_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   406
apply (rule Ord_Least)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   407
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   408
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   409
text\<open>The cardinals are the initial ordinals.\<close>
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   410
lemma Card_iff_initial: "Card(K) \<longleftrightarrow> Ord(K) & (\<forall>j. j<K \<longrightarrow> ~ j \<approx> K)"
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   411
proof -
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   412
  { fix j
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   413
    assume K: "Card(K)" "j \<approx> K"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   414
    assume "j < K"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   415
    also have "... = (\<mu> i. i \<approx> K)" using K
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   416
      by (simp add: Card_def cardinal_def)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   417
    finally have "j < (\<mu> i. i \<approx> K)" .
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   418
    hence "False" using K
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   419
      by (best dest: less_LeastE) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   420
  }
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   421
  then show ?thesis
47042
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   422
    by (blast intro: CardI Card_is_Ord) 
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   423
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   424
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   425
lemma lt_Card_imp_lesspoll: "[| Card(a); i<a |] ==> i \<prec> a"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   426
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   427
apply (drule Card_iff_initial [THEN iffD1])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   428
apply (blast intro!: leI [THEN le_imp_lepoll])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   429
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   430
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   431
lemma Card_0: "Card(0)"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   432
apply (rule Ord_0 [THEN CardI])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   433
apply (blast elim!: ltE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   434
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   435
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   436
lemma Card_Un: "[| Card(K);  Card(L) |] ==> Card(K \<union> L)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   437
apply (rule Ord_linear_le [of K L])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   438
apply (simp_all add: subset_Un_iff [THEN iffD1]  Card_is_Ord le_imp_subset
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   439
                     subset_Un_iff2 [THEN iffD1])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   440
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   441
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   442
(*Infinite unions of cardinals?  See Devlin, Lemma 6.7, page 98*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   443
47101
ded5cc757bc9 proof tidying
paulson
parents: 47042
diff changeset
   444
lemma Card_cardinal [iff]: "Card(|A|)"
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   445
proof (unfold cardinal_def)
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   446
  show "Card(\<mu> i. i \<approx> A)"
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   447
    proof (cases "\<exists>i. Ord (i) & i \<approx> A")
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   448
      case False thus ?thesis           --\<open>degenerate case\<close>
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   449
        by (simp add: Least_0 Card_0)
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   450
    next
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   451
      case True                         --\<open>real case: @{term A} is isomorphic to some ordinal\<close>
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   452
      then obtain i where i: "Ord(i)" "i \<approx> A" by blast
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   453
      show ?thesis
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   454
        proof (rule CardI [OF Ord_Least], rule notI)
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   455
          fix j
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   456
          assume j: "j < (\<mu> i. i \<approx> A)"
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   457
          assume "j \<approx> (\<mu> i. i \<approx> A)"
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   458
          also have "... \<approx> A" using i by (auto intro: LeastI)
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   459
          finally have "j \<approx> A" .
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   460
          thus False
46847
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   461
            by (rule less_LeastE [OF _ j])
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   462
        qed
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   463
    qed
8740cea39a4a More calculation-based cardinality proofs
paulson
parents: 46841
diff changeset
   464
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   465
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   466
(*Kunen's Lemma 10.5*)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   467
lemma cardinal_eq_lemma:
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   468
  assumes i:"|i| \<le> j" and j: "j \<le> i" shows "|j| = |i|"
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   469
proof (rule eqpollI [THEN cardinal_cong])
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   470
  show "j \<lesssim> i" by (rule le_imp_lepoll [OF j])
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   471
next
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   472
  have Oi: "Ord(i)" using j by (rule le_Ord2)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   473
  hence "i \<approx> |i|"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   474
    by (blast intro: Ord_cardinal_eqpoll eqpoll_sym)
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   475
  also have "... \<lesssim> j"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   476
    by (blast intro: le_imp_lepoll i)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   477
  finally show "i \<lesssim> j" .
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   478
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   479
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   480
lemma cardinal_mono:
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   481
  assumes ij: "i \<le> j" shows "|i| \<le> |j|"
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   482
using Ord_cardinal [of i] Ord_cardinal [of j]
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   483
proof (cases rule: Ord_linear_le)
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   484
  case le thus ?thesis .
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   485
next
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   486
  case ge
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   487
  have i: "Ord(i)" using ij
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   488
    by (simp add: lt_Ord)
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   489
  have ci: "|i| \<le> j"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   490
    by (blast intro: Ord_cardinal_le ij le_trans i)
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   491
  have "|i| = ||i||"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   492
    by (auto simp add: Ord_cardinal_idem i)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   493
  also have "... = |j|"
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   494
    by (rule cardinal_eq_lemma [OF ge ci])
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   495
  finally have "|i| = |j|" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   496
  thus ?thesis by simp
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   497
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   498
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   499
text\<open>Since we have @{term"|succ(nat)| \<le> |nat|"}, the converse of @{text cardinal_mono} fails!\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   500
lemma cardinal_lt_imp_lt: "[| |i| < |j|;  Ord(i);  Ord(j) |] ==> i < j"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   501
apply (rule Ord_linear2 [of i j], assumption+)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   502
apply (erule lt_trans2 [THEN lt_irrefl])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   503
apply (erule cardinal_mono)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   504
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   505
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   506
lemma Card_lt_imp_lt: "[| |i| < K;  Ord(i);  Card(K) |] ==> i < K"
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   507
  by (simp (no_asm_simp) add: cardinal_lt_imp_lt Card_is_Ord Card_cardinal_eq)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   508
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   509
lemma Card_lt_iff: "[| Ord(i);  Card(K) |] ==> (|i| < K) \<longleftrightarrow> (i < K)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   510
by (blast intro: Card_lt_imp_lt Ord_cardinal_le [THEN lt_trans1])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   511
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   512
lemma Card_le_iff: "[| Ord(i);  Card(K) |] ==> (K \<le> |i|) \<longleftrightarrow> (K \<le> i)"
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13244
diff changeset
   513
by (simp add: Card_lt_iff Card_is_Ord Ord_cardinal not_lt_iff_le [THEN iff_sym])
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   514
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   515
(*Can use AC or finiteness to discharge first premise*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   516
lemma well_ord_lepoll_imp_Card_le:
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   517
  assumes wB: "well_ord(B,r)" and AB: "A \<lesssim> B"
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   518
  shows "|A| \<le> |B|"
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   519
using Ord_cardinal [of A] Ord_cardinal [of B]
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   520
proof (cases rule: Ord_linear_le)
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   521
  case le thus ?thesis .
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   522
next
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   523
  case ge
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   524
  from lepoll_well_ord [OF AB wB]
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   525
  obtain s where s: "well_ord(A, s)" by blast
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   526
  have "B  \<approx> |B|" by (blast intro: wB eqpoll_sym well_ord_cardinal_eqpoll)
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   527
  also have "... \<lesssim> |A|" by (rule le_imp_lepoll [OF ge])
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   528
  also have "... \<approx> A" by (rule well_ord_cardinal_eqpoll [OF s])
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   529
  finally have "B \<lesssim> A" .
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   530
  hence "A \<approx> B" by (blast intro: eqpollI AB)
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   531
  hence "|A| = |B|" by (rule cardinal_cong)
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   532
  thus ?thesis by simp
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   533
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   534
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   535
lemma lepoll_cardinal_le: "[| A \<lesssim> i; Ord(i) |] ==> |A| \<le> i"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   536
apply (rule le_trans)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   537
apply (erule well_ord_Memrel [THEN well_ord_lepoll_imp_Card_le], assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   538
apply (erule Ord_cardinal_le)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   539
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   540
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   541
lemma lepoll_Ord_imp_eqpoll: "[| A \<lesssim> i; Ord(i) |] ==> |A| \<approx> A"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   542
by (blast intro: lepoll_cardinal_le well_ord_Memrel well_ord_cardinal_eqpoll dest!: lepoll_well_ord)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   543
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 13784
diff changeset
   544
lemma lesspoll_imp_eqpoll: "[| A \<prec> i; Ord(i) |] ==> |A| \<approx> A"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   545
apply (unfold lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   546
apply (blast intro: lepoll_Ord_imp_eqpoll)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   547
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   548
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   549
lemma cardinal_subset_Ord: "[|A<=i; Ord(i)|] ==> |A| \<subseteq> i"
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 13784
diff changeset
   550
apply (drule subset_imp_lepoll [THEN lepoll_cardinal_le])
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 13784
diff changeset
   551
apply (auto simp add: lt_def)
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 13784
diff changeset
   552
apply (blast intro: Ord_trans)
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 13784
diff changeset
   553
done
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   554
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   555
subsection\<open>The finite cardinals\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   556
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   557
lemma cons_lepoll_consD:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   558
 "[| cons(u,A) \<lesssim> cons(v,B);  u\<notin>A;  v\<notin>B |] ==> A \<lesssim> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   559
apply (unfold lepoll_def inj_def, safe)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   560
apply (rule_tac x = "\<lambda>x\<in>A. if f`x=v then f`u else f`x" in exI)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   561
apply (rule CollectI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   562
(*Proving it's in the function space A->B*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   563
apply (rule if_type [THEN lam_type])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   564
apply (blast dest: apply_funtype)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   565
apply (blast elim!: mem_irrefl dest: apply_funtype)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   566
(*Proving it's injective*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   567
apply (simp (no_asm_simp))
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   568
apply blast
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   569
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   570
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   571
lemma cons_eqpoll_consD: "[| cons(u,A) \<approx> cons(v,B);  u\<notin>A;  v\<notin>B |] ==> A \<approx> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   572
apply (simp add: eqpoll_iff)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   573
apply (blast intro: cons_lepoll_consD)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   574
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   575
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   576
(*Lemma suggested by Mike Fourman*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   577
lemma succ_lepoll_succD: "succ(m) \<lesssim> succ(n) ==> m \<lesssim> n"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   578
apply (unfold succ_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   579
apply (erule cons_lepoll_consD)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   580
apply (rule mem_not_refl)+
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   581
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   582
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   583
46935
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   584
lemma nat_lepoll_imp_le:
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   585
     "m \<in> nat ==> n \<in> nat \<Longrightarrow> m \<lesssim> n \<Longrightarrow> m \<le> n"
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   586
proof (induct m arbitrary: n rule: nat_induct)
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   587
  case 0 thus ?case by (blast intro!: nat_0_le)
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   588
next
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   589
  case (succ m)
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   590
  show ?case  using \<open>n \<in> nat\<close>
46935
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   591
    proof (cases rule: natE)
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   592
      case 0 thus ?thesis using succ
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   593
        by (simp add: lepoll_def inj_def)
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   594
    next
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   595
      case (succ n') thus ?thesis using succ.hyps \<open> succ(m) \<lesssim> n\<close>
46935
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   596
        by (blast intro!: succ_leI dest!: succ_lepoll_succD)
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   597
    qed
38ecb2dc3636 structured case and induct rules
paulson
parents: 46877
diff changeset
   598
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   599
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   600
lemma nat_eqpoll_iff: "[| m \<in> nat; n \<in> nat |] ==> m \<approx> n \<longleftrightarrow> m = n"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   601
apply (rule iffI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   602
apply (blast intro: nat_lepoll_imp_le le_anti_sym elim!: eqpollE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   603
apply (simp add: eqpoll_refl)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   604
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   605
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   606
(*The object of all this work: every natural number is a (finite) cardinal*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   607
lemma nat_into_Card:
47042
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   608
  assumes n: "n \<in> nat" shows "Card(n)"
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   609
proof (unfold Card_def cardinal_def, rule sym)
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   610
  have "Ord(n)" using n  by auto
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   611
  moreover
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   612
  { fix i
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   613
    assume "i < n" "i \<approx> n"
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   614
    hence False using n
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   615
      by (auto simp add: lt_nat_in_nat [THEN nat_eqpoll_iff])
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   616
  }
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   617
  ultimately show "(\<mu> i. i \<approx> n) = n" by (auto intro!: Least_equality) 
cb907612b59c more structured proofs
paulson
parents: 47018
diff changeset
   618
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   619
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   620
lemmas cardinal_0 = nat_0I [THEN nat_into_Card, THEN Card_cardinal_eq, iff]
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   621
lemmas cardinal_1 = nat_1I [THEN nat_into_Card, THEN Card_cardinal_eq, iff]
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   622
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   623
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   624
(*Part of Kunen's Lemma 10.6*)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   625
lemma succ_lepoll_natE: "[| succ(n) \<lesssim> n;  n \<in> nat |] ==> P"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   626
by (rule nat_lepoll_imp_le [THEN lt_irrefl], auto)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   627
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   628
lemma nat_lepoll_imp_ex_eqpoll_n:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   629
     "[| n \<in> nat;  nat \<lesssim> X |] ==> \<exists>Y. Y \<subseteq> X & n \<approx> Y"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   630
apply (unfold lepoll_def eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   631
apply (fast del: subsetI subsetCE
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   632
            intro!: subset_SIs
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   633
            dest!: Ord_nat [THEN [2] OrdmemD, THEN [2] restrict_inj]
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   634
            elim!: restrict_bij
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   635
                   inj_is_fun [THEN fun_is_rel, THEN image_subset])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   636
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   637
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   638
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   639
(** lepoll, \<prec> and natural numbers **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   640
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   641
lemma lepoll_succ: "i \<lesssim> succ(i)"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   642
  by (blast intro: subset_imp_lepoll)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   643
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   644
lemma lepoll_imp_lesspoll_succ:
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   645
  assumes A: "A \<lesssim> m" and m: "m \<in> nat"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   646
  shows "A \<prec> succ(m)"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   647
proof -
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   648
  { assume "A \<approx> succ(m)"
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   649
    hence "succ(m) \<approx> A" by (rule eqpoll_sym)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   650
    also have "... \<lesssim> m" by (rule A)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   651
    finally have "succ(m) \<lesssim> m" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   652
    hence False by (rule succ_lepoll_natE) (rule m) }
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   653
  moreover have "A \<lesssim> succ(m)" by (blast intro: lepoll_trans A lepoll_succ)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   654
  ultimately show ?thesis by (auto simp add: lesspoll_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   655
qed
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   656
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   657
lemma lesspoll_succ_imp_lepoll:
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   658
     "[| A \<prec> succ(m); m \<in> nat |] ==> A \<lesssim> m"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   659
apply (unfold lesspoll_def lepoll_def eqpoll_def bij_def)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   660
apply (auto dest: inj_not_surj_succ)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   661
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   662
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   663
lemma lesspoll_succ_iff: "m \<in> nat ==> A \<prec> succ(m) \<longleftrightarrow> A \<lesssim> m"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   664
by (blast intro!: lepoll_imp_lesspoll_succ lesspoll_succ_imp_lepoll)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   665
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   666
lemma lepoll_succ_disj: "[| A \<lesssim> succ(m);  m \<in> nat |] ==> A \<lesssim> m | A \<approx> succ(m)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   667
apply (rule disjCI)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   668
apply (rule lesspoll_succ_imp_lepoll)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   669
prefer 2 apply assumption
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   670
apply (simp (no_asm_simp) add: lesspoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   671
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   672
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   673
lemma lesspoll_cardinal_lt: "[| A \<prec> i; Ord(i) |] ==> |A| < i"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   674
apply (unfold lesspoll_def, clarify)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   675
apply (frule lepoll_cardinal_le, assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   676
apply (blast intro: well_ord_Memrel well_ord_cardinal_eqpoll [THEN eqpoll_sym]
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   677
             dest: lepoll_well_ord  elim!: leE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   678
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   679
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   680
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   681
subsection\<open>The first infinite cardinal: Omega, or nat\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   682
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   683
(*This implies Kunen's Lemma 10.6*)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   684
lemma lt_not_lepoll:
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   685
  assumes n: "n<i" "n \<in> nat" shows "~ i \<lesssim> n"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   686
proof -
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   687
  { assume i: "i \<lesssim> n"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   688
    have "succ(n) \<lesssim> i" using n
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   689
      by (elim ltE, blast intro: Ord_succ_subsetI [THEN subset_imp_lepoll])
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   690
    also have "... \<lesssim> n" by (rule i)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   691
    finally have "succ(n) \<lesssim> n" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   692
    hence False  by (rule succ_lepoll_natE) (rule n) }
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   693
  thus ?thesis by auto
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   694
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   695
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   696
text\<open>A slightly weaker version of @{text nat_eqpoll_iff}\<close>
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   697
lemma Ord_nat_eqpoll_iff:
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   698
  assumes i: "Ord(i)" and n: "n \<in> nat" shows "i \<approx> n \<longleftrightarrow> i=n"
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   699
using i nat_into_Ord [OF n]
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   700
proof (cases rule: Ord_linear_lt)
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   701
  case lt
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   702
  hence  "i \<in> nat" by (rule lt_nat_in_nat) (rule n)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   703
  thus ?thesis by (simp add: nat_eqpoll_iff n)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   704
next
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   705
  case eq
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   706
  thus ?thesis by (simp add: eqpoll_refl)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   707
next
47016
15d33549edea more structured case and induction proofs
paulson
parents: 46953
diff changeset
   708
  case gt
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   709
  hence  "~ i \<lesssim> n" using n  by (rule lt_not_lepoll)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   710
  hence  "~ i \<approx> n" using n  by (blast intro: eqpoll_imp_lepoll)
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   711
  moreover have "i \<noteq> n" using \<open>n<i\<close> by auto
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   712
  ultimately show ?thesis by blast
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   713
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   714
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   715
lemma Card_nat: "Card(nat)"
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   716
proof -
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   717
  { fix i
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   718
    assume i: "i < nat" "i \<approx> nat"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   719
    hence "~ nat \<lesssim> i"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   720
      by (simp add: lt_def lt_not_lepoll)
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   721
    hence False using i
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   722
      by (simp add: eqpoll_iff)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   723
  }
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   724
  hence "(\<mu> i. i \<approx> nat) = nat" by (blast intro: Least_equality eqpoll_refl)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   725
  thus ?thesis
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   726
    by (auto simp add: Card_def cardinal_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   727
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   728
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   729
(*Allows showing that |i| is a limit cardinal*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   730
lemma nat_le_cardinal: "nat \<le> i ==> nat \<le> |i|"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   731
apply (rule Card_nat [THEN Card_cardinal_eq, THEN subst])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   732
apply (erule cardinal_mono)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   733
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   734
46841
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   735
lemma n_lesspoll_nat: "n \<in> nat ==> n \<prec> nat"
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   736
  by (blast intro: Ord_nat Card_nat ltI lt_Card_imp_lesspoll)
49b91b716cbe Structured and calculation-based proofs (with new trans rules!)
paulson
parents: 46821
diff changeset
   737
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   738
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   739
subsection\<open>Towards Cardinal Arithmetic\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   740
(** Congruence laws for successor, cardinal addition and multiplication **)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   741
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   742
(*Congruence law for  cons  under equipollence*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   743
lemma cons_lepoll_cong:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   744
    "[| A \<lesssim> B;  b \<notin> B |] ==> cons(a,A) \<lesssim> cons(b,B)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   745
apply (unfold lepoll_def, safe)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   746
apply (rule_tac x = "\<lambda>y\<in>cons (a,A) . if y=a then b else f`y" in exI)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   747
apply (rule_tac d = "%z. if z \<in> B then converse (f) `z else a" in lam_injective)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   748
apply (safe elim!: consE')
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   749
   apply simp_all
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   750
apply (blast intro: inj_is_fun [THEN apply_type])+
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   751
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   752
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   753
lemma cons_eqpoll_cong:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   754
     "[| A \<approx> B;  a \<notin> A;  b \<notin> B |] ==> cons(a,A) \<approx> cons(b,B)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   755
by (simp add: eqpoll_iff cons_lepoll_cong)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   756
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   757
lemma cons_lepoll_cons_iff:
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   758
     "[| a \<notin> A;  b \<notin> B |] ==> cons(a,A) \<lesssim> cons(b,B)  \<longleftrightarrow>  A \<lesssim> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   759
by (blast intro: cons_lepoll_cong cons_lepoll_consD)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   760
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   761
lemma cons_eqpoll_cons_iff:
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   762
     "[| a \<notin> A;  b \<notin> B |] ==> cons(a,A) \<approx> cons(b,B)  \<longleftrightarrow>  A \<approx> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   763
by (blast intro: cons_eqpoll_cong cons_eqpoll_consD)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   764
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   765
lemma singleton_eqpoll_1: "{a} \<approx> 1"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   766
apply (unfold succ_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   767
apply (blast intro!: eqpoll_refl [THEN cons_eqpoll_cong])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   768
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   769
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   770
lemma cardinal_singleton: "|{a}| = 1"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   771
apply (rule singleton_eqpoll_1 [THEN cardinal_cong, THEN trans])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   772
apply (simp (no_asm) add: nat_into_Card [THEN Card_cardinal_eq])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   773
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   774
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   775
lemma not_0_is_lepoll_1: "A \<noteq> 0 ==> 1 \<lesssim> A"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   776
apply (erule not_emptyE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   777
apply (rule_tac a = "cons (x, A-{x}) " in subst)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   778
apply (rule_tac [2] a = "cons(0,0)" and P= "%y. y \<lesssim> cons (x, A-{x})" in subst)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   779
prefer 3 apply (blast intro: cons_lepoll_cong subset_imp_lepoll, auto)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   780
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   781
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   782
(*Congruence law for  succ  under equipollence*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   783
lemma succ_eqpoll_cong: "A \<approx> B ==> succ(A) \<approx> succ(B)"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   784
apply (unfold succ_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   785
apply (simp add: cons_eqpoll_cong mem_not_refl)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   786
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   787
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   788
(*Congruence law for + under equipollence*)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   789
lemma sum_eqpoll_cong: "[| A \<approx> C;  B \<approx> D |] ==> A+B \<approx> C+D"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   790
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   791
apply (blast intro!: sum_bij)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   792
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   793
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   794
(*Congruence law for * under equipollence*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   795
lemma prod_eqpoll_cong:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   796
    "[| A \<approx> C;  B \<approx> D |] ==> A*B \<approx> C*D"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   797
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   798
apply (blast intro!: prod_bij)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   799
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   800
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   801
lemma inj_disjoint_eqpoll:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   802
    "[| f \<in> inj(A,B);  A \<inter> B = 0 |] ==> A \<union> (B - range(f)) \<approx> B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   803
apply (unfold eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   804
apply (rule exI)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   805
apply (rule_tac c = "%x. if x \<in> A then f`x else x"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   806
            and d = "%y. if y \<in> range (f) then converse (f) `y else y"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   807
       in lam_bijective)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   808
apply (blast intro!: if_type inj_is_fun [THEN apply_type])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   809
apply (simp (no_asm_simp) add: inj_converse_fun [THEN apply_funtype])
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   810
apply (safe elim!: UnE')
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   811
   apply (simp_all add: inj_is_fun [THEN apply_rangeI])
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   812
apply (blast intro: inj_converse_fun [THEN apply_type])+
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   813
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   814
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   815
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   816
subsection\<open>Lemmas by Krzysztof Grabczewski\<close>
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
   817
c9cfe1638bf2 improved presentation markup
paulson
parents: 13328
diff changeset
   818
(*New proofs using cons_lepoll_cons. Could generalise from succ to cons.*)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   819
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   820
text\<open>If @{term A} has at most @{term"n+1"} elements and @{term"a \<in> A"}
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   821
      then @{term"A-{a}"} has at most @{term n}.\<close>
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   822
lemma Diff_sing_lepoll:
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   823
      "[| a \<in> A;  A \<lesssim> succ(n) |] ==> A - {a} \<lesssim> n"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   824
apply (unfold succ_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   825
apply (rule cons_lepoll_consD)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   826
apply (rule_tac [3] mem_not_refl)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   827
apply (erule cons_Diff [THEN ssubst], safe)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   828
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   829
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   830
text\<open>If @{term A} has at least @{term"n+1"} elements then @{term"A-{a}"} has at least @{term n}.\<close>
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   831
lemma lepoll_Diff_sing:
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   832
  assumes A: "succ(n) \<lesssim> A" shows "n \<lesssim> A - {a}"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   833
proof -
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   834
  have "cons(n,n) \<lesssim> A" using A
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   835
    by (unfold succ_def)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   836
  also have "... \<lesssim> cons(a, A-{a})"
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   837
    by (blast intro: subset_imp_lepoll)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   838
  finally have "cons(n,n) \<lesssim> cons(a, A-{a})" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   839
  thus ?thesis
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   840
    by (blast intro: cons_lepoll_consD mem_irrefl)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   841
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   842
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   843
lemma Diff_sing_eqpoll: "[| a \<in> A; A \<approx> succ(n) |] ==> A - {a} \<approx> n"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   844
by (blast intro!: eqpollI
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   845
          elim!: eqpollE
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   846
          intro: Diff_sing_lepoll lepoll_Diff_sing)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   847
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   848
lemma lepoll_1_is_sing: "[| A \<lesssim> 1; a \<in> A |] ==> A = {a}"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   849
apply (frule Diff_sing_lepoll, assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   850
apply (drule lepoll_0_is_0)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   851
apply (blast elim: equalityE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   852
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   853
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   854
lemma Un_lepoll_sum: "A \<union> B \<lesssim> A+B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   855
apply (unfold lepoll_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   856
apply (rule_tac x = "\<lambda>x\<in>A \<union> B. if x\<in>A then Inl (x) else Inr (x)" in exI)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   857
apply (rule_tac d = "%z. snd (z)" in lam_injective)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   858
apply force
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   859
apply (simp add: Inl_def Inr_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   860
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   861
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   862
lemma well_ord_Un:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   863
     "[| well_ord(X,R); well_ord(Y,S) |] ==> \<exists>T. well_ord(X \<union> Y, T)"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   864
by (erule well_ord_radd [THEN Un_lepoll_sum [THEN lepoll_well_ord]],
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   865
    assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   866
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   867
(*Krzysztof Grabczewski*)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   868
lemma disj_Un_eqpoll_sum: "A \<inter> B = 0 ==> A \<union> B \<approx> A + B"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   869
apply (unfold eqpoll_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   870
apply (rule_tac x = "\<lambda>a\<in>A \<union> B. if a \<in> A then Inl (a) else Inr (a)" in exI)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   871
apply (rule_tac d = "%z. case (%x. x, %x. x, z)" in lam_bijective)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   872
apply auto
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   873
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   874
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   875
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
   876
subsection \<open>Finite and infinite sets\<close>
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   877
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   878
lemma eqpoll_imp_Finite_iff: "A \<approx> B ==> Finite(A) \<longleftrightarrow> Finite(B)"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   879
apply (unfold Finite_def)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   880
apply (blast intro: eqpoll_trans eqpoll_sym)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   881
done
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   882
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   883
lemma Finite_0 [simp]: "Finite(0)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   884
apply (unfold Finite_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   885
apply (blast intro!: eqpoll_refl nat_0I)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   886
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   887
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   888
lemma Finite_cons: "Finite(x) ==> Finite(cons(y,x))"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   889
apply (unfold Finite_def)
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   890
apply (case_tac "y \<in> x")
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   891
apply (simp add: cons_absorb)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   892
apply (erule bexE)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   893
apply (rule bexI)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   894
apply (erule_tac [2] nat_succI)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   895
apply (simp (no_asm_simp) add: succ_def cons_eqpoll_cong mem_not_refl)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   896
done
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   897
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   898
lemma Finite_succ: "Finite(x) ==> Finite(succ(x))"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   899
apply (unfold succ_def)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   900
apply (erule Finite_cons)
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   901
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   902
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   903
lemma lepoll_nat_imp_Finite:
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   904
  assumes A: "A \<lesssim> n" and n: "n \<in> nat" shows "Finite(A)"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   905
proof -
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   906
  have "A \<lesssim> n \<Longrightarrow> Finite(A)" using n
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   907
    proof (induct n)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   908
      case 0
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   909
      hence "A = 0" by (rule lepoll_0_is_0) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   910
      thus ?case by simp
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   911
    next
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   912
      case (succ n)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   913
      hence "A \<lesssim> n \<or> A \<approx> succ(n)" by (blast dest: lepoll_succ_disj)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   914
      thus ?case using succ by (auto simp add: Finite_def) 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   915
    qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   916
  thus ?thesis using A .
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   917
qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   918
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   919
lemma lesspoll_nat_is_Finite:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   920
     "A \<prec> nat ==> Finite(A)"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   921
apply (unfold Finite_def)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   922
apply (blast dest: ltD lesspoll_cardinal_lt
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   923
                   lesspoll_imp_eqpoll [THEN eqpoll_sym])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   924
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   925
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   926
lemma lepoll_Finite:
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   927
  assumes Y: "Y \<lesssim> X" and X: "Finite(X)" shows "Finite(Y)"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   928
proof -
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   929
  obtain n where n: "n \<in> nat" "X \<approx> n" using X
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   930
    by (auto simp add: Finite_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   931
  have "Y \<lesssim> X"         by (rule Y)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   932
  also have "... \<approx> n"  by (rule n)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   933
  finally have "Y \<lesssim> n" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   934
  thus ?thesis using n by (simp add: lepoll_nat_imp_Finite)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
   935
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   936
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 39159
diff changeset
   937
lemmas subset_Finite = subset_imp_lepoll [THEN lepoll_Finite]
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   938
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   939
lemma Finite_cons_iff [iff]: "Finite(cons(y,x)) \<longleftrightarrow> Finite(x)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   940
by (blast intro: Finite_cons subset_Finite)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   941
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
   942
lemma Finite_succ_iff [iff]: "Finite(succ(x)) \<longleftrightarrow> Finite(x)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   943
by (simp add: succ_def)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   944
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   945
lemma Finite_Int: "Finite(A) | Finite(B) ==> Finite(A \<inter> B)"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   946
by (blast intro: subset_Finite)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   947
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   948
lemmas Finite_Diff = Diff_subset [THEN subset_Finite]
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
   949
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   950
lemma nat_le_infinite_Ord:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   951
      "[| Ord(i);  ~ Finite(i) |] ==> nat \<le> i"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   952
apply (unfold Finite_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   953
apply (erule Ord_nat [THEN [2] Ord_linear2])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   954
prefer 2 apply assumption
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   955
apply (blast intro!: eqpoll_refl elim!: ltE)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   956
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   957
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   958
lemma Finite_imp_well_ord:
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   959
    "Finite(A) ==> \<exists>r. well_ord(A,r)"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   960
apply (unfold Finite_def eqpoll_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   961
apply (blast intro: well_ord_rvimage bij_is_inj well_ord_Memrel nat_into_Ord)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   962
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
   963
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   964
lemma succ_lepoll_imp_not_empty: "succ(x) \<lesssim> y ==> y \<noteq> 0"
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   965
by (fast dest!: lepoll_0_is_0)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   966
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   967
lemma eqpoll_succ_imp_not_empty: "x \<approx> succ(n) ==> x \<noteq> 0"
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   968
by (fast elim!: eqpoll_sym [THEN eqpoll_0_is_0, THEN succ_neq_0])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   969
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   970
lemma Finite_Fin_lemma [rule_format]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   971
     "n \<in> nat ==> \<forall>A. (A\<approx>n & A \<subseteq> X) \<longrightarrow> A \<in> Fin(X)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   972
apply (induct_tac n)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   973
apply (rule allI)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   974
apply (fast intro!: Fin.emptyI dest!: eqpoll_imp_lepoll [THEN lepoll_0_is_0])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   975
apply (rule allI)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   976
apply (rule impI)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   977
apply (erule conjE)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   978
apply (rule eqpoll_succ_imp_not_empty [THEN not_emptyE], assumption)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   979
apply (frule Diff_sing_eqpoll, assumption)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   980
apply (erule allE)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   981
apply (erule impE, fast)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   982
apply (drule subsetD, assumption)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   983
apply (drule Fin.consI, assumption)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   984
apply (simp add: cons_Diff)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   985
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   986
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   987
lemma Finite_Fin: "[| Finite(A); A \<subseteq> X |] ==> A \<in> Fin(X)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
   988
by (unfold Finite_def, blast intro: Finite_Fin_lemma)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   989
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   990
lemma Fin_lemma [rule_format]: "n \<in> nat ==> \<forall>A. A \<approx> n \<longrightarrow> A \<in> Fin(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   991
apply (induct_tac n)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   992
apply (simp add: eqpoll_0_iff, clarify)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
   993
apply (subgoal_tac "\<exists>u. u \<in> A")
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   994
apply (erule exE)
46471
2289a3869c88 prefer high-level elim_format;
wenzelm
parents: 45602
diff changeset
   995
apply (rule Diff_sing_eqpoll [elim_format])
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   996
prefer 2 apply assumption
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   997
apply assumption
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
   998
apply (rule_tac b = A in cons_Diff [THEN subst], assumption)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
   999
apply (rule Fin.consI, blast)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1000
apply (blast intro: subset_consI [THEN Fin_mono, THEN subsetD])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1001
(*Now for the lemma assumed above*)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1002
apply (unfold eqpoll_def)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1003
apply (blast intro: bij_converse_bij [THEN bij_is_fun, THEN apply_type])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1004
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1005
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1006
lemma Finite_into_Fin: "Finite(A) ==> A \<in> Fin(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1007
apply (unfold Finite_def)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1008
apply (blast intro: Fin_lemma)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1009
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1010
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1011
lemma Fin_into_Finite: "A \<in> Fin(U) ==> Finite(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1012
by (fast intro!: Finite_0 Finite_cons elim: Fin_induct)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1013
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
  1014
lemma Finite_Fin_iff: "Finite(A) \<longleftrightarrow> A \<in> Fin(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1015
by (blast intro: Finite_into_Fin Fin_into_Finite)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1016
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1017
lemma Finite_Un: "[| Finite(A); Finite(B) |] ==> Finite(A \<union> B)"
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1018
by (blast intro!: Fin_into_Finite Fin_UnI
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1019
          dest!: Finite_into_Fin
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1020
          intro: Un_upper1 [THEN Fin_mono, THEN subsetD]
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1021
                 Un_upper2 [THEN Fin_mono, THEN subsetD])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1022
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
  1023
lemma Finite_Un_iff [simp]: "Finite(A \<union> B) \<longleftrightarrow> (Finite(A) & Finite(B))"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1024
by (blast intro: subset_Finite Finite_Un)
14883
ca000a495448 Groups, Rings and supporting lemmas
paulson
parents: 14565
diff changeset
  1025
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
  1026
text\<open>The converse must hold too.\<close>
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1027
lemma Finite_Union: "[| \<forall>y\<in>X. Finite(y);  Finite(X) |] ==> Finite(\<Union>(X))"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1028
apply (simp add: Finite_Fin_iff)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1029
apply (rule Fin_UnionI)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1030
apply (erule Fin_induct, simp)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1031
apply (blast intro: Fin.consI Fin_mono [THEN [2] rev_subsetD])
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1032
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1033
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1034
(* Induction principle for Finite(A), by Sidi Ehmety *)
13524
604d0f3622d6 *** empty log message ***
wenzelm
parents: 13357
diff changeset
  1035
lemma Finite_induct [case_names 0 cons, induct set: Finite]:
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1036
"[| Finite(A); P(0);
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1037
    !! x B.   [| Finite(B); x \<notin> B; P(B) |] ==> P(cons(x, B)) |]
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1038
 ==> P(A)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1039
apply (erule Finite_into_Fin [THEN Fin_induct])
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1040
apply (blast intro: Fin_into_Finite)+
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1041
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1042
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1043
(*Sidi Ehmety.  The contrapositive says ~Finite(A) ==> ~Finite(A-{a}) *)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1044
lemma Diff_sing_Finite: "Finite(A - {a}) ==> Finite(A)"
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1045
apply (unfold Finite_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1046
apply (case_tac "a \<in> A")
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1047
apply (subgoal_tac [2] "A-{a}=A", auto)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1048
apply (rule_tac x = "succ (n) " in bexI)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1049
apply (subgoal_tac "cons (a, A - {a}) = A & cons (n, n) = succ (n) ")
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13615
diff changeset
  1050
apply (drule_tac a = a and b = n in cons_eqpoll_cong)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1051
apply (auto dest: mem_irrefl)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1052
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1053
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1054
(*Sidi Ehmety.  And the contrapositive of this says
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1055
   [| ~Finite(A); Finite(B) |] ==> ~Finite(A-B) *)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1056
lemma Diff_Finite [rule_format]: "Finite(B) ==> Finite(A-B) \<longrightarrow> Finite(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1057
apply (erule Finite_induct, auto)
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1058
apply (case_tac "x \<in> A")
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1059
 apply (subgoal_tac [2] "A-cons (x, B) = A - B")
13615
449a70d88b38 Numerous cosmetic changes, prompted by the new simplifier
paulson
parents: 13524
diff changeset
  1060
apply (subgoal_tac "A - cons (x, B) = (A - B) - {x}", simp)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1061
apply (drule Diff_sing_Finite, auto)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1062
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1063
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1064
lemma Finite_RepFun: "Finite(A) ==> Finite(RepFun(A,f))"
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1065
by (erule Finite_induct, simp_all)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1066
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1067
lemma Finite_RepFun_iff_lemma [rule_format]:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1068
     "[|Finite(x); !!x y. f(x)=f(y) ==> x=y|]
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1069
      ==> \<forall>A. x = RepFun(A,f) \<longrightarrow> Finite(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1070
apply (erule Finite_induct)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1071
 apply clarify
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1072
 apply (case_tac "A=0", simp)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1073
 apply (blast del: allE, clarify)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1074
apply (subgoal_tac "\<exists>z\<in>A. x = f(z)")
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1075
 prefer 2 apply (blast del: allE elim: equalityE, clarify)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1076
apply (subgoal_tac "B = {f(u) . u \<in> A - {z}}")
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1077
 apply (blast intro: Diff_sing_Finite)
59788
6f7b6adac439 prefer local fixes;
wenzelm
parents: 58871
diff changeset
  1078
apply (thin_tac "\<forall>A. P(A) \<longrightarrow> Finite(A)" for P)
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1079
apply (rule equalityI)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1080
 apply (blast intro: elim: equalityE)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1081
apply (blast intro: elim: equalityCE)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1082
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1083
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
  1084
text\<open>I don't know why, but if the premise is expressed using meta-connectives
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
  1085
then  the simplifier cannot prove it automatically in conditional rewriting.\<close>
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1086
lemma Finite_RepFun_iff:
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
  1087
     "(\<forall>x y. f(x)=f(y) \<longrightarrow> x=y) ==> Finite(RepFun(A,f)) \<longleftrightarrow> Finite(A)"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1088
by (blast intro: Finite_RepFun Finite_RepFun_iff_lemma [of _ f])
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1089
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1090
lemma Finite_Pow: "Finite(A) ==> Finite(Pow(A))"
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1091
apply (erule Finite_induct)
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1092
apply (simp_all add: Pow_insert Finite_Un Finite_RepFun)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1093
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1094
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1095
lemma Finite_Pow_imp_Finite: "Finite(Pow(A)) ==> Finite(A)"
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1096
apply (subgoal_tac "Finite({{x} . x \<in> A})")
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1097
 apply (simp add: Finite_RepFun_iff )
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1098
apply (blast intro: subset_Finite)
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1099
done
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1100
46821
ff6b0c1087f2 Using mathematical notation for <-> and cardinal arithmetic
paulson
parents: 46820
diff changeset
  1101
lemma Finite_Pow_iff [iff]: "Finite(Pow(A)) \<longleftrightarrow> Finite(A)"
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1102
by (blast intro: Finite_Pow Finite_Pow_imp_Finite)
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1103
47101
ded5cc757bc9 proof tidying
paulson
parents: 47042
diff changeset
  1104
lemma Finite_cardinal_iff:
ded5cc757bc9 proof tidying
paulson
parents: 47042
diff changeset
  1105
  assumes i: "Ord(i)" shows "Finite(|i|) \<longleftrightarrow> Finite(i)"
ded5cc757bc9 proof tidying
paulson
parents: 47042
diff changeset
  1106
  by (auto simp add: Finite_def) (blast intro: eqpoll_trans eqpoll_sym Ord_cardinal_eqpoll [OF i])+
13244
7b37e218f298 moving some results around
paulson
parents: 13221
diff changeset
  1107
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1108
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1109
(*Krzysztof Grabczewski's proof that the converse of a finite, well-ordered
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1110
  set is well-ordered.  Proofs simplified by lcp. *)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1111
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1112
lemma nat_wf_on_converse_Memrel: "n \<in> nat ==> wf[n](converse(Memrel(n)))"
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1113
proof (induct n rule: nat_induct)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1114
  case 0 thus ?case by (blast intro: wf_onI)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1115
next
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1116
  case (succ x)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1117
  hence wfx: "\<And>Z. Z = 0 \<or> (\<exists>z\<in>Z. \<forall>y. z \<in> y \<and> z \<in> x \<and> y \<in> x \<and> z \<in> x \<longrightarrow> y \<notin> Z)"
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 59788
diff changeset
  1118
    by (simp add: wf_on_def wf_def)  --\<open>not easy to erase the duplicate @{term"z \<in> x"}!\<close>
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1119
  show ?case
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1120
    proof (rule wf_onI)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1121
      fix Z u
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1122
      assume Z: "u \<in> Z" "\<forall>z\<in>Z. \<exists>y\<in>Z. \<langle>y, z\<rangle> \<in> converse(Memrel(succ(x)))"
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1123
      show False 
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1124
        proof (cases "x \<in> Z")
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1125
          case True thus False using Z
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1126
            by (blast elim: mem_irrefl mem_asym)
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1127
          next
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1128
          case False thus False using wfx [of Z] Z
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1129
            by blast
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1130
        qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1131
    qed
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1132
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1133
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1134
lemma nat_well_ord_converse_Memrel: "n \<in> nat ==> well_ord(n,converse(Memrel(n)))"
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1135
apply (frule Ord_nat [THEN Ord_in_Ord, THEN well_ord_Memrel])
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1136
apply (simp add: well_ord_def tot_ord_converse nat_wf_on_converse_Memrel) 
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1137
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1138
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1139
lemma well_ord_converse:
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1140
     "[|well_ord(A,r);
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1141
        well_ord(ordertype(A,r), converse(Memrel(ordertype(A, r)))) |]
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1142
      ==> well_ord(A,converse(r))"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1143
apply (rule well_ord_Int_iff [THEN iffD1])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1144
apply (frule ordermap_bij [THEN bij_is_inj, THEN well_ord_rvimage], assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1145
apply (simp add: rvimage_converse converse_Int converse_prod
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1146
                 ordertype_ord_iso [THEN ord_iso_rvimage_eq])
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1147
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1148
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1149
lemma ordertype_eq_n:
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1150
  assumes r: "well_ord(A,r)" and A: "A \<approx> n" and n: "n \<in> nat"
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1151
  shows "ordertype(A,r) = n"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1152
proof -
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1153
  have "ordertype(A,r) \<approx> A"
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1154
    by (blast intro: bij_imp_eqpoll bij_converse_bij ordermap_bij r)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1155
  also have "... \<approx> n" by (rule A)
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1156
  finally have "ordertype(A,r) \<approx> n" .
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1157
  thus ?thesis
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1158
    by (simp add: Ord_nat_eqpoll_iff Ord_ordertype n r)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1159
qed
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1160
46820
c656222c4dc1 mathematical symbols instead of ASCII
paulson
parents: 46751
diff changeset
  1161
lemma Finite_well_ord_converse:
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1162
    "[| Finite(A);  well_ord(A,r) |] ==> well_ord(A,converse(r))"
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1163
apply (unfold Finite_def)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1164
apply (rule well_ord_converse, assumption)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1165
apply (blast dest: ordertype_eq_n intro!: nat_well_ord_converse_Memrel)
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1166
done
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1167
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1168
lemma nat_into_Finite: "n \<in> nat ==> Finite(n)"
47018
3a2e6b8a2bb8 More structured proofs for cardinalities
paulson
parents: 47016
diff changeset
  1169
  by (auto simp add: Finite_def intro: eqpoll_refl) 
13221
e29378f347e4 conversion of Cardinal, CardinalArith
paulson
parents: 12861
diff changeset
  1170
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1171
lemma nat_not_Finite: "~ Finite(nat)"
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1172
proof -
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1173
  { fix n
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1174
    assume n: "n \<in> nat" "nat \<approx> n"
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1175
    have "n \<in> nat"    by (rule n)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1176
    also have "... = n" using n
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1177
      by (simp add: Ord_nat_eqpoll_iff Ord_nat)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1178
    finally have "n \<in> n" .
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1179
    hence False
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1180
      by (blast elim: mem_irrefl)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1181
  }
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1182
  thus ?thesis
46953
2b6e55924af3 replacing ":" by "\<in>"
paulson
parents: 46935
diff changeset
  1183
    by (auto simp add: Finite_def)
46877
059d20d08ff1 Structured proofs in ZF
paulson
parents: 46847
diff changeset
  1184
qed
14076
5cfc8b9fb880 Conversion of AllocBase to new-style
paulson
parents: 14046
diff changeset
  1185
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents:
diff changeset
  1186
end