src/HOL/Library/Equipollence.thy
author desharna
Thu, 08 Jul 2021 08:42:36 +0200
changeset 73932 fd21b4a93043
parent 71857 d73955442df5
child 75331 c3f1bf2824bc
permissions -rw-r--r--
added opaque_combs and renamed hide_lams to opaque_lifting
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     1
section \<open>Equipollence and Other Relations Connected with Cardinality\<close>
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     2
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     3
theory "Equipollence"
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
     4
  imports FuncSet 
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     5
begin
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     6
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     7
subsection\<open>Eqpoll\<close>
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     8
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     9
definition eqpoll :: "'a set \<Rightarrow> 'b set \<Rightarrow> bool" (infixl "\<approx>" 50)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
  where "eqpoll A B \<equiv> \<exists>f. bij_betw f A B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    11
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    12
definition lepoll :: "'a set \<Rightarrow> 'b set \<Rightarrow> bool" (infixl "\<lesssim>" 50)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    13
  where "lepoll A B \<equiv> \<exists>f. inj_on f A \<and> f ` A \<subseteq> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    15
definition lesspoll :: "'a set \<Rightarrow> 'b set \<Rightarrow> bool" (infixl \<open>\<prec>\<close> 50)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
  where "A \<prec> B == A \<lesssim> B \<and> ~(A \<approx> B)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    17
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    18
lemma lepoll_empty_iff_empty [simp]: "A \<lesssim> {} \<longleftrightarrow> A = {}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
  by (auto simp: lepoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    21
lemma eqpoll_iff_card_of_ordIso: "A \<approx> B \<longleftrightarrow> ordIso2 (card_of A) (card_of B)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
  by (simp add: card_of_ordIso eqpoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    23
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    24
lemma eqpoll_refl [iff]: "A \<approx> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    25
  by (simp add: card_of_refl eqpoll_iff_card_of_ordIso)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    26
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
lemma eqpoll_finite_iff: "A \<approx> B \<Longrightarrow> finite A \<longleftrightarrow> finite B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    28
  by (meson bij_betw_finite eqpoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    29
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    30
lemma eqpoll_iff_card:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    31
  assumes "finite A" "finite B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    32
  shows  "A \<approx> B \<longleftrightarrow> card A = card B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
  using assms by (auto simp: bij_betw_iff_card eqpoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    34
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
lemma lepoll_antisym:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
  assumes "A \<lesssim> B" "B \<lesssim> A" shows "A \<approx> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    37
  using assms unfolding eqpoll_def lepoll_def by (metis Schroeder_Bernstein)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    38
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    39
lemma lepoll_trans [trans]: "\<lbrakk>A \<lesssim> B; B \<lesssim> C\<rbrakk> \<Longrightarrow> A \<lesssim> C"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    40
  apply (clarsimp simp: lepoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
  apply (rename_tac f g)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    42
  apply (rule_tac x="g \<circ> f" in exI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
  apply (auto simp: image_subset_iff inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    44
  done
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    45
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
lemma lepoll_trans1 [trans]: "\<lbrakk>A \<approx> B; B \<lesssim> C\<rbrakk> \<Longrightarrow> A \<lesssim> C"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
  by (meson card_of_ordLeq eqpoll_iff_card_of_ordIso lepoll_def lepoll_trans ordIso_iff_ordLeq)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    48
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    49
lemma lepoll_trans2 [trans]: "\<lbrakk>A \<lesssim> B; B \<approx> C\<rbrakk> \<Longrightarrow> A \<lesssim> C"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    50
  apply (clarsimp simp: eqpoll_def lepoll_def bij_betw_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    51
  apply (rename_tac f g)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    52
  apply (rule_tac x="g \<circ> f" in exI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    53
  apply (auto simp: image_subset_iff inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    54
  done
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    55
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    56
lemma eqpoll_sym: "A \<approx> B \<Longrightarrow> B \<approx> A"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
  unfolding eqpoll_def
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    58
  using bij_betw_the_inv_into by auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    59
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    60
lemma eqpoll_trans [trans]: "\<lbrakk>A \<approx> B; B \<approx> C\<rbrakk> \<Longrightarrow> A \<approx> C"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    61
  unfolding eqpoll_def using bij_betw_trans by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    62
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    63
lemma eqpoll_imp_lepoll: "A \<approx> B \<Longrightarrow> A \<lesssim> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    64
  unfolding eqpoll_def lepoll_def by (metis bij_betw_def order_refl)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    65
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    66
lemma subset_imp_lepoll: "A \<subseteq> B \<Longrightarrow> A \<lesssim> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    67
  by (force simp: lepoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    68
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    69
lemma lepoll_refl [iff]: "A \<lesssim> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    70
  by (simp add: subset_imp_lepoll)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    71
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    72
lemma lepoll_iff: "A \<lesssim> B \<longleftrightarrow> (\<exists>g. A \<subseteq> g ` B)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    73
  unfolding lepoll_def
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    74
proof safe
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    75
  fix g assume "A \<subseteq> g ` B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    76
  then show "\<exists>f. inj_on f A \<and> f ` A \<subseteq> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    77
    by (rule_tac x="inv_into B g" in exI) (auto simp: inv_into_into inj_on_inv_into)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
qed (metis image_mono the_inv_into_onto)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    80
lemma empty_lepoll [iff]: "{} \<lesssim> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    81
  by (simp add: lepoll_iff)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    82
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    83
lemma subset_image_lepoll: "B \<subseteq> f ` A \<Longrightarrow> B \<lesssim> A"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    84
  by (auto simp: lepoll_iff)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    86
lemma image_lepoll: "f ` A \<lesssim> A"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    87
  by (auto simp: lepoll_iff)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    89
lemma infinite_le_lepoll: "infinite A \<longleftrightarrow> (UNIV::nat set) \<lesssim> A"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    90
apply (auto simp: lepoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
  apply (simp add: infinite_countable_subset)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    92
  using infinite_iff_countable_subset by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    93
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    94
lemma lepoll_Pow_self: "A \<lesssim> Pow A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    95
  unfolding lepoll_def inj_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    96
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    97
    show "inj_on (\<lambda>x. {x}) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    98
      by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
    99
qed auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   100
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
lemma eqpoll_iff_bijections:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   102
   "A \<approx> B \<longleftrightarrow> (\<exists>f g. (\<forall>x \<in> A. f x \<in> B \<and> g(f x) = x) \<and> (\<forall>y \<in> B. g y \<in> A \<and> f(g y) = y))"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   103
    by (auto simp: eqpoll_def bij_betw_iff_bijections)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   105
lemma lepoll_restricted_funspace:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   106
   "{f. f ` A \<subseteq> B \<and> {x. f x \<noteq> k x} \<subseteq> A \<and> finite {x. f x \<noteq> k x}} \<lesssim> Fpow (A \<times> B)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   107
proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   108
  have *: "\<exists>U \<in> Fpow (A \<times> B). f = (\<lambda>x. if \<exists>y. (x, y) \<in> U then SOME y. (x,y) \<in> U else k x)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
    if "f ` A \<subseteq> B" "{x. f x \<noteq> k x} \<subseteq> A" "finite {x. f x \<noteq> k x}" for f
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   110
    apply (rule_tac x="(\<lambda>x. (x, f x)) ` {x. f x \<noteq> k x}" in bexI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   111
    using that by (auto simp: image_def Fpow_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
  show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
    apply (rule subset_image_lepoll [where f = "\<lambda>U x. if \<exists>y. (x,y) \<in> U then @y. (x,y) \<in> U else k x"])
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   114
    using * by (auto simp: image_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   115
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
69874
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   117
lemma singleton_lepoll: "{x} \<lesssim> insert y A"
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   118
  by (force simp: lepoll_def)
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   119
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   120
lemma singleton_eqpoll: "{x} \<approx> {y}"
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   121
  by (blast intro: lepoll_antisym singleton_lepoll)
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   122
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   123
lemma subset_singleton_iff_lepoll: "(\<exists>x. S \<subseteq> {x}) \<longleftrightarrow> S \<lesssim> {()}"
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   124
proof safe
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   125
  show "S \<lesssim> {()}" if "S \<subseteq> {x}" for x
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   126
    using subset_imp_lepoll [OF that] by (simp add: singleton_eqpoll lepoll_trans2)
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   127
  show "\<exists>x. S \<subseteq> {x}" if "S \<lesssim> {()}"
73932
fd21b4a93043 added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents: 71857
diff changeset
   128
  by (metis (no_types, opaque_lifting) image_empty image_insert lepoll_iff that)
69874
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   129
qed
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   130
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   131
lemma infinite_insert_lepoll:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   132
  assumes "infinite A" shows "insert a A \<lesssim> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   133
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   134
  obtain f :: "nat \<Rightarrow> 'a" where "inj f" and f: "range f \<subseteq> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   135
    using assms infinite_countable_subset by blast
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   136
  let ?g = "(\<lambda>z. if z=a then f 0 else if z \<in> range f then f (Suc (inv f z)) else z)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   137
  show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   138
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   139
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   140
    show "inj_on ?g (insert a A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   141
      using inj_on_eq_iff [OF \<open>inj f\<close>]
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   142
      by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   143
    show "?g ` insert a A \<subseteq> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   144
      using f by auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   145
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   146
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   147
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   148
lemma infinite_insert_eqpoll: "infinite A \<Longrightarrow> insert a A \<approx> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   149
  by (simp add: lepoll_antisym infinite_insert_lepoll subset_imp_lepoll subset_insertI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   150
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   151
lemma finite_lepoll_infinite:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   152
  assumes "infinite A" "finite B" shows "B \<lesssim> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   153
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   154
  have "B \<lesssim> (UNIV::nat set)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   155
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   156
    using finite_imp_inj_to_nat_seg [OF \<open>finite B\<close>] by blast
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   157
  then show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   158
    using \<open>infinite A\<close> infinite_le_lepoll lepoll_trans by auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   159
qed
69874
11065b70407d new material for Analysis
paulson <lp15@cam.ac.uk>
parents: 69735
diff changeset
   160
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
subsection\<open>The strict relation\<close>
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
lemma lesspoll_not_refl [iff]: "~ (i \<prec> i)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
  by (simp add: lepoll_antisym lesspoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
lemma lesspoll_imp_lepoll: "A \<prec> B ==> A \<lesssim> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
by (unfold lesspoll_def, blast)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   168
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
lemma lepoll_iff_leqpoll: "A \<lesssim> B \<longleftrightarrow> A \<prec> B | A \<approx> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
  using eqpoll_imp_lepoll lesspoll_def by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   172
lemma lesspoll_trans [trans]: "\<lbrakk>X \<prec> Y; Y \<prec> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   173
  by (meson eqpoll_sym lepoll_antisym lepoll_trans lepoll_trans1 lesspoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
lemma lesspoll_trans1 [trans]: "\<lbrakk>X \<lesssim> Y; Y \<prec> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
  by (meson eqpoll_sym lepoll_antisym lepoll_trans lepoll_trans1 lesspoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
lemma lesspoll_trans2 [trans]: "\<lbrakk>X \<prec> Y; Y \<lesssim> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
  by (meson eqpoll_imp_lepoll eqpoll_sym lepoll_antisym lepoll_trans lesspoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
lemma eq_lesspoll_trans [trans]: "\<lbrakk>X \<approx> Y; Y \<prec> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   182
  using eqpoll_imp_lepoll lesspoll_trans1 by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
lemma lesspoll_eq_trans [trans]: "\<lbrakk>X \<prec> Y; Y \<approx> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
  using eqpoll_imp_lepoll lesspoll_trans2 by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
71096
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   187
lemma lesspoll_Pow_self: "A \<prec> Pow A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   188
  unfolding lesspoll_def bij_betw_def eqpoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   189
  by (meson lepoll_Pow_self Cantors_paradox)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   190
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   191
lemma finite_lesspoll_infinite:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   192
  assumes "infinite A" "finite B" shows "B \<prec> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   193
  by (meson assms eqpoll_finite_iff finite_lepoll_infinite lesspoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   194
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   195
subsection\<open>Mapping by an injection\<close>
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   196
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   197
lemma inj_on_image_eqpoll_self: "inj_on f A \<Longrightarrow> f ` A \<approx> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   198
  by (meson bij_betw_def eqpoll_def eqpoll_sym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   199
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   200
lemma inj_on_image_lepoll_1 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   201
  assumes "inj_on f A" shows "f ` A \<lesssim> B \<longleftrightarrow> A \<lesssim> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   202
  by (meson assms image_lepoll lepoll_def lepoll_trans order_refl)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   203
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   204
lemma inj_on_image_lepoll_2 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   205
  assumes "inj_on f B" shows "A \<lesssim> f ` B \<longleftrightarrow> A \<lesssim> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   206
  by (meson assms eq_iff image_lepoll lepoll_def lepoll_trans)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   207
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   208
lemma inj_on_image_lesspoll_1 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   209
  assumes "inj_on f A" shows "f ` A \<prec> B \<longleftrightarrow> A \<prec> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   210
  by (meson assms image_lepoll le_less lepoll_def lesspoll_trans1)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   211
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   212
lemma inj_on_image_lesspoll_2 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   213
  assumes "inj_on f B" shows "A \<prec> f ` B \<longleftrightarrow> A \<prec> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   214
  by (meson assms eqpoll_sym inj_on_image_eqpoll_self lesspoll_eq_trans)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   215
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   216
lemma inj_on_image_eqpoll_1 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   217
  assumes "inj_on f A" shows "f ` A \<approx> B \<longleftrightarrow> A \<approx> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   218
  by (metis assms eqpoll_trans inj_on_image_eqpoll_self eqpoll_sym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   219
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   220
lemma inj_on_image_eqpoll_2 [simp]:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   221
  assumes "inj_on f B" shows "A \<approx> f ` B \<longleftrightarrow> A \<approx> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   222
  by (metis assms inj_on_image_eqpoll_1 eqpoll_sym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   223
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   224
subsection \<open>Inserting elements into sets\<close>
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   225
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   226
lemma insert_lepoll_insertD:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   227
  assumes "insert u A \<lesssim> insert v B" "u \<notin> A" "v \<notin> B" shows "A \<lesssim> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   228
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   229
  obtain f where inj: "inj_on f (insert u A)" and fim: "f ` (insert u A) \<subseteq> insert v B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   230
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   231
  show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   232
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   233
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   234
    let ?g = "\<lambda>x\<in>A. if f x = v then f u else f x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   235
    show "inj_on ?g A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   236
      using inj \<open>u \<notin> A\<close> by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   237
    show "?g ` A \<subseteq> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   238
      using fim \<open>u \<notin> A\<close> image_subset_iff inj inj_on_image_mem_iff by fastforce
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   239
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   240
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   241
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   242
lemma insert_eqpoll_insertD: "\<lbrakk>insert u A \<approx> insert v B; u \<notin> A; v \<notin> B\<rbrakk> \<Longrightarrow> A \<approx> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   243
  by (meson insert_lepoll_insertD eqpoll_imp_lepoll eqpoll_sym lepoll_antisym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   244
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   245
lemma insert_lepoll_cong:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   246
  assumes "A \<lesssim> B" "b \<notin> B" shows "insert a A \<lesssim> insert b B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   247
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   248
  obtain f where f: "inj_on f A" "f ` A \<subseteq> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   249
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   250
  let ?f = "\<lambda>u \<in> insert a A. if u=a then b else f u"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   251
  show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   252
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   253
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   254
    show "inj_on ?f (insert a A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   255
      using f \<open>b \<notin> B\<close> by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   256
    show "?f ` insert a A \<subseteq> insert b B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   257
      using f \<open>b \<notin> B\<close> by auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   258
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   259
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   260
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   261
lemma insert_eqpoll_cong:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   262
     "\<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert a A \<approx> insert b B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   263
  apply (rule lepoll_antisym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   264
  apply (simp add: eqpoll_imp_lepoll insert_lepoll_cong)+
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   265
  by (meson eqpoll_imp_lepoll eqpoll_sym insert_lepoll_cong)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   266
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   267
lemma insert_eqpoll_insert_iff:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   268
     "\<lbrakk>a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert a A \<approx> insert b B  \<longleftrightarrow>  A \<approx> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   269
  by (meson insert_eqpoll_insertD insert_eqpoll_cong)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   270
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   271
lemma insert_lepoll_insert_iff:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   272
     " \<lbrakk>a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> (insert a A \<lesssim> insert b B) \<longleftrightarrow> (A \<lesssim> B)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   273
  by (meson insert_lepoll_insertD insert_lepoll_cong)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   274
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   275
lemma less_imp_insert_lepoll:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   276
  assumes "A \<prec> B" shows "insert a A \<lesssim> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   277
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   278
  obtain f where "inj_on f A" "f ` A \<subset> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   279
    using assms by (metis bij_betw_def eqpoll_def lepoll_def lesspoll_def psubset_eq)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   280
  then obtain b where b: "b \<in> B" "b \<notin> f ` A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   281
    by auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   282
  show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   283
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   284
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   285
    show "inj_on (f(a:=b)) (insert a A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   286
      using b \<open>inj_on f A\<close> by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   287
    show "(f(a:=b)) ` insert a A \<subseteq> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   288
      using \<open>f ` A \<subset> B\<close>  by (auto simp: b)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   289
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   290
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   291
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   292
lemma finite_insert_lepoll: "finite A \<Longrightarrow> (insert a A \<lesssim> A) \<longleftrightarrow> (a \<in> A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   293
proof (induction A rule: finite_induct)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   294
  case (insert x A)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   295
  then show ?case
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   296
    apply (auto simp: insert_absorb)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   297
    by (metis insert_commute insert_iff insert_lepoll_insertD)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   298
qed auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   299
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   300
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   301
subsection\<open>Binary sums and unions\<close>
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   302
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   303
lemma Un_lepoll_mono:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   304
  assumes "A \<lesssim> C" "B \<lesssim> D" "disjnt C D" shows "A \<union> B \<lesssim> C \<union> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   305
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   306
  obtain f g where inj: "inj_on f A" "inj_on g B" and fg: "f ` A \<subseteq> C" "g ` B \<subseteq> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   307
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   308
  have "inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   309
    using inj \<open>disjnt C D\<close> fg unfolding disjnt_iff
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   310
    by (fastforce intro: inj_onI dest: inj_on_contraD split: if_split_asm)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   311
  with fg show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   312
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   313
    by (rule_tac x="\<lambda>x. if x \<in> A then f x else g x" in exI) auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   314
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   315
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   316
lemma Un_eqpoll_cong: "\<lbrakk>A \<approx> C; B \<approx> D; disjnt A B; disjnt C D\<rbrakk> \<Longrightarrow> A \<union> B \<approx> C \<union> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   317
  by (meson Un_lepoll_mono eqpoll_imp_lepoll eqpoll_sym lepoll_antisym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   318
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   319
lemma sum_lepoll_mono:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   320
  assumes "A \<lesssim> C" "B \<lesssim> D" shows "A <+> B \<lesssim> C <+> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   321
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   322
  obtain f g where "inj_on f A" "f ` A \<subseteq> C" "inj_on g B" "g ` B \<subseteq> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   323
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   324
  then show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   325
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   326
    by (rule_tac x="case_sum (Inl \<circ> f) (Inr \<circ> g)" in exI) (force simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   327
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   328
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   329
lemma sum_eqpoll_cong: "\<lbrakk>A \<approx> C; B \<approx> D\<rbrakk> \<Longrightarrow> A <+> B \<approx> C <+> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   330
  by (meson eqpoll_imp_lepoll eqpoll_sym lepoll_antisym sum_lepoll_mono)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   331
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   332
subsection\<open>Binary Cartesian products\<close>
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   333
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   334
lemma times_square_lepoll: "A \<lesssim> A \<times> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   335
  unfolding lepoll_def inj_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   336
proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   337
  show "inj_on (\<lambda>x. (x,x)) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   338
    by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   339
qed auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   340
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   341
lemma times_commute_eqpoll: "A \<times> B \<approx> B \<times> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   342
  unfolding eqpoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   343
  by (force intro: bij_betw_byWitness [where f = "\<lambda>(x,y). (y,x)" and f' = "\<lambda>(x,y). (y,x)"])
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   344
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   345
lemma times_assoc_eqpoll: "(A \<times> B) \<times> C \<approx> A \<times> (B \<times> C)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   346
  unfolding eqpoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   347
  by (force intro: bij_betw_byWitness [where f = "\<lambda>((x,y),z). (x,(y,z))" and f' = "\<lambda>(x,(y,z)). ((x,y),z)"])
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   348
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   349
lemma times_singleton_eqpoll: "{a} \<times> A \<approx> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   350
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   351
  have "{a} \<times> A = (\<lambda>x. (a,x)) ` A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   352
    by auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   353
  also have "\<dots>  \<approx> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   354
    proof (rule inj_on_image_eqpoll_self)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   355
      show "inj_on (Pair a) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   356
        by (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   357
    qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   358
    finally show ?thesis .
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   359
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   360
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   361
lemma times_lepoll_mono:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   362
  assumes "A \<lesssim> C" "B \<lesssim> D" shows "A \<times> B \<lesssim> C \<times> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   363
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   364
  obtain f g where "inj_on f A" "f ` A \<subseteq> C" "inj_on g B" "g ` B \<subseteq> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   365
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   366
  then show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   367
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   368
    by (rule_tac x="\<lambda>(x,y). (f x, g y)" in exI) (auto simp: inj_on_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   369
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   370
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   371
lemma times_eqpoll_cong: "\<lbrakk>A \<approx> C; B \<approx> D\<rbrakk> \<Longrightarrow> A \<times> B \<approx> C \<times> D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   372
  by (metis eqpoll_imp_lepoll eqpoll_sym lepoll_antisym times_lepoll_mono)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   373
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   374
lemma
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   375
  assumes "B \<noteq> {}" shows lepoll_times1: "A \<lesssim> A \<times> B" and lepoll_times2:  "A \<lesssim> B \<times> A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   376
  using assms lepoll_iff by fastforce+
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   377
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   378
lemma times_0_eqpoll: "{} \<times> A \<approx> {}"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   379
  by (simp add: eqpoll_iff_bijections)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   380
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   381
lemma Sigma_lepoll_mono:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   382
  assumes "A \<subseteq> C" "\<And>x. x \<in> A \<Longrightarrow> B x \<lesssim> D x" shows "Sigma A B \<lesssim> Sigma C D"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   383
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   384
  have "\<And>x. x \<in> A \<Longrightarrow> \<exists>f. inj_on f (B x) \<and> f ` (B x) \<subseteq> D x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   385
    by (meson assms lepoll_def)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   386
  then obtain f where  "\<And>x. x \<in> A \<Longrightarrow> inj_on (f x) (B x) \<and> f x ` B x \<subseteq> D x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   387
    by metis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   388
  with \<open>A \<subseteq> C\<close> show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   389
    unfolding lepoll_def inj_on_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   390
    by (rule_tac x="\<lambda>(x,y). (x, f x y)" in exI) force
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   391
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   392
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   393
lemma sum_times_distrib_eqpoll: "(A <+> B) \<times> C \<approx> (A \<times> C) <+> (B \<times> C)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   394
  unfolding eqpoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   395
proof
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   396
  show "bij_betw (\<lambda>(x,z). case_sum(\<lambda>y. Inl(y,z)) (\<lambda>y. Inr(y,z)) x) ((A <+> B) \<times> C) (A \<times> C <+> B \<times> C)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   397
    by (rule bij_betw_byWitness [where f' = "case_sum (\<lambda>(x,z). (Inl x, z)) (\<lambda>(y,z). (Inr y, z))"]) auto
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   398
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   399
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   400
lemma prod_insert_eqpoll:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   401
  assumes "a \<notin> A" shows "insert a A \<times> B \<approx> B <+> A \<times> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   402
  unfolding eqpoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   403
  proof
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   404
  show "bij_betw (\<lambda>(x,y). if x=a then Inl y else Inr (x,y)) (insert a A \<times> B) (B <+> A \<times> B)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   405
    by (rule bij_betw_byWitness [where f' = "case_sum (\<lambda>y. (a,y)) id"]) (auto simp: assms)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   406
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   407
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   408
subsection\<open>General Unions\<close>
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   409
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   410
lemma Union_eqpoll_Times:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   411
  assumes B: "\<And>x. x \<in> A \<Longrightarrow> F x \<approx> B" and disj: "pairwise (\<lambda>x y. disjnt (F x) (F y)) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   412
  shows "(\<Union>x\<in>A. F x) \<approx> A \<times> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   413
proof (rule lepoll_antisym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   414
  obtain b where b: "\<And>x. x \<in> A \<Longrightarrow> bij_betw (b x) (F x) B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   415
    using B unfolding eqpoll_def by metis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   416
  show "\<Union>(F ` A) \<lesssim> A \<times> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   417
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   418
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   419
    define \<chi> where "\<chi> \<equiv> \<lambda>z. THE x. x \<in> A \<and> z \<in> F x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   420
    have \<chi>: "\<chi> z = x" if "x \<in> A" "z \<in> F x" for x z
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   421
      unfolding \<chi>_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   422
      apply (rule the_equality)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   423
      apply (simp add: that)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   424
      by (metis disj disjnt_iff pairwiseD that)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   425
    let ?f = "\<lambda>z. (\<chi> z, b (\<chi> z) z)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   426
    show "inj_on ?f (\<Union>(F ` A))"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   427
      unfolding inj_on_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   428
      by clarify (metis \<chi> b bij_betw_inv_into_left)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   429
    show "?f ` \<Union>(F ` A) \<subseteq> A \<times> B"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   430
      using \<chi> b bij_betwE by blast
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   431
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   432
  show "A \<times> B \<lesssim> \<Union>(F ` A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   433
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   434
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   435
    let ?f = "\<lambda>(x,y). inv_into (F x) (b x) y"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   436
    have *: "inv_into (F x) (b x) y \<in> F x" if "x \<in> A" "y \<in> B" for x y
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   437
      by (metis b bij_betw_imp_surj_on inv_into_into that)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   438
    then show "inj_on ?f (A \<times> B)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   439
      unfolding inj_on_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   440
      by clarsimp (metis (mono_tags, lifting) b bij_betw_inv_into_right disj disjnt_iff pairwiseD)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   441
    show "?f ` (A \<times> B) \<subseteq> \<Union> (F ` A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   442
      by clarsimp (metis b bij_betw_imp_surj_on inv_into_into)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   443
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   444
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   445
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   446
lemma UN_lepoll_UN:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   447
  assumes A: "\<And>x. x \<in> A \<Longrightarrow> B x \<lesssim> C x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   448
    and disj: "pairwise (\<lambda>x y. disjnt (C x) (C y)) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   449
  shows "\<Union> (B`A) \<lesssim> \<Union> (C`A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   450
proof -
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   451
  obtain f where f: "\<And>x. x \<in> A \<Longrightarrow> inj_on (f x) (B x) \<and> f x ` (B x) \<subseteq> (C x)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   452
    using A unfolding lepoll_def by metis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   453
  show ?thesis
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   454
    unfolding lepoll_def
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   455
  proof (intro exI conjI)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   456
    define \<chi> where "\<chi> \<equiv> \<lambda>z. @x. x \<in> A \<and> z \<in> B x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   457
    have \<chi>: "\<chi> z \<in> A \<and> z \<in> B (\<chi> z)" if "x \<in> A" "z \<in> B x" for x z
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   458
      unfolding \<chi>_def by (metis (mono_tags, lifting) someI_ex that)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   459
    let ?f = "\<lambda>z. (f (\<chi> z) z)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   460
    show "inj_on ?f (\<Union>(B ` A))"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   461
      using disj f unfolding inj_on_def disjnt_iff pairwise_def image_subset_iff
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   462
      by (metis UN_iff \<chi>)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   463
    show "?f ` \<Union> (B ` A) \<subseteq> \<Union> (C ` A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   464
      using \<chi> f unfolding image_subset_iff by blast
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   465
  qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   466
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   467
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   468
lemma UN_eqpoll_UN:
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   469
  assumes A: "\<And>x. x \<in> A \<Longrightarrow> B x \<approx> C x"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   470
    and B: "pairwise (\<lambda>x y. disjnt (B x) (B y)) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   471
    and C: "pairwise (\<lambda>x y. disjnt (C x) (C y)) A"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   472
  shows "(\<Union>x\<in>A. B x) \<approx> (\<Union>x\<in>A. C x)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   473
proof (rule lepoll_antisym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   474
  show "\<Union> (B ` A) \<lesssim> \<Union> (C ` A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   475
    by (meson A C UN_lepoll_UN eqpoll_imp_lepoll)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   476
  show "\<Union> (C ` A) \<lesssim> \<Union> (B ` A)"
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   477
    by (simp add: A B UN_lepoll_UN eqpoll_imp_lepoll eqpoll_sym)
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   478
qed
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   479
ec7cc76e88e5 New library material from the AFP entry ZFC_in_HOL
paulson <lp15@cam.ac.uk>
parents: 69874
diff changeset
   480
subsection\<open>General Cartesian products (Pi)\<close>
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   481
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   482
lemma PiE_sing_eqpoll_self: "({a} \<rightarrow>\<^sub>E B) \<approx> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   483
proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   484
  have 1: "x = y"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   485
    if "x \<in> {a} \<rightarrow>\<^sub>E B" "y \<in> {a} \<rightarrow>\<^sub>E B" "x a = y a" for x y
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
    by (metis IntD2 PiE_def extensionalityI singletonD that)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   487
  have 2: "x \<in> (\<lambda>h. h a) ` ({a} \<rightarrow>\<^sub>E B)" if "x \<in> B" for x
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   488
    using that by (rule_tac x="\<lambda>z\<in>{a}. x" in image_eqI) auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   489
  show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   490
  unfolding eqpoll_def bij_betw_def inj_on_def
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
  by (force intro: 1 2)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   493
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
lemma lepoll_funcset_right:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
   "B \<lesssim> B' \<Longrightarrow> A \<rightarrow>\<^sub>E B \<lesssim> A \<rightarrow>\<^sub>E B'"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   496
  apply (auto simp: lepoll_def inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   497
  apply (rule_tac x = "\<lambda>g. \<lambda>z \<in> A. f(g z)" in exI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   498
  apply (auto simp: fun_eq_iff)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   499
  apply (metis PiE_E)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   500
  by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
lemma lepoll_funcset_left:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   503
  assumes "B \<noteq> {}" "A \<lesssim> A'"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   504
  shows "A \<rightarrow>\<^sub>E B \<lesssim> A' \<rightarrow>\<^sub>E B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   505
proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   506
  obtain b where "b \<in> B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   507
    using assms by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   508
  obtain f where "inj_on f A" and fim: "f ` A \<subseteq> A'"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   509
    using assms by (auto simp: lepoll_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   510
  then obtain h where h: "\<And>x. x \<in> A \<Longrightarrow> h (f x) = x"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
    using the_inv_into_f_f by fastforce
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   512
  let ?F = "\<lambda>g. \<lambda>u \<in> A'. if h u \<in> A then g(h u) else b"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   513
  show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   514
    unfolding lepoll_def inj_on_def
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   515
  proof (intro exI conjI ballI impI ext)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   516
    fix k l x
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
    assume k: "k \<in> A \<rightarrow>\<^sub>E B" and l: "l \<in> A \<rightarrow>\<^sub>E B" and "?F k = ?F l"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
    then have "?F k (f x) = ?F l (f x)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   519
      by simp
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   520
    then show "k x = l x"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   521
      apply (auto simp: h split: if_split_asm)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   522
      apply (metis PiE_arb h k l)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   523
      apply (metis (full_types) PiE_E h k l)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   524
      using fim k l by fastforce
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
  next
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   526
    show "?F ` (A \<rightarrow>\<^sub>E B) \<subseteq> A' \<rightarrow>\<^sub>E B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   527
      using \<open>b \<in> B\<close> by force
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   528
  qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   530
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   531
lemma lepoll_funcset:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   532
   "\<lbrakk>B \<noteq> {}; A \<lesssim> A'; B \<lesssim> B'\<rbrakk> \<Longrightarrow> A \<rightarrow>\<^sub>E B \<lesssim> A' \<rightarrow>\<^sub>E B'"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   533
  by (rule lepoll_trans [OF lepoll_funcset_right lepoll_funcset_left]) auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   534
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
lemma lepoll_PiE:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
  assumes "\<And>i. i \<in> A \<Longrightarrow> B i \<lesssim> C i"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   537
  shows "PiE A B \<lesssim> PiE A C"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   538
proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   539
  obtain f where f: "\<And>i. i \<in> A \<Longrightarrow> inj_on (f i) (B i) \<and> (f i) ` B i \<subseteq> C i"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
    using assms unfolding lepoll_def by metis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   541
  then show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   542
    unfolding lepoll_def
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   543
    apply (rule_tac x = "\<lambda>g. \<lambda>i \<in> A. f i (g i)" in exI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
    apply (auto simp: inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
     apply (rule PiE_ext, auto)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   546
     apply (metis (full_types) PiE_mem restrict_apply')
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   547
    by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   548
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   549
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   550
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   551
lemma card_le_PiE_subindex:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   552
  assumes "A \<subseteq> A'" "Pi\<^sub>E A' B \<noteq> {}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   553
  shows "PiE A B \<lesssim> PiE A' B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   554
proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
  have "\<And>x. x \<in> A' \<Longrightarrow> \<exists>y. y \<in> B x"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   556
    using assms by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   557
  then obtain g where g: "\<And>x. x \<in> A' \<Longrightarrow> g x \<in> B x"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
    by metis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   559
  let ?F = "\<lambda>f x. if x \<in> A then f x else if x \<in> A' then g x else undefined"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
  have "Pi\<^sub>E A B \<subseteq> (\<lambda>f. restrict f A) ` Pi\<^sub>E A' B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   561
  proof
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   562
    show "f \<in> Pi\<^sub>E A B \<Longrightarrow> f \<in> (\<lambda>f. restrict f A) ` Pi\<^sub>E A' B" for f
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
      using \<open>A \<subseteq> A'\<close>
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
      by (rule_tac x="?F f" in image_eqI) (auto simp: g fun_eq_iff)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   565
  qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   566
  then have "Pi\<^sub>E A B \<lesssim> (\<lambda>f. \<lambda>i \<in> A. f i) ` Pi\<^sub>E A' B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   567
    by (simp add: subset_imp_lepoll)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   568
  also have "\<dots> \<lesssim> PiE A' B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   569
    by (rule image_lepoll)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   570
  finally show ?thesis .
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   571
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   573
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   574
lemma finite_restricted_funspace:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
  assumes "finite A" "finite B"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   576
  shows "finite {f. f ` A \<subseteq> B \<and> {x. f x \<noteq> k x} \<subseteq> A}" (is "finite ?F")
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   577
proof (rule finite_subset)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   578
  show "finite ((\<lambda>U x. if \<exists>y. (x,y) \<in> U then @y. (x,y) \<in> U else k x) ` Pow(A \<times> B))" (is "finite ?G")
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   579
    using assms by auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   580
  show "?F \<subseteq> ?G"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   581
  proof
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   582
    fix f
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   583
    assume "f \<in> ?F"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   584
    then show "f \<in> ?G"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
      by (rule_tac x="(\<lambda>x. (x,f x)) ` {x. f x \<noteq> k x}" in image_eqI) (auto simp: fun_eq_iff image_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   586
  qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   588
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   589
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   590
proposition finite_PiE_iff:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   591
   "finite(PiE I S) \<longleftrightarrow> PiE I S = {} \<or> finite {i \<in> I. ~(\<exists>a. S i \<subseteq> {a})} \<and> (\<forall>i \<in> I. finite(S i))"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   592
 (is "?lhs = ?rhs")
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   593
proof (cases "PiE I S = {}")
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   594
  case False
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   595
  define J where "J \<equiv> {i \<in> I. \<nexists>a. S i \<subseteq> {a}}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   596
  show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   597
  proof
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   598
    assume L: ?lhs
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   599
    have "infinite (Pi\<^sub>E I S)" if "infinite J"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   600
    proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   601
      have "(UNIV::nat set) \<lesssim> (UNIV::(nat\<Rightarrow>bool) set)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   602
      proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   603
        have "\<forall>N::nat set. inj_on (=) N"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   604
          by (simp add: inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   605
        then show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   606
          by (meson infinite_iff_countable_subset infinite_le_lepoll top.extremum)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   607
      qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   608
      also have "\<dots> = (UNIV::nat set) \<rightarrow>\<^sub>E (UNIV::bool set)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   609
        by auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   610
      also have "\<dots> \<lesssim> J \<rightarrow>\<^sub>E (UNIV::bool set)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   611
        apply (rule lepoll_funcset_left)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   612
        using infinite_le_lepoll that by auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   613
      also have "\<dots> \<lesssim> Pi\<^sub>E J S"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   614
      proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
        have *: "(UNIV::bool set) \<lesssim> S i" if "i \<in> I" and "\<forall>a. \<not> S i \<subseteq> {a}" for i
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
        proof -
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   617
          obtain a b where "{a,b} \<subseteq> S i" "a \<noteq> b"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
            by (metis \<open>\<forall>a. \<not> S i \<subseteq> {a}\<close> all_not_in_conv empty_subsetI insertCI insert_subset set_eq_subset subsetI)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   619
          then show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
            apply (clarsimp simp: lepoll_def inj_on_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   621
            apply (rule_tac x="\<lambda>x. if x then a else b" in exI, auto)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   622
            done
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   623
        qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   624
        show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
          by (auto simp: * J_def intro: lepoll_PiE)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   626
      qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
      also have "\<dots> \<lesssim> Pi\<^sub>E I S"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   628
        using False by (auto simp: J_def intro: card_le_PiE_subindex)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   629
      finally have "(UNIV::nat set) \<lesssim> Pi\<^sub>E I S" .
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
      then show ?thesis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
        by (simp add: infinite_le_lepoll)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   632
    qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   633
    moreover have "finite (S i)" if "i \<in> I" for i
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   634
    proof (rule finite_subset)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
      obtain f where f: "f \<in> PiE I S"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   636
        using False by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   637
      show "S i \<subseteq> (\<lambda>f. f i) ` Pi\<^sub>E I S"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
      proof
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
        show "s \<in> (\<lambda>f. f i) ` Pi\<^sub>E I S" if "s \<in> S i" for s
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
          using that f \<open>i \<in> I\<close>
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
          by (rule_tac x="\<lambda>j. if j = i then s else f j" in image_eqI) auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
      qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   643
    next
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
      show "finite ((\<lambda>x. x i) ` Pi\<^sub>E I S)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
        using L by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
    qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
    ultimately show ?rhs
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   648
      using L
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   649
      by (auto simp: J_def False)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   650
  next
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   651
    assume R: ?rhs
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   652
    have "\<forall>i \<in> I - J. \<exists>a. S i = {a}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
      using False J_def by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   654
    then obtain a where a: "\<forall>i \<in> I - J. S i = {a i}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   655
      by metis
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
    let ?F = "{f. f ` J \<subseteq> (\<Union>i \<in> J. S i) \<and> {i. f i \<noteq> (if i \<in> I then a i else undefined)} \<subseteq> J}"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
    have *: "finite (Pi\<^sub>E I S)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   658
      if "finite J" and "\<forall>i\<in>I. finite (S i)"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
    proof (rule finite_subset)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
      show "Pi\<^sub>E I S \<subseteq> ?F"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
        apply safe
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
        using J_def apply blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
        by (metis DiffI PiE_E a singletonD)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
      show "finite ?F"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   665
      proof (rule finite_restricted_funspace [OF \<open>finite J\<close>])
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   666
        show "finite (\<Union> (S ` J))"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   667
          using that J_def by blast
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   668
      qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
  qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   670
  show ?lhs
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   671
      using R by (auto simp: * J_def)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   672
  qed
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   673
qed auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   674
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   675
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   676
corollary finite_funcset_iff:
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   677
  "finite(I \<rightarrow>\<^sub>E S) \<longleftrightarrow> (\<exists>a. S \<subseteq> {a}) \<or> I = {} \<or> finite I \<and> finite S"
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   678
  apply (auto simp: finite_PiE_iff PiE_eq_empty_iff dest: not_finite_existsD)
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   679
  using finite.simps by auto
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   680
71226
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   681
lemma lists_lepoll_mono:
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   682
  assumes "A \<lesssim> B" shows "lists A \<lesssim> lists B"
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   683
proof -
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   684
  obtain f where f: "inj_on f A" "f ` A \<subseteq> B"
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   685
    by (meson assms lepoll_def)
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   686
  moreover have "inj_on (map f) (lists A)"
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   687
    using f unfolding inj_on_def
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   688
    by clarsimp (metis list.inj_map_strong)
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   689
  ultimately show ?thesis
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   690
    unfolding lepoll_def by force
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   691
qed
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   692
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   693
lemma lepoll_lists: "A \<lesssim> lists A"
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   694
  unfolding lepoll_def inj_on_def by(rule_tac x="\<lambda>x. [x]" in exI) auto
9adb1e16b2a6 two new theorems
paulson <lp15@cam.ac.uk>
parents: 71096
diff changeset
   695
69735
8230dca028eb the theory of Equipollence, and moving Fpow from Cardinals into Main
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   696
end