| author | nipkow | 
| Tue, 29 Oct 2024 10:26:06 +0100 | |
| changeset 81285 | 34f3ec8d4d24 | 
| parent 81095 | 49c04500c5f9 | 
| child 81577 | a712bf5ccab0 | 
| permissions | -rw-r--r-- | 
| 42151 | 1 | (* Title: HOL/HOLCF/ConvexPD.thy | 
| 25904 | 2 | Author: Brian Huffman | 
| 3 | *) | |
| 4 | ||
| 62175 | 5 | section \<open>Convex powerdomain\<close> | 
| 25904 | 6 | |
| 7 | theory ConvexPD | |
| 8 | imports UpperPD LowerPD | |
| 9 | begin | |
| 10 | ||
| 62175 | 11 | subsection \<open>Basis preorder\<close> | 
| 25904 | 12 | |
| 13 | definition | |
| 80914 
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
 wenzelm parents: 
80786diff
changeset | 14 | convex_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix \<open>\<le>\<natural>\<close> 50) where | 
| 25904 | 15 | "convex_le = (\<lambda>u v. u \<le>\<sharp> v \<and> u \<le>\<flat> v)" | 
| 16 | ||
| 17 | lemma convex_le_refl [simp]: "t \<le>\<natural> t" | |
| 18 | unfolding convex_le_def by (fast intro: upper_le_refl lower_le_refl) | |
| 19 | ||
| 20 | lemma convex_le_trans: "\<lbrakk>t \<le>\<natural> u; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> t \<le>\<natural> v" | |
| 21 | unfolding convex_le_def by (fast intro: upper_le_trans lower_le_trans) | |
| 22 | ||
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29990diff
changeset | 23 | interpretation convex_le: preorder convex_le | 
| 25904 | 24 | by (rule preorder.intro, rule convex_le_refl, rule convex_le_trans) | 
| 25 | ||
| 26 | lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<natural> t" | |
| 27 | unfolding convex_le_def Rep_PDUnit by simp | |
| 28 | ||
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 29 | lemma PDUnit_convex_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y" | 
| 25904 | 30 | unfolding convex_le_def by (fast intro: PDUnit_upper_mono PDUnit_lower_mono) | 
| 31 | ||
| 32 | lemma PDPlus_convex_mono: "\<lbrakk>s \<le>\<natural> t; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<natural> PDPlus t v" | |
| 33 | unfolding convex_le_def by (fast intro: PDPlus_upper_mono PDPlus_lower_mono) | |
| 34 | ||
| 35 | lemma convex_le_PDUnit_PDUnit_iff [simp]: | |
| 40436 | 36 | "(PDUnit a \<le>\<natural> PDUnit b) = (a \<sqsubseteq> b)" | 
| 25904 | 37 | unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast | 
| 38 | ||
| 39 | lemma convex_le_PDUnit_lemma1: | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 40 | "(PDUnit a \<le>\<natural> t) = (\<forall>b\<in>Rep_pd_basis t. a \<sqsubseteq> b)" | 
| 25904 | 41 | unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit | 
| 42 | using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast | |
| 43 | ||
| 44 | lemma convex_le_PDUnit_PDPlus_iff [simp]: | |
| 45 | "(PDUnit a \<le>\<natural> PDPlus t u) = (PDUnit a \<le>\<natural> t \<and> PDUnit a \<le>\<natural> u)" | |
| 46 | unfolding convex_le_PDUnit_lemma1 Rep_PDPlus by fast | |
| 47 | ||
| 48 | lemma convex_le_PDUnit_lemma2: | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 49 | "(t \<le>\<natural> PDUnit b) = (\<forall>a\<in>Rep_pd_basis t. a \<sqsubseteq> b)" | 
| 25904 | 50 | unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit | 
| 51 | using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast | |
| 52 | ||
| 53 | lemma convex_le_PDPlus_PDUnit_iff [simp]: | |
| 54 | "(PDPlus t u \<le>\<natural> PDUnit a) = (t \<le>\<natural> PDUnit a \<and> u \<le>\<natural> PDUnit a)" | |
| 55 | unfolding convex_le_PDUnit_lemma2 Rep_PDPlus by fast | |
| 56 | ||
| 57 | lemma convex_le_PDPlus_lemma: | |
| 58 | assumes z: "PDPlus t u \<le>\<natural> z" | |
| 59 | shows "\<exists>v w. z = PDPlus v w \<and> t \<le>\<natural> v \<and> u \<le>\<natural> w" | |
| 60 | proof (intro exI conjI) | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 61 |   let ?A = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis t. a \<sqsubseteq> b}"
 | 
| 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 62 |   let ?B = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis u. a \<sqsubseteq> b}"
 | 
