# HG changeset patch # User huffman # Date 1257450420 28800 # Node ID b4210cc3ac97036ad4fcd583f85da74d8938543f # Parent 3496616b2171685437e43ec0d901b9520ed153a4 map functions for various types, with ep_pair/deflation/finite_deflation lemmas diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Bifinite.thy --- a/src/HOLCF/Bifinite.thy Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Bifinite.thy Thu Nov 05 11:47:00 2009 -0800 @@ -106,21 +106,69 @@ subsection {* Instance for product type *} +definition + cprod_map :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" +where + "cprod_map = (\ f g p. (f\(fst p), g\(snd p)))" + +lemma cprod_map_Pair [simp]: "cprod_map\f\g\(x, y) = (f\x, g\y)" +unfolding cprod_map_def by simp + +lemma ep_pair_cprod_map: + assumes "ep_pair e1 p1" and "ep_pair e2 p2" + shows "ep_pair (cprod_map\e1\e2) (cprod_map\p1\p2)" +proof + interpret e1p1: ep_pair e1 p1 by fact + interpret e2p2: ep_pair e2 p2 by fact + fix x show "cprod_map\p1\p2\(cprod_map\e1\e2\x) = x" + by (induct x) simp + fix y show "cprod_map\e1\e2\(cprod_map\p1\p2\y) \ y" + by (induct y) (simp add: e1p1.e_p_below e2p2.e_p_below) +qed + +lemma deflation_cprod_map: + assumes "deflation d1" and "deflation d2" + shows "deflation (cprod_map\d1\d2)" +proof + interpret d1: deflation d1 by fact + interpret d2: deflation d2 by fact + fix x + show "cprod_map\d1\d2\(cprod_map\d1\d2\x) = cprod_map\d1\d2\x" + by (induct x) (simp add: d1.idem d2.idem) + show "cprod_map\d1\d2\x \ x" + by (induct x) (simp add: d1.below d2.below) +qed + +lemma finite_deflation_cprod_map: + assumes "finite_deflation d1" and "finite_deflation d2" + shows "finite_deflation (cprod_map\d1\d2)" +proof (intro finite_deflation.intro finite_deflation_axioms.intro) + interpret d1: finite_deflation d1 by fact + interpret d2: finite_deflation d2 by fact + have "deflation d1" and "deflation d2" by fact+ + thus "deflation (cprod_map\d1\d2)" by (rule deflation_cprod_map) + have "{p. cprod_map\d1\d2\p = p} \ {x. d1\x = x} \ {y. d2\y = y}" + by clarsimp + thus "finite {p. cprod_map\d1\d2\p = p}" + by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes) +qed + instantiation "*" :: (profinite, profinite) profinite begin -definition approx_prod_def: - "approx = (\n. \ x. (approx n\(fst x), approx n\(snd x)))" +definition + approx_prod_def: + "approx = (\n. cprod_map\(approx n)\(approx n))" instance proof fix i :: nat and x :: "'a \ 'b" show "chain (approx :: nat \ 'a \ 'b \ 'a \ 'b)" unfolding approx_prod_def by simp show "(\i. approx i\x) = x" - unfolding approx_prod_def + unfolding approx_prod_def cprod_map_def by (simp add: lub_distribs thelub_Pair) show "approx i\(approx i\x) = approx i\x" - unfolding approx_prod_def by simp + unfolding approx_prod_def cprod_map_def by simp have "{x::'a \ 'b. approx i\x = x} \ {x::'a. approx i\x = x} \ {x::'b. approx i\x = x}" unfolding approx_prod_def by clarsimp @@ -146,10 +194,51 @@ subsection {* Instance for continuous function space *} -lemma finite_range_cfun_lemma: +definition + cfun_map :: "('b \ 'a) \ ('c \ 'd) \ ('a \ 'c) \ ('b \ 'd)" +where + "cfun_map = (\ a b f x. b\(f\(a\x)))" + +lemma cfun_map_beta [simp]: "cfun_map\a\b\f\x = b\(f\(a\x))" +unfolding cfun_map_def by simp + +lemma ep_pair_cfun_map: + assumes "ep_pair e1 p1" and "ep_pair e2 p2" + shows "ep_pair (cfun_map\p1\e2) (cfun_map\e1\p2)" +proof + interpret e1p1: ep_pair e1 p1 by fact + interpret e2p2: ep_pair e2 p2 by fact + fix f show "cfun_map\e1\p2\(cfun_map\p1\e2\f) = f" + by (simp add: expand_cfun_eq) + fix g show "cfun_map\p1\e2\(cfun_map\e1\p2\g) \ g" + apply (rule below_cfun_ext, simp) + apply (rule below_trans [OF e2p2.e_p_below]) + apply (rule monofun_cfun_arg) + apply (rule e1p1.e_p_below) + done +qed + +lemma deflation_cfun_map: + assumes "deflation d1" and "deflation d2" + shows "deflation (cfun_map\d1\d2)" +proof + interpret d1: deflation d1 by fact + interpret d2: deflation d2 by fact + fix f + show "cfun_map\d1\d2\(cfun_map\d1\d2\f) = cfun_map\d1\d2\f" + by (simp add: expand_cfun_eq d1.idem d2.idem) + show "cfun_map\d1\d2\f \ f" + apply (rule below_cfun_ext, simp) + apply (rule below_trans [OF d2.below]) + apply (rule monofun_cfun_arg) + apply (rule d1.below) + done +qed + +lemma finite_range_cfun_map: assumes a: "finite (range (\x. a\x))" assumes b: "finite (range (\y. b\y))" - shows "finite (range (\f. \ x. b\(f\(a\x))))" (is "finite (range ?h)") + shows "finite (range (\f. cfun_map\a\b\f))" (is "finite (range ?h)") proof (rule finite_imageD) let ?f = "\g. range (\x. (a\x, g\x))" show "finite (?f ` range ?h)" @@ -175,12 +264,27 @@ qed qed +lemma finite_deflation_cfun_map: + assumes "finite_deflation d1" and "finite_deflation d2" + shows "finite_deflation (cfun_map\d1\d2)" +proof (intro finite_deflation.intro finite_deflation_axioms.intro) + interpret d1: finite_deflation d1 by fact + interpret d2: finite_deflation d2 by fact + have "deflation d1" and "deflation d2" by fact+ + thus "deflation (cfun_map\d1\d2)" by (rule deflation_cfun_map) + have "finite (range (\f. cfun_map\d1\d2\f))" + using d1.finite_range d2.finite_range + by (rule finite_range_cfun_map) + thus "finite {f. cfun_map\d1\d2\f = f}" + by (rule finite_range_imp_finite_fixes) +qed + instantiation "->" :: (profinite, profinite) profinite begin definition approx_cfun_def: - "approx = (\n. \ f x. approx n\(f\(approx n\x)))" + "approx = (\n. cfun_map\(approx n)\(approx n))" instance proof show "chain (approx :: nat \ ('a \ 'b) \ ('a \ 'b))" @@ -188,19 +292,19 @@ next fix x :: "'a \ 'b" show "(\i. approx i\x) = x" - unfolding approx_cfun_def + unfolding approx_cfun_def cfun_map_def by (simp add: lub_distribs eta_cfun) next fix i :: nat and x :: "'a \ 'b" show "approx i\(approx i\x) = approx i\x" - unfolding approx_cfun_def by simp + unfolding approx_cfun_def cfun_map_def by simp next fix i :: nat show "finite {x::'a \ 'b. approx i\x = x}" - apply (rule finite_range_imp_finite_fixes) - apply (simp add: approx_cfun_def) - apply (intro finite_range_cfun_lemma finite_range_approx) - done + unfolding approx_cfun_def + by (intro finite_deflation.finite_fixes + finite_deflation_cfun_map + finite_deflation_approx) qed end diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Domain.thy --- a/src/HOLCF/Domain.thy Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Domain.thy Thu Nov 05 11:47:00 2009 -0800 @@ -204,61 +204,11 @@ subsection {* Combinators for building copy functions *} -definition - cfun_fun :: "('b \ 'a) \ ('c \ 'd) \ ('a \ 'c) \ ('b \ 'd)" -where - "cfun_fun = (\ f g p. g oo p oo f)" - -definition - ssum_fun :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" -where - "ssum_fun = (\ f g. sscase\(sinl oo f)\(sinr oo g))" - -definition - sprod_fun :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" -where - "sprod_fun = (\ f g. ssplit\(\ x y. (:f\x, g\y:)))" - -definition - cprod_fun :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" -where - "cprod_fun = (\ f g. csplit\(\ x y. (f\x, g\y)))" - -definition - u_fun :: "('a \ 'b) \ 'a u \ 'b u" -where - "u_fun = (\ f. fup\(up oo f))" - -lemma cfun_fun_strict: "b\\ = \ \ cfun_fun\a\b\\ = \" -unfolding cfun_fun_def expand_cfun_eq by simp +lemmas domain_map_stricts = + ssum_map_strict sprod_map_strict u_map_strict -lemma ssum_fun_strict: "ssum_fun\a\b\\ = \" -unfolding ssum_fun_def by simp - -lemma sprod_fun_strict: "sprod_fun\a\b\\ = \" -unfolding sprod_fun_def by simp - -lemma u_fun_strict: "u_fun\a\\ = \" -unfolding u_fun_def by simp - -lemma ssum_fun_sinl: "x \ \ \ ssum_fun\f\g\(sinl\x) = sinl\(f\x)" -by (simp add: ssum_fun_def) - -lemma ssum_fun_sinr: "x \ \ \ ssum_fun\f\g\(sinr\x) = sinr\(g\x)" -by (simp add: ssum_fun_def) - -lemma sprod_fun_spair: - "x \ \ \ y \ \ \ sprod_fun\f\g\(:x, y:) = (:f\x, g\y:)" -by (simp add: sprod_fun_def) - -lemma u_fun_up: "u_fun\a\(up\x) = up\(a\x)" -by (simp add: u_fun_def) - -lemmas domain_fun_stricts = - ssum_fun_strict sprod_fun_strict u_fun_strict - -lemmas domain_fun_simps = - ssum_fun_sinl ssum_fun_sinr sprod_fun_spair u_fun_up +lemmas domain_map_simps = + ssum_map_sinl ssum_map_sinr sprod_map_spair u_map_up subsection {* Installing the domain package *} diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Sprod.thy --- a/src/HOLCF/Sprod.thy Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Sprod.thy Thu Nov 05 11:47:00 2009 -0800 @@ -131,6 +131,9 @@ lemma inst_sprod_pcpo2: "UU = (:UU,UU:)" by simp +lemma sprodE2: "(\x y. p = (:x, y:) \ Q) \ Q" +by (cases p, simp only: inst_sprod_pcpo2, simp) + subsection {* Properties of @{term sfst} and @{term ssnd} *} lemma sfst_strict [simp]: "sfst\\ = \" @@ -228,6 +231,68 @@ done qed +subsection {* Map function for strict products *} + +definition + sprod_map :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" +where + "sprod_map = (\ f g. ssplit\(\ x y. (:f\x, g\y:)))" + +lemma sprod_map_strict [simp]: "sprod_map\a\b\\ = \" +unfolding sprod_map_def by simp + +lemma sprod_map_spair [simp]: + "x \ \ \ y \ \ \ sprod_map\f\g\(:x, y:) = (:f\x, g\y:)" +by (simp add: sprod_map_def) + +lemma ep_pair_sprod_map: + assumes "ep_pair e1 p1" and "ep_pair e2 p2" + shows "ep_pair (sprod_map\e1\e2) (sprod_map\p1\p2)" +proof + interpret e1p1: pcpo_ep_pair e1 p1 unfolding pcpo_ep_pair_def by fact + interpret e2p2: pcpo_ep_pair e2 p2 unfolding pcpo_ep_pair_def by fact + fix x show "sprod_map\p1\p2\(sprod_map\e1\e2\x) = x" + by (induct x) simp_all + fix y show "sprod_map\e1\e2\(sprod_map\p1\p2\y) \ y" + apply (induct y, simp) + apply (case_tac "p1\x = \", simp, case_tac "p2\y = \", simp) + apply (simp add: monofun_cfun e1p1.e_p_below e2p2.e_p_below) + done +qed + +lemma deflation_sprod_map: + assumes "deflation d1" and "deflation d2" + shows "deflation (sprod_map\d1\d2)" +proof + interpret d1: deflation d1 by fact + interpret d2: deflation d2 by fact + fix x + show "sprod_map\d1\d2\(sprod_map\d1\d2\x) = sprod_map\d1\d2\x" + apply (induct x, simp) + apply (case_tac "d1\x = \", simp, case_tac "d2\y = \", simp) + apply (simp add: d1.idem d2.idem) + done + show "sprod_map\d1\d2\x \ x" + apply (induct x, simp) + apply (simp add: monofun_cfun d1.below d2.below) + done +qed + +lemma finite_deflation_sprod_map: + assumes "finite_deflation d1" and "finite_deflation d2" + shows "finite_deflation (sprod_map\d1\d2)" +proof (intro finite_deflation.intro finite_deflation_axioms.intro) + interpret d1: finite_deflation d1 by fact + interpret d2: finite_deflation d2 by fact + have "deflation d1" and "deflation d2" by fact+ + thus "deflation (sprod_map\d1\d2)" by (rule deflation_sprod_map) + have "{x. sprod_map\d1\d2\x = x} \ insert \ + ((\(x, y). (:x, y:)) ` ({x. d1\x = x} \ {y. d2\y = y}))" + by (rule subsetI, case_tac x, auto simp add: spair_eq_iff) + thus "finite {x. sprod_map\d1\d2\x = x}" + by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes) +qed + subsection {* Strict product is a bifinite domain *} instantiation "**" :: (bifinite, bifinite) bifinite @@ -235,35 +300,30 @@ definition approx_sprod_def: - "approx = (\n. \(:x, y:). (:approx n\x, approx n\y:))" + "approx = (\n. sprod_map\(approx n)\(approx n))" instance proof fix i :: nat and x :: "'a \ 'b" show "chain (approx :: nat \ 'a \ 'b \ 'a \ 'b)" unfolding approx_sprod_def by simp show "(\i. approx i\x) = x" - unfolding approx_sprod_def + unfolding approx_sprod_def sprod_map_def by (simp add: lub_distribs eta_cfun) show "approx i\(approx i\x) = approx i\x" - unfolding approx_sprod_def + unfolding approx_sprod_def sprod_map_def by (simp add: ssplit_def strictify_conv_if) - have "Rep_Sprod ` {x::'a \ 'b. approx i\x = x} \ {x. approx i\x = x}" + show "finite {x::'a \ 'b. approx i\x = x}" unfolding approx_sprod_def - apply (clarify, case_tac x) - apply (simp add: Rep_Sprod_strict) - apply (simp add: Rep_Sprod_spair spair_eq_iff) - done - hence "finite (Rep_Sprod ` {x::'a \ 'b. approx i\x = x})" - using finite_fixes_approx by (rule finite_subset) - thus "finite {x::'a \ 'b. approx i\x = x}" - by (rule finite_imageD, simp add: inj_on_def Rep_Sprod_inject) + by (intro finite_deflation.finite_fixes + finite_deflation_sprod_map + finite_deflation_approx) qed end lemma approx_spair [simp]: "approx i\(:x, y:) = (:approx i\x, approx i\y:)" -unfolding approx_sprod_def +unfolding approx_sprod_def sprod_map_def by (simp add: ssplit_def strictify_conv_if) end diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Ssum.thy --- a/src/HOLCF/Ssum.thy Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Ssum.thy Thu Nov 05 11:47:00 2009 -0800 @@ -210,6 +210,72 @@ apply (case_tac y, simp_all add: flat_below_iff) done +subsection {* Map function for strict sums *} + +definition + ssum_map :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" +where + "ssum_map = (\ f g. sscase\(sinl oo f)\(sinr oo g))" + +lemma ssum_map_strict [simp]: "ssum_map\f\g\\ = \" +unfolding ssum_map_def by simp + +lemma ssum_map_sinl [simp]: "x \ \ \ ssum_map\f\g\(sinl\x) = sinl\(f\x)" +unfolding ssum_map_def by simp + +lemma ssum_map_sinr [simp]: "x \ \ \ ssum_map\f\g\(sinr\x) = sinr\(g\x)" +unfolding ssum_map_def by simp + +lemma ep_pair_ssum_map: + assumes "ep_pair e1 p1" and "ep_pair e2 p2" + shows "ep_pair (ssum_map\e1\e2) (ssum_map\p1\p2)" +proof + interpret e1p1: pcpo_ep_pair e1 p1 unfolding pcpo_ep_pair_def by fact + interpret e2p2: pcpo_ep_pair e2 p2 unfolding pcpo_ep_pair_def by fact + fix x show "ssum_map\p1\p2\(ssum_map\e1\e2\x) = x" + by (induct x) simp_all + fix y show "ssum_map\e1\e2\(ssum_map\p1\p2\y) \ y" + apply (induct y, simp) + apply (case_tac "p1\x = \", simp, simp add: e1p1.e_p_below) + apply (case_tac "p2\y = \", simp, simp add: e2p2.e_p_below) + done +qed + +lemma deflation_ssum_map: + assumes "deflation d1" and "deflation d2" + shows "deflation (ssum_map\d1\d2)" +proof + interpret d1: deflation d1 by fact + interpret d2: deflation d2 by fact + fix x + show "ssum_map\d1\d2\(ssum_map\d1\d2\x) = ssum_map\d1\d2\x" + apply (induct x, simp) + apply (case_tac "d1\x = \", simp, simp add: d1.idem) + apply (case_tac "d2\y = \", simp, simp add: d2.idem) + done + show "ssum_map\d1\d2\x \ x" + apply (induct x, simp) + apply (case_tac "d1\x = \", simp, simp add: d1.below) + apply (case_tac "d2\y = \", simp, simp add: d2.below) + done +qed + +lemma finite_deflation_ssum_map: + assumes "finite_deflation d1" and "finite_deflation d2" + shows "finite_deflation (ssum_map\d1\d2)" +proof (intro finite_deflation.intro finite_deflation_axioms.intro) + interpret d1: finite_deflation d1 by fact + interpret d2: finite_deflation d2 by fact + have "deflation d1" and "deflation d2" by fact+ + thus "deflation (ssum_map\d1\d2)" by (rule deflation_ssum_map) + have "{x. ssum_map\d1\d2\x = x} \ + (\x. sinl\x) ` {x. d1\x = x} \ + (\x. sinr\x) ` {x. d2\x = x} \ {\}" + by (rule subsetI, case_tac x, simp_all) + thus "finite {x. ssum_map\d1\d2\x = x}" + by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes) +qed + subsection {* Strict sum is a bifinite domain *} instantiation "++" :: (bifinite, bifinite) bifinite @@ -217,7 +283,7 @@ definition approx_ssum_def: - "approx = (\n. sscase\(\ x. sinl\(approx n\x))\(\ y. sinr\(approx n\y)))" + "approx = (\n. ssum_map\(approx n)\(approx n))" lemma approx_sinl [simp]: "approx i\(sinl\x) = sinl\(approx i\x)" unfolding approx_ssum_def by (cases "x = \") simp_all @@ -231,16 +297,14 @@ unfolding approx_ssum_def by simp show "(\i. approx i\x) = x" unfolding approx_ssum_def - by (simp add: lub_distribs eta_cfun) + by (cases x, simp_all add: lub_distribs) show "approx i\(approx i\x) = approx i\x" by (cases x, simp add: approx_ssum_def, simp, simp) - have "{x::'a \ 'b. approx i\x = x} \ - (\x. sinl\x) ` {x. approx i\x = x} \ - (\x. sinr\x) ` {x. approx i\x = x}" - by (rule subsetI, case_tac x rule: ssumE2, simp, simp) - thus "finite {x::'a \ 'b. approx i\x = x}" - by (rule finite_subset, - intro finite_UnI finite_imageI finite_fixes_approx) + show "finite {x::'a \ 'b. approx i\x = x}" + unfolding approx_ssum_def + by (intro finite_deflation.finite_fixes + finite_deflation_ssum_map + finite_deflation_approx) qed end diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Tools/Domain/domain_axioms.ML --- a/src/HOLCF/Tools/Domain/domain_axioms.ML Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Tools/Domain/domain_axioms.ML Thu Nov 05 11:47:00 2009 -0800 @@ -28,11 +28,11 @@ (* FIXME: use theory data for this *) val copy_tab : string Symtab.table = - Symtab.make [(@{type_name "->"}, @{const_name "cfun_fun"}), - (@{type_name "++"}, @{const_name "ssum_fun"}), - (@{type_name "**"}, @{const_name "sprod_fun"}), - (@{type_name "*"}, @{const_name "cprod_fun"}), - (@{type_name "u"}, @{const_name "u_fun"})]; + Symtab.make [(@{type_name "->"}, @{const_name "cfun_map"}), + (@{type_name "++"}, @{const_name "ssum_map"}), + (@{type_name "**"}, @{const_name "sprod_map"}), + (@{type_name "*"}, @{const_name "cprod_map"}), + (@{type_name "u"}, @{const_name "u_map"})]; fun copy_of_dtyp r dt = if DatatypeAux.is_rec_type dt then copy r dt else ID and copy r (DatatypeAux.DtRec i) = r i diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Tools/Domain/domain_theorems.ML --- a/src/HOLCF/Tools/Domain/domain_theorems.ML Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Tools/Domain/domain_theorems.ML Thu Nov 05 11:47:00 2009 -0800 @@ -589,7 +589,7 @@ let val _ = trace " Proving copy_strict..."; val goal = mk_trp (strict (dc_copy `% "f")); - val rules = [abs_strict, rep_strict] @ @{thms domain_fun_stricts}; + val rules = [abs_strict, rep_strict] @ @{thms domain_map_stricts}; val tacs = [asm_simp_tac (HOLCF_ss addsimps rules) 1]; in pg [ax_copy_def] goal (K tacs) end; @@ -604,9 +604,9 @@ val rhs = con_app2 con one_rhs args; val goal = lift_defined %: (nonlazy_rec args, mk_trp (lhs === rhs)); val args' = filter_out (fn a => is_rec a orelse is_lazy a) args; - val stricts = abs_strict :: rep_strict :: @{thms domain_fun_stricts}; + val stricts = abs_strict :: rep_strict :: @{thms domain_map_stricts}; fun tacs1 ctxt = map (case_UU_tac ctxt stricts 1 o vname) args'; - val rules = [ax_abs_iso] @ @{thms domain_fun_simps}; + val rules = [ax_abs_iso] @ @{thms domain_map_simps}; val tacs2 = [asm_simp_tac (HOLCF_ss addsimps rules) 1]; in pg (ax_copy_def::con_appls) goal (fn ctxt => (tacs1 ctxt @ tacs2)) end; in diff -r 3496616b2171 -r b4210cc3ac97 src/HOLCF/Up.thy --- a/src/HOLCF/Up.thy Thu Nov 05 11:36:30 2009 -0800 +++ b/src/HOLCF/Up.thy Thu Nov 05 11:47:00 2009 -0800 @@ -290,6 +290,43 @@ lemma fup3 [simp]: "fup\up\x = x" by (cases x, simp_all) +subsection {* Map function for lifted cpo *} + +definition + u_map :: "('a \ 'b) \ 'a u \ 'b u" +where + "u_map = (\ f. fup\(up oo f))" + +lemma u_map_strict [simp]: "u_map\f\\ = \" +unfolding u_map_def by simp + +lemma u_map_up [simp]: "u_map\f\(up\x) = up\(f\x)" +unfolding u_map_def by simp + +lemma ep_pair_u_map: "ep_pair e p \ ep_pair (u_map\e) (u_map\p)" +apply default +apply (case_tac x, simp, simp add: ep_pair.e_inverse) +apply (case_tac y, simp, simp add: ep_pair.e_p_below) +done + +lemma deflation_u_map: "deflation d \ deflation (u_map\d)" +apply default +apply (case_tac x, simp, simp add: deflation.idem) +apply (case_tac x, simp, simp add: deflation.below) +done + +lemma finite_deflation_u_map: + assumes "finite_deflation d" shows "finite_deflation (u_map\d)" +proof (intro finite_deflation.intro finite_deflation_axioms.intro) + interpret d: finite_deflation d by fact + have "deflation d" by fact + thus "deflation (u_map\d)" by (rule deflation_u_map) + have "{x. u_map\d\x = x} \ insert \ ((\x. up\x) ` {x. d\x = x})" + by (rule subsetI, case_tac x, simp_all) + thus "finite {x. u_map\d\x = x}" + by (rule finite_subset, simp add: d.finite_fixes) +qed + subsection {* Lifted cpo is a bifinite domain *} instantiation u :: (profinite) bifinite @@ -297,7 +334,7 @@ definition approx_up_def: - "approx = (\n. fup\(\ x. up\(approx n\x)))" + "approx = (\n. u_map\(approx n))" instance proof fix i :: nat and x :: "'a u" @@ -305,16 +342,15 @@ unfolding approx_up_def by simp show "(\i. approx i\x) = x" unfolding approx_up_def - by (simp add: lub_distribs eta_cfun) + by (induct x, simp, simp add: lub_distribs) show "approx i\(approx i\x) = approx i\x" unfolding approx_up_def - by (induct x, simp, simp) - have "{x::'a u. approx i\x = x} \ - insert \ ((\x. up\x) ` {x::'a. approx i\x = x})" + by (induct x) simp_all + show "finite {x::'a u. approx i\x = x}" unfolding approx_up_def - by (rule subsetI, case_tac x, simp_all) - thus "finite {x::'a u. approx i\x = x}" - by (rule finite_subset, simp add: finite_fixes_approx) + by (intro finite_deflation.finite_fixes + finite_deflation_u_map + finite_deflation_approx) qed end