author | wenzelm |
Sat, 13 Aug 2022 18:06:30 +0200 | |
changeset 75848 | 9e4c0aaa30aa |
parent 75625 | 0dd3ac5fdbaa |
child 76953 | f70d431b5016 |
permissions | -rw-r--r-- |
55075 | 1 |
(* Title: HOL/Basic_BNFs.thy |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
2 |
Author: Dmitriy Traytel, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
3 |
Author: Andrei Popescu, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
4 |
Author: Jasmin Blanchette, TU Muenchen |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
5 |
Author: Jan van Brügge, TU Muenchen |
75624 | 6 |
Copyright 2012, 2022 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
7 |
|
49309
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49236
diff
changeset
|
8 |
Registration of basic types as bounded natural functors. |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
9 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
10 |
|
60758 | 11 |
section \<open>Registration of Basic Types as Bounded Natural Functors\<close> |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
12 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
13 |
theory Basic_BNFs |
49310 | 14 |
imports BNF_Def |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
15 |
begin |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
16 |
|
58916 | 17 |
inductive_set setl :: "'a + 'b \<Rightarrow> 'a set" for s :: "'a + 'b" where |
18 |
"s = Inl x \<Longrightarrow> x \<in> setl s" |
|
19 |
inductive_set setr :: "'a + 'b \<Rightarrow> 'b set" for s :: "'a + 'b" where |
|
20 |
"s = Inr x \<Longrightarrow> x \<in> setr s" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
21 |
|
58916 | 22 |
lemma sum_set_defs[code]: |
67091 | 23 |
"setl = (\<lambda>x. case x of Inl z \<Rightarrow> {z} | _ \<Rightarrow> {})" |
24 |
"setr = (\<lambda>x. case x of Inr z \<Rightarrow> {z} | _ \<Rightarrow> {})" |
|
58916 | 25 |
by (auto simp: fun_eq_iff intro: setl.intros setr.intros elim: setl.cases setr.cases split: sum.splits) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
26 |
|
58916 | 27 |
lemma rel_sum_simps[code, simp]: |
55943 | 28 |
"rel_sum R1 R2 (Inl a1) (Inl b1) = R1 a1 b1" |
29 |
"rel_sum R1 R2 (Inl a1) (Inr b2) = False" |
|
30 |
"rel_sum R1 R2 (Inr a2) (Inl b1) = False" |
|
31 |
"rel_sum R1 R2 (Inr a2) (Inr b2) = R2 a2 b2" |
|
58916 | 32 |
by (auto intro: rel_sum.intros elim: rel_sum.cases) |
55083 | 33 |
|
62324 | 34 |
inductive |
35 |
pred_sum :: "('a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> 'a + 'b \<Rightarrow> bool" for P1 P2 |
|
36 |
where |
|
37 |
"P1 a \<Longrightarrow> pred_sum P1 P2 (Inl a)" |
|
38 |
| "P2 b \<Longrightarrow> pred_sum P1 P2 (Inr b)" |
|
39 |
||
62335 | 40 |
lemma pred_sum_inject[code, simp]: |
41 |
"pred_sum P1 P2 (Inl a) \<longleftrightarrow> P1 a" |
|
42 |
"pred_sum P1 P2 (Inr b) \<longleftrightarrow> P2 b" |
|
43 |
by (simp add: pred_sum.simps)+ |
|
44 |
||
54421 | 45 |
bnf "'a + 'b" |
55931 | 46 |
map: map_sum |
54421 | 47 |
sets: setl setr |
48 |
bd: natLeq |
|
49 |
wits: Inl Inr |
|
55943 | 50 |
rel: rel_sum |
62324 | 51 |
pred: pred_sum |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
52 |
proof - |
55931 | 53 |
show "map_sum id id = id" by (rule map_sum.id) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
54 |
next |
54486 | 55 |
fix f1 :: "'o \<Rightarrow> 's" and f2 :: "'p \<Rightarrow> 't" and g1 :: "'s \<Rightarrow> 'q" and g2 :: "'t \<Rightarrow> 'r" |
67091 | 56 |
show "map_sum (g1 \<circ> f1) (g2 \<circ> f2) = map_sum g1 g2 \<circ> map_sum f1 f2" |
55931 | 57 |
by (rule map_sum.comp[symmetric]) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
58 |
next |
54486 | 59 |
fix x and f1 :: "'o \<Rightarrow> 'q" and f2 :: "'p \<Rightarrow> 'r" and g1 g2 |
49451
7a28d22c33c6
renamed "sum_setl" to "setl" and similarly for r
blanchet
parents:
49450
diff
changeset
|
60 |
assume a1: "\<And>z. z \<in> setl x \<Longrightarrow> f1 z = g1 z" and |
7a28d22c33c6
renamed "sum_setl" to "setl" and similarly for r
blanchet
parents:
49450
diff
changeset
|
61 |
a2: "\<And>z. z \<in> setr x \<Longrightarrow> f2 z = g2 z" |
55931 | 62 |
thus "map_sum f1 f2 x = map_sum g1 g2 x" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
63 |
proof (cases x) |
58916 | 64 |
case Inl thus ?thesis using a1 by (clarsimp simp: sum_set_defs(1)) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
65 |
next |
58916 | 66 |
case Inr thus ?thesis using a2 by (clarsimp simp: sum_set_defs(2)) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
67 |
qed |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
68 |
next |
54486 | 69 |
fix f1 :: "'o \<Rightarrow> 'q" and f2 :: "'p \<Rightarrow> 'r" |
67091 | 70 |
show "setl \<circ> map_sum f1 f2 = image f1 \<circ> setl" |
58916 | 71 |
by (rule ext, unfold o_apply) (simp add: sum_set_defs(1) split: sum.split) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
72 |
next |
54486 | 73 |
fix f1 :: "'o \<Rightarrow> 'q" and f2 :: "'p \<Rightarrow> 'r" |
67091 | 74 |
show "setr \<circ> map_sum f1 f2 = image f2 \<circ> setr" |
58916 | 75 |
by (rule ext, unfold o_apply) (simp add: sum_set_defs(2) split: sum.split) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
76 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
77 |
show "card_order natLeq" by (rule natLeq_card_order) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
78 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
79 |
show "cinfinite natLeq" by (rule natLeq_cinfinite) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
80 |
next |
75624 | 81 |
show "regularCard natLeq" by (rule regularCard_natLeq) |
82 |
next |
|
54486 | 83 |
fix x :: "'o + 'p" |
75624 | 84 |
show "|setl x| <o natLeq" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
85 |
apply (rule finite_iff_ordLess_natLeq[THEN iffD1]) |
58916 | 86 |
by (simp add: sum_set_defs(1) split: sum.split) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
87 |
next |
54486 | 88 |
fix x :: "'o + 'p" |
75624 | 89 |
show "|setr x| <o natLeq" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
90 |
apply (rule finite_iff_ordLess_natLeq[THEN iffD1]) |
58916 | 91 |
by (simp add: sum_set_defs(2) split: sum.split) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
92 |
next |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54581
diff
changeset
|
93 |
fix R1 R2 S1 S2 |
55943 | 94 |
show "rel_sum R1 R2 OO rel_sum S1 S2 \<le> rel_sum (R1 OO S1) (R2 OO S2)" |
58916 | 95 |
by (force elim: rel_sum.cases) |
49453 | 96 |
next |
97 |
fix R S |
|
62324 | 98 |
show "rel_sum R S = (\<lambda>x y. |
99 |
\<exists>z. (setl z \<subseteq> {(x, y). R x y} \<and> setr z \<subseteq> {(x, y). S x y}) \<and> |
|
100 |
map_sum fst fst z = x \<and> map_sum snd snd z = y)" |
|
101 |
unfolding sum_set_defs relcompp.simps conversep.simps fun_eq_iff |
|
58916 | 102 |
by (fastforce elim: rel_sum.cases split: sum.splits) |
62324 | 103 |
qed (auto simp: sum_set_defs fun_eq_iff pred_sum.simps split: sum.splits) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
104 |
|
58916 | 105 |
inductive_set fsts :: "'a \<times> 'b \<Rightarrow> 'a set" for p :: "'a \<times> 'b" where |
106 |
"fst p \<in> fsts p" |
|
107 |
inductive_set snds :: "'a \<times> 'b \<Rightarrow> 'b set" for p :: "'a \<times> 'b" where |
|
108 |
"snd p \<in> snds p" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
109 |
|
58916 | 110 |
lemma prod_set_defs[code]: "fsts = (\<lambda>p. {fst p})" "snds = (\<lambda>p. {snd p})" |
111 |
by (auto intro: fsts.intros snds.intros elim: fsts.cases snds.cases) |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
112 |
|
58916 | 113 |
inductive |
114 |
rel_prod :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('c \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> 'a \<times> 'c \<Rightarrow> 'b \<times> 'd \<Rightarrow> bool" for R1 R2 |
|
55083 | 115 |
where |
58916 | 116 |
"\<lbrakk>R1 a b; R2 c d\<rbrakk> \<Longrightarrow> rel_prod R1 R2 (a, c) (b, d)" |
117 |
||
62324 | 118 |
inductive |
119 |
pred_prod :: "('a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> 'a \<times> 'b \<Rightarrow> bool" for P1 P2 |
|
120 |
where |
|
121 |
"\<lbrakk>P1 a; P2 b\<rbrakk> \<Longrightarrow> pred_prod P1 P2 (a, b)" |
|
122 |
||
62335 | 123 |
lemma rel_prod_inject [code, simp]: |
58916 | 124 |
"rel_prod R1 R2 (a, b) (c, d) \<longleftrightarrow> R1 a c \<and> R2 b d" |
125 |
by (auto intro: rel_prod.intros elim: rel_prod.cases) |
|
126 |
||
62335 | 127 |
lemma pred_prod_inject [code, simp]: |
62324 | 128 |
"pred_prod P1 P2 (a, b) \<longleftrightarrow> P1 a \<and> P2 b" |
129 |
by (auto intro: pred_prod.intros elim: pred_prod.cases) |
|
130 |
||
58916 | 131 |
lemma rel_prod_conv: |
55944 | 132 |
"rel_prod R1 R2 = (\<lambda>(a, b) (c, d). R1 a c \<and> R2 b d)" |
58916 | 133 |
by (rule ext, rule ext) auto |
55083 | 134 |
|
62324 | 135 |
definition |
136 |
pred_fun :: "('a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool" |
|
137 |
where |
|
138 |
"pred_fun A B = (\<lambda>f. \<forall>x. A x \<longrightarrow> B (f x))" |
|
139 |
||
140 |
lemma pred_funI: "(\<And>x. A x \<Longrightarrow> B (f x)) \<Longrightarrow> pred_fun A B f" |
|
141 |
unfolding pred_fun_def by simp |
|
142 |
||
54421 | 143 |
bnf "'a \<times> 'b" |
55932 | 144 |
map: map_prod |
54421 | 145 |
sets: fsts snds |
146 |
bd: natLeq |
|
55944 | 147 |
rel: rel_prod |
62324 | 148 |
pred: pred_prod |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
149 |
proof (unfold prod_set_defs) |
55932 | 150 |
show "map_prod id id = id" by (rule map_prod.id) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
151 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
152 |
fix f1 f2 g1 g2 |
67091 | 153 |
show "map_prod (g1 \<circ> f1) (g2 \<circ> f2) = map_prod g1 g2 \<circ> map_prod f1 f2" |
55932 | 154 |
by (rule map_prod.comp[symmetric]) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
155 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
156 |
fix x f1 f2 g1 g2 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
157 |
assume "\<And>z. z \<in> {fst x} \<Longrightarrow> f1 z = g1 z" "\<And>z. z \<in> {snd x} \<Longrightarrow> f2 z = g2 z" |
55932 | 158 |
thus "map_prod f1 f2 x = map_prod g1 g2 x" by (cases x) simp |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
159 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
160 |
fix f1 f2 |
67091 | 161 |
show "(\<lambda>x. {fst x}) \<circ> map_prod f1 f2 = image f1 \<circ> (\<lambda>x. {fst x})" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
162 |
by (rule ext, unfold o_apply) simp |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
163 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
164 |
fix f1 f2 |
67091 | 165 |
show "(\<lambda>x. {snd x}) \<circ> map_prod f1 f2 = image f2 \<circ> (\<lambda>x. {snd x})" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
166 |
by (rule ext, unfold o_apply) simp |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
167 |
next |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
52545
diff
changeset
|
168 |
show "card_order natLeq" by (rule natLeq_card_order) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
169 |
next |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
52545
diff
changeset
|
170 |
show "cinfinite natLeq" by (rule natLeq_cinfinite) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
171 |
next |
75624 | 172 |
show "regularCard natLeq" by (rule regularCard_natLeq) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
173 |
next |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
52545
diff
changeset
|
174 |
fix x |
75624 | 175 |
show "|{fst x}| <o natLeq" |
176 |
by (simp add: finite_iff_ordLess_natLeq[symmetric]) |
|
177 |
next |
|
178 |
fix x |
|
179 |
show "|{snd x}| <o natLeq" |
|
180 |
by (simp add: finite_iff_ordLess_natLeq[symmetric]) |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
181 |
next |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54581
diff
changeset
|
182 |
fix R1 R2 S1 S2 |
55944 | 183 |
show "rel_prod R1 R2 OO rel_prod S1 S2 \<le> rel_prod (R1 OO S1) (R2 OO S2)" by auto |
49453 | 184 |
next |
185 |
fix R S |
|
62324 | 186 |
show "rel_prod R S = (\<lambda>x y. |
187 |
\<exists>z. ({fst z} \<subseteq> {(x, y). R x y} \<and> {snd z} \<subseteq> {(x, y). S x y}) \<and> |
|
188 |
map_prod fst fst z = x \<and> map_prod snd snd z = y)" |
|
62335 | 189 |
unfolding prod_set_defs rel_prod_inject relcompp.simps conversep.simps fun_eq_iff |
49453 | 190 |
by auto |
62324 | 191 |
qed auto |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
192 |
|
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
193 |
lemma card_order_bd_fun: "card_order (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
194 |
by (auto simp: card_order_csum natLeq_card_order card_order_card_suc card_of_card_order_on) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
195 |
|
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
196 |
lemma Cinfinite_bd_fun: "Cinfinite (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
197 |
by (auto simp: Cinfinite_csum natLeq_Cinfinite) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
198 |
|
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
199 |
lemma regularCard_bd_fun: "regularCard (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
200 |
(is "regularCard (_ +c card_suc ?U)") |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
201 |
apply (cases "Cinfinite ?U") |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
202 |
apply (rule regularCard_csum) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
203 |
apply (rule natLeq_Cinfinite) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
204 |
apply (rule Cinfinite_card_suc) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
205 |
apply assumption |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
206 |
apply (rule card_of_card_order_on) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
207 |
apply (rule regularCard_natLeq) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
208 |
apply (rule regularCard_card_suc) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
209 |
apply (rule card_of_card_order_on) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
210 |
apply assumption |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
211 |
apply (rule regularCard_ordIso[of natLeq]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
212 |
apply (rule csum_absorb1[THEN ordIso_symmetric]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
213 |
apply (rule natLeq_Cinfinite) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
214 |
apply (rule card_suc_least) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
215 |
apply (rule card_of_card_order_on) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
216 |
apply (rule natLeq_Card_order) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
217 |
apply (subst finite_iff_ordLess_natLeq[symmetric]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
218 |
apply (simp add: cinfinite_def Field_card_of card_of_card_order_on) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
219 |
apply (rule natLeq_Cinfinite) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
220 |
apply (rule regularCard_natLeq) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
221 |
done |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
222 |
|
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
223 |
lemma ordLess_bd_fun: "|UNIV::'a set| <o natLeq +c card_suc ( |UNIV::'a set| )" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
224 |
(is "_ <o (_ +c card_suc (?U :: 'a rel))") |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
225 |
proof (cases "Cinfinite ?U") |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
226 |
case True |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
227 |
have "?U <o card_suc ?U" using card_of_card_order_on natLeq_card_order card_suc_greater by blast |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
228 |
also have "card_suc ?U =o natLeq +c card_suc ?U" by (rule csum_absorb2[THEN ordIso_symmetric]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
229 |
(auto simp: True card_of_card_order_on intro!: Cinfinite_card_suc natLeq_ordLeq_cinfinite) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
230 |
finally show ?thesis . |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
231 |
next |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
232 |
case False |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
233 |
then have "?U <o natLeq" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
234 |
by (auto simp: cinfinite_def Field_card_of card_of_card_order_on finite_iff_ordLess_natLeq[symmetric]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
235 |
then show ?thesis |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
236 |
by (rule ordLess_ordLeq_trans[OF _ ordLeq_csum1[OF natLeq_Card_order]]) |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
237 |
qed |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
238 |
|
54421 | 239 |
bnf "'a \<Rightarrow> 'b" |
67399 | 240 |
map: "(\<circ>)" |
54421 | 241 |
sets: range |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
242 |
bd: "natLeq +c card_suc ( |UNIV::'a set| )" |
67399 | 243 |
rel: "rel_fun (=)" |
62324 | 244 |
pred: "pred_fun (\<lambda>_. True)" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
245 |
proof |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
246 |
fix f show "id \<circ> f = id f" by simp |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
247 |
next |
67399 | 248 |
fix f g show "(\<circ>) (g \<circ> f) = (\<circ>) g \<circ> (\<circ>) f" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
249 |
unfolding comp_def[abs_def] .. |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
250 |
next |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
251 |
fix x f g |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
252 |
assume "\<And>z. z \<in> range x \<Longrightarrow> f z = g z" |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
253 |
thus "f \<circ> x = g \<circ> x" by auto |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
254 |
next |
67399 | 255 |
fix f show "range \<circ> (\<circ>) f = (`) f \<circ> range" |
56077 | 256 |
by (auto simp add: fun_eq_iff) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
257 |
next |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
258 |
show "card_order (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
259 |
by (rule card_order_bd_fun) |
75624 | 260 |
next |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
261 |
show "cinfinite (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
262 |
by (rule Cinfinite_bd_fun[THEN conjunct1]) |
75624 | 263 |
next |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
264 |
show "regularCard (natLeq +c card_suc ( |UNIV| ))" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
265 |
by (rule regularCard_bd_fun) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
266 |
next |
75625
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
267 |
fix f :: "'d \<Rightarrow> 'a" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
268 |
show "|range f| <o natLeq +c card_suc |UNIV :: 'd set|" |
0dd3ac5fdbaa
tuned BNF bounds for function space and bounded sets; NEWS and CONTRIBUTORS
traytel
parents:
75624
diff
changeset
|
269 |
by (rule ordLeq_ordLess_trans[OF card_of_image ordLess_bd_fun]) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
270 |
next |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54581
diff
changeset
|
271 |
fix R S |
67399 | 272 |
show "rel_fun (=) R OO rel_fun (=) S \<le> rel_fun (=) (R OO S)" by (auto simp: rel_fun_def) |
49453 | 273 |
next |
49463 | 274 |
fix R |
67399 | 275 |
show "rel_fun (=) R = (\<lambda>x y. |
62324 | 276 |
\<exists>z. range z \<subseteq> {(x, y). R x y} \<and> fst \<circ> z = x \<and> snd \<circ> z = y)" |
277 |
unfolding rel_fun_def subset_iff by (force simp: fun_eq_iff[symmetric]) |
|
278 |
qed (auto simp: pred_fun_def) |
|
54191 | 279 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
280 |
end |