| 25904 | 63 | let ?v = "Abs_pd_basis ?A" | 
| 64 | let ?w = "Abs_pd_basis ?B" | |
| 65 | have Rep_v: "Rep_pd_basis ?v = ?A" | |
| 66 | apply (rule Abs_pd_basis_inverse) | |
| 67 | apply (rule Rep_pd_basis_nonempty [of t, folded ex_in_conv, THEN exE]) | |
| 68 | apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify) | |
| 69 | apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE) | |
| 70 | apply (simp add: pd_basis_def) | |
| 71 | apply fast | |
| 72 | done | |
| 73 | have Rep_w: "Rep_pd_basis ?w = ?B" | |
| 74 | apply (rule Abs_pd_basis_inverse) | |
| 75 | apply (rule Rep_pd_basis_nonempty [of u, folded ex_in_conv, THEN exE]) | |
| 76 | apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify) | |
| 77 | apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE) | |
| 78 | apply (simp add: pd_basis_def) | |
| 79 | apply fast | |
| 80 | done | |
| 81 | show "z = PDPlus ?v ?w" | |
| 82 | apply (insert z) | |
| 83 | apply (simp add: convex_le_def, erule conjE) | |
| 84 | apply (simp add: Rep_pd_basis_inject [symmetric] Rep_PDPlus) | |
| 85 | apply (simp add: Rep_v Rep_w) | |
| 86 | apply (rule equalityI) | |
| 87 | apply (rule subsetI) | |
| 88 | apply (simp only: upper_le_def) | |
| 89 | apply (drule (1) bspec, erule bexE) | |
| 90 | apply (simp add: Rep_PDPlus) | |
| 91 | apply fast | |
| 92 | apply fast | |
| 93 | done | |
| 94 | show "t \<le>\<natural> ?v" "u \<le>\<natural> ?w" | |
| 95 | apply (insert z) | |
| 96 | apply (simp_all add: convex_le_def upper_le_def lower_le_def Rep_PDPlus Rep_v Rep_w) | |
| 97 | apply fast+ | |
| 98 | done | |
| 99 | qed | |
| 100 | ||
| 101 | lemma convex_le_induct [induct set: convex_le]: | |
| 102 | assumes le: "t \<le>\<natural> u" | |
| 103 | assumes 2: "\<And>t u v. \<lbrakk>P t u; P u v\<rbrakk> \<Longrightarrow> P t v" | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 104 | assumes 3: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)" | 
| 25904 | 105 | assumes 4: "\<And>t u v w. \<lbrakk>P t v; P u w\<rbrakk> \<Longrightarrow> P (PDPlus t u) (PDPlus v w)" | 
| 106 | shows "P t u" | |
| 107 | using le apply (induct t arbitrary: u rule: pd_basis_induct) | |
| 108 | apply (erule rev_mp) | |
| 109 | apply (induct_tac u rule: pd_basis_induct1) | |
| 110 | apply (simp add: 3) | |
| 111 | apply (simp, clarify, rename_tac a b t) | |
| 112 | apply (subgoal_tac "P (PDPlus (PDUnit a) (PDUnit a)) (PDPlus (PDUnit b) t)") | |
| 113 | apply (simp add: PDPlus_absorb) | |
| 114 | apply (erule (1) 4 [OF 3]) | |
| 115 | apply (drule convex_le_PDPlus_lemma, clarify) | |
| 116 | apply (simp add: 4) | |
| 117 | done | |
| 118 | ||
| 119 | ||
| 62175 | 120 | subsection \<open>Type definition\<close> | 
| 25904 | 121 | |
| 81095 | 122 | typedef 'a convex_pd (\<open>(\<open>notation=\<open>postfix convex_pd\<close>\<close>'(_')\<natural>)\<close>) = | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 123 |   "{S::'a pd_basis set. convex_le.ideal S}"
 | 
| 40888 
28cd51cff70c
reformulate lemma preorder.ex_ideal, and use it for typedefs
 huffman parents: 
40774diff
changeset | 124 | by (rule convex_le.ex_ideal) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 125 | |
| 41288 
a19edebad961
powerdomain theories require class 'bifinite' instead of 'domain'
 huffman parents: 
41287diff
changeset | 126 | instantiation convex_pd :: (bifinite) below | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 127 | begin | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 128 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 129 | definition | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 130 | "x \<sqsubseteq> y \<longleftrightarrow> Rep_convex_pd x \<subseteq> Rep_convex_pd y" | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 131 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 132 | instance .. | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 133 | end | 
| 25904 | 134 | |
| 41288 
a19edebad961
powerdomain theories require class 'bifinite' instead of 'domain'
 huffman parents: 
41287diff
changeset | 135 | instance convex_pd :: (bifinite) po | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 136 | using type_definition_convex_pd below_convex_pd_def | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 137 | by (rule convex_le.typedef_ideal_po) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 138 | |
| 41288 
a19edebad961
powerdomain theories require class 'bifinite' instead of 'domain'
 huffman parents: 
41287diff
changeset | 139 | instance convex_pd :: (bifinite) cpo | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 140 | using type_definition_convex_pd below_convex_pd_def | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 141 | by (rule convex_le.typedef_ideal_cpo) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 142 | |
| 25904 | 143 | definition | 
| 144 | convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where | |
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 145 |   "convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}"
 | 
| 25904 | 146 | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29990diff
changeset | 147 | interpretation convex_pd: | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 148 | ideal_completion convex_le convex_principal Rep_convex_pd | 
| 39984 | 149 | using type_definition_convex_pd below_convex_pd_def | 
| 150 | using convex_principal_def pd_basis_countable | |
| 151 | by (rule convex_le.typedef_ideal_completion) | |
| 25904 | 152 | |
| 62175 | 153 | text \<open>Convex powerdomain is pointed\<close> | 
| 25904 | 154 | |
| 155 | lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys" | |
| 156 | by (induct ys rule: convex_pd.principal_induct, simp, simp) | |
| 157 | ||
| 41288 
a19edebad961
powerdomain theories require class 'bifinite' instead of 'domain'
 huffman parents: 
