| author | wenzelm | 
| Mon, 27 Jan 2025 12:13:37 +0100 | |
| changeset 81989 | 96afb0707532 | 
| parent 81644 | 325593146d19 | 
| permissions | -rw-r--r-- | 
| 41959 | 1 | (* Title: HOL/HOLCF/Algebraic.thy | 
| 27409 | 2 | Author: Brian Huffman | 
| 3 | *) | |
| 4 | ||
| 62175 | 5 | section \<open>Algebraic deflations\<close> | 
| 27409 | 6 | |
| 7 | theory Algebraic | |
| 40502 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 huffman parents: 
40327diff
changeset | 8 | imports Universal Map_Functions | 
| 27409 | 9 | begin | 
| 10 | ||
| 62175 | 11 | subsection \<open>Type constructor for finite deflations\<close> | 
| 27409 | 12 | |
| 81583 
b6df83045178
clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
 wenzelm parents: 
81577diff
changeset | 13 | typedef 'a::bifinite fin_defl = "{d::'a \<rightarrow> 'a. finite_deflation d}"
 | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41394diff
changeset | 14 | by (fast intro: finite_deflation_bottom) | 
| 27409 | 15 | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 16 | instantiation fin_defl :: (bifinite) below | 
| 27409 | 17 | begin | 
| 18 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 19 | definition below_fin_defl_def: | 
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 20 | "below \<equiv> \<lambda>x y. Rep_fin_defl x \<sqsubseteq> Rep_fin_defl y" | 
| 27409 | 21 | |
| 22 | instance .. | |
| 23 | end | |
| 24 | ||
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 25 | instance fin_defl :: (bifinite) po | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 26 | using type_definition_fin_defl below_fin_defl_def | 
| 81584 
a065d8bcfd3d
clarified class/locale reasoning: avoid side-stepping constraints;
 wenzelm parents: 
81583diff
changeset | 27 | by (rule typedef_po_class) | 
| 27409 | 28 | |
| 29 | lemma finite_deflation_Rep_fin_defl: "finite_deflation (Rep_fin_defl d)" | |
| 30 | using Rep_fin_defl by simp | |
| 31 | ||
| 31164 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 32 | lemma deflation_Rep_fin_defl: "deflation (Rep_fin_defl d)" | 
| 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 33 | using finite_deflation_Rep_fin_defl | 
| 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 34 | by (rule finite_deflation_imp_deflation) | 
| 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 35 | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29252diff
changeset | 36 | interpretation Rep_fin_defl: finite_deflation "Rep_fin_defl d" | 
| 27409 | 37 | by (rule finite_deflation_Rep_fin_defl) | 
| 38 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 39 | lemma fin_defl_belowI: | 
| 27409 | 40 | "(\<And>x. Rep_fin_defl a\<cdot>x = x \<Longrightarrow> Rep_fin_defl b\<cdot>x = x) \<Longrightarrow> a \<sqsubseteq> b" | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 41 | unfolding below_fin_defl_def | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 42 | by (rule Rep_fin_defl.belowI) | 
| 27409 | 43 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 44 | lemma fin_defl_belowD: | 
| 27409 | 45 | "\<lbrakk>a \<sqsubseteq> b; Rep_fin_defl a\<cdot>x = x\<rbrakk> \<Longrightarrow> Rep_fin_defl b\<cdot>x = x" | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 46 | unfolding below_fin_defl_def | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 47 | by (rule Rep_fin_defl.belowD) | 
| 27409 | 48 | |
| 49 | lemma fin_defl_eqI: | |
| 81644 | 50 | "a = b" if "(\<And>x. Rep_fin_defl a\<cdot>x = x \<longleftrightarrow> Rep_fin_defl b\<cdot>x = x)" | 
| 51 | proof (rule below_antisym) | |
| 52 | show "a \<sqsubseteq> b" by (rule fin_defl_belowI) (simp add: that) | |
| 53 | show "b \<sqsubseteq> a" by (rule fin_defl_belowI) (simp add: that) | |
| 54 | qed | |
| 27409 | 55 | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 56 | lemma Rep_fin_defl_mono: "a \<sqsubseteq> b \<Longrightarrow> Rep_fin_defl a \<sqsubseteq> Rep_fin_defl b" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 57 | unfolding below_fin_defl_def . | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 58 | |
| 27409 | 59 | lemma Abs_fin_defl_mono: | 
| 60 | "\<lbrakk>finite_deflation a; finite_deflation b; a \<sqsubseteq> b\<rbrakk> | |
| 61 | \<Longrightarrow> Abs_fin_defl a \<sqsubseteq> Abs_fin_defl b" | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 62 | unfolding below_fin_defl_def | 
| 27409 | 63 | by (simp add: Abs_fin_defl_inverse) | 
| 64 | ||
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 65 | lemma (in finite_deflation) compact_belowI: | 
| 81644 | 66 | "d \<sqsubseteq> f" if "\<And>x. compact x \<Longrightarrow> d\<cdot>x = x \<Longrightarrow> f\<cdot>x = x" | 
| 67 | by (rule belowI, rule that, erule subst, rule compact) | |
| 27409 | 68 | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 69 | lemma compact_Rep_fin_defl [simp]: "compact (Rep_fin_defl a)" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 70 | using finite_deflation_Rep_fin_defl | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 71 | by (rule finite_deflation_imp_compact) | 
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 72 | |
| 81577 | 73 | |
| 62175 | 74 | subsection \<open>Defining algebraic deflations by ideal completion\<close> | 
| 27409 | 75 | |
| 81583 
b6df83045178
clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
 wenzelm parents: 
