author | traytel |
Mon, 25 Nov 2013 13:48:00 +0100 | |
changeset 54581 | 1502a1f707d9 |
parent 54538 | ba7392b52a7c |
child 54841 | af71b753c459 |
permissions | -rw-r--r-- |
49509
163914705f8d
renamed top-level theory from "Codatatype" to "BNF"
blanchet
parents:
49328
diff
changeset
|
1 |
(* Title: HOL/BNF/BNF_GFP.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 |
Copyright 2012 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
4 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
5 |
Greatest fixed point operation on bounded natural functors. |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
6 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
7 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
8 |
header {* Greatest Fixed Point Operation on Bounded Natural Functors *} |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
9 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
10 |
theory BNF_GFP |
54581
1502a1f707d9
eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents:
54538
diff
changeset
|
11 |
imports BNF_FP_Base Equiv_Relations_More List_Prefix |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
12 |
keywords |
53310 | 13 |
"codatatype" :: thy_decl and |
53822 | 14 |
"primcorecursive" :: thy_goal and |
15 |
"primcorec" :: thy_decl |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
16 |
begin |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
17 |
|
54485 | 18 |
lemma not_TrueE: "\<not> True \<Longrightarrow> P" |
19 |
by (erule notE, rule TrueI) |
|
20 |
||
21 |
lemma neq_eq_eq_contradict: "\<lbrakk>t \<noteq> u; s = t; s = u\<rbrakk> \<Longrightarrow> P" |
|
22 |
by fast |
|
23 |
||
49312 | 24 |
lemma sum_case_expand_Inr: "f o Inl = g \<Longrightarrow> f x = sum_case g (f o Inr) x" |
25 |
by (auto split: sum.splits) |
|
26 |
||
51739
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
51447
diff
changeset
|
27 |
lemma sum_case_expand_Inr': "f o Inl = g \<Longrightarrow> h = f o Inr \<longleftrightarrow> sum_case g h = f" |
54488 | 28 |
apply rule |
29 |
apply (rule ext, force split: sum.split) |
|
30 |
by (rule ext, metis sum_case_o_inj(2)) |
|
51739
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
51447
diff
changeset
|
31 |
|
49312 | 32 |
lemma converse_Times: "(A \<times> B) ^-1 = B \<times> A" |
54488 | 33 |
by fast |
49312 | 34 |
|
35 |
lemma equiv_proj: |
|
36 |
assumes e: "equiv A R" and "z \<in> R" |
|
37 |
shows "(proj R o fst) z = (proj R o snd) z" |
|
38 |
proof - |
|
39 |
from assms(2) have z: "(fst z, snd z) \<in> R" by auto |
|
53695 | 40 |
with e have "\<And>x. (fst z, x) \<in> R \<Longrightarrow> (snd z, x) \<in> R" "\<And>x. (snd z, x) \<in> R \<Longrightarrow> (fst z, x) \<in> R" |
41 |
unfolding equiv_def sym_def trans_def by blast+ |
|
42 |
then show ?thesis unfolding proj_def[abs_def] by auto |
|
49312 | 43 |
qed |
44 |
||
45 |
(* Operators: *) |
|
46 |
definition image2 where "image2 A f g = {(f a, g a) | a. a \<in> A}" |
|
47 |
||
51447 | 48 |
lemma Id_onD: "(a, b) \<in> Id_on A \<Longrightarrow> a = b" |
49 |
unfolding Id_on_def by simp |
|
49312 | 50 |
|
51447 | 51 |
lemma Id_onD': "x \<in> Id_on A \<Longrightarrow> fst x = snd x" |
52 |
unfolding Id_on_def by auto |
|
49312 | 53 |
|
51447 | 54 |
lemma Id_on_fst: "x \<in> Id_on A \<Longrightarrow> fst x \<in> A" |
55 |
unfolding Id_on_def by auto |
|
49312 | 56 |
|
51447 | 57 |
lemma Id_on_UNIV: "Id_on UNIV = Id" |
58 |
unfolding Id_on_def by auto |
|
49312 | 59 |
|
51447 | 60 |
lemma Id_on_Comp: "Id_on A = Id_on A O Id_on A" |
61 |
unfolding Id_on_def by auto |
|
49312 | 62 |
|
51447 | 63 |
lemma Id_on_Gr: "Id_on A = Gr A id" |
64 |
unfolding Id_on_def Gr_def by auto |
|
49312 | 65 |
|
66 |
lemma image2_eqI: "\<lbrakk>b = f x; c = g x; x \<in> A\<rbrakk> \<Longrightarrow> (b, c) \<in> image2 A f g" |
|
67 |
unfolding image2_def by auto |
|
68 |
||
69 |
lemma IdD: "(a, b) \<in> Id \<Longrightarrow> a = b" |
|
70 |
by auto |
|
71 |
||
72 |
lemma image2_Gr: "image2 A f g = (Gr A f)^-1 O (Gr A g)" |
|
73 |
unfolding image2_def Gr_def by auto |
|
74 |
||
75 |
lemma GrD1: "(x, fx) \<in> Gr A f \<Longrightarrow> x \<in> A" |
|
76 |
unfolding Gr_def by simp |
|
77 |
||
78 |
lemma GrD2: "(x, fx) \<in> Gr A f \<Longrightarrow> f x = fx" |
|
79 |
unfolding Gr_def by simp |
|
80 |
||
81 |
lemma Gr_incl: "Gr A f \<subseteq> A <*> B \<longleftrightarrow> f ` A \<subseteq> B" |
|
82 |
unfolding Gr_def by auto |
|
83 |
||
54485 | 84 |
lemma subset_Collect_iff: "B \<subseteq> A \<Longrightarrow> (B \<subseteq> {x \<in> A. P x}) = (\<forall>x \<in> B. P x)" |
85 |
by blast |
|
86 |
||
87 |
lemma subset_CollectI: "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> Q x \<Longrightarrow> P x) \<Longrightarrow> ({x \<in> B. Q x} \<subseteq> {x \<in> A. P x})" |
|
88 |
by blast |
|
89 |
||
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
90 |
lemma in_rel_Collect_split_eq: "in_rel (Collect (split X)) = X" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
91 |
unfolding fun_eq_iff by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
92 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
93 |
lemma Collect_split_in_rel_leI: "X \<subseteq> Y \<Longrightarrow> X \<subseteq> Collect (split (in_rel Y))" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
94 |
by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
95 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
96 |
lemma Collect_split_in_rel_leE: "X \<subseteq> Collect (split (in_rel Y)) \<Longrightarrow> (X \<subseteq> Y \<Longrightarrow> R) \<Longrightarrow> R" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
97 |
by force |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
98 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
99 |
lemma Collect_split_in_relI: "x \<in> X \<Longrightarrow> x \<in> Collect (split (in_rel X))" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
100 |
by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
101 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
102 |
lemma conversep_in_rel: "(in_rel R)\<inverse>\<inverse> = in_rel (R\<inverse>)" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
103 |
unfolding fun_eq_iff by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
104 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
105 |
lemma relcompp_in_rel: "in_rel R OO in_rel S = in_rel (R O S)" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
106 |
unfolding fun_eq_iff by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
107 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
108 |
lemma in_rel_Gr: "in_rel (Gr A f) = Grp A f" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
109 |
unfolding Gr_def Grp_def fun_eq_iff by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
110 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
111 |
lemma in_rel_Id_on_UNIV: "in_rel (Id_on UNIV) = op =" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
112 |
unfolding fun_eq_iff by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51850
diff
changeset
|
113 |
|
49312 | 114 |
definition relImage where |
115 |
"relImage R f \<equiv> {(f a1, f a2) | a1 a2. (a1,a2) \<in> R}" |
|
116 |
||
117 |
definition relInvImage where |
|
118 |
"relInvImage A R f \<equiv> {(a1, a2) | a1 a2. a1 \<in> A \<and> a2 \<in> A \<and> (f a1, f a2) \<in> R}" |
|
119 |
||
120 |
lemma relImage_Gr: |
|
121 |
"\<lbrakk>R \<subseteq> A \<times> A\<rbrakk> \<Longrightarrow> relImage R f = (Gr A f)^-1 O R O Gr A f" |
|
122 |
unfolding relImage_def Gr_def relcomp_def by auto |
|
123 |
||
124 |
lemma relInvImage_Gr: "\<lbrakk>R \<subseteq> B \<times> B\<rbrakk> \<Longrightarrow> relInvImage A R f = Gr A f O R O (Gr A f)^-1" |
|
125 |
unfolding Gr_def relcomp_def image_def relInvImage_def by auto |
|
126 |
||
127 |
lemma relImage_mono: |
|
128 |
"R1 \<subseteq> R2 \<Longrightarrow> relImage R1 f \<subseteq> relImage R2 f" |
|
129 |
unfolding relImage_def by auto |
|
130 |
||
131 |
lemma relInvImage_mono: |
|
132 |
"R1 \<subseteq> R2 \<Longrightarrow> relInvImage A R1 f \<subseteq> relInvImage A R2 f" |
|
133 |
unfolding relInvImage_def by auto |
|
134 |
||
51447 | 135 |
lemma relInvImage_Id_on: |
136 |
"(\<And>a1 a2. f a1 = f a2 \<longleftrightarrow> a1 = a2) \<Longrightarrow> relInvImage A (Id_on B) f \<subseteq> Id" |
|
137 |
unfolding relInvImage_def Id_on_def by auto |
|
49312 | 138 |
|
139 |
lemma relInvImage_UNIV_relImage: |
|
140 |
"R \<subseteq> relInvImage UNIV (relImage R f) f" |
|
141 |
unfolding relInvImage_def relImage_def by auto |
|
142 |
||
143 |
lemma relImage_proj: |
|
144 |
assumes "equiv A R" |
|
51447 | 145 |
shows "relImage R (proj R) \<subseteq> Id_on (A//R)" |
146 |
unfolding relImage_def Id_on_def |
|
147 |
using proj_iff[OF assms] equiv_class_eq_iff[OF assms] |
|
148 |
by (auto simp: proj_preserves) |
|
49312 | 149 |
|
150 |
lemma relImage_relInvImage: |
|
151 |
assumes "R \<subseteq> f ` A <*> f ` A" |
|
152 |
shows "relImage (relInvImage A R f) f = R" |
|
54488 | 153 |
using assms unfolding relImage_def relInvImage_def by fast |
49312 | 154 |
|
155 |
lemma subst_Pair: "P x y \<Longrightarrow> a = (x, y) \<Longrightarrow> P (fst a) (snd a)" |
|
156 |
by simp |
|
157 |
||
158 |
lemma fst_diag_id: "(fst \<circ> (%x. (x, x))) z = id z" |
|
159 |
by simp |
|
160 |
||
161 |
lemma snd_diag_id: "(snd \<circ> (%x. (x, x))) z = id z" |
|
162 |
by simp |
|
163 |
||
164 |
lemma image_convolD: "\<lbrakk>(a, b) \<in> <f, g> ` X\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> X \<and> a = f x \<and> b = g x" |
|
165 |
unfolding convol_def by auto |
|
166 |
||
167 |
(*Extended Sublist*) |
|
168 |
||
54581
1502a1f707d9
eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents:
54538
diff
changeset
|
169 |
definition clists where "clists r = |lists (Field r)|" |
1502a1f707d9
eliminated dependence of Cardinals_FP on Set_Intervals, more precise imports
traytel
parents:
54538
diff
changeset
|
170 |
|
49312 | 171 |
definition prefCl where |
50058
bb1fadeba35e
import Sublist rather than PrefixOrder to avoid unnecessary class instantiation
traytel
parents:
49635
diff
changeset
|
172 |
"prefCl Kl = (\<forall> kl1 kl2. prefixeq kl1 kl2 \<and> kl2 \<in> Kl \<longrightarrow> kl1 \<in> Kl)" |
49312 | 173 |
definition PrefCl where |
50058
bb1fadeba35e
import Sublist rather than PrefixOrder to avoid unnecessary class instantiation
traytel
parents:
49635
diff
changeset
|
174 |
"PrefCl A n = (\<forall>kl kl'. kl \<in> A n \<and> prefixeq kl' kl \<longrightarrow> (\<exists>m\<le>n. kl' \<in> A m))" |
49312 | 175 |
|
176 |
lemma prefCl_UN: |
|
177 |
"\<lbrakk>\<And>n. PrefCl A n\<rbrakk> \<Longrightarrow> prefCl (\<Union>n. A n)" |
|
178 |
unfolding prefCl_def PrefCl_def by fastforce |
|
179 |
||
180 |
definition Succ where "Succ Kl kl = {k . kl @ [k] \<in> Kl}" |
|
181 |
definition Shift where "Shift Kl k = {kl. k # kl \<in> Kl}" |
|
182 |
definition shift where "shift lab k = (\<lambda>kl. lab (k # kl))" |
|
183 |
||
184 |
lemma empty_Shift: "\<lbrakk>[] \<in> Kl; k \<in> Succ Kl []\<rbrakk> \<Longrightarrow> [] \<in> Shift Kl k" |
|
185 |
unfolding Shift_def Succ_def by simp |
|
186 |
||
187 |
lemma Shift_clists: "Kl \<subseteq> Field (clists r) \<Longrightarrow> Shift Kl k \<subseteq> Field (clists r)" |
|
188 |
unfolding Shift_def clists_def Field_card_of by auto |
|
189 |
||
190 |
lemma Shift_prefCl: "prefCl Kl \<Longrightarrow> prefCl (Shift Kl k)" |
|
191 |
unfolding prefCl_def Shift_def |
|
192 |
proof safe |
|
193 |
fix kl1 kl2 |
|
50058
bb1fadeba35e
import Sublist rather than PrefixOrder to avoid unnecessary class instantiation
traytel
parents:
49635
diff
changeset
|
194 |
assume "\<forall>kl1 kl2. prefixeq kl1 kl2 \<and> kl2 \<in> Kl \<longrightarrow> kl1 \<in> Kl" |
bb1fadeba35e
import Sublist rather than PrefixOrder to avoid unnecessary class instantiation
traytel
parents:
49635
diff
changeset
|
195 |
"prefixeq kl1 kl2" "k # kl2 \<in> Kl" |
bb1fadeba35e
import Sublist rather than PrefixOrder to avoid unnecessary class instantiation
traytel
parents:
49635
diff
changeset
|
196 |
thus "k # kl1 \<in> Kl" using Cons_prefixeq_Cons[of k kl1 k kl2] by blast |
49312 | 197 |
qed |
198 |
||
199 |
lemma not_in_Shift: "kl \<notin> Shift Kl x \<Longrightarrow> x # kl \<notin> Kl" |
|
200 |
unfolding Shift_def by simp |
|
201 |
||
202 |
lemma SuccD: "k \<in> Succ Kl kl \<Longrightarrow> kl @ [k] \<in> Kl" |
|
203 |
unfolding Succ_def by simp |
|
204 |
||
205 |
lemmas SuccE = SuccD[elim_format] |
|
206 |
||
207 |
lemma SuccI: "kl @ [k] \<in> Kl \<Longrightarrow> k \<in> Succ Kl kl" |
|
208 |
unfolding Succ_def by simp |
|
209 |
||
210 |
lemma ShiftD: "kl \<in> Shift Kl k \<Longrightarrow> k # kl \<in> Kl" |
|
211 |
unfolding Shift_def by simp |
|
212 |
||
213 |
lemma Succ_Shift: "Succ (Shift Kl k) kl = Succ Kl (k # kl)" |
|
214 |
unfolding Succ_def Shift_def by auto |
|
215 |
||
216 |
lemma Nil_clists: "{[]} \<subseteq> Field (clists r)" |
|
217 |
unfolding clists_def Field_card_of by auto |
|
218 |
||
219 |
lemma Cons_clists: |
|
220 |
"\<lbrakk>x \<in> Field r; xs \<in> Field (clists r)\<rbrakk> \<Longrightarrow> x # xs \<in> Field (clists r)" |
|
221 |
unfolding clists_def Field_card_of by auto |
|
222 |
||
223 |
lemma length_Cons: "length (x # xs) = Suc (length xs)" |
|
224 |
by simp |
|
225 |
||
226 |
lemma length_append_singleton: "length (xs @ [x]) = Suc (length xs)" |
|
227 |
by simp |
|
228 |
||
229 |
(*injection into the field of a cardinal*) |
|
230 |
definition "toCard_pred A r f \<equiv> inj_on f A \<and> f ` A \<subseteq> Field r \<and> Card_order r" |
|
231 |
definition "toCard A r \<equiv> SOME f. toCard_pred A r f" |
|
232 |
||
233 |
lemma ex_toCard_pred: |
|
234 |
"\<lbrakk>|A| \<le>o r; Card_order r\<rbrakk> \<Longrightarrow> \<exists> f. toCard_pred A r f" |
|
235 |
unfolding toCard_pred_def |
|
236 |
using card_of_ordLeq[of A "Field r"] |
|
237 |
ordLeq_ordIso_trans[OF _ card_of_unique[of "Field r" r], of "|A|"] |
|
238 |
by blast |
|
239 |
||
240 |
lemma toCard_pred_toCard: |
|
241 |
"\<lbrakk>|A| \<le>o r; Card_order r\<rbrakk> \<Longrightarrow> toCard_pred A r (toCard A r)" |
|
242 |
unfolding toCard_def using someI_ex[OF ex_toCard_pred] . |
|
243 |
||
244 |
lemma toCard_inj: "\<lbrakk>|A| \<le>o r; Card_order r; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> |
|
245 |
toCard A r x = toCard A r y \<longleftrightarrow> x = y" |
|
246 |
using toCard_pred_toCard unfolding inj_on_def toCard_pred_def by blast |
|
247 |
||
248 |
lemma toCard: "\<lbrakk>|A| \<le>o r; Card_order r; b \<in> A\<rbrakk> \<Longrightarrow> toCard A r b \<in> Field r" |
|
249 |
using toCard_pred_toCard unfolding toCard_pred_def by blast |
|
250 |
||
251 |
definition "fromCard A r k \<equiv> SOME b. b \<in> A \<and> toCard A r b = k" |
|
252 |
||
253 |
lemma fromCard_toCard: |
|
254 |
"\<lbrakk>|A| \<le>o r; Card_order r; b \<in> A\<rbrakk> \<Longrightarrow> fromCard A r (toCard A r b) = b" |
|
255 |
unfolding fromCard_def by (rule some_equality) (auto simp add: toCard_inj) |
|
256 |
||
257 |
(* pick according to the weak pullback *) |
|
258 |
definition pickWP where |
|
51446 | 259 |
"pickWP A p1 p2 b1 b2 \<equiv> SOME a. a \<in> A \<and> p1 a = b1 \<and> p2 a = b2" |
49312 | 260 |
|
261 |
lemma pickWP_pred: |
|
262 |
assumes "wpull A B1 B2 f1 f2 p1 p2" and |
|
263 |
"b1 \<in> B1" and "b2 \<in> B2" and "f1 b1 = f2 b2" |
|
51446 | 264 |
shows "\<exists> a. a \<in> A \<and> p1 a = b1 \<and> p2 a = b2" |
265 |
using assms unfolding wpull_def by blast |
|
49312 | 266 |
|
54488 | 267 |
lemma pickWP_raw: |
49312 | 268 |
assumes "wpull A B1 B2 f1 f2 p1 p2" and |
269 |
"b1 \<in> B1" and "b2 \<in> B2" and "f1 b1 = f2 b2" |
|
54488 | 270 |
shows "pickWP A p1 p2 b1 b2 \<in> A |
271 |
\<and> p1 (pickWP A p1 p2 b1 b2) = b1 |
|
272 |
\<and> p2 (pickWP A p1 p2 b1 b2) = b2" |
|
273 |
unfolding pickWP_def using assms someI_ex[OF pickWP_pred] by fastforce |
|
274 |
||
275 |
lemmas pickWP = |
|
276 |
pickWP_raw[THEN conjunct1] |
|
277 |
pickWP_raw[THEN conjunct2, THEN conjunct1] |
|
278 |
pickWP_raw[THEN conjunct2, THEN conjunct2] |
|
49312 | 279 |
|
280 |
lemma Inl_Field_csum: "a \<in> Field r \<Longrightarrow> Inl a \<in> Field (r +c s)" |
|
281 |
unfolding Field_card_of csum_def by auto |
|
282 |
||
283 |
lemma Inr_Field_csum: "a \<in> Field s \<Longrightarrow> Inr a \<in> Field (r +c s)" |
|
284 |
unfolding Field_card_of csum_def by auto |
|
285 |
||
286 |
lemma nat_rec_0: "f = nat_rec f1 (%n rec. f2 n rec) \<Longrightarrow> f 0 = f1" |
|
287 |
by auto |
|
288 |
||
289 |
lemma nat_rec_Suc: "f = nat_rec f1 (%n rec. f2 n rec) \<Longrightarrow> f (Suc n) = f2 n (f n)" |
|
290 |
by auto |
|
291 |
||
292 |
lemma list_rec_Nil: "f = list_rec f1 (%x xs rec. f2 x xs rec) \<Longrightarrow> f [] = f1" |
|
293 |
by auto |
|
294 |
||
295 |
lemma list_rec_Cons: "f = list_rec f1 (%x xs rec. f2 x xs rec) \<Longrightarrow> f (x # xs) = f2 x xs (f xs)" |
|
296 |
by auto |
|
297 |
||
298 |
lemma not_arg_cong_Inr: "x \<noteq> y \<Longrightarrow> Inr x \<noteq> Inr y" |
|
299 |
by simp |
|
300 |
||
51925 | 301 |
lemma Collect_splitD: "x \<in> Collect (split A) \<Longrightarrow> A (fst x) (snd x)" |
302 |
by auto |
|
303 |
||
52731 | 304 |
definition image2p where |
305 |
"image2p f g R = (\<lambda>x y. \<exists>x' y'. R x' y' \<and> f x' = x \<and> g y' = y)" |
|
306 |
||
307 |
lemma image2pI: "R x y \<Longrightarrow> (image2p f g R) (f x) (g y)" |
|
308 |
unfolding image2p_def by blast |
|
309 |
||
310 |
lemma image2pE: "\<lbrakk>(image2p f g R) fx gy; (\<And>x y. fx = f x \<Longrightarrow> gy = g y \<Longrightarrow> R x y \<Longrightarrow> P)\<rbrakk> \<Longrightarrow> P" |
|
311 |
unfolding image2p_def by blast |
|
312 |
||
313 |
lemma fun_rel_iff_geq_image2p: "(fun_rel R S) f g = (image2p f g R \<le> S)" |
|
314 |
unfolding fun_rel_def image2p_def by auto |
|
315 |
||
316 |
lemma fun_rel_image2p: "(fun_rel R (image2p f g R)) f g" |
|
317 |
unfolding fun_rel_def image2p_def by auto |
|
318 |
||
54246
8fdb4dc08ed1
split 'primrec_new' and 'primcorec' code (to ease bootstrapping, e.g. dependency on datatype 'String' in 'primcorec')
blanchet
parents:
53822
diff
changeset
|
319 |
ML_file "Tools/bnf_gfp_rec_sugar_tactics.ML" |
8fdb4dc08ed1
split 'primrec_new' and 'primcorec' code (to ease bootstrapping, e.g. dependency on datatype 'String' in 'primcorec')
blanchet
parents:
53822
diff
changeset
|
320 |
ML_file "Tools/bnf_gfp_rec_sugar.ML" |
49309
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49308
diff
changeset
|
321 |
ML_file "Tools/bnf_gfp_util.ML" |
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49308
diff
changeset
|
322 |
ML_file "Tools/bnf_gfp_tactics.ML" |
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49308
diff
changeset
|
323 |
ML_file "Tools/bnf_gfp.ML" |
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49308
diff
changeset
|
324 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
325 |
end |