41287diff
changeset | 158 | instance convex_pd :: (bifinite) pcpo | 
| 26927 | 159 | by intro_classes (fast intro: convex_pd_minimal) | 
| 25904 | 160 | |
| 161 | lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)" | |
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41402diff
changeset | 162 | by (rule convex_pd_minimal [THEN bottomI, symmetric]) | 
| 25904 | 163 | |
| 164 | ||
| 62175 | 165 | subsection \<open>Monadic unit and plus\<close> | 
| 25904 | 166 | |
| 167 | definition | |
| 168 | convex_unit :: "'a \<rightarrow> 'a convex_pd" where | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 169 | "convex_unit = compact_basis.extension (\<lambda>a. convex_principal (PDUnit a))" | 
| 25904 | 170 | |
| 171 | definition | |
| 172 | convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 173 | "convex_plus = convex_pd.extension (\<lambda>t. convex_pd.extension (\<lambda>u. | 
| 25904 | 174 | convex_principal (PDPlus t u)))" | 
| 175 | ||
| 176 | abbreviation | |
| 177 | convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd" | |
| 80914 
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
 wenzelm parents: 
80786diff
changeset | 178 | (infixl \<open>\<union>\<natural>\<close> 65) where | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 179 | "xs \<union>\<natural> ys == convex_plus\<cdot>xs\<cdot>ys" | 
| 25904 | 180 | |
| 26927 | 181 | syntax | 
| 81089 
8042869c2072
clarified syntax: prefer nonterminal "args", use outer block (with indent);
 wenzelm parents: 
80914diff
changeset | 182 |   "_convex_pd" :: "args \<Rightarrow> logic"  (\<open>(\<open>indent=1 notation=\<open>mixfix convex_pd enumeration\<close>\<close>{_}\<natural>)\<close>)
 | 
| 26927 | 183 | translations | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 184 |   "{x,xs}\<natural>" == "{x}\<natural> \<union>\<natural> {xs}\<natural>"
 | 
| 26927 | 185 |   "{x}\<natural>" == "CONST convex_unit\<cdot>x"
 | 
| 186 | ||
| 187 | lemma convex_unit_Rep_compact_basis [simp]: | |
| 188 |   "{Rep_compact_basis a}\<natural> = convex_principal (PDUnit a)"
 | |
| 189 | unfolding convex_unit_def | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 190 | by (simp add: compact_basis.extension_principal PDUnit_convex_mono) | 
| 26927 | 191 | |
| 25904 | 192 | lemma convex_plus_principal [simp]: | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 193 | "convex_principal t \<union>\<natural> convex_principal u = convex_principal (PDPlus t u)" | 
| 25904 | 194 | unfolding convex_plus_def | 
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 195 | by (simp add: convex_pd.extension_principal | 
| 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 196 | convex_pd.extension_mono PDPlus_convex_mono) | 
| 25904 | 197 | |
| 37770 
cddb3106adb8
avoid explicit mandatory prefix markers when prefixes are mandatory implicitly
 haftmann parents: 
36635diff
changeset | 198 | interpretation convex_add: semilattice convex_add proof | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 199 | fix xs ys zs :: "'a convex_pd" | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 200 | show "(xs \<union>\<natural> ys) \<union>\<natural> zs = xs \<union>\<natural> (ys \<union>\<natural> zs)" | 
| 41402 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 201 | apply (induct xs rule: convex_pd.principal_induct, simp) | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 202 | apply (induct ys rule: convex_pd.principal_induct, simp) | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 203 | apply (induct zs rule: convex_pd.principal_induct, simp) | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 204 | apply (simp add: PDPlus_assoc) | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 205 | done | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 206 | show "xs \<union>\<natural> ys = ys \<union>\<natural> xs" | 
| 41402 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 207 | apply (induct xs rule: convex_pd.principal_induct, simp) | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 208 | apply (induct ys rule: convex_pd.principal_induct, simp) | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 209 | apply (simp add: PDPlus_commute) | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 210 | done | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 211 | show "xs \<union>\<natural> xs = xs" | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 212 | apply (induct xs rule: convex_pd.principal_induct, simp) | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 213 | apply (simp add: PDPlus_absorb) | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 214 | done | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 215 | qed | 
| 26927 | 216 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 217 | lemmas convex_plus_assoc = convex_add.assoc | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 218 | lemmas convex_plus_commute = convex_add.commute | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 219 | lemmas convex_plus_absorb = convex_add.idem | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 220 | lemmas convex_plus_left_commute = convex_add.left_commute | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
33808diff
changeset | 221 | lemmas convex_plus_left_absorb = convex_add.left_idem | 
| 26927 | 222 | |
| 62175 | 223 | text \<open>Useful for \<open>simp add: convex_plus_ac\<close>\<close> | 
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 224 | lemmas convex_plus_ac = | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 225 | convex_plus_assoc convex_plus_commute convex_plus_left_commute | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 226 | |
| 62175 | 227 | text \<open>Useful for \<open>simp only: convex_plus_aci\<close>\<close> | 
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 228 | lemmas convex_plus_aci = | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 229 | convex_plus_ac convex_plus_absorb convex_plus_left_absorb | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 230 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 231 | lemma convex_unit_below_plus_iff [simp]: | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 232 |   "{x}\<natural> \<sqsubseteq> ys \<union>\<natural> zs \<longleftrightarrow> {x}\<natural> \<sqsubseteq> ys \<and> {x}\<natural> \<sqsubseteq> zs"
 | 