81577diff
changeset | 76 | typedef 'a::bifinite defl = "{S::'a fin_defl set. below.ideal S}"
 | 
| 40888 
28cd51cff70c
reformulate lemma preorder.ex_ideal, and use it for typedefs
 huffman parents: 
40774diff
changeset | 77 | by (rule below.ex_ideal) | 
| 27409 | 78 | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 79 | instantiation defl :: (bifinite) below | 
| 27409 | 80 | begin | 
| 81 | ||
| 81644 | 82 | definition "x \<sqsubseteq> y \<longleftrightarrow> Rep_defl x \<subseteq> Rep_defl y" | 
| 27409 | 83 | |
| 84 | instance .. | |
| 81644 | 85 | |
| 27409 | 86 | end | 
| 87 | ||
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 88 | instance defl :: (bifinite) po | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 89 | using type_definition_defl below_defl_def | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 90 | by (rule below.typedef_ideal_po) | 
| 27409 | 91 | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 92 | instance defl :: (bifinite) cpo | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 93 | using type_definition_defl below_defl_def | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 94 | by (rule below.typedef_ideal_cpo) | 
| 27409 | 95 | |
| 81644 | 96 | definition defl_principal :: "'a::bifinite fin_defl \<Rightarrow> 'a defl" | 
| 97 |   where "defl_principal t = Abs_defl {u. u \<sqsubseteq> t}"
 | |
| 27409 | 98 | |
| 81583 
b6df83045178
clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
 wenzelm parents: 
