| author | haftmann | 
| Thu, 11 Mar 2021 07:05:38 +0000 | |
| changeset 73411 | 1f1366966296 | 
| parent 73328 | ff24fe85ee57 | 
| child 73555 | 92783562ab78 | 
| permissions | -rw-r--r-- | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
1  | 
(* Title: HOL/Hilbert_Choice.thy  | 
| 32988 | 2  | 
Author: Lawrence C Paulson, Tobias Nipkow  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
3  | 
Author: Viorel Preoteasa (Results about complete distributive lattices)  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
4  | 
Copyright 2001 University of Cambridge  | 
| 12023 | 5  | 
*)  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
6  | 
|
| 60758 | 7  | 
section \<open>Hilbert's Epsilon-Operator and the Axiom of Choice\<close>  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
8  | 
|
| 15131 | 9  | 
theory Hilbert_Choice  | 
| 63612 | 10  | 
imports Wellfounded  | 
| 69913 | 11  | 
keywords "specification" :: thy_goal_defn  | 
| 15131 | 12  | 
begin  | 
| 12298 | 13  | 
|
| 60758 | 14  | 
subsection \<open>Hilbert's epsilon\<close>  | 
| 12298 | 15  | 
|
| 63612 | 16  | 
axiomatization Eps :: "('a \<Rightarrow> bool) \<Rightarrow> 'a"
 | 
17  | 
where someI: "P x \<Longrightarrow> P (Eps P)"  | 
|
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
18  | 
|
| 
14872
 
3f2144aebd76
improved symbolic syntax of Eps: \<some> for mode "epsilon";
 
wenzelm 
parents: 
14760 
diff
changeset
 | 
19  | 
syntax (epsilon)  | 
| 63612 | 20  | 
  "_Eps" :: "pttrn \<Rightarrow> bool \<Rightarrow> 'a"  ("(3\<some>_./ _)" [0, 10] 10)
 | 
| 62521 | 21  | 
syntax (input)  | 
| 63612 | 22  | 
  "_Eps" :: "pttrn \<Rightarrow> bool \<Rightarrow> 'a"  ("(3@ _./ _)" [0, 10] 10)
 | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
23  | 
syntax  | 
| 63612 | 24  | 
  "_Eps" :: "pttrn \<Rightarrow> bool \<Rightarrow> 'a"  ("(3SOME _./ _)" [0, 10] 10)
 | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
25  | 
translations  | 
| 63612 | 26  | 
"SOME x. P" \<rightleftharpoons> "CONST Eps (\<lambda>x. P)"  | 
| 
13763
 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
 
nipkow 
parents: 
13585 
diff
changeset
 | 
27  | 
|
| 60758 | 28  | 
print_translation \<open>  | 
| 69593 | 29  | 
[(\<^const_syntax>\<open>Eps\<close>, fn _ => fn [Abs abs] =>  | 
| 42284 | 30  | 
let val (x, t) = Syntax_Trans.atomic_abs_tr' abs  | 
| 69593 | 31  | 
in Syntax.const \<^syntax_const>\<open>_Eps\<close> $ x $ t end)]  | 
| 61799 | 32  | 
\<close> \<comment> \<open>to avoid eta-contraction of body\<close>  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
33  | 
|
| 65815 | 34  | 
definition inv_into :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'a)" where
 | 
35  | 
"inv_into A f = (\<lambda>x. SOME y. y \<in> A \<and> f y = x)"  | 
|
| 
11454
 
7514e5e21cb8
Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
 
paulson 
parents: 
11451 
diff
changeset
 | 
36  | 
|
| 65815 | 37  | 
lemma inv_into_def2: "inv_into A f x = (SOME y. y \<in> A \<and> f y = x)"  | 
38  | 
by(simp add: inv_into_def)  | 
|
39  | 
||
40  | 
abbreviation inv :: "('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'a)" where
 | 
|
41  | 
"inv \<equiv> inv_into UNIV"  | 
|
| 14760 | 42  | 
|
43  | 
||
| 60758 | 44  | 
subsection \<open>Hilbert's Epsilon-operator\<close>  | 
| 14760 | 45  | 
|
| 
70097
 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 
paulson <lp15@cam.ac.uk> 
parents: 
69913 
diff
changeset
 | 
46  | 
lemma Eps_cong:  | 
| 
 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 
paulson <lp15@cam.ac.uk> 
parents: 
69913 
diff
changeset
 | 
47  | 
assumes "\<And>x. P x = Q x"  | 
| 
 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 
paulson <lp15@cam.ac.uk> 
parents: 
69913 
diff
changeset
 | 
48  | 
shows "Eps P = Eps Q"  | 
| 
 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 
paulson <lp15@cam.ac.uk> 
parents: 
69913 
diff
changeset
 | 
49  | 
using ext[of P Q, OF assms] by simp  | 
| 
 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 
paulson <lp15@cam.ac.uk> 
parents: 
69913 
diff
changeset
 | 
50  | 
|
| 63612 | 51  | 
text \<open>  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
52  | 
Easier to use than \<open>someI\<close> if the witness comes from an  | 
| 63612 | 53  | 
existential formula.  | 
54  | 
\<close>  | 
|
55  | 
lemma someI_ex [elim?]: "\<exists>x. P x \<Longrightarrow> P (SOME x. P x)"  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
56  | 
by (elim exE someI)  | 
| 14760 | 57  | 
|
| 71544 | 58  | 
lemma some_eq_imp:  | 
59  | 
assumes "Eps P = a" "P b" shows "P a"  | 
|
60  | 
using assms someI_ex by force  | 
|
61  | 
||
| 63612 | 62  | 
text \<open>  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
63  | 
Easier to use than \<open>someI\<close> because the conclusion has only one  | 
| 69593 | 64  | 
occurrence of \<^term>\<open>P\<close>.  | 
| 63612 | 65  | 
\<close>  | 
66  | 
lemma someI2: "P a \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> Q (SOME x. P x)"  | 
|
| 
60974
 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 
paulson <lp15@cam.ac.uk> 
parents: 
60758 
diff
changeset
 | 
67  | 
by (blast intro: someI)  | 
| 14760 | 68  | 
|
| 63612 | 69  | 
text \<open>  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
70  | 
Easier to use than \<open>someI2\<close> if the witness comes from an  | 
| 63612 | 71  | 
existential formula.  | 
72  | 
\<close>  | 
|
73  | 
lemma someI2_ex: "\<exists>a. P a \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> Q (SOME x. P x)"  | 
|
| 
60974
 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 
paulson <lp15@cam.ac.uk> 
parents: 
60758 
diff
changeset
 | 
74  | 
by (blast intro: someI2)  | 
| 14760 | 75  | 
|
| 63612 | 76  | 
lemma someI2_bex: "\<exists>a\<in>A. P a \<Longrightarrow> (\<And>x. x \<in> A \<and> P x \<Longrightarrow> Q x) \<Longrightarrow> Q (SOME x. x \<in> A \<and> P x)"  | 
77  | 
by (blast intro: someI2)  | 
|
78  | 
||
79  | 
lemma some_equality [intro]: "P a \<Longrightarrow> (\<And>x. P x \<Longrightarrow> x = a) \<Longrightarrow> (SOME x. P x) = a"  | 
|
80  | 
by (blast intro: someI2)  | 
|
| 14760 | 81  | 
|
| 63629 | 82  | 
lemma some1_equality: "\<exists>!x. P x \<Longrightarrow> P a \<Longrightarrow> (SOME x. P x) = a"  | 
| 63612 | 83  | 
by blast  | 
| 14760 | 84  | 
|
| 63612 | 85  | 
lemma some_eq_ex: "P (SOME x. P x) \<longleftrightarrow> (\<exists>x. P x)"  | 
86  | 
by (blast intro: someI)  | 
|
| 14760 | 87  | 
|
| 59000 | 88  | 
lemma some_in_eq: "(SOME x. x \<in> A) \<in> A \<longleftrightarrow> A \<noteq> {}"
 | 
89  | 
unfolding ex_in_conv[symmetric] by (rule some_eq_ex)  | 
|
90  | 
||
| 63612 | 91  | 
lemma some_eq_trivial [simp]: "(SOME y. y = x) = x"  | 
92  | 
by (rule some_equality) (rule refl)  | 
|
| 14760 | 93  | 
|
| 63612 | 94  | 
lemma some_sym_eq_trivial [simp]: "(SOME y. x = y) = x"  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
95  | 
by (iprover intro: some_equality)  | 
| 14760 | 96  | 
|
97  | 
||
| 63612 | 98  | 
subsection \<open>Axiom of Choice, Proved Using the Description Operator\<close>  | 
| 14760 | 99  | 
|
| 63612 | 100  | 
lemma choice: "\<forall>x. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)"  | 
101  | 
by (fast elim: someI)  | 
|
| 14760 | 102  | 
|
| 63612 | 103  | 
lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x\<in>S. Q x (f x)"  | 
104  | 
by (fast elim: someI)  | 
|
| 14760 | 105  | 
|
| 50105 | 106  | 
lemma choice_iff: "(\<forall>x. \<exists>y. Q x y) \<longleftrightarrow> (\<exists>f. \<forall>x. Q x (f x))"  | 
| 63612 | 107  | 
by (fast elim: someI)  | 
| 50105 | 108  | 
|
109  | 
lemma choice_iff': "(\<forall>x. P x \<longrightarrow> (\<exists>y. Q x y)) \<longleftrightarrow> (\<exists>f. \<forall>x. P x \<longrightarrow> Q x (f x))"  | 
|
| 63612 | 110  | 
by (fast elim: someI)  | 
| 50105 | 111  | 
|
112  | 
lemma bchoice_iff: "(\<forall>x\<in>S. \<exists>y. Q x y) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>S. Q x (f x))"  | 
|
| 63612 | 113  | 
by (fast elim: someI)  | 
| 50105 | 114  | 
|
115  | 
lemma bchoice_iff': "(\<forall>x\<in>S. P x \<longrightarrow> (\<exists>y. Q x y)) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>S. P x \<longrightarrow> Q x (f x))"  | 
|
| 63612 | 116  | 
by (fast elim: someI)  | 
| 14760 | 117  | 
|
| 
57275
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
56740 
diff
changeset
 | 
118  | 
lemma dependent_nat_choice:  | 
| 63612 | 119  | 
assumes 1: "\<exists>x. P 0 x"  | 
120  | 
and 2: "\<And>x n. P n x \<Longrightarrow> \<exists>y. P (Suc n) y \<and> Q n x y"  | 
|
| 
57448
 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 
hoelzl 
parents: 
57275 
diff
changeset
 | 
121  | 
shows "\<exists>f. \<forall>n. P n (f n) \<and> Q n (f n) (f (Suc n))"  | 
| 
57275
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
56740 
diff
changeset
 | 
122  | 
proof (intro exI allI conjI)  | 
| 63040 | 123  | 
fix n  | 
124  | 
define f where "f = rec_nat (SOME x. P 0 x) (\<lambda>n x. SOME y. P (Suc n) y \<and> Q n x y)"  | 
|
| 63612 | 125  | 
then have "P 0 (f 0)" "\<And>n. P n (f n) \<Longrightarrow> P (Suc n) (f (Suc n)) \<and> Q n (f n) (f (Suc n))"  | 
126  | 
using someI_ex[OF 1] someI_ex[OF 2] by simp_all  | 
|
| 
57448
 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 
hoelzl 
parents: 
57275 
diff
changeset
 | 
127  | 
then show "P n (f n)" "Q n (f n) (f (Suc n))"  | 
| 
57275
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
56740 
diff
changeset
 | 
128  | 
by (induct n) auto  | 
| 
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
56740 
diff
changeset
 | 