| 39970 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 233 | apply (induct x rule: compact_basis.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 234 | apply (induct ys rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 235 | apply (induct zs rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 236 | apply simp | 
| 25904 | 237 | done | 
| 238 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 239 | lemma convex_plus_below_unit_iff [simp]: | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 240 |   "xs \<union>\<natural> ys \<sqsubseteq> {z}\<natural> \<longleftrightarrow> xs \<sqsubseteq> {z}\<natural> \<and> ys \<sqsubseteq> {z}\<natural>"
 | 
| 39970 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 241 | apply (induct xs rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 242 | apply (induct ys rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 243 | apply (induct z rule: compact_basis.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 244 | apply simp | 
| 25904 | 245 | done | 
| 246 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 247 | lemma convex_unit_below_iff [simp]: "{x}\<natural> \<sqsubseteq> {y}\<natural> \<longleftrightarrow> x \<sqsubseteq> y"
 | 
| 39970 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 248 | apply (induct x rule: compact_basis.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 249 | apply (induct y rule: compact_basis.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 250 | apply simp | 
| 26927 | 251 | done | 
| 252 | ||
| 253 | lemma convex_unit_eq_iff [simp]: "{x}\<natural> = {y}\<natural> \<longleftrightarrow> x = y"
 | |
| 254 | unfolding po_eq_conv by simp | |
| 255 | ||
| 256 | lemma convex_unit_strict [simp]: "{\<bottom>}\<natural> = \<bottom>"
 | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 257 | using convex_unit_Rep_compact_basis [of compact_bot] | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 258 | by (simp add: inst_convex_pd_pcpo) | 
| 26927 | 259 | |
| 40321 
d065b195ec89
rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
 huffman parents: 
40002diff
changeset | 260 | lemma convex_unit_bottom_iff [simp]: "{x}\<natural> = \<bottom> \<longleftrightarrow> x = \<bottom>"
 | 
| 26927 | 261 | unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff) | 
| 262 | ||
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 263 | lemma compact_convex_unit: "compact x \<Longrightarrow> compact {x}\<natural>"
 | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 264 | by (auto dest!: compact_basis.compact_imp_principal) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 265 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 266 | lemma compact_convex_unit_iff [simp]: "compact {x}\<natural> \<longleftrightarrow> compact x"
 | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 267 | apply (safe elim!: compact_convex_unit) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 268 | apply (simp only: compact_def convex_unit_below_iff [symmetric]) | 
| 40327 | 269 | apply (erule adm_subst [OF cont_Rep_cfun2]) | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 270 | done | 
| 26927 | 271 | |
| 272 | lemma compact_convex_plus [simp]: | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 273 | "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs \<union>\<natural> ys)" | 
| 27289 | 274 | by (auto dest!: convex_pd.compact_imp_principal) | 
| 26927 | 275 | |
| 25904 | 276 | |
| 62175 | 277 | subsection \<open>Induction rules\<close> | 
| 25904 | 278 | |
| 279 | lemma convex_pd_induct1: | |
| 280 | assumes P: "adm P" | |
| 26927 | 281 |   assumes unit: "\<And>x. P {x}\<natural>"
 | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 282 |   assumes insert: "\<And>x ys. \<lbrakk>P {x}\<natural>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<natural> \<union>\<natural> ys)"
 | 
| 25904 | 283 | shows "P (xs::'a convex_pd)" | 
| 27289 | 284 | apply (induct xs rule: convex_pd.principal_induct, rule P) | 
| 285 | apply (induct_tac a rule: pd_basis_induct1) | |
| 25904 | 286 | apply (simp only: convex_unit_Rep_compact_basis [symmetric]) | 
| 287 | apply (rule unit) | |
| 288 | apply (simp only: convex_unit_Rep_compact_basis [symmetric] | |
| 289 | convex_plus_principal [symmetric]) | |
| 290 | apply (erule insert [OF unit]) | |
| 291 | done | |
| 292 | ||
| 40576 
fa5e0cacd5e7
declare {upper,lower,convex}_pd_induct as default induction rules
 huffman parents: 
40497diff
changeset | 293 | lemma convex_pd_induct | 
| 
fa5e0cacd5e7
declare {upper,lower,convex}_pd_induct as default induction rules
 huffman parents: 
40497diff
changeset | 294 | [case_names adm convex_unit convex_plus, induct type: convex_pd]: | 
| 25904 | 295 | assumes P: "adm P" | 
| 26927 | 296 |   assumes unit: "\<And>x. P {x}\<natural>"
 | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 297 | assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs \<union>\<natural> ys)" | 
| 25904 | 298 | shows "P (xs::'a convex_pd)" | 
| 27289 | 299 | apply (induct xs rule: convex_pd.principal_induct, rule P) | 
| 300 | apply (induct_tac a rule: pd_basis_induct) | |
| 25904 | 301 | apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit) | 
| 302 | apply (simp only: convex_plus_principal [symmetric] plus) | |
| 303 | done | |
| 304 | ||
| 305 | ||
| 62175 | 306 | subsection \<open>Monadic bind\<close> | 
| 25904 | 307 | |
| 308 | definition | |
| 309 | convex_bind_basis :: | |
| 310 |   "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
 | |
| 311 | "convex_bind_basis = fold_pd | |
| 312 | (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 313 | (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<natural> y\<cdot>f)" | 
| 25904 | 314 | |
| 26927 | 315 | lemma ACI_convex_bind: | 
| 51489 | 316 | "semilattice (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<natural> y\<cdot>f)" | 
| 25904 | 317 | apply unfold_locales | 
| 26041 
c2e15e65165f
locales ACf, ACIf, ACIfSL and ACIfSLlin have been abandoned in favour of the existing algebraic classes ab_semigroup_mult, ab_semigroup_idem_mult, lower_semilattice (resp. uper_semilattice) and linorder
 haftmann parents: 
25925diff
changeset | 318 | apply (simp add: convex_plus_assoc) | 
| 25904 | 319 | apply (simp add: convex_plus_commute) | 
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 320 | apply (simp add: eta_cfun) | 
| 25904 | 321 | done | 
| 322 | ||
| 323 | lemma convex_bind_basis_simps [simp]: | |
| 324 | "convex_bind_basis (PDUnit a) = | |
| 325 | (\<Lambda> f. f\<cdot>(Rep_compact_basis a))" | |
| 326 | "convex_bind_basis (PDPlus t u) = | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 327 | (\<Lambda> f. convex_bind_basis t\<cdot>f \<union>\<natural> convex_bind_basis u\<cdot>f)" | 
| 25904 | 328 | unfolding convex_bind_basis_def | 
| 329 | apply - | |
| 26927 | 330 | apply (rule fold_pd_PDUnit [OF ACI_convex_bind]) | 
| 331 | apply (rule fold_pd_PDPlus [OF ACI_convex_bind]) | |
| 25904 | 332 | done | 
| 333 | ||
| 334 | lemma convex_bind_basis_mono: | |
| 335 | "t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u" | |
| 336 | apply (erule convex_le_induct) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 337 | apply (erule (1) below_trans) | 
| 27289 | 338 | apply (simp add: monofun_LAM monofun_cfun) | 
| 339 | apply (simp add: monofun_LAM monofun_cfun) | |
| 25904 | 340 | done | 
| 341 | ||
| 342 | definition | |
| 343 |   convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
 | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 344 | "convex_bind = convex_pd.extension convex_bind_basis" | 
| 25904 | 345 | |
| 41036 
4acbacd6c5bc
add set-union-like syntax for powerdomain bind operators
 huffman parents: 
40888diff
changeset | 346 | syntax | 
| 
4acbacd6c5bc
add set-union-like syntax for powerdomain bind operators
 huffman parents: 
40888diff
changeset | 347 | "_convex_bind" :: "[logic, logic, logic] \<Rightarrow> logic" | 
| 81095 | 348 | (\<open>(\<open>indent=3 notation=\<open>binder convex_bind\<close>\<close>\<Union>\<natural>_\<in>_./ _)\<close> [0, 0, 10] 10) | 
| 80768 | 349 | |
| 41036 
4acbacd6c5bc
add set-union-like syntax for powerdomain bind operators
 huffman parents: 
40888diff
changeset | 350 | translations | 
| 
4acbacd6c5bc
add set-union-like syntax for powerdomain bind operators
 huffman parents: 
40888diff
changeset | 351 | "\<Union>\<natural>x\<in>xs. e" == "CONST convex_bind\<cdot>xs\<cdot>(\<Lambda> x. e)" | 
| 
4acbacd6c5bc
add set-union-like syntax for powerdomain bind operators
 huffman parents: 
40888diff
changeset | 352 | |
| 25904 | 353 | lemma convex_bind_principal [simp]: | 
| 354 | "convex_bind\<cdot>(convex_principal t) = convex_bind_basis t" | |
| 355 | unfolding convex_bind_def | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 356 | apply (rule convex_pd.extension_principal) | 
| 25904 | 357 | apply (erule convex_bind_basis_mono) | 
| 358 | done | |
| 359 | ||
| 360 | lemma convex_bind_unit [simp]: | |
| 26927 | 361 |   "convex_bind\<cdot>{x}\<natural>\<cdot>f = f\<cdot>x"
 | 
| 27289 | 362 | by (induct x rule: compact_basis.principal_induct, simp, simp) | 
| 25904 | 363 | |
| 364 | lemma convex_bind_plus [simp]: | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 365 | "convex_bind\<cdot>(xs \<union>\<natural> ys)\<cdot>f = convex_bind\<cdot>xs\<cdot>f \<union>\<natural> convex_bind\<cdot>ys\<cdot>f" | 
| 41402 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 366 | by (induct xs rule: convex_pd.principal_induct, simp, | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 367 | induct ys rule: convex_pd.principal_induct, simp, simp) | 
| 25904 | 368 | |
| 369 | lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" | |
| 370 | unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit) | |
| 371 | ||
| 40589 | 372 | lemma convex_bind_bind: | 
| 373 | "convex_bind\<cdot>(convex_bind\<cdot>xs\<cdot>f)\<cdot>g = | |
| 374 | convex_bind\<cdot>xs\<cdot>(\<Lambda> x. convex_bind\<cdot>(f\<cdot>x)\<cdot>g)" | |
| 375 | by (induct xs, simp_all) | |
| 376 | ||
| 25904 | 377 | |
| 62175 | 378 | subsection \<open>Map\<close> | 
| 25904 | 379 | |
| 380 | definition | |
| 381 |   convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where
 | |
| 26927 | 382 |   "convex_map = (\<Lambda> f xs. convex_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<natural>))"
 | 
| 25904 | 383 | |
| 384 | lemma convex_map_unit [simp]: | |
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 385 |   "convex_map\<cdot>f\<cdot>{x}\<natural> = {f\<cdot>x}\<natural>"
 | 
| 25904 | 386 | unfolding convex_map_def by simp | 
| 387 | ||
| 388 | lemma convex_map_plus [simp]: | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 389 | "convex_map\<cdot>f\<cdot>(xs \<union>\<natural> ys) = convex_map\<cdot>f\<cdot>xs \<union>\<natural> convex_map\<cdot>f\<cdot>ys" | 
| 25904 | 390 | unfolding convex_map_def by simp | 
| 391 | ||
| 40577 | 392 | lemma convex_map_bottom [simp]: "convex_map\<cdot>f\<cdot>\<bottom> = {f\<cdot>\<bottom>}\<natural>"
 | 
| 393 | unfolding convex_map_def by simp | |
| 394 | ||
| 25904 | 395 | lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" | 
| 396 | by (induct xs rule: convex_pd_induct, simp_all) | |
| 397 | ||
| 33808 | 398 | lemma convex_map_ID: "convex_map\<cdot>ID = ID" | 
| 40002 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
 huffman parents: 
39989diff
changeset | 399 | by (simp add: cfun_eq_iff ID_def convex_map_ident) | 
| 33808 | 400 | |
| 25904 | 401 | lemma convex_map_map: | 
| 402 | "convex_map\<cdot>f\<cdot>(convex_map\<cdot>g\<cdot>xs) = convex_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" | |
| 403 | by (induct xs rule: convex_pd_induct, simp_all) | |
| 404 | ||
| 41110 | 405 | lemma convex_bind_map: | 
| 406 | "convex_bind\<cdot>(convex_map\<cdot>f\<cdot>xs)\<cdot>g = convex_bind\<cdot>xs\<cdot>(\<Lambda> x. g\<cdot>(f\<cdot>x))" | |
| 407 | by (simp add: convex_map_def convex_bind_bind) | |
| 408 | ||
| 409 | lemma convex_map_bind: | |
| 410 | "convex_map\<cdot>f\<cdot>(convex_bind\<cdot>xs\<cdot>g) = convex_bind\<cdot>xs\<cdot>(\<Lambda> x. convex_map\<cdot>f\<cdot>(g\<cdot>x))" | |
| 411 | by (simp add: convex_map_def convex_bind_bind) | |
| 412 | ||
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 413 | lemma ep_pair_convex_map: "ep_pair e p \<Longrightarrow> ep_pair (convex_map\<cdot>e) (convex_map\<cdot>p)" | 
| 61169 | 414 | apply standard | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 415 | apply (induct_tac x rule: convex_pd_induct, simp_all add: ep_pair.e_inverse) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 416 | apply (induct_tac y rule: convex_pd_induct) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 417 | apply (simp_all add: ep_pair.e_p_below monofun_cfun) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 418 | done | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 419 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 420 | lemma deflation_convex_map: "deflation d \<Longrightarrow> deflation (convex_map\<cdot>d)" | 
| 61169 | 421 | apply standard | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 422 | apply (induct_tac x rule: convex_pd_induct, simp_all add: deflation.idem) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 423 | apply (induct_tac x rule: convex_pd_induct) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 424 | apply (simp_all add: deflation.below monofun_cfun) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 425 | done | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 426 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 427 | (* FIXME: long proof! *) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 428 | lemma finite_deflation_convex_map: | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 429 | assumes "finite_deflation d" shows "finite_deflation (convex_map\<cdot>d)" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 430 | proof (rule finite_deflation_intro) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 431 | interpret d: finite_deflation d by fact | 
| 67682 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 wenzelm parents: 
62175diff
changeset | 432 | from d.deflation_axioms show "deflation (convex_map\<cdot>d)" | 
| 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 wenzelm parents: 
62175diff
changeset | 433 | by (rule deflation_convex_map) | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 434 | have "finite (range (\<lambda>x. d\<cdot>x))" by (rule d.finite_range) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 435 | hence "finite (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 436 | by (rule finite_vimageI, simp add: inj_on_def Rep_compact_basis_inject) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 437 | hence "finite (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x)))" by simp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 438 | hence "finite (Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 439 | by (rule finite_vimageI, simp add: inj_on_def Rep_pd_basis_inject) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 440 | hence *: "finite (convex_principal ` Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))" by simp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 441 | hence "finite (range (\<lambda>xs. convex_map\<cdot>d\<cdot>xs))" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 442 | apply (rule rev_finite_subset) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 443 | apply clarsimp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 444 | apply (induct_tac xs rule: convex_pd.principal_induct) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 445 | apply (simp add: adm_mem_finite *) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 446 | apply (rename_tac t, induct_tac t rule: pd_basis_induct) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 447 | apply (simp only: convex_unit_Rep_compact_basis [symmetric] convex_map_unit) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 448 | apply simp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 449 | apply (subgoal_tac "\<exists>b. d\<cdot>(Rep_compact_basis a) = Rep_compact_basis b") | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 450 | apply clarsimp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 451 | apply (rule imageI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 452 | apply (rule vimageI2) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 453 | apply (simp add: Rep_PDUnit) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 454 | apply (rule range_eqI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 455 | apply (erule sym) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 456 | apply (rule exI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 457 | apply (rule Abs_compact_basis_inverse [symmetric]) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 458 | apply (simp add: d.compact) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 459 | apply (simp only: convex_plus_principal [symmetric] convex_map_plus) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 460 | apply clarsimp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 461 | apply (rule imageI) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 462 | apply (rule vimageI2) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 463 | apply (simp add: Rep_PDPlus) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 464 | done | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 465 |   thus "finite {xs. convex_map\<cdot>d\<cdot>xs = xs}"
 | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 466 | by (rule finite_range_imp_finite_fixes) | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 467 | qed | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 468 | |
| 62175 | 469 | subsection \<open>Convex powerdomain is bifinite\<close> | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 470 | |
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 471 | lemma approx_chain_convex_map: | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 472 | assumes "approx_chain a" | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 473 | shows "approx_chain (\<lambda>i. convex_map\<cdot>(a i))" | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 474 | using assms unfolding approx_chain_def | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 475 | by (simp add: lub_APP convex_map_ID finite_deflation_convex_map) | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 476 | |
| 41288 
a19edebad961
powerdomain theories require class 'bifinite' instead of 'domain'
 huffman parents: 
41287diff
changeset | 477 | instance convex_pd :: (bifinite) bifinite | 
| 41286 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 478 | proof | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 479 | show "\<exists>(a::nat \<Rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd). approx_chain a" | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 480 | using bifinite [where 'a='a] | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 481 | by (fast intro!: approx_chain_convex_map) | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 482 | qed | 
| 
3d7685a4a5ff
reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
 huffman parents: 
41111diff
changeset | 483 | |
| 62175 | 484 | subsection \<open>Join\<close> | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 485 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 486 | definition | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 487 | convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 488 | "convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 489 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 490 | lemma convex_join_unit [simp]: | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 491 |   "convex_join\<cdot>{xs}\<natural> = xs"
 | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 492 | unfolding convex_join_def by simp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 493 | |
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 494 | lemma convex_join_plus [simp]: | 
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 495 | "convex_join\<cdot>(xss \<union>\<natural> yss) = convex_join\<cdot>xss \<union>\<natural> convex_join\<cdot>yss" | 
| 39974 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 496 | unfolding convex_join_def by simp | 
| 
b525988432e9
major reorganization/simplification of HOLCF type classes:
 huffman parents: 
39970diff
changeset | 497 | |
| 40577 | 498 | lemma convex_join_bottom [simp]: "convex_join\<cdot>\<bottom> = \<bottom>" | 
| 499 | unfolding convex_join_def by simp | |
| 500 | ||
| 25904 | 501 | lemma convex_join_map_unit: | 
| 502 | "convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs" | |
| 503 | by (induct xs rule: convex_pd_induct, simp_all) | |
| 504 | ||
| 505 | lemma convex_join_map_join: | |
| 506 | "convex_join\<cdot>(convex_map\<cdot>convex_join\<cdot>xsss) = convex_join\<cdot>(convex_join\<cdot>xsss)" | |
| 507 | by (induct xsss rule: convex_pd_induct, simp_all) | |
| 508 | ||
| 509 | lemma convex_join_map_map: | |
| 510 | "convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) = | |
| 511 | convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)" | |
| 512 | by (induct xss rule: convex_pd_induct, simp_all) | |
| 513 | ||
| 514 | ||
| 62175 | 515 | subsection \<open>Conversions to other powerdomains\<close> | 
| 25904 | 516 | |
| 62175 | 517 | text \<open>Convex to upper\<close> | 
| 25904 | 518 | |
| 519 | lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u" | |
| 520 | unfolding convex_le_def by simp | |
| 521 | ||
| 522 | definition | |
| 523 | convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 524 | "convex_to_upper = convex_pd.extension upper_principal" | 
| 25904 | 525 | |
| 526 | lemma convex_to_upper_principal [simp]: | |
| 527 | "convex_to_upper\<cdot>(convex_principal t) = upper_principal t" | |
| 528 | unfolding convex_to_upper_def | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 529 | apply (rule convex_pd.extension_principal) | 
| 27289 | 530 | apply (rule upper_pd.principal_mono) | 
| 25904 | 531 | apply (erule convex_le_imp_upper_le) | 
| 532 | done | |
| 533 | ||
| 534 | lemma convex_to_upper_unit [simp]: | |
| 26927 | 535 |   "convex_to_upper\<cdot>{x}\<natural> = {x}\<sharp>"
 | 
| 27289 | 536 | by (induct x rule: compact_basis.principal_induct, simp, simp) | 
| 25904 | 537 | |
| 538 | lemma convex_to_upper_plus [simp]: | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 539 | "convex_to_upper\<cdot>(xs \<union>\<natural> ys) = convex_to_upper\<cdot>xs \<union>\<sharp> convex_to_upper\<cdot>ys" | 
| 41402 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 540 | by (induct xs rule: convex_pd.principal_induct, simp, | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 541 | induct ys rule: convex_pd.principal_induct, simp, simp) | 
| 25904 | 542 | |
| 27289 | 543 | lemma convex_to_upper_bind [simp]: | 
| 544 | "convex_to_upper\<cdot>(convex_bind\<cdot>xs\<cdot>f) = | |
| 545 | upper_bind\<cdot>(convex_to_upper\<cdot>xs)\<cdot>(convex_to_upper oo f)" | |
| 546 | by (induct xs rule: convex_pd_induct, simp, simp, simp) | |
| 547 | ||
| 548 | lemma convex_to_upper_map [simp]: | |
| 549 | "convex_to_upper\<cdot>(convex_map\<cdot>f\<cdot>xs) = upper_map\<cdot>f\<cdot>(convex_to_upper\<cdot>xs)" | |
| 550 | by (simp add: convex_map_def upper_map_def cfcomp_LAM) | |
| 551 | ||
| 552 | lemma convex_to_upper_join [simp]: | |
| 553 | "convex_to_upper\<cdot>(convex_join\<cdot>xss) = | |
| 554 | upper_bind\<cdot>(convex_to_upper\<cdot>xss)\<cdot>convex_to_upper" | |
| 555 | by (simp add: convex_join_def upper_join_def cfcomp_LAM eta_cfun) | |
| 556 | ||
| 62175 | 557 | text \<open>Convex to lower\<close> | 
| 25904 | 558 | |
| 559 | lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u" | |
| 560 | unfolding convex_le_def by simp | |
| 561 | ||
| 562 | definition | |
| 563 | convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 564 | "convex_to_lower = convex_pd.extension lower_principal" | 
| 25904 | 565 | |
| 566 | lemma convex_to_lower_principal [simp]: | |
| 567 | "convex_to_lower\<cdot>(convex_principal t) = lower_principal t" | |
| 568 | unfolding convex_to_lower_def | |
| 41394 
51c866d1b53b
rename function ideal_completion.basis_fun to ideal_completion.extension
 huffman parents: 
41289diff
changeset | 569 | apply (rule convex_pd.extension_principal) | 
| 27289 | 570 | apply (rule lower_pd.principal_mono) | 
| 25904 | 571 | apply (erule convex_le_imp_lower_le) | 
| 572 | done | |
| 573 | ||
| 574 | lemma convex_to_lower_unit [simp]: | |
| 26927 | 575 |   "convex_to_lower\<cdot>{x}\<natural> = {x}\<flat>"
 | 
| 27289 | 576 | by (induct x rule: compact_basis.principal_induct, simp, simp) | 
| 25904 | 577 | |
| 578 | lemma convex_to_lower_plus [simp]: | |
| 41399 
ad093e4638e2
changed syntax of powerdomain binary union operators
 huffman parents: 
41394diff
changeset | 579 | "convex_to_lower\<cdot>(xs \<union>\<natural> ys) = convex_to_lower\<cdot>xs \<union>\<flat> convex_to_lower\<cdot>ys" | 
| 41402 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 580 | by (induct xs rule: convex_pd.principal_induct, simp, | 
| 
b647212cee03
remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
 huffman parents: 
41399diff
changeset | 581 | induct ys rule: convex_pd.principal_induct, simp, simp) | 
| 25904 | 582 | |
| 27289 | 583 | lemma convex_to_lower_bind [simp]: | 
| 584 | "convex_to_lower\<cdot>(convex_bind\<cdot>xs\<cdot>f) = | |
| 585 | lower_bind\<cdot>(convex_to_lower\<cdot>xs)\<cdot>(convex_to_lower oo f)" | |
| 586 | by (induct xs rule: convex_pd_induct, simp, simp, simp) | |
| 587 | ||
| 588 | lemma convex_to_lower_map [simp]: | |
| 589 | "convex_to_lower\<cdot>(convex_map\<cdot>f\<cdot>xs) = lower_map\<cdot>f\<cdot>(convex_to_lower\<cdot>xs)" | |
| 590 | by (simp add: convex_map_def lower_map_def cfcomp_LAM) | |
| 591 | ||
| 592 | lemma convex_to_lower_join [simp]: | |
| 593 | "convex_to_lower\<cdot>(convex_join\<cdot>xss) = | |
| 594 | lower_bind\<cdot>(convex_to_lower\<cdot>xss)\<cdot>convex_to_lower" | |
| 595 | by (simp add: convex_join_def lower_join_def cfcomp_LAM eta_cfun) | |
| 596 | ||
| 62175 | 597 | text \<open>Ordering property\<close> | 
| 25904 | 598 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 599 | lemma convex_pd_below_iff: | 
| 25904 | 600 | "(xs \<sqsubseteq> ys) = | 
| 601 | (convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and> | |
| 602 | convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)" | |
| 39970 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 603 | apply (induct xs rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 604 | apply (induct ys rule: convex_pd.principal_induct, simp) | 
| 
9023b897e67a
simplify proofs of powerdomain inequalities
 Brian Huffman <brianh@cs.pdx.edu> parents: 
37770diff
changeset | 605 | apply (simp add: convex_le_def) | 
| 25904 | 606 | done | 
| 607 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 608 | lemmas convex_plus_below_plus_iff = | 
| 45606 | 609 | convex_pd_below_iff [where xs="xs \<union>\<natural> ys" and ys="zs \<union>\<natural> ws"] | 
| 610 | for xs ys zs ws | |
| 26927 | 611 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 612 | lemmas convex_pd_below_simps = | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 613 | convex_unit_below_plus_iff | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 614 | convex_plus_below_unit_iff | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 615 | convex_plus_below_plus_iff | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 616 | convex_unit_below_iff | 
| 26927 | 617 | convex_to_upper_unit | 
| 618 | convex_to_upper_plus | |
| 619 | convex_to_lower_unit | |
| 620 | convex_to_lower_plus | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 621 | upper_pd_below_simps | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 622 | lower_pd_below_simps | 
| 26927 | 623 | |
| 25904 | 624 | end |