81577diff
changeset | 99 | lemma fin_defl_countable: "\<exists>f::'a::bifinite fin_defl \<Rightarrow> nat. inj f" | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 100 | proof - | 
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 101 | obtain f :: "'a compact_basis \<Rightarrow> nat" where inj_f: "inj f" | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 102 | using compact_basis.countable .. | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 103 |   have *: "\<And>d. finite (f ` Rep_compact_basis -` {x. Rep_fin_defl d\<cdot>x = x})"
 | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 104 | apply (rule finite_imageI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 105 | apply (rule finite_vimageI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 106 | apply (rule Rep_fin_defl.finite_fixes) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 107 | apply (simp add: inj_on_def Rep_compact_basis_inject) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 108 | done | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 109 |   have range_eq: "range Rep_compact_basis = {x. compact x}"
 | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 110 | using type_definition_compact_basis by (rule type_definition.Rep_range) | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 111 | have "inj (\<lambda>d. set_encode | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 112 |     (f ` Rep_compact_basis -` {x. Rep_fin_defl d\<cdot>x = x}))"
 | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 113 | apply (rule inj_onI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 114 | apply (simp only: set_encode_eq *) | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 115 | apply (simp only: inj_image_eq_iff inj_f) | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 116 | apply (drule_tac f="image Rep_compact_basis" in arg_cong) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 117 | apply (simp del: vimage_Collect_eq add: range_eq set_eq_iff) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 118 | apply (rule Rep_fin_defl_inject [THEN iffD1]) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 119 | apply (rule below_antisym) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 120 | apply (rule Rep_fin_defl.compact_belowI, rename_tac z) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 121 | apply (drule_tac x=z in spec, simp) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 122 | apply (rule Rep_fin_defl.compact_belowI, rename_tac z) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 123 | apply (drule_tac x=z in spec, simp) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 124 | done | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
40888diff
changeset | 125 | thus ?thesis by - (rule exI) | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 126 | qed | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 127 | |
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 128 | interpretation defl: ideal_completion below defl_principal Rep_defl | 
| 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 129 | using type_definition_defl below_defl_def | 
| 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 130 | using defl_principal_def fin_defl_countable | 
| 39984 | 131 | by (rule below.typedef_ideal_completion) | 
| 27409 | 132 | |
| 62175 | 133 | text \<open>Algebraic deflations are pointed\<close> | 
| 27409 | 134 | |
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 135 | lemma defl_minimal: "defl_principal (Abs_fin_defl \<bottom>) \<sqsubseteq> x" | 
| 81644 | 136 | proof (induct x rule: defl.principal_induct) | 
| 137 | fix a :: "'a fin_defl" | |
| 138 | have "Abs_fin_defl \<bottom> \<sqsubseteq> a" | |
| 139 | by (simp add: below_fin_defl_def Abs_fin_defl_inverse finite_deflation_bottom) | |
| 140 | then show "defl_principal (Abs_fin_defl \<bottom>) \<sqsubseteq> defl_principal a" | |
| 141 | by (rule defl.principal_mono) | |
| 142 | qed simp | |
| 27409 | 143 | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41286diff
changeset | 144 | instance defl :: (bifinite) pcpo | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 145 | by intro_classes (fast intro: defl_minimal) | 
| 27409 | 146 | |
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 147 | lemma inst_defl_pcpo: "\<bottom> = defl_principal (Abs_fin_defl \<bottom>)" | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41394diff
changeset | 148 | by (rule defl_minimal [THEN bottomI, symmetric]) | 
| 27409 | 149 | |
| 81577 | 150 | |
| 62175 | 151 | subsection \<open>Applying algebraic deflations\<close> | 
| 27409 | 152 | |
| 81644 | 153 | definition cast :: "'a::bifinite defl \<rightarrow> 'a \<rightarrow> 'a" | 
| 154 | where "cast = defl.extension Rep_fin_defl" | |
| 27409 | 155 | |
| 81644 | 156 | lemma cast_defl_principal: "cast\<cdot>(defl_principal a) = Rep_fin_defl a" | 
| 157 | unfolding cast_def | |
| 158 | by (rule defl.extension_principal) (simp only: below_fin_defl_def) | |
| 27409 | 159 | |
| 160 | lemma deflation_cast: "deflation (cast\<cdot>d)" | |
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 161 | apply (induct d rule: defl.principal_induct) | 
| 27409 | 162 | apply (rule adm_subst [OF _ adm_deflation], simp) | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 163 | apply (simp add: cast_defl_principal) | 
| 27409 | 164 | apply (rule finite_deflation_imp_deflation) | 
| 165 | apply (rule finite_deflation_Rep_fin_defl) | |
| 166 | done | |
| 167 | ||
| 81644 | 168 | lemma finite_deflation_cast: "compact d \<Longrightarrow> finite_deflation (cast\<cdot>d)" | 
| 169 | apply (drule defl.compact_imp_principal) | |
| 170 | apply clarify | |
| 171 | apply (simp add: cast_defl_principal) | |
| 172 | apply (rule finite_deflation_Rep_fin_defl) | |
| 173 | done | |
| 27409 | 174 | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29252diff
changeset | 175 | interpretation cast: deflation "cast\<cdot>d" | 
| 27409 | 176 | by (rule deflation_cast) | 
| 177 | ||
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 178 | declare cast.idem [simp] | 
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 179 | |
| 81644 | 180 | lemma compact_cast [simp]: "compact (cast\<cdot>d)" if "compact d" | 
| 181 | by (rule finite_deflation_imp_compact) (use that in \<open>rule finite_deflation_cast\<close>) | |
| 31164 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 182 | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 183 | lemma cast_below_cast: "cast\<cdot>A \<sqsubseteq> cast\<cdot>B \<longleftrightarrow> A \<sqsubseteq> B" | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 184 | apply (induct A rule: defl.principal_induct, simp) | 
| 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 185 | apply (induct B rule: defl.principal_induct, simp) | 
| 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 186 | apply (simp add: cast_defl_principal below_fin_defl_def) | 
| 31164 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 187 | done | 
| 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 188 | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 189 | lemma compact_cast_iff: "compact (cast\<cdot>d) \<longleftrightarrow> compact d" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 190 | apply (rule iffI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 191 | apply (simp only: compact_def cast_below_cast [symmetric]) | 
| 40327 | 192 | apply (erule adm_subst [OF cont_Rep_cfun2]) | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 193 | apply (erule compact_cast) | 
| 39972 
4244ff4f9649
add lemmas finite_deflation_imp_compact, cast_below_cast_iff
 Brian Huffman <brianh@cs.pdx.edu> parents: 
39971diff
changeset | 194 | done | 
| 
4244ff4f9649
add lemmas finite_deflation_imp_compact, cast_below_cast_iff
 Brian Huffman <brianh@cs.pdx.edu> parents: 
39971diff
changeset | 195 | |
| 31164 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 196 | lemma cast_below_imp_below: "cast\<cdot>A \<sqsubseteq> cast\<cdot>B \<Longrightarrow> A \<sqsubseteq> B" | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39972diff
changeset | 197 | by (simp only: cast_below_cast) | 
| 31164 
f550c4cf3f3a
continuity proofs for approx function on deflations; lemma cast_below_imp_below
 huffman parents: 
31076diff
changeset | 198 | |
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 199 | lemma cast_eq_imp_eq: "cast\<cdot>A = cast\<cdot>B \<Longrightarrow> A = B" | 
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 200 | by (simp add: below_antisym cast_below_imp_below) | 
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 201 | |
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 202 | lemma cast_strict1 [simp]: "cast\<cdot>\<bottom> = \<bottom>" | 
| 39989 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 203 | apply (subst inst_defl_pcpo) | 
| 
ad60d7311f43
renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
 huffman parents: 
39985diff
changeset | 204 | apply (subst cast_defl_principal) | 
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 205 | apply (rule Abs_fin_defl_inverse) | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41394diff
changeset | 206 | apply (simp add: finite_deflation_bottom) | 
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 207 | done | 
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 208 | |
| 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 209 | lemma cast_strict2 [simp]: "cast\<cdot>A\<cdot>\<bottom> = \<bottom>" | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41394diff
changeset | 210 | by (rule cast.below [THEN bottomI]) | 
| 33586 
0e745228d605
add in_deflation relation, more lemmas about cast
 huffman parents: 
31164diff
changeset | 211 | |
| 81577 | 212 | |
| 62175 | 213 | subsection \<open>Deflation combinators\<close> | 
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 214 | |
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 215 | definition | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 216 | "defl_fun1 e p f = | 
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 217 | defl.extension (\<lambda>a. | 
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 218 | defl_principal (Abs_fin_defl | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 219 | (e oo f\<cdot>(Rep_fin_defl a) oo p)))" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 220 | |
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 221 | definition | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 222 | "defl_fun2 e p f = | 
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 223 | defl.extension (\<lambda>a. | 
| 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 224 | defl.extension (\<lambda>b. | 
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 225 | defl_principal (Abs_fin_defl | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 226 | (e oo f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo p))))" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 227 | |
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 228 | lemma cast_defl_fun1: | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 229 | assumes ep: "ep_pair e p" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 230 | assumes f: "\<And>a. finite_deflation a \<Longrightarrow> finite_deflation (f\<cdot>a)" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 231 | shows "cast\<cdot>(defl_fun1 e p f\<cdot>A) = e oo f\<cdot>(cast\<cdot>A) oo p" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 232 | proof - | 
| 81644 | 233 | have 1: "finite_deflation (e oo f\<cdot>(Rep_fin_defl a) oo p)" for a | 
| 234 | proof - | |
| 235 | have "finite_deflation (f\<cdot>(Rep_fin_defl a))" | |
| 236 | using finite_deflation_Rep_fin_defl by (rule f) | |
| 237 | with ep show ?thesis | |
| 238 | by (rule ep_pair.finite_deflation_e_d_p) | |
| 239 | qed | |
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 240 | show ?thesis | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 241 | by (induct A rule: defl.principal_induct, simp) | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 242 | (simp only: defl_fun1_def | 
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 243 | defl.extension_principal | 
| 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 244 | defl.extension_mono | 
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 245 | defl.principal_mono | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 246 | Abs_fin_defl_mono [OF 1 1] | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 247 | monofun_cfun below_refl | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 248 | Rep_fin_defl_mono | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 249 | cast_defl_principal | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 250 | Abs_fin_defl_inverse [unfolded mem_Collect_eq, OF 1]) | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 251 | qed | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 252 | |
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 253 | lemma cast_defl_fun2: | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 254 | assumes ep: "ep_pair e p" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 255 | assumes f: "\<And>a b. finite_deflation a \<Longrightarrow> finite_deflation b \<Longrightarrow> | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 256 | finite_deflation (f\<cdot>a\<cdot>b)" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 257 | shows "cast\<cdot>(defl_fun2 e p f\<cdot>A\<cdot>B) = e oo f\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo p" | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 258 | proof - | 
| 81644 | 259 | have 1: "finite_deflation (e oo f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo p)" for a b | 
| 260 | proof - | |
| 261 | have "finite_deflation (f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b))" | |
| 262 | using finite_deflation_Rep_fin_defl finite_deflation_Rep_fin_defl by (rule f) | |
| 263 | with ep show ?thesis | |
| 264 | by (rule ep_pair.finite_deflation_e_d_p) | |
| 265 | qed | |
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 266 | show ?thesis | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 267 | apply (induct A rule: defl.principal_induct, simp) | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 268 | apply (induct B rule: defl.principal_induct, simp) | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 269 | by (simp only: defl_fun2_def | 
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 270 | defl.extension_principal | 
| 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41290diff
changeset | 271 | defl.extension_mono | 
| 41290 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 272 | defl.principal_mono | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 273 | Abs_fin_defl_mono [OF 1 1] | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 274 | monofun_cfun below_refl | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 275 | Rep_fin_defl_mono | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 276 | cast_defl_principal | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 277 | Abs_fin_defl_inverse [unfolded mem_Collect_eq, OF 1]) | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 278 | qed | 
| 
e9c9577d88b5
replace foo_approx functions with foo_emb, foo_prj functions for universal domain embeddings
 huffman parents: 
41287diff
changeset | 279 | |
| 27409 | 280 | end |