equal
deleted
inserted
replaced
19 begin |
19 begin |
20 |
20 |
21 lemma option_rec_conv_option_case: "option_rec = option_case" |
21 lemma option_rec_conv_option_case: "option_rec = option_case" |
22 by (simp add: fun_eq_iff split: option.split) |
22 by (simp add: fun_eq_iff split: option.split) |
23 |
23 |
24 bnf Option.map [Option.set] "\<lambda>_::'a option. natLeq" ["None"] option_rel |
24 bnf "'a option" |
|
25 map: Option.map |
|
26 sets: Option.set |
|
27 bd: natLeq |
|
28 wits: None |
|
29 rel: option_rel |
25 proof - |
30 proof - |
26 show "Option.map id = id" by (simp add: fun_eq_iff Option.map_def split: option.split) |
31 show "Option.map id = id" by (simp add: fun_eq_iff Option.map_def split: option.split) |
27 next |
32 next |
28 fix f g |
33 fix f g |
29 show "Option.map (g \<circ> f) = Option.map g \<circ> Option.map f" |
34 show "Option.map (g \<circ> f) = Option.map g \<circ> Option.map f" |
92 } |
97 } |
93 thus "\<forall>as bs. as \<in> ?B1 \<and> bs \<in> ?B2 \<and> map f1 as = map f2 bs \<longrightarrow> |
98 thus "\<forall>as bs. as \<in> ?B1 \<and> bs \<in> ?B2 \<and> map f1 as = map f2 bs \<longrightarrow> |
94 (\<exists>zs \<in> ?A. map p1 zs = as \<and> map p2 zs = bs)" by blast |
99 (\<exists>zs \<in> ?A. map p1 zs = as \<and> map p2 zs = bs)" by blast |
95 qed |
100 qed |
96 |
101 |
97 bnf map [set] "\<lambda>_::'a list. natLeq" ["[]"] |
102 bnf "'a list" |
|
103 map: map |
|
104 sets: set |
|
105 bd: natLeq |
|
106 wits: Nil |
98 proof - |
107 proof - |
99 show "map id = id" by (rule List.map.id) |
108 show "map id = id" by (rule List.map.id) |
100 next |
109 next |
101 fix f g |
110 fix f g |
102 show "map (g o f) = map g o map f" by (rule List.map.comp[symmetric]) |
111 show "map (g o f) = map g o map f" by (rule List.map.comp[symmetric]) |
212 then obtain x where X'eq: "X' = fset x" by transfer simp |
221 then obtain x where X'eq: "X' = fset x" by transfer simp |
213 show "\<exists>x. fset x \<subseteq> A \<and> fimage p1 x = y1 \<and> fimage p2 x = y2" |
222 show "\<exists>x. fset x \<subseteq> A \<and> fimage p1 x = y1 \<and> fimage p2 x = y2" |
214 using X' Y1 Y2 by (auto simp: X'eq intro!: exI[of _ "x"]) (transfer, blast)+ |
223 using X' Y1 Y2 by (auto simp: X'eq intro!: exI[of _ "x"]) (transfer, blast)+ |
215 qed |
224 qed |
216 |
225 |
217 bnf fimage [fset] "\<lambda>_::'a fset. natLeq" ["{||}"] fset_rel |
226 bnf "'a fset" |
|
227 map: fimage |
|
228 sets: fset |
|
229 bd: natLeq |
|
230 wits: "{||}" |
|
231 rel: fset_rel |
218 apply - |
232 apply - |
219 apply transfer' apply simp |
233 apply transfer' apply simp |
220 apply transfer' apply force |
234 apply transfer' apply force |
221 apply transfer apply force |
235 apply transfer apply force |
222 apply transfer' apply force |
236 apply transfer' apply force |
298 next |
312 next |
299 assume ?R thus ?L unfolding Grp_def relcompp.simps conversep.simps |
313 assume ?R thus ?L unfolding Grp_def relcompp.simps conversep.simps |
300 by transfer force |
314 by transfer force |
301 qed |
315 qed |
302 |
316 |
303 bnf cimage [rcset] "\<lambda>_::'a cset. natLeq" ["cempty"] cset_rel |
317 bnf "'a cset" |
|
318 map: cimage |
|
319 sets: rcset |
|
320 bd: natLeq |
|
321 wits: "cempty" |
|
322 rel: cset_rel |
304 proof - |
323 proof - |
305 show "cimage id = id" by transfer' simp |
324 show "cimage id = id" by transfer' simp |
306 next |
325 next |
307 fix f g show "cimage (g \<circ> f) = cimage g \<circ> cimage f" by transfer' fastforce |
326 fix f g show "cimage (g \<circ> f) = cimage g \<circ> cimage f" by transfer' fastforce |
308 next |
327 next |
872 |
891 |
873 lemma set_of_bd: "|set_of x| \<le>o natLeq" |
892 lemma set_of_bd: "|set_of x| \<le>o natLeq" |
874 by transfer |
893 by transfer |
875 (auto intro!: ordLess_imp_ordLeq simp: finite_iff_ordLess_natLeq[symmetric] multiset_def) |
894 (auto intro!: ordLess_imp_ordLeq simp: finite_iff_ordLess_natLeq[symmetric] multiset_def) |
876 |
895 |
877 bnf mmap [set_of] "\<lambda>_::'a multiset. natLeq" ["{#}"] |
896 bnf "'a multiset" |
|
897 map: mmap |
|
898 sets: set_of |
|
899 bd: natLeq |
|
900 wits: "{#}" |
878 by (auto simp add: mmap_id0 mmap_comp set_of_mmap natLeq_card_order natLeq_cinfinite set_of_bd |
901 by (auto simp add: mmap_id0 mmap_comp set_of_mmap natLeq_card_order natLeq_cinfinite set_of_bd |
879 intro: mmap_cong wpull_mmap) |
902 intro: mmap_cong wpull_mmap) |
880 |
903 |
881 inductive multiset_rel' where |
904 inductive multiset_rel' where |
882 Zero: "multiset_rel' R {#} {#}" |
905 Zero: "multiset_rel' R {#} {#}" |