129  | 
qed  | 
| 
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
56740 
diff
changeset
 | 
130  | 
|
| 
68975
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
131  | 
lemma finite_subset_Union:  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
132  | 
assumes "finite A" "A \<subseteq> \<Union>\<B>"  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
133  | 
obtains \<F> where "finite \<F>" "\<F> \<subseteq> \<B>" "A \<subseteq> \<Union>\<F>"  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
134  | 
proof -  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
135  | 
have "\<forall>x\<in>A. \<exists>B\<in>\<B>. x\<in>B"  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
136  | 
using assms by blast  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
137  | 
then obtain f where f: "\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<B> \<and> x \<in> f x"  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
138  | 
by (auto simp add: bchoice_iff Bex_def)  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
139  | 
show thesis  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
140  | 
proof  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
141  | 
show "finite (f ` A)"  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
142  | 
using assms by auto  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
143  | 
qed (use f in auto)  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
144  | 
qed  | 
| 
 
5ce4d117cea7
A few new results, elimination of duplicates and more use of "pairwise"
 
paulson <lp15@cam.ac.uk> 
parents: 
68802 
diff
changeset
 | 
145  | 
|
| 58074 | 146  | 
|
| 60758 | 147  | 
subsection \<open>Function Inverse\<close>  | 
| 14760 | 148  | 
|
| 63612 | 149  | 
lemma inv_def: "inv f = (\<lambda>y. SOME x. f x = y)"  | 
150  | 
by (simp add: inv_into_def)  | 
|
| 33014 | 151  | 
|
| 63612 | 152  | 
lemma inv_into_into: "x \<in> f ` A \<Longrightarrow> inv_into A f x \<in> A"  | 
153  | 
by (simp add: inv_into_def) (fast intro: someI2)  | 
|
| 14760 | 154  | 
|
| 63612 | 155  | 
lemma inv_identity [simp]: "inv (\<lambda>a. a) = (\<lambda>a. a)"  | 
| 63365 | 156  | 
by (simp add: inv_def)  | 
157  | 
||
| 63612 | 158  | 
lemma inv_id [simp]: "inv id = id"  | 
| 63365 | 159  | 
by (simp add: id_def)  | 
| 14760 | 160  | 
|
| 63612 | 161  | 
lemma inv_into_f_f [simp]: "inj_on f A \<Longrightarrow> x \<in> A \<Longrightarrow> inv_into A f (f x) = x"  | 
162  | 
by (simp add: inv_into_def inj_on_def) (blast intro: someI2)  | 
|
| 14760 | 163  | 
|
| 63612 | 164  | 
lemma inv_f_f: "inj f \<Longrightarrow> inv f (f x) = x"  | 
165  | 
by simp  | 
|
| 32988 | 166  | 
|
| 67613 | 167  | 
lemma f_inv_into_f: "y \<in> f`A \<Longrightarrow> f (inv_into A f y) = y"  | 
| 63612 | 168  | 
by (simp add: inv_into_def) (fast intro: someI2)  | 
| 32988 | 169  | 
|
| 63612 | 170  | 
lemma inv_into_f_eq: "inj_on f A \<Longrightarrow> x \<in> A \<Longrightarrow> f x = y \<Longrightarrow> inv_into A f y = x"  | 
171  | 
by (erule subst) (fast intro: inv_into_f_f)  | 
|
| 32988 | 172  | 
|
| 63612 | 173  | 
lemma inv_f_eq: "inj f \<Longrightarrow> f x = y \<Longrightarrow> inv f y = x"  | 
174  | 
by (simp add:inv_into_f_eq)  | 
|
| 32988 | 175  | 
|
| 63612 | 176  | 
lemma inj_imp_inv_eq: "inj f \<Longrightarrow> \<forall>x. f (g x) = x \<Longrightarrow> inv f = g"  | 
| 44921 | 177  | 
by (blast intro: inv_into_f_eq)  | 
| 14760 | 178  | 
|
| 63612 | 179  | 
text \<open>But is it useful?\<close>  | 
| 14760 | 180  | 
lemma inj_transfer:  | 
| 63612 | 181  | 
assumes inj: "inj f"  | 
182  | 
and minor: "\<And>y. y \<in> range f \<Longrightarrow> P (inv f y)"  | 
|
| 14760 | 183  | 
shows "P x"  | 
184  | 
proof -  | 
|
185  | 
have "f x \<in> range f" by auto  | 
|
| 63612 | 186  | 
then have "P(inv f (f x))" by (rule minor)  | 
187  | 
then show "P x" by (simp add: inv_into_f_f [OF inj])  | 
|
| 14760 | 188  | 
qed  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
189  | 
|
| 63612 | 190  | 
lemma inj_iff: "inj f \<longleftrightarrow> inv f \<circ> f = id"  | 
191  | 
by (simp add: o_def fun_eq_iff) (blast intro: inj_on_inverseI inv_into_f_f)  | 
|
| 14760 | 192  | 
|
| 63612 | 193  | 
lemma inv_o_cancel[simp]: "inj f \<Longrightarrow> inv f \<circ> f = id"  | 
194  | 
by (simp add: inj_iff)  | 
|
195  | 
||
196  | 
lemma o_inv_o_cancel[simp]: "inj f \<Longrightarrow> g \<circ> inv f \<circ> f = g"  | 
|
197  | 
by (simp add: comp_assoc)  | 
|
| 23433 | 198  | 
|
| 63612 | 199  | 
lemma inv_into_image_cancel[simp]: "inj_on f A \<Longrightarrow> S \<subseteq> A \<Longrightarrow> inv_into A f ` f ` S = S"  | 
200  | 
by (fastforce simp: image_def)  | 
|
| 23433 | 201  | 
|
| 63612 | 202  | 
lemma inj_imp_surj_inv: "inj f \<Longrightarrow> surj (inv f)"  | 
203  | 
by (blast intro!: surjI inv_into_f_f)  | 
|
| 32988 | 204  | 
|
| 63612 | 205  | 
lemma surj_f_inv_f: "surj f \<Longrightarrow> f (inv f y) = y"  | 
206  | 
by (simp add: f_inv_into_f)  | 
|
| 14760 | 207  | 
|
| 
67673
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67613 
diff
changeset
 | 
208  | 
lemma bij_inv_eq_iff: "bij p \<Longrightarrow> x = inv p y \<longleftrightarrow> p x = y"  | 
| 
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67613 
diff
changeset
 | 
209  | 
using surj_f_inv_f[of p] by (auto simp add: bij_def)  | 
| 
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67613 
diff
changeset
 | 
210  | 
|
| 33057 | 211  | 
lemma inv_into_injective:  | 
212  | 
assumes eq: "inv_into A f x = inv_into A f y"  | 
|
| 63612 | 213  | 
and x: "x \<in> f`A"  | 
214  | 
and y: "y \<in> f`A"  | 
|
215  | 
shows "x = y"  | 
|
| 14760 | 216  | 
proof -  | 
| 63612 | 217  | 
from eq have "f (inv_into A f x) = f (inv_into A f y)"  | 
218  | 
by simp  | 
|
219  | 
with x y show ?thesis  | 
|
220  | 
by (simp add: f_inv_into_f)  | 
|
| 14760 | 221  | 
qed  | 
222  | 
||
| 63612 | 223  | 
lemma inj_on_inv_into: "B \<subseteq> f`A \<Longrightarrow> inj_on (inv_into A f) B"  | 
224  | 
by (blast intro: inj_onI dest: inv_into_injective injD)  | 
|
| 32988 | 225  | 
|
| 71827 | 226  | 
lemma inj_imp_bij_betw_inv: "inj f \<Longrightarrow> bij_betw (inv f) (f ` M) M"  | 
227  | 
by (simp add: bij_betw_def image_subsetI inj_on_inv_into)  | 
|
228  | 
||
| 63612 | 229  | 
lemma bij_betw_inv_into: "bij_betw f A B \<Longrightarrow> bij_betw (inv_into A f) B A"  | 
230  | 
by (auto simp add: bij_betw_def inj_on_inv_into)  | 
|
| 14760 | 231  | 
|
| 63612 | 232  | 
lemma surj_imp_inj_inv: "surj f \<Longrightarrow> inj (inv f)"  | 
233  | 
by (simp add: inj_on_inv_into)  | 
|
| 14760 | 234  | 
|
| 63612 | 235  | 
lemma surj_iff: "surj f \<longleftrightarrow> f \<circ> inv f = id"  | 
236  | 
by (auto intro!: surjI simp: surj_f_inv_f fun_eq_iff[where 'b='a])  | 
|
| 40702 | 237  | 
|
238  | 
lemma surj_iff_all: "surj f \<longleftrightarrow> (\<forall>x. f (inv f x) = x)"  | 
|
| 63612 | 239  | 
by (simp add: o_def surj_iff fun_eq_iff)  | 
| 14760 | 240  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
241  | 
lemma surj_imp_inv_eq:  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
242  | 
assumes "surj f" and gf: "\<And>x. g (f x) = x"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
243  | 
shows "inv f = g"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
244  | 
proof (rule ext)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
245  | 
fix x  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
246  | 
have "g (f (inv f x)) = inv f x"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
247  | 
by (rule gf)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
248  | 
then show "inv f x = g x"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
249  | 
by (simp add: surj_f_inv_f \<open>surj f\<close>)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
250  | 
qed  | 
| 14760 | 251  | 
|
| 63612 | 252  | 
lemma bij_imp_bij_inv: "bij f \<Longrightarrow> bij (inv f)"  | 
253  | 
by (simp add: bij_def inj_imp_surj_inv surj_imp_inj_inv)  | 
|
| 12372 | 254  | 
|
| 63612 | 255  | 
lemma inv_equality: "(\<And>x. g (f x) = x) \<Longrightarrow> (\<And>y. f (g y) = y) \<Longrightarrow> inv f = g"  | 
256  | 
by (rule ext) (auto simp add: inv_into_def)  | 
|
257  | 
||
258  | 
lemma inv_inv_eq: "bij f \<Longrightarrow> inv (inv f) = f"  | 
|
259  | 
by (rule inv_equality) (auto simp add: bij_def surj_f_inv_f)  | 
|
| 14760 | 260  | 
|
| 63612 | 261  | 
text \<open>  | 
262  | 
\<open>bij (inv f)\<close> implies little about \<open>f\<close>. Consider \<open>f :: bool \<Rightarrow> bool\<close> such  | 
|
263  | 
that \<open>f True = f False = True\<close>. Then it ia consistent with axiom \<open>someI\<close>  | 
|
264  | 
that \<open>inv f\<close> could be any function at all, including the identity function.  | 
|
265  | 
If \<open>inv f = id\<close> then \<open>inv f\<close> is a bijection, but \<open>inj f\<close>, \<open>surj f\<close> and \<open>inv  | 
|
266  | 
(inv f) = f\<close> all fail.  | 
|
267  | 
\<close>  | 
|
| 14760 | 268  | 
|
| 33057 | 269  | 
lemma inv_into_comp:  | 
| 63612 | 270  | 
"inj_on f (g ` A) \<Longrightarrow> inj_on g A \<Longrightarrow> x \<in> f ` g ` A \<Longrightarrow>  | 
271  | 
inv_into A (f \<circ> g) x = (inv_into A g \<circ> inv_into (g ` A) f) x"  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
272  | 
by (auto simp: f_inv_into_f inv_into_into intro: inv_into_f_eq comp_inj_on)  | 
| 32988 | 273  | 
|
| 63612 | 274  | 
lemma o_inv_distrib: "bij f \<Longrightarrow> bij g \<Longrightarrow> inv (f \<circ> g) = inv g \<circ> inv f"  | 
275  | 
by (rule inv_equality) (auto simp add: bij_def surj_f_inv_f)  | 
|
| 14760 | 276  | 
|
| 63807 | 277  | 
lemma image_f_inv_f: "surj f \<Longrightarrow> f ` (inv f ` A) = A"  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
61859 
diff
changeset
 | 
278  | 
by (simp add: surj_f_inv_f image_comp comp_def)  | 
| 14760 | 279  | 
|
| 63612 | 280  | 
lemma image_inv_f_f: "inj f \<Longrightarrow> inv f ` (f ` A) = A"  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
61859 
diff
changeset
 | 
281  | 
by simp  | 
| 14760 | 282  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
283  | 
lemma bij_image_Collect_eq:  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
284  | 
assumes "bij f"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
285  | 
  shows "f ` Collect P = {y. P (inv f y)}"
 | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
286  | 
proof  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
287  | 
  show "f ` Collect P \<subseteq> {y. P (inv f y)}"
 | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
288  | 
using assms by (force simp add: bij_is_inj)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
289  | 
  show "{y. P (inv f y)} \<subseteq> f ` Collect P"
 | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
290  | 
using assms by (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric])  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
291  | 
qed  | 
| 14760 | 292  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
293  | 
lemma bij_vimage_eq_inv_image:  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
294  | 
assumes "bij f"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
295  | 
shows "f -` A = inv f ` A"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
296  | 
proof  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
297  | 
show "f -` A \<subseteq> inv f ` A"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
298  | 
using assms by (blast intro: bij_is_inj [THEN inv_into_f_f, symmetric])  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
299  | 
show "inv f ` A \<subseteq> f -` A"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
300  | 
using assms by (auto simp add: bij_is_surj [THEN surj_f_inv_f])  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
301  | 
qed  | 
| 14760 | 302  | 
|
| 68610 | 303  | 
lemma inv_fn_o_fn_is_id:  | 
304  | 
fixes f::"'a \<Rightarrow> 'a"  | 
|
305  | 
assumes "bij f"  | 
|
306  | 
shows "((inv f)^^n) o (f^^n) = (\<lambda>x. x)"  | 
|
307  | 
proof -  | 
|
308  | 
have "((inv f)^^n)((f^^n) x) = x" for x n  | 
|
309  | 
proof (induction n)  | 
|
310  | 
case (Suc n)  | 
|
311  | 
have *: "(inv f) (f y) = y" for y  | 
|
312  | 
by (simp add: assms bij_is_inj)  | 
|
313  | 
have "(inv f ^^ Suc n) ((f ^^ Suc n) x) = (inv f^^n) (inv f (f ((f^^n) x)))"  | 
|
314  | 
by (simp add: funpow_swap1)  | 
|
315  | 
also have "... = (inv f^^n) ((f^^n) x)"  | 
|
316  | 
using * by auto  | 
|
317  | 
also have "... = x" using Suc.IH by auto  | 
|
318  | 
finally show ?case by simp  | 
|
319  | 
qed (auto)  | 
|
320  | 
then show ?thesis unfolding o_def by blast  | 
|
321  | 
qed  | 
|
322  | 
||
323  | 
lemma fn_o_inv_fn_is_id:  | 
|
324  | 
fixes f::"'a \<Rightarrow> 'a"  | 
|
325  | 
assumes "bij f"  | 
|
326  | 
shows "(f^^n) o ((inv f)^^n) = (\<lambda>x. x)"  | 
|
327  | 
proof -  | 
|
328  | 
have "(f^^n) (((inv f)^^n) x) = x" for x n  | 
|
329  | 
proof (induction n)  | 
|
330  | 
case (Suc n)  | 
|
331  | 
have *: "f(inv f y) = y" for y  | 
|
332  | 
using bij_inv_eq_iff[OF assms] by auto  | 
|
333  | 
have "(f ^^ Suc n) ((inv f ^^ Suc n) x) = (f^^n) (f (inv f ((inv f^^n) x)))"  | 
|
334  | 
by (simp add: funpow_swap1)  | 
|
335  | 
also have "... = (f^^n) ((inv f^^n) x)"  | 
|
336  | 
using * by auto  | 
|
337  | 
also have "... = x" using Suc.IH by auto  | 
|
338  | 
finally show ?case by simp  | 
|
339  | 
qed (auto)  | 
|
340  | 
then show ?thesis unfolding o_def by blast  | 
|
341  | 
qed  | 
|
342  | 
||
343  | 
lemma inv_fn:  | 
|
344  | 
fixes f::"'a \<Rightarrow> 'a"  | 
|
345  | 
assumes "bij f"  | 
|
346  | 
shows "inv (f^^n) = ((inv f)^^n)"  | 
|
347  | 
proof -  | 
|
348  | 
have "inv (f^^n) x = ((inv f)^^n) x" for x  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
349  | 
proof (rule inv_into_f_eq)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
350  | 
show "inj (f ^^ n)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
351  | 
by (simp add: inj_fn[OF bij_is_inj [OF assms]])  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
352  | 
show "(f ^^ n) ((inv f ^^ n) x) = x"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
353  | 
using fn_o_inv_fn_is_id[OF assms, THEN fun_cong] by force  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
354  | 
qed auto  | 
| 68610 | 355  | 
then show ?thesis by auto  | 
356  | 
qed  | 
|
357  | 
||
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
358  | 
|
| 68610 | 359  | 
lemma mono_inv:  | 
360  | 
fixes f::"'a::linorder \<Rightarrow> 'b::linorder"  | 
|
361  | 
assumes "mono f" "bij f"  | 
|
362  | 
shows "mono (inv f)"  | 
|
363  | 
proof  | 
|
364  | 
fix x y::'b assume "x \<le> y"  | 
|
365  | 
from \<open>bij f\<close> obtain a b where x: "x = f a" and y: "y = f b" by(fastforce simp: bij_def surj_def)  | 
|
366  | 
show "inv f x \<le> inv f y"  | 
|
367  | 
proof (rule le_cases)  | 
|
368  | 
assume "a \<le> b"  | 
|
369  | 
thus ?thesis using \<open>bij f\<close> x y by(simp add: bij_def inv_f_f)  | 
|
370  | 
next  | 
|
371  | 
assume "b \<le> a"  | 
|
372  | 
hence "f b \<le> f a" by(rule monoD[OF \<open>mono f\<close>])  | 
|
373  | 
hence "y \<le> x" using x y by simp  | 
|
374  | 
hence "x = y" using \<open>x \<le> y\<close> by auto  | 
|
375  | 
thus ?thesis by simp  | 
|
376  | 
qed  | 
|
377  | 
qed  | 
|
378  | 
||
| 71827 | 379  | 
lemma strict_mono_inv_on_range:  | 
380  | 
fixes f :: "'a::linorder \<Rightarrow> 'b::order"  | 
|
381  | 
assumes "strict_mono f"  | 
|
382  | 
shows "strict_mono_on (inv f) (range f)"  | 
|
383  | 
proof (clarsimp simp: strict_mono_on_def)  | 
|
384  | 
fix x y  | 
|
385  | 
assume "f x < f y"  | 
|
386  | 
then show "inv f (f x) < inv f (f y)"  | 
|
387  | 
using assms strict_mono_imp_inj_on strict_mono_less by fastforce  | 
|
388  | 
qed  | 
|
389  | 
||
| 68610 | 390  | 
lemma mono_bij_Inf:  | 
391  | 
fixes f :: "'a::complete_linorder \<Rightarrow> 'b::complete_linorder"  | 
|
392  | 
assumes "mono f" "bij f"  | 
|
393  | 
shows "f (Inf A) = Inf (f`A)"  | 
|
394  | 
proof -  | 
|
395  | 
have "surj f" using \<open>bij f\<close> by (auto simp: bij_betw_def)  | 
|
396  | 
have *: "(inv f) (Inf (f`A)) \<le> Inf ((inv f)`(f`A))"  | 
|
397  | 
using mono_Inf[OF mono_inv[OF assms], of "f`A"] by simp  | 
|
398  | 
have "Inf (f`A) \<le> f (Inf ((inv f)`(f`A)))"  | 
|
399  | 
using monoD[OF \<open>mono f\<close> *] by(simp add: surj_f_inv_f[OF \<open>surj f\<close>])  | 
|
400  | 
also have "... = f(Inf A)"  | 
|
401  | 
using assms by (simp add: bij_is_inj)  | 
|
402  | 
finally show ?thesis using mono_Inf[OF assms(1), of A] by auto  | 
|
403  | 
qed  | 
|
404  | 
||
| 31380 | 405  | 
lemma finite_fun_UNIVD1:  | 
406  | 
  assumes fin: "finite (UNIV :: ('a \<Rightarrow> 'b) set)"
 | 
|
| 63612 | 407  | 
and card: "card (UNIV :: 'b set) \<noteq> Suc 0"  | 
| 31380 | 408  | 
shows "finite (UNIV :: 'a set)"  | 
409  | 
proof -  | 
|
| 63630 | 410  | 
let ?UNIV_b = "UNIV :: 'b set"  | 
411  | 
from fin have "finite ?UNIV_b"  | 
|
| 63612 | 412  | 
by (rule finite_fun_UNIVD2)  | 
| 63630 | 413  | 
with card have "card ?UNIV_b \<ge> Suc (Suc 0)"  | 
414  | 
by (cases "card ?UNIV_b") (auto simp: card_eq_0_iff)  | 
|
415  | 
then have "card ?UNIV_b = Suc (Suc (card ?UNIV_b - Suc (Suc 0)))"  | 
|
416  | 
by simp  | 
|
| 63629 | 417  | 
then obtain b1 b2 :: 'b where b1b2: "b1 \<noteq> b2"  | 
418  | 
by (auto simp: card_Suc_eq)  | 
|
| 63630 | 419  | 
from fin have fin': "finite (range (\<lambda>f :: 'a \<Rightarrow> 'b. inv f b1))"  | 
| 63612 | 420  | 
by (rule finite_imageI)  | 
| 63630 | 421  | 
have "UNIV = range (\<lambda>f :: 'a \<Rightarrow> 'b. inv f b1)"  | 
| 31380 | 422  | 
proof (rule UNIV_eq_I)  | 
423  | 
fix x :: 'a  | 
|
| 63612 | 424  | 
from b1b2 have "x = inv (\<lambda>y. if y = x then b1 else b2) b1"  | 
425  | 
by (simp add: inv_into_def)  | 
|
426  | 
then show "x \<in> range (\<lambda>f::'a \<Rightarrow> 'b. inv f b1)"  | 
|
427  | 
by blast  | 
|
| 31380 | 428  | 
qed  | 
| 63630 | 429  | 
with fin' show ?thesis  | 
| 63612 | 430  | 
by simp  | 
| 31380 | 431  | 
qed  | 
| 14760 | 432  | 
|
| 60758 | 433  | 
text \<open>  | 
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
434  | 
Every infinite set contains a countable subset. More precisely we  | 
| 61799 | 435  | 
show that a set \<open>S\<close> is infinite if and only if there exists an  | 
436  | 
injective function from the naturals into \<open>S\<close>.  | 
|
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
437  | 
|
| 
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
438  | 
The ``only if'' direction is harder because it requires the  | 
| 
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
439  | 
construction of a sequence of pairwise different elements of an  | 
| 61799 | 440  | 
infinite set \<open>S\<close>. The idea is to construct a sequence of  | 
441  | 
non-empty and infinite subsets of \<open>S\<close> obtained by successively  | 
|
442  | 
removing elements of \<open>S\<close>.  | 
|
| 60758 | 443  | 
\<close>  | 
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
444  | 
|
| 
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
445  | 
lemma infinite_countable_subset:  | 
| 63629 | 446  | 
assumes inf: "\<not> finite S"  | 
447  | 
shows "\<exists>f::nat \<Rightarrow> 'a. inj f \<and> range f \<subseteq> S"  | 
|
| 61799 | 448  | 
\<comment> \<open>Courtesy of Stephan Merz\<close>  | 
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
449  | 
proof -  | 
| 63040 | 450  | 
  define Sseq where "Sseq = rec_nat S (\<lambda>n T. T - {SOME e. e \<in> T})"
 | 
451  | 
define pick where "pick n = (SOME e. e \<in> Sseq n)" for n  | 
|
| 63540 | 452  | 
have *: "Sseq n \<subseteq> S" "\<not> finite (Sseq n)" for n  | 
| 63612 | 453  | 
by (induct n) (auto simp: Sseq_def inf)  | 
| 63540 | 454  | 
then have **: "\<And>n. pick n \<in> Sseq n"  | 
| 55811 | 455  | 
unfolding pick_def by (subst (asm) finite.simps) (auto simp add: ex_in_conv intro: someI_ex)  | 
| 63540 | 456  | 
with * have "range pick \<subseteq> S" by auto  | 
| 63612 | 457  | 
moreover have "pick n \<noteq> pick (n + Suc m)" for m n  | 
458  | 
proof -  | 
|
| 63540 | 459  | 
have "pick n \<notin> Sseq (n + Suc m)"  | 
460  | 
by (induct m) (auto simp add: Sseq_def pick_def)  | 
|
| 63612 | 461  | 
with ** show ?thesis by auto  | 
462  | 
qed  | 
|
463  | 
then have "inj pick"  | 
|
464  | 
by (intro linorder_injI) (auto simp add: less_iff_Suc_add)  | 
|
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
465  | 
ultimately show ?thesis by blast  | 
| 
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
466  | 
qed  | 
| 
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
467  | 
|
| 63629 | 468  | 
lemma infinite_iff_countable_subset: "\<not> finite S \<longleftrightarrow> (\<exists>f::nat \<Rightarrow> 'a. inj f \<and> range f \<subseteq> S)"  | 
| 61799 | 469  | 
\<comment> \<open>Courtesy of Stephan Merz\<close>  | 
| 55811 | 470  | 
using finite_imageD finite_subset infinite_UNIV_char_0 infinite_countable_subset by auto  | 
| 
54578
 
9387251b6a46
eliminated dependence of BNF on Infinite_Set by moving 3 theorems from the latter to Main
 
traytel 
parents: 
54295 
diff
changeset
 | 
471  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
472  | 
lemma image_inv_into_cancel:  | 
| 63612 | 473  | 
assumes surj: "f`A = A'"  | 
474  | 
and sub: "B' \<subseteq> A'"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
475  | 
shows "f `((inv_into A f)`B') = B'"  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
476  | 
using assms  | 
| 63612 | 477  | 
proof (auto simp: f_inv_into_f)  | 
478  | 
let ?f' = "inv_into A f"  | 
|
479  | 
fix a'  | 
|
480  | 
assume *: "a' \<in> B'"  | 
|
481  | 
with sub have "a' \<in> A'" by auto  | 
|
482  | 
with surj have "a' = f (?f' a')"  | 
|
483  | 
by (auto simp: f_inv_into_f)  | 
|
484  | 
with * show "a' \<in> f ` (?f' ` B')" by blast  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
485  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
486  | 
|
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
487  | 
lemma inv_into_inv_into_eq:  | 
| 63612 | 488  | 
assumes "bij_betw f A A'"  | 
489  | 
and a: "a \<in> A"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
490  | 
shows "inv_into A' (inv_into A f) a = f a"  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
491  | 
proof -  | 
| 63612 | 492  | 
let ?f' = "inv_into A f"  | 
493  | 
let ?f'' = "inv_into A' ?f'"  | 
|
494  | 
from assms have *: "bij_betw ?f' A' A"  | 
|
495  | 
by (auto simp: bij_betw_inv_into)  | 
|
496  | 
with a obtain a' where a': "a' \<in> A'" "?f' a' = a"  | 
|
497  | 
unfolding bij_betw_def by force  | 
|
498  | 
with a * have "?f'' a = a'"  | 
|
499  | 
by (auto simp: f_inv_into_f bij_betw_def)  | 
|
500  | 
moreover from assms a' have "f a = a'"  | 
|
501  | 
by (auto simp: bij_betw_def)  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
502  | 
ultimately show "?f'' a = f a" by simp  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
503  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
504  | 
|
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
505  | 
lemma inj_on_iff_surj:  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
506  | 
  assumes "A \<noteq> {}"
 | 
| 63629 | 507  | 
shows "(\<exists>f. inj_on f A \<and> f ` A \<subseteq> A') \<longleftrightarrow> (\<exists>g. g ` A' = A)"  | 
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
508  | 
proof safe  | 
| 63612 | 509  | 
fix f  | 
510  | 
assume inj: "inj_on f A" and incl: "f ` A \<subseteq> A'"  | 
|
511  | 
let ?phi = "\<lambda>a' a. a \<in> A \<and> f a = a'"  | 
|
512  | 
let ?csi = "\<lambda>a. a \<in> A"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
513  | 
let ?g = "\<lambda>a'. if a' \<in> f ` A then (SOME a. ?phi a' a) else (SOME a. ?csi a)"  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
514  | 
have "?g ` A' = A"  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
515  | 
proof  | 
| 63612 | 516  | 
show "?g ` A' \<subseteq> A"  | 
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
517  | 
proof clarify  | 
| 63612 | 518  | 
fix a'  | 
519  | 
assume *: "a' \<in> A'"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
520  | 
show "?g a' \<in> A"  | 
| 63612 | 521  | 
proof (cases "a' \<in> f ` A")  | 
522  | 
case True  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
523  | 
then obtain a where "?phi a' a" by blast  | 
| 63612 | 524  | 
then have "?phi a' (SOME a. ?phi a' a)"  | 
525  | 
using someI[of "?phi a'" a] by blast  | 
|
526  | 
with True show ?thesis by auto  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
527  | 
next  | 
| 63612 | 528  | 
case False  | 
529  | 
with assms have "?csi (SOME a. ?csi a)"  | 
|
530  | 
using someI_ex[of ?csi] by blast  | 
|
531  | 
with False show ?thesis by auto  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
532  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
533  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
534  | 
next  | 
| 63612 | 535  | 
show "A \<subseteq> ?g ` A'"  | 
536  | 
proof -  | 
|
537  | 
have "?g (f a) = a \<and> f a \<in> A'" if a: "a \<in> A" for a  | 
|
538  | 
proof -  | 
|
539  | 
let ?b = "SOME aa. ?phi (f a) aa"  | 
|
540  | 
from a have "?phi (f a) a" by auto  | 
|
541  | 
then have *: "?phi (f a) ?b"  | 
|
542  | 
using someI[of "?phi(f a)" a] by blast  | 
|
543  | 
then have "?g (f a) = ?b" using a by auto  | 
|
544  | 
moreover from inj * a have "a = ?b"  | 
|
545  | 
by (auto simp add: inj_on_def)  | 
|
546  | 
ultimately have "?g(f a) = a" by simp  | 
|
547  | 
with incl a show ?thesis by auto  | 
|
548  | 
qed  | 
|
549  | 
then show ?thesis by force  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
550  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
551  | 
qed  | 
| 63612 | 552  | 
then show "\<exists>g. g ` A' = A" by blast  | 
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
553  | 
next  | 
| 63612 | 554  | 
fix g  | 
555  | 
let ?f = "inv_into A' g"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
556  | 
have "inj_on ?f (g ` A')"  | 
| 63612 | 557  | 
by (auto simp: inj_on_inv_into)  | 
558  | 
moreover have "?f (g a') \<in> A'" if a': "a' \<in> A'" for a'  | 
|
559  | 
proof -  | 
|
560  | 
let ?phi = "\<lambda> b'. b' \<in> A' \<and> g b' = g a'"  | 
|
561  | 
from a' have "?phi a'" by auto  | 
|
562  | 
then have "?phi (SOME b'. ?phi b')"  | 
|
563  | 
using someI[of ?phi] by blast  | 
|
564  | 
then show ?thesis by (auto simp: inv_into_def)  | 
|
565  | 
qed  | 
|
566  | 
ultimately show "\<exists>f. inj_on f (g ` A') \<and> f ` g ` A' \<subseteq> A'"  | 
|
567  | 
by auto  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
568  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
569  | 
|
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
570  | 
lemma Ex_inj_on_UNION_Sigma:  | 
| 63629 | 571  | 
"\<exists>f. (inj_on f (\<Union>i \<in> I. A i) \<and> f ` (\<Union>i \<in> I. A i) \<subseteq> (SIGMA i : I. A i))"  | 
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
572  | 
proof  | 
| 63612 | 573  | 
let ?phi = "\<lambda>a i. i \<in> I \<and> a \<in> A i"  | 
574  | 
let ?sm = "\<lambda>a. SOME i. ?phi a i"  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
575  | 
let ?f = "\<lambda>a. (?sm a, a)"  | 
| 63612 | 576  | 
have "inj_on ?f (\<Union>i \<in> I. A i)"  | 
577  | 
by (auto simp: inj_on_def)  | 
|
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
578  | 
moreover  | 
| 63612 | 579  | 
have "?sm a \<in> I \<and> a \<in> A(?sm a)" if "i \<in> I" and "a \<in> A i" for i a  | 
580  | 
using that someI[of "?phi a" i] by auto  | 
|
| 63629 | 581  | 
then have "?f ` (\<Union>i \<in> I. A i) \<subseteq> (SIGMA i : I. A i)"  | 
| 63612 | 582  | 
by auto  | 
| 63629 | 583  | 
ultimately show "inj_on ?f (\<Union>i \<in> I. A i) \<and> ?f ` (\<Union>i \<in> I. A i) \<subseteq> (SIGMA i : I. A i)"  | 
| 63612 | 584  | 
by auto  | 
| 
40703
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
585  | 
qed  | 
| 
 
d1fc454d6735
Move some missing lemmas from Andrei Popescus 'Ordinals and Cardinals' AFP entry to the HOL-image.
 
hoelzl 
parents: 
40702 
diff
changeset
 | 
586  | 
|
| 56608 | 587  | 
lemma inv_unique_comp:  | 
588  | 
assumes fg: "f \<circ> g = id"  | 
|
589  | 
and gf: "g \<circ> f = id"  | 
|
590  | 
shows "inv f = g"  | 
|
591  | 
using fg gf inv_equality[of g f] by (auto simp add: fun_eq_iff)  | 
|
592  | 
||
| 73328 | 593  | 
lemma inv_swap_id: "inv (Fun.swap a b id) = Fun.swap a b id"  | 
594  | 
by (rule inv_unique_comp) simp_all  | 
|
595  | 
||
596  | 
lemma bij_swap_comp:  | 
|
597  | 
assumes "bij p"  | 
|
598  | 
shows "Fun.swap a b id \<circ> p = Fun.swap (inv p a) (inv p b) p"  | 
|
599  | 
using surj_f_inv_f[OF bij_is_surj[OF \<open>bij p\<close>]]  | 
|
600  | 
by (simp add: fun_eq_iff Fun.swap_def bij_inv_eq_iff[OF \<open>bij p\<close>])  | 
|
601  | 
||
| 
70179
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
602  | 
lemma subset_image_inj:  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
603  | 
"S \<subseteq> f ` T \<longleftrightarrow> (\<exists>U. U \<subseteq> T \<and> inj_on f U \<and> S = f ` U)"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
604  | 
proof safe  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
605  | 
show "\<exists>U\<subseteq>T. inj_on f U \<and> S = f ` U"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
606  | 
if "S \<subseteq> f ` T"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
607  | 
proof -  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
608  | 
from that [unfolded subset_image_iff subset_iff]  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
609  | 
obtain g where g: "\<And>x. x \<in> S \<Longrightarrow> g x \<in> T \<and> x = f (g x)"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
610  | 
by (auto simp add: image_iff Bex_def choice_iff')  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
611  | 
show ?thesis  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
612  | 
proof (intro exI conjI)  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
613  | 
show "g ` S \<subseteq> T"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
614  | 
by (simp add: g image_subsetI)  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
615  | 
show "inj_on f (g ` S)"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
616  | 
using g by (auto simp: inj_on_def)  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
617  | 
show "S = f ` (g ` S)"  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
618  | 
using g image_subset_iff by auto  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
619  | 
qed  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
620  | 
qed  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
621  | 
qed blast  | 
| 
 
269dcea7426c
moved subset_image_inj into Hilbert_Choice
 
paulson <lp15@cam.ac.uk> 
parents: 
70097 
diff
changeset
 | 
622  | 
|
| 56608 | 623  | 
|
| 60758 | 624  | 
subsection \<open>Other Consequences of Hilbert's Epsilon\<close>  | 
| 14760 | 625  | 
|
| 69593 | 626  | 
text \<open>Hilbert's Epsilon and the \<^term>\<open>split\<close> Operator\<close>  | 
| 14760 | 627  | 
|
| 63612 | 628  | 
text \<open>Looping simprule!\<close>  | 
629  | 
lemma split_paired_Eps: "(SOME x. P x) = (SOME (a, b). P (a, b))"  | 
|
| 26347 | 630  | 
by simp  | 
| 14760 | 631  | 
|
| 
61424
 
c3658c18b7bc
prod_case as canonical name for product type eliminator
 
haftmann 
parents: 
61076 
diff
changeset
 | 
632  | 
lemma Eps_case_prod: "Eps (case_prod P) = (SOME xy. P (fst xy) (snd xy))"  | 
| 26347 | 633  | 
by (simp add: split_def)  | 
| 14760 | 634  | 
|
| 63612 | 635  | 
lemma Eps_case_prod_eq [simp]: "(SOME (x', y'). x = x' \<and> y = y') = (x, y)"  | 
| 26347 | 636  | 
by blast  | 
| 14760 | 637  | 
|
638  | 
||
| 63612 | 639  | 
text \<open>A relation is wellfounded iff it has no infinite descending chain.\<close>  | 
| 63981 | 640  | 
lemma wf_iff_no_infinite_down_chain: "wf r \<longleftrightarrow> (\<nexists>f. \<forall>i. (f (Suc i), f i) \<in> r)"  | 
641  | 
(is "_ \<longleftrightarrow> \<not> ?ex")  | 
|
642  | 
proof  | 
|
643  | 
assume "wf r"  | 
|
644  | 
show "\<not> ?ex"  | 
|
645  | 
proof  | 
|
646  | 
assume ?ex  | 
|
647  | 
then obtain f where f: "(f (Suc i), f i) \<in> r" for i  | 
|
648  | 
by blast  | 
|
649  | 
from \<open>wf r\<close> have minimal: "x \<in> Q \<Longrightarrow> \<exists>z\<in>Q. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> Q" for x Q  | 
|
650  | 
by (auto simp: wf_eq_minimal)  | 
|
651  | 
    let ?Q = "{w. \<exists>i. w = f i}"
 | 
|
652  | 
fix n  | 
|
653  | 
have "f n \<in> ?Q" by blast  | 
|
654  | 
from minimal [OF this] obtain j where "(y, f j) \<in> r \<Longrightarrow> y \<notin> ?Q" for y by blast  | 
|
655  | 
with this [OF \<open>(f (Suc j), f j) \<in> r\<close>] have "f (Suc j) \<notin> ?Q" by simp  | 
|
656  | 
then show False by blast  | 
|
657  | 
qed  | 
|
658  | 
next  | 
|
659  | 
assume "\<not> ?ex"  | 
|
660  | 
then show "wf r"  | 
|
661  | 
proof (rule contrapos_np)  | 
|
662  | 
assume "\<not> wf r"  | 
|
663  | 
then obtain Q x where x: "x \<in> Q" and rec: "z \<in> Q \<Longrightarrow> \<exists>y. (y, z) \<in> r \<and> y \<in> Q" for z  | 
|
664  | 
by (auto simp add: wf_eq_minimal)  | 
|
665  | 
obtain descend :: "nat \<Rightarrow> 'a"  | 
|
666  | 
where descend_0: "descend 0 = x"  | 
|
667  | 
and descend_Suc: "descend (Suc n) = (SOME y. y \<in> Q \<and> (y, descend n) \<in> r)" for n  | 
|
668  | 
by (rule that [of "rec_nat x (\<lambda>_ rec. (SOME y. y \<in> Q \<and> (y, rec) \<in> r))"]) simp_all  | 
|
669  | 
have descend_Q: "descend n \<in> Q" for n  | 
|
670  | 
proof (induct n)  | 
|
671  | 
case 0  | 
|
672  | 
with x show ?case by (simp only: descend_0)  | 
|
673  | 
next  | 
|
674  | 
case Suc  | 
|
675  | 
then show ?case by (simp only: descend_Suc) (rule someI2_ex; use rec in blast)  | 
|
676  | 
qed  | 
|
677  | 
have "(descend (Suc i), descend i) \<in> r" for i  | 
|
678  | 
by (simp only: descend_Suc) (rule someI2_ex; use descend_Q rec in blast)  | 
|
679  | 
then show "\<exists>f. \<forall>i. (f (Suc i), f i) \<in> r" by blast  | 
|
680  | 
qed  | 
|
681  | 
qed  | 
|
| 14760 | 682  | 
|
| 27760 | 683  | 
lemma wf_no_infinite_down_chainE:  | 
| 63612 | 684  | 
assumes "wf r"  | 
685  | 
obtains k where "(f (Suc k), f k) \<notin> r"  | 
|
686  | 
using assms wf_iff_no_infinite_down_chain[of r] by blast  | 
|
| 27760 | 687  | 
|
688  | 
||
| 63612 | 689  | 
text \<open>A dynamically-scoped fact for TFL\<close>  | 
690  | 
lemma tfl_some: "\<forall>P x. P x \<longrightarrow> P (Eps P)"  | 
|
| 12298 | 691  | 
by (blast intro: someI)  | 
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
692  | 
|
| 12298 | 693  | 
|
| 60758 | 694  | 
subsection \<open>An aside: bounded accessible part\<close>  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
695  | 
|
| 60758 | 696  | 
text \<open>Finite monotone eventually stable sequences\<close>  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
697  | 
|
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
698  | 
lemma finite_mono_remains_stable_implies_strict_prefix:  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
699  | 
fixes f :: "nat \<Rightarrow> 'a::order"  | 
| 63612 | 700  | 
assumes S: "finite (range f)" "mono f"  | 
701  | 
and eq: "\<forall>n. f n = f (Suc n) \<longrightarrow> f (Suc n) = f (Suc (Suc n))"  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
702  | 
shows "\<exists>N. (\<forall>n\<le>N. \<forall>m\<le>N. m < n \<longrightarrow> f m < f n) \<and> (\<forall>n\<ge>N. f N = f n)"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
703  | 
using assms  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
704  | 
proof -  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
705  | 
have "\<exists>n. f n = f (Suc n)"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
706  | 
proof (rule ccontr)  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
707  | 
assume "\<not> ?thesis"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
708  | 
then have "\<And>n. f n \<noteq> f (Suc n)" by auto  | 
| 63612 | 709  | 
with \<open>mono f\<close> have "\<And>n. f n < f (Suc n)"  | 
710  | 
by (auto simp: le_less mono_iff_le_Suc)  | 
|
711  | 
with lift_Suc_mono_less_iff[of f] have *: "\<And>n m. n < m \<Longrightarrow> f n < f m"  | 
|
712  | 
by auto  | 
|
| 55811 | 713  | 
have "inj f"  | 
714  | 
proof (intro injI)  | 
|
715  | 
fix x y  | 
|
716  | 
assume "f x = f y"  | 
|
| 63612 | 717  | 
then show "x = y"  | 
718  | 
by (cases x y rule: linorder_cases) (auto dest: *)  | 
|
| 55811 | 719  | 
qed  | 
| 60758 | 720  | 
with \<open>finite (range f)\<close> have "finite (UNIV::nat set)"  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
721  | 
by (rule finite_imageD)  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
722  | 
then show False by simp  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
723  | 
qed  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
724  | 
then obtain n where n: "f n = f (Suc n)" ..  | 
| 63040 | 725  | 
define N where "N = (LEAST n. f n = f (Suc n))"  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
726  | 
have N: "f N = f (Suc N)"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
727  | 
unfolding N_def using n by (rule LeastI)  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
728  | 
show ?thesis  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
729  | 
proof (intro exI[of _ N] conjI allI impI)  | 
| 63612 | 730  | 
fix n  | 
731  | 
assume "N \<le> n"  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
732  | 
then have "\<And>m. N \<le> m \<Longrightarrow> m \<le> n \<Longrightarrow> f m = f N"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
733  | 
proof (induct rule: dec_induct)  | 
| 63612 | 734  | 
case base  | 
735  | 
then show ?case by simp  | 
|
736  | 
next  | 
|
737  | 
case (step n)  | 
|
738  | 
then show ?case  | 
|
739  | 
using eq [rule_format, of "n - 1"] N  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
740  | 
by (cases n) (auto simp add: le_Suc_eq)  | 
| 63612 | 741  | 
qed  | 
| 60758 | 742  | 
from this[of n] \<open>N \<le> n\<close> show "f N = f n" by auto  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
743  | 
next  | 
| 63612 | 744  | 
fix n m :: nat  | 
745  | 
assume "m < n" "n \<le> N"  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
746  | 
then show "f m < f n"  | 
| 62683 | 747  | 
proof (induct rule: less_Suc_induct)  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
748  | 
case (1 i)  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
749  | 
then have "i < N" by simp  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
750  | 
then have "f i \<noteq> f (Suc i)"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
751  | 
unfolding N_def by (rule not_less_Least)  | 
| 60758 | 752  | 
with \<open>mono f\<close> show ?case by (simp add: mono_iff_le_Suc less_le)  | 
| 63612 | 753  | 
next  | 
754  | 
case 2  | 
|
755  | 
then show ?case by simp  | 
|
756  | 
qed  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
757  | 
qed  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
758  | 
qed  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
759  | 
|
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
760  | 
lemma finite_mono_strict_prefix_implies_finite_fixpoint:  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
761  | 
fixes f :: "nat \<Rightarrow> 'a set"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
762  | 
assumes S: "\<And>i. f i \<subseteq> S" "finite S"  | 
| 63612 | 763  | 
and ex: "\<exists>N. (\<forall>n\<le>N. \<forall>m\<le>N. m < n \<longrightarrow> f m \<subset> f n) \<and> (\<forall>n\<ge>N. f N = f n)"  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
764  | 
shows "f (card S) = (\<Union>n. f n)"  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
765  | 
proof -  | 
| 63612 | 766  | 
from ex obtain N where inj: "\<And>n m. n \<le> N \<Longrightarrow> m \<le> N \<Longrightarrow> m < n \<Longrightarrow> f m \<subset> f n"  | 
767  | 
and eq: "\<forall>n\<ge>N. f N = f n"  | 
|
768  | 
by atomize auto  | 
|
769  | 
have "i \<le> N \<Longrightarrow> i \<le> card (f i)" for i  | 
|
770  | 
proof (induct i)  | 
|
771  | 
case 0  | 
|
772  | 
then show ?case by simp  | 
|
773  | 
next  | 
|
774  | 
case (Suc i)  | 
|
775  | 
with inj [of "Suc i" i] have "(f i) \<subset> (f (Suc i))" by auto  | 
|
776  | 
moreover have "finite (f (Suc i))" using S by (rule finite_subset)  | 
|
777  | 
ultimately have "card (f i) < card (f (Suc i))" by (intro psubset_card_mono)  | 
|
778  | 
with Suc inj show ?case by auto  | 
|
779  | 
qed  | 
|
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
780  | 
then have "N \<le> card (f N)" by simp  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
781  | 
also have "\<dots> \<le> card S" using S by (intro card_mono)  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
782  | 
finally have \<section>: "f (card S) = f N" using eq by auto  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
783  | 
moreover have "\<Union> (range f) \<subseteq> f N"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
784  | 
proof clarify  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
785  | 
fix x n  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
786  | 
assume "x \<in> f n"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
787  | 
with eq inj [of N] show "x \<in> f N"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
788  | 
by (cases "n < N") (auto simp: not_less)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
789  | 
qed  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
790  | 
ultimately show ?thesis  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
791  | 
by auto  | 
| 
49948
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
792  | 
qed  | 
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
793  | 
|
| 
 
744934b818c7
moved quite generic material from theory Enum to more appropriate places
 
haftmann 
parents: 
49739 
diff
changeset
 | 
794  | 
|
| 60758 | 795  | 
subsection \<open>More on injections, bijections, and inverses\<close>  | 
| 55020 | 796  | 
|
| 63374 | 797  | 
locale bijection =  | 
798  | 
fixes f :: "'a \<Rightarrow> 'a"  | 
|
799  | 
assumes bij: "bij f"  | 
|
800  | 
begin  | 
|
801  | 
||
| 63612 | 802  | 
lemma bij_inv: "bij (inv f)"  | 
| 63374 | 803  | 
using bij by (rule bij_imp_bij_inv)  | 
804  | 
||
| 63612 | 805  | 
lemma surj [simp]: "surj f"  | 
| 63374 | 806  | 
using bij by (rule bij_is_surj)  | 
807  | 
||
| 63612 | 808  | 
lemma inj: "inj f"  | 
| 63374 | 809  | 
using bij by (rule bij_is_inj)  | 
810  | 
||
| 63612 | 811  | 
lemma surj_inv [simp]: "surj (inv f)"  | 
| 63374 | 812  | 
using inj by (rule inj_imp_surj_inv)  | 
813  | 
||
| 63612 | 814  | 
lemma inj_inv: "inj (inv f)"  | 
| 63374 | 815  | 
using surj by (rule surj_imp_inj_inv)  | 
816  | 
||
| 63612 | 817  | 
lemma eqI: "f a = f b \<Longrightarrow> a = b"  | 
| 63374 | 818  | 
using inj by (rule injD)  | 
819  | 
||
| 63612 | 820  | 
lemma eq_iff [simp]: "f a = f b \<longleftrightarrow> a = b"  | 
| 63374 | 821  | 
by (auto intro: eqI)  | 
822  | 
||
| 63612 | 823  | 
lemma eq_invI: "inv f a = inv f b \<Longrightarrow> a = b"  | 
| 63374 | 824  | 
using inj_inv by (rule injD)  | 
825  | 
||
| 63612 | 826  | 
lemma eq_inv_iff [simp]: "inv f a = inv f b \<longleftrightarrow> a = b"  | 
| 63374 | 827  | 
by (auto intro: eq_invI)  | 
828  | 
||
| 63612 | 829  | 
lemma inv_left [simp]: "inv f (f a) = a"  | 
| 63374 | 830  | 
using inj by (simp add: inv_f_eq)  | 
831  | 
||
| 63612 | 832  | 
lemma inv_comp_left [simp]: "inv f \<circ> f = id"  | 
| 63374 | 833  | 
by (simp add: fun_eq_iff)  | 
834  | 
||
| 63612 | 835  | 
lemma inv_right [simp]: "f (inv f a) = a"  | 
| 63374 | 836  | 
using surj by (simp add: surj_f_inv_f)  | 
837  | 
||
| 63612 | 838  | 
lemma inv_comp_right [simp]: "f \<circ> inv f = id"  | 
| 63374 | 839  | 
by (simp add: fun_eq_iff)  | 
840  | 
||
| 63612 | 841  | 
lemma inv_left_eq_iff [simp]: "inv f a = b \<longleftrightarrow> f b = a"  | 
| 63374 | 842  | 
by auto  | 
843  | 
||
| 63612 | 844  | 
lemma inv_right_eq_iff [simp]: "b = inv f a \<longleftrightarrow> f b = a"  | 
| 63374 | 845  | 
by auto  | 
846  | 
||
847  | 
end  | 
|
848  | 
||
| 55020 | 849  | 
lemma infinite_imp_bij_betw:  | 
| 63612 | 850  | 
assumes infinite: "\<not> finite A"  | 
851  | 
  shows "\<exists>h. bij_betw h A (A - {a})"
 | 
|
852  | 
proof (cases "a \<in> A")  | 
|
853  | 
case False  | 
|
854  | 
  then have "A - {a} = A" by blast
 | 
|
855  | 
then show ?thesis  | 
|
856  | 
using bij_betw_id[of A] by auto  | 
|
| 55020 | 857  | 
next  | 
| 63612 | 858  | 
case True  | 
859  | 
  with infinite have "\<not> finite (A - {a})" by auto
 | 
|
860  | 
  with infinite_iff_countable_subset[of "A - {a}"]
 | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
861  | 
  obtain f :: "nat \<Rightarrow> 'a" where "inj f" and f: "f ` UNIV \<subseteq> A - {a}" by blast
 | 
| 63612 | 862  | 
define g where "g n = (if n = 0 then a else f (Suc n))" for n  | 
863  | 
define A' where "A' = g ` UNIV"  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
864  | 
have *: "\<forall>y. f y \<noteq> a" using f by blast  | 
| 63612 | 865  | 
have 3: "inj_on g UNIV \<and> g ` UNIV \<subseteq> A \<and> a \<in> g ` UNIV"  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
866  | 
using \<open>inj f\<close> f * unfolding inj_on_def g_def  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
867  | 
by (auto simp add: True image_subset_iff)  | 
| 63612 | 868  | 
then have 4: "bij_betw g UNIV A' \<and> a \<in> A' \<and> A' \<subseteq> A"  | 
869  | 
using inj_on_imp_bij_betw[of g] by (auto simp: A'_def)  | 
|
870  | 
then have 5: "bij_betw (inv g) A' UNIV"  | 
|
871  | 
by (auto simp add: bij_betw_inv_into)  | 
|
872  | 
from 3 obtain n where n: "g n = a" by auto  | 
|
873  | 
  have 6: "bij_betw g (UNIV - {n}) (A' - {a})"
 | 
|
874  | 
by (rule bij_betw_subset) (use 3 4 n in \<open>auto simp: image_set_diff A'_def\<close>)  | 
|
875  | 
define v where "v m = (if m < n then m else Suc m)" for m  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
876  | 
have "m < n \<or> m = n" if "\<And>k. k < n \<or> m \<noteq> Suc k" for m  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
877  | 
using that [of "m-1"] by auto  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
878  | 
  then have 7: "bij_betw v UNIV (UNIV - {n})"
 | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
879  | 
unfolding bij_betw_def inj_on_def v_def by auto  | 
| 63612 | 880  | 
define h' where "h' = g \<circ> v \<circ> (inv g)"  | 
881  | 
  with 5 6 7 have 8: "bij_betw h' A' (A' - {a})"
 | 
|
882  | 
by (auto simp add: bij_betw_trans)  | 
|
883  | 
define h where "h b = (if b \<in> A' then h' b else b)" for b  | 
|
884  | 
  with 8 have "bij_betw h  A' (A' - {a})"
 | 
|
885  | 
using bij_betw_cong[of A' h] by auto  | 
|
| 55020 | 886  | 
moreover  | 
| 63612 | 887  | 
have "\<forall>b \<in> A - A'. h b = b" by (auto simp: h_def)  | 
888  | 
then have "bij_betw h (A - A') (A - A')"  | 
|
889  | 
using bij_betw_cong[of "A - A'" h id] bij_betw_id[of "A - A'"] by auto  | 
|
| 55020 | 890  | 
moreover  | 
| 63612 | 891  | 
  from 4 have "(A' \<inter> (A - A') = {} \<and> A' \<union> (A - A') = A) \<and>
 | 
892  | 
    ((A' - {a}) \<inter> (A - A') = {} \<and> (A' - {a}) \<union> (A - A') = A - {a})"
 | 
|
893  | 
by blast  | 
|
| 55020 | 894  | 
  ultimately have "bij_betw h A (A - {a})"
 | 
| 63612 | 895  | 
    using bij_betw_combine[of h A' "A' - {a}" "A - A'" "A - A'"] by simp
 | 
896  | 
then show ?thesis by blast  | 
|
| 55020 | 897  | 
qed  | 
898  | 
||
899  | 
lemma infinite_imp_bij_betw2:  | 
|
| 63612 | 900  | 
assumes "\<not> finite A"  | 
901  | 
  shows "\<exists>h. bij_betw h A (A \<union> {a})"
 | 
|
902  | 
proof (cases "a \<in> A")  | 
|
903  | 
case True  | 
|
904  | 
  then have "A \<union> {a} = A" by blast
 | 
|
905  | 
then show ?thesis using bij_betw_id[of A] by auto  | 
|
| 55020 | 906  | 
next  | 
| 63612 | 907  | 
case False  | 
| 55020 | 908  | 
  let ?A' = "A \<union> {a}"
 | 
| 63612 | 909  | 
  from False have "A = ?A' - {a}" by blast
 | 
910  | 
moreover from assms have "\<not> finite ?A'" by auto  | 
|
| 55020 | 911  | 
ultimately obtain f where "bij_betw f ?A' A"  | 
| 63612 | 912  | 
using infinite_imp_bij_betw[of ?A' a] by auto  | 
913  | 
then have "bij_betw (inv_into ?A' f) A ?A'" by (rule bij_betw_inv_into)  | 
|
914  | 
then show ?thesis by auto  | 
|
| 55020 | 915  | 
qed  | 
916  | 
||
| 63612 | 917  | 
lemma bij_betw_inv_into_left: "bij_betw f A A' \<Longrightarrow> a \<in> A \<Longrightarrow> inv_into A f (f a) = a"  | 
918  | 
unfolding bij_betw_def by clarify (rule inv_into_f_f)  | 
|
| 55020 | 919  | 
|
| 63612 | 920  | 
lemma bij_betw_inv_into_right: "bij_betw f A A' \<Longrightarrow> a' \<in> A' \<Longrightarrow> f (inv_into A f a') = a'"  | 
921  | 
unfolding bij_betw_def using f_inv_into_f by force  | 
|
| 55020 | 922  | 
|
923  | 
lemma bij_betw_inv_into_subset:  | 
|
| 63612 | 924  | 
"bij_betw f A A' \<Longrightarrow> B \<subseteq> A \<Longrightarrow> f ` B = B' \<Longrightarrow> bij_betw (inv_into A f) B' B"  | 
925  | 
by (auto simp: bij_betw_def intro: inj_on_inv_into)  | 
|
| 55020 | 926  | 
|
927  | 
||
| 60758 | 928  | 
subsection \<open>Specification package -- Hilbertized version\<close>  | 
| 
17893
 
aef5a6d11c2a
added lemma exE_some (from specification_package.ML);
 
wenzelm 
parents: 
17702 
diff
changeset
 | 
929  | 
|
| 63612 | 930  | 
lemma exE_some: "Ex P \<Longrightarrow> c \<equiv> Eps P \<Longrightarrow> P c"  | 
| 
17893
 
aef5a6d11c2a
added lemma exE_some (from specification_package.ML);
 
wenzelm 
parents: 
17702 
diff
changeset
 | 
931  | 
by (simp only: someI_ex)  | 
| 
 
aef5a6d11c2a
added lemma exE_some (from specification_package.ML);
 
wenzelm 
parents: 
17702 
diff
changeset
 | 
932  | 
|
| 69605 | 933  | 
ML_file \<open>Tools/choice_specification.ML\<close>  | 
| 14115 | 934  | 
|
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
935  | 
subsection \<open>Complete Distributive Lattices -- Properties depending on Hilbert Choice\<close>  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
936  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
937  | 
context complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
938  | 
begin  | 
| 69479 | 939  | 
|
940  | 
lemma Sup_Inf: "\<Squnion> (Inf ` A) = \<Sqinter> (Sup ` {f ` A |f. \<forall>B\<in>A. f B \<in> B})"
 | 
|
| 73411 | 941  | 
proof (rule order.antisym)  | 
| 69479 | 942  | 
  show "\<Squnion> (Inf ` A) \<le> \<Sqinter> (Sup ` {f ` A |f. \<forall>B\<in>A. f B \<in> B})"
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
943  | 
using Inf_lower2 Sup_upper  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
944  | 
by (fastforce simp add: intro: Sup_least INF_greatest)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
945  | 
next  | 
| 69479 | 946  | 
  show "\<Sqinter> (Sup ` {f ` A |f. \<forall>B\<in>A. f B \<in> B}) \<le> \<Squnion> (Inf ` A)"
 | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
947  | 
proof (simp add: Inf_Sup, rule SUP_least, simp, safe)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
948  | 
fix f  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
949  | 
assume "\<forall>Y. (\<exists>f. Y = f ` A \<and> (\<forall>Y\<in>A. f Y \<in> Y)) \<longrightarrow> f Y \<in> Y"  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
950  | 
then have B: "\<And> F . (\<forall> Y \<in> A . F Y \<in> Y) \<Longrightarrow> \<exists> Z \<in> A . f (F ` A) = F Z"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
951  | 
by auto  | 
| 69275 | 952  | 
    show "\<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> \<Squnion>(Inf ` A)"
 | 
953  | 
    proof (cases "\<exists> Z \<in> A . \<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> Inf Z")
 | 
|
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
954  | 
case True  | 
| 69275 | 955  | 
      from this obtain Z where [simp]: "Z \<in> A" and A: "\<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> Inf Z"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
956  | 
by blast  | 
| 69275 | 957  | 
have B: "... \<le> \<Squnion>(Inf ` A)"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
958  | 
by (simp add: SUP_upper)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
959  | 
from A and B show ?thesis  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
960  | 
by simp  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
961  | 
next  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
962  | 
case False  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
963  | 
      then have X: "\<And> Z . Z \<in> A \<Longrightarrow> \<exists> x . x \<in> Z \<and> \<not> \<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> x"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
964  | 
using Inf_greatest by blast  | 
| 69275 | 965  | 
      define F where "F = (\<lambda> Z . SOME x . x \<in> Z \<and> \<not> \<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> x)"
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
966  | 
have C: "\<And>Y. Y \<in> A \<Longrightarrow> F Y \<in> Y"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
967  | 
using X by (simp add: F_def, rule someI2_ex, auto)  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
968  | 
      have E: "\<And>Y. Y \<in> A \<Longrightarrow> \<not> \<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> F Y"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
969  | 
using X by (simp add: F_def, rule someI2_ex, auto)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
970  | 
from C and B obtain Z where D: "Z \<in> A " and Y: "f (F ` A) = F Z"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
971  | 
by blast  | 
| 69275 | 972  | 
      from E and D have W: "\<not> \<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> F Z"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
973  | 
by simp  | 
| 69275 | 974  | 
      have "\<Sqinter>(f ` {f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}) \<le> f (F ` A)"
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
975  | 
using C by (blast intro: INF_lower)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
976  | 
with W Y show ?thesis  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
977  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
978  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
979  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
980  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
981  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
982  | 
lemma dual_complete_distrib_lattice:  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
983  | 
"class.complete_distrib_lattice Sup Inf sup (\<ge>) (>) inf \<top> \<bottom>"  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
984  | 
by (simp add: class.complete_distrib_lattice.intro [OF dual_complete_lattice]  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
985  | 
class.complete_distrib_lattice_axioms_def Sup_Inf)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
986  | 
|
| 68802 | 987  | 
lemma sup_Inf: "a \<squnion> \<Sqinter>B = \<Sqinter>((\<squnion>) a ` B)"  | 
| 73411 | 988  | 
proof (rule order.antisym)  | 
| 68802 | 989  | 
show "a \<squnion> \<Sqinter>B \<le> \<Sqinter>((\<squnion>) a ` B)"  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
990  | 
using Inf_lower sup.mono by (fastforce intro: INF_greatest)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
991  | 
next  | 
| 68802 | 992  | 
  have "\<Sqinter>((\<squnion>) a ` B) \<le> \<Sqinter>(Sup ` {{f {a}, f B} |f. f {a} = a \<and> f B \<in> B})"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
993  | 
by (rule INF_greatest, auto simp add: INF_lower)  | 
| 69275 | 994  | 
  also have "... = \<Squnion>(Inf ` {{a}, B})"
 | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
995  | 
by (unfold Sup_Inf, simp)  | 
| 68802 | 996  | 
finally show "\<Sqinter>((\<squnion>) a ` B) \<le> a \<squnion> \<Sqinter>B"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
997  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
998  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
999  | 
|
| 68802 | 1000  | 
lemma inf_Sup: "a \<sqinter> \<Squnion>B = \<Squnion>((\<sqinter>) a ` B)"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1001  | 
using dual_complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1002  | 
by (rule complete_distrib_lattice.sup_Inf)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1003  | 
|
| 69479 | 1004  | 
lemma INF_SUP: "(\<Sqinter>y. \<Squnion>x. P x y) = (\<Squnion>f. \<Sqinter>x. P (f x) x)"  | 
| 73411 | 1005  | 
proof (rule order.antisym)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1006  | 
show "(SUP x. INF y. P (x y) y) \<le> (INF y. SUP x. P x y)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1007  | 
by (rule SUP_least, rule INF_greatest, rule SUP_upper2, simp_all, rule INF_lower2, simp, blast)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1008  | 
next  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1009  | 
  have "(INF y. SUP x. ((P x y))) \<le> Inf (Sup ` {{P x y | x . True} | y . True })" (is "?A \<le> ?B")
 | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1010  | 
proof (rule INF_greatest, clarsimp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1011  | 
fix y  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1012  | 
have "?A \<le> (SUP x. P x y)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1013  | 
by (rule INF_lower, simp)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1014  | 
    also have "... \<le> Sup {uu. \<exists>x. uu = P x y}"
 | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1015  | 
by (simp add: full_SetCompr_eq)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1016  | 
    finally show "?A \<le> Sup {uu. \<exists>x. uu = P x y}"
 | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1017  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1018  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1019  | 
also have "... \<le> (SUP x. INF y. P (x y) y)"  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1020  | 
proof (subst Inf_Sup, rule SUP_least, clarsimp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1021  | 
fix f  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1022  | 
    assume A: "\<forall>Y. (\<exists>y. Y = {uu. \<exists>x. uu = P x y}) \<longrightarrow> f Y \<in> Y"
 | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1023  | 
|
| 68802 | 1024  | 
    have " \<Sqinter>(f ` {uu. \<exists>y. uu = {uu. \<exists>x. uu = P x y}}) \<le>
 | 
1025  | 
      (\<Sqinter>y. P (SOME x. f {P x y |x. True} = P x y) y)"
 | 
|
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1026  | 
proof (rule INF_greatest, clarsimp)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1027  | 
fix y  | 
| 68802 | 1028  | 
        have "(INF x\<in>{uu. \<exists>y. uu = {uu. \<exists>x. uu = P x y}}. f x) \<le> f {uu. \<exists>x. uu = P x y}"
 | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1029  | 
by (rule INF_lower, blast)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1030  | 
        also have "... \<le> P (SOME x. f {uu . \<exists>x. uu = P x y} = P x y) y"
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1031  | 
by (rule someI2_ex) (use A in auto)  | 
| 68802 | 1032  | 
        finally show "\<Sqinter>(f ` {uu. \<exists>y. uu = {uu. \<exists>x. uu = P x y}}) \<le>
 | 
1033  | 
          P (SOME x. f {uu. \<exists>x. uu = P x y} = P x y) y"
 | 
|
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1034  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1035  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1036  | 
also have "... \<le> (SUP x. INF y. P (x y) y)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1037  | 
by (rule SUP_upper, simp)  | 
| 68802 | 1038  | 
      finally show "\<Sqinter>(f ` {uu. \<exists>y. uu = {uu. \<exists>x. uu = P x y}}) \<le> (\<Squnion>x. \<Sqinter>y. P (x y) y)"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1039  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1040  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1041  | 
finally show "(INF y. SUP x. P x y) \<le> (SUP x. INF y. P (x y) y)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1042  | 
by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1043  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1044  | 
|
| 69478 | 1045  | 
lemma INF_SUP_set: "(\<Sqinter>B\<in>A. \<Squnion>(g ` B)) = (\<Squnion>B\<in>{f ` A |f. \<forall>C\<in>A. f C \<in> C}. \<Sqinter>(g ` B))"
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1046  | 
(is "_ = (\<Squnion>B\<in>?F. _)")  | 
| 73411 | 1047  | 
proof (rule order.antisym)  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1048  | 
have "\<Sqinter> ((g \<circ> f) ` A) \<le> \<Squnion> (g ` B)" if "\<And>B. B \<in> A \<Longrightarrow> f B \<in> B" "B \<in> A" for f B  | 
| 69478 | 1049  | 
using that by (auto intro: SUP_upper2 INF_lower2)  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1050  | 
then show "(\<Squnion>x\<in>?F. \<Sqinter>a\<in>x. g a) \<le> (\<Sqinter>x\<in>A. \<Squnion>a\<in>x. g a)"  | 
| 
69861
 
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
 
haftmann 
parents: 
69768 
diff
changeset
 | 
1051  | 
by (auto intro!: SUP_least INF_greatest simp add: image_comp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1052  | 
next  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1053  | 
show "(\<Sqinter>x\<in>A. \<Squnion>a\<in>x. g a) \<le> (\<Squnion>x\<in>?F. \<Sqinter>a\<in>x. g a)"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1054  | 
  proof (cases "{} \<in> A")
 | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1055  | 
case True  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1056  | 
then show ?thesis  | 
| 69478 | 1057  | 
by (rule INF_lower2) simp_all  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1058  | 
next  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1059  | 
case False  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1060  | 
    {fix x
 | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1061  | 
have "(\<Sqinter>x\<in>A. \<Squnion>x\<in>x. g x) \<le> (\<Squnion>u. if x \<in> A then if u \<in> x then g u else \<bottom> else \<top>)"  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1062  | 
proof (cases "x \<in> A")  | 
| 
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1063  | 
case True  | 
| 
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1064  | 
then show ?thesis  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1065  | 
by (intro INF_lower2 SUP_least SUP_upper2) auto  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1066  | 
qed auto  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1067  | 
}  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1068  | 
then have "(\<Sqinter>Y\<in>A. \<Squnion>a\<in>Y. g a) \<le> (\<Sqinter>Y. \<Squnion>y. if Y \<in> A then if y \<in> Y then g y else \<bottom> else \<top>)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1069  | 
by (rule INF_greatest)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1070  | 
also have "... = (\<Squnion>x. \<Sqinter>Y. if Y \<in> A then if x Y \<in> Y then g (x Y) else \<bottom> else \<top>)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1071  | 
by (simp only: INF_SUP)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1072  | 
also have "... \<le> (\<Squnion>x\<in>?F. \<Sqinter>a\<in>x. g a)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1073  | 
proof (rule SUP_least)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1074  | 
show "(\<Sqinter>B. if B \<in> A then if x B \<in> B then g (x B) else \<bottom> else \<top>)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1075  | 
\<le> (\<Squnion>x\<in>?F. \<Sqinter>x\<in>x. g x)" for x  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1076  | 
proof -  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1077  | 
define G where "G \<equiv> \<lambda>Y. if x Y \<in> Y then x Y else (SOME x. x \<in>Y)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1078  | 
have "\<forall>Y\<in>A. G Y \<in> Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1079  | 
using False some_in_eq G_def by auto  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1080  | 
then have A: "G ` A \<in> ?F"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1081  | 
by blast  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1082  | 
show "(\<Sqinter>Y. if Y \<in> A then if x Y \<in> Y then g (x Y) else \<bottom> else \<top>) \<le> (\<Squnion>x\<in>?F. \<Sqinter>x\<in>x. g x)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1083  | 
by (fastforce simp: G_def intro: SUP_upper2 [OF A] INF_greatest INF_lower2)  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1084  | 
qed  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1085  | 
qed  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1086  | 
finally show ?thesis by simp  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1087  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1088  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1089  | 
|
| 69479 | 1090  | 
lemma SUP_INF: "(\<Squnion>y. \<Sqinter>x. P x y) = (\<Sqinter>x. \<Squnion>y. P (x y) y)"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1091  | 
using dual_complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1092  | 
by (rule complete_distrib_lattice.INF_SUP)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1093  | 
|
| 69479 | 1094  | 
lemma SUP_INF_set: "(\<Squnion>x\<in>A. \<Sqinter> (g ` x)) = (\<Sqinter>x\<in>{f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}. \<Squnion> (g ` x))"
 | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1095  | 
using dual_complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1096  | 
by (rule complete_distrib_lattice.INF_SUP_set)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1097  | 
|
| 
11451
 
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
 
paulson 
parents:  
diff
changeset
 | 
1098  | 
end  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1099  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1100  | 
(*properties of the former complete_distrib_lattice*)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1101  | 
context complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1102  | 
begin  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1103  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1104  | 
lemma sup_INF: "a \<squnion> (\<Sqinter>b\<in>B. f b) = (\<Sqinter>b\<in>B. a \<squnion> f b)"  | 
| 
69861
 
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
 
haftmann 
parents: 
69768 
diff
changeset
 | 
1105  | 
by (simp add: sup_Inf image_comp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1106  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1107  | 
lemma inf_SUP: "a \<sqinter> (\<Squnion>b\<in>B. f b) = (\<Squnion>b\<in>B. a \<sqinter> f b)"  | 
| 
69861
 
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
 
haftmann 
parents: 
69768 
diff
changeset
 | 
1108  | 
by (simp add: inf_Sup image_comp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1109  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1110  | 
lemma Inf_sup: "\<Sqinter>B \<squnion> a = (\<Sqinter>b\<in>B. b \<squnion> a)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1111  | 
by (simp add: sup_Inf sup_commute)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1112  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1113  | 
lemma Sup_inf: "\<Squnion>B \<sqinter> a = (\<Squnion>b\<in>B. b \<sqinter> a)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1114  | 
by (simp add: inf_Sup inf_commute)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1115  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1116  | 
lemma INF_sup: "(\<Sqinter>b\<in>B. f b) \<squnion> a = (\<Sqinter>b\<in>B. f b \<squnion> a)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1117  | 
by (simp add: sup_INF sup_commute)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1118  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1119  | 
lemma SUP_inf: "(\<Squnion>b\<in>B. f b) \<sqinter> a = (\<Squnion>b\<in>B. f b \<sqinter> a)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1120  | 
by (simp add: inf_SUP inf_commute)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1121  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1122  | 
lemma Inf_sup_eq_top_iff: "(\<Sqinter>B \<squnion> a = \<top>) \<longleftrightarrow> (\<forall>b\<in>B. b \<squnion> a = \<top>)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1123  | 
by (simp only: Inf_sup INF_top_conv)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1124  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1125  | 
lemma Sup_inf_eq_bot_iff: "(\<Squnion>B \<sqinter> a = \<bottom>) \<longleftrightarrow> (\<forall>b\<in>B. b \<sqinter> a = \<bottom>)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1126  | 
by (simp only: Sup_inf SUP_bot_conv)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1127  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1128  | 
lemma INF_sup_distrib2: "(\<Sqinter>a\<in>A. f a) \<squnion> (\<Sqinter>b\<in>B. g b) = (\<Sqinter>a\<in>A. \<Sqinter>b\<in>B. f a \<squnion> g b)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1129  | 
by (subst INF_commute) (simp add: sup_INF INF_sup)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1130  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1131  | 
lemma SUP_inf_distrib2: "(\<Squnion>a\<in>A. f a) \<sqinter> (\<Squnion>b\<in>B. g b) = (\<Squnion>a\<in>A. \<Squnion>b\<in>B. f a \<sqinter> g b)"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1132  | 
by (subst SUP_commute) (simp add: inf_SUP SUP_inf)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1133  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1134  | 
end  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1135  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1136  | 
context complete_boolean_algebra  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1137  | 
begin  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1138  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1139  | 
lemma dual_complete_boolean_algebra:  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1140  | 
"class.complete_boolean_algebra Sup Inf sup (\<ge>) (>) inf \<top> \<bottom> (\<lambda>x y. x \<squnion> - y) uminus"  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1141  | 
by (rule class.complete_boolean_algebra.intro,  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1142  | 
rule dual_complete_distrib_lattice,  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1143  | 
rule dual_boolean_algebra)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1144  | 
end  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1145  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1146  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1147  | 
|
| 68802 | 1148  | 
instantiation set :: (type) complete_distrib_lattice  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1149  | 
begin  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1150  | 
instance proof (standard, clarsimp)  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1151  | 
  fix A :: "(('a set) set) set"
 | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1152  | 
fix x::'a  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1153  | 
assume A: "\<forall>\<S>\<in>A. \<exists>X\<in>\<S>. x \<in> X"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1154  | 
define F where "F \<equiv> \<lambda>Y. SOME X. Y \<in> A \<and> X \<in> Y \<and> x \<in> X"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1155  | 
have "(\<forall>S \<in> F ` A. x \<in> S)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1156  | 
using A unfolding F_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1157  | 
moreover have "\<forall>Y\<in>A. F Y \<in> Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1158  | 
using A unfolding F_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1159  | 
then have "\<exists>f. F ` A = f ` A \<and> (\<forall>Y\<in>A. f Y \<in> Y)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1160  | 
by blast  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1161  | 
ultimately show "\<exists>X. (\<exists>f. X = f ` A \<and> (\<forall>Y\<in>A. f Y \<in> Y)) \<and> (\<forall>S\<in>X. x \<in> S)"  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1162  | 
by auto  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1163  | 
qed  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1164  | 
end  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1165  | 
|
| 68802 | 1166  | 
instance set :: (type) complete_boolean_algebra ..  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1167  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1168  | 
instantiation "fun" :: (type, complete_distrib_lattice) complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1169  | 
begin  | 
| 
69861
 
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
 
haftmann 
parents: 
69768 
diff
changeset
 | 
1170  | 
instance by standard (simp add: le_fun_def INF_SUP_set image_comp)  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1171  | 
end  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1172  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1173  | 
instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra ..  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1174  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1175  | 
context complete_linorder  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1176  | 
begin  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1177  | 
|
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1178  | 
subclass complete_distrib_lattice  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1179  | 
proof (standard, rule ccontr)  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1180  | 
fix A :: "'a set set"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1181  | 
  let ?F = "{f ` A |f. \<forall>Y\<in>A. f Y \<in> Y}"
 | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1182  | 
assume "\<not> \<Sqinter>(Sup ` A) \<le> \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1183  | 
then have C: "\<Sqinter>(Sup ` A) > \<Squnion>(Inf ` ?F)"  | 
| 69275 | 1184  | 
by (simp add: not_le)  | 
1185  | 
show False  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1186  | 
proof (cases "\<exists> z . \<Sqinter>(Sup ` A) > z \<and> z > \<Squnion>(Inf ` ?F)")  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1187  | 
case True  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1188  | 
then obtain z where A: "z < \<Sqinter>(Sup ` A)" and X: "z > \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1189  | 
by blast  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1190  | 
then have B: "\<And>Y. Y \<in> A \<Longrightarrow> \<exists>k \<in>Y . z < k"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1191  | 
using local.less_Sup_iff by(force dest: less_INF_D)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1192  | 
|
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1193  | 
define G where "G \<equiv> \<lambda>Y. SOME k . k \<in> Y \<and> z < k"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1194  | 
have E: "\<And>Y. Y \<in> A \<Longrightarrow> G Y \<in> Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1195  | 
using B unfolding G_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1196  | 
have "z \<le> Inf (G ` A)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1197  | 
proof (rule INF_greatest)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1198  | 
show "\<And>Y. Y \<in> A \<Longrightarrow> z \<le> G Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1199  | 
using B unfolding G_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1200  | 
qed  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1201  | 
also have "... \<le> \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1202  | 
by (rule SUP_upper) (use E in blast)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1203  | 
finally have "z \<le> \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1204  | 
by simp  | 
| 
67951
 
655aa11359dc
Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa)
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67829 
diff
changeset
 | 
1205  | 
|
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1206  | 
with X show ?thesis  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1207  | 
using local.not_less by blast  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1208  | 
next  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1209  | 
case False  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1210  | 
have B: "\<And>Y. Y \<in> A \<Longrightarrow> \<exists> k \<in>Y . \<Squnion>(Inf ` ?F) < k"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1211  | 
using C local.less_Sup_iff by(force dest: less_INF_D)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1212  | 
define G where "G \<equiv> \<lambda> Y . SOME k . k \<in> Y \<and> \<Squnion>(Inf ` ?F) < k"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1213  | 
have E: "\<And>Y. Y \<in> A \<Longrightarrow> G Y \<in> Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1214  | 
using B unfolding G_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1215  | 
have "\<And>Y. Y \<in> A \<Longrightarrow> \<Sqinter>(Sup ` A) \<le> G Y"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1216  | 
using B False local.leI unfolding G_def by (fastforce intro: someI2_ex)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1217  | 
then have "\<Sqinter>(Sup ` A) \<le> Inf (G ` A)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1218  | 
by (simp add: local.INF_greatest)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1219  | 
also have "Inf (G ` A) \<le> \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1220  | 
by (rule SUP_upper) (use E in blast)  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1221  | 
finally have "\<Sqinter>(Sup ` A) \<le> \<Squnion>(Inf ` ?F)"  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1222  | 
by simp  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1223  | 
with C show ?thesis  | 
| 
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1224  | 
using not_less by blast  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1225  | 
qed  | 
| 
71695
 
65489718f4dc
Tidied up more ancient, horrible proofs. Liberalised frac_le
 
paulson <lp15@cam.ac.uk> 
parents: 
71544 
diff
changeset
 | 
1226  | 
qed  | 
| 
67829
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1227  | 
end  | 
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1228  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1229  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1230  | 
|
| 
 
2a6ef5ba4822
Changes to complete distributive lattices due to Viorel Preoteasa
 
Manuel Eberl <eberlm@in.tum.de> 
parents: 
67673 
diff
changeset
 | 
1231  | 
end  |