lemma compact_abs: "compact x \ compact (abs\x)" by (rule compact_rep_rev) simp
lemma compact_rep: "compact x \ compact (rep\x)" by (rule iso.compact_abs [OF iso.swap]) (rule iso_axioms)
lemma iso_swap: "(x = abs\y) = (rep\x = y)" proof assume"x = abs\y" thenhave"rep\x = rep\(abs\y)" by simp thenshow"rep\x = y" by simp next assume"rep\x = y" thenhave"abs\(rep\x) = abs\y" by simp thenshow"x = abs\y" by simp qed
end
subsection \<open>Proofs about take functions\<close>
text\<open>
This section containslemmas that are used in a module that supports
the domain isomorphism package; the module contains proofs related to take functions and the finiteness predicate. \<close>
lemma deflation_abs_rep: fixes abs and rep and d assumes abs_iso: "\x. rep\(abs\x) = x" assumes rep_iso: "\y. abs\(rep\y) = y" shows"deflation d \ deflation (abs oo d oo rep)" by (rule ep_pair.deflation_e_d_p) (simp add: ep_pair.intro assms)
lemma deflation_chain_min: assumes chain: "chain d" assumes defl: "\n. deflation (d n)" shows"d m\(d n\x) = d (min m n)\x" proof (rule linorder_le_cases) assume"m \ n" with chain have"d m \ d n" by (rule chain_mono) thenhave"d m\(d n\x) = d m\x" by (rule deflation_below_comp1 [OF defl defl]) moreoverfrom\<open>m \<le> n\<close> have "min m n = m" by simp ultimatelyshow ?thesis by simp next assume"n \ m" with chain have"d n \ d m" by (rule chain_mono) thenhave"d m\(d n\x) = d n\x" by (rule deflation_below_comp2 [OF defl defl]) moreoverfrom\<open>n \<le> m\<close> have "min m n = n" by simp ultimatelyshow ?thesis by simp qed
lemma lub_ID_take_lemma: assumes"chain t"and"(\n. t n) = ID" assumes"\n. t n\x = t n\y" shows "x = y" proof - have"(\n. t n\x) = (\n. t n\y)" using assms(3) by simp thenhave"(\n. t n)\x = (\n. t n)\y" using assms(1) by (simp add: lub_distribs) thenshow"x = y" using assms(2) by simp qed
lemma lub_ID_reach: assumes"chain t"and"(\n. t n) = ID" shows"(\n. t n\x) = x" using assms by (simp add: lub_distribs)
lemma lub_ID_take_induct: assumes"chain t"and"(\n. t n) = ID" assumes"adm P"and"\n. P (t n\x)" shows "P x" proof - from\<open>chain t\<close> have "chain (\<lambda>n. t n\<cdot>x)" by simp from\<open>adm P\<close> this \<open>\<And>n. P (t n\<cdot>x)\<close> have "P (\<Squnion>n. t n\<cdot>x)" by (rule admD) with\<open>chain t\<close> \<open>(\<Squnion>n. t n) = ID\<close> show "P x" by (simp add: lub_distribs) qed
subsection \<open>Finiteness\<close>
text\<open> Let a ``decisive''function be a deflation that maps every input to
either itself or bottom. Thenif a domain's take functions are all
decisive, then all values in the domain are finite. \<close>
definition
decisive :: "('a::pcpo \ 'a) \ bool" where "decisive d \ (\x. d\x = x \ d\x = \)"
lemma decisiveI: "(\x. d\x = x \ d\x = \) \ decisive d" unfolding decisive_def by simp
lemma decisive_cases: assumes"decisive d"obtains"d\x = x" | "d\x = \" using assms unfolding decisive_def by auto
lemma decisive_bottom: "decisive \" unfolding decisive_def by simp
lemma decisive_ID: "decisive ID" unfolding decisive_def by simp
lemma decisive_ssum_map: assumes f: "decisive f" assumes g: "decisive g" shows"decisive (ssum_map\f\g)" apply (rule decisiveI)
subgoal for s apply (cases s, simp_all) apply (rule_tac x=x in decisive_cases [OF f], simp_all) apply (rule_tac x=y in decisive_cases [OF g], simp_all) done done
lemma decisive_sprod_map: assumes f: "decisive f" assumes g: "decisive g" shows"decisive (sprod_map\f\g)" apply (rule decisiveI)
subgoal for s apply (cases s, simp)
subgoal for x y apply (rule decisive_cases [OF f, where x = x], simp_all) apply (rule decisive_cases [OF g, where x = y], simp_all) done done done
lemma lub_ID_finite: assumes chain: "chain d" assumes lub: "(\n. d n) = ID" assumes decisive: "\n. decisive (d n)" shows"\n. d n\x = x" proof - have 1: "chain (\n. d n\x)" using chain by simp have 2: "(\n. d n\x) = x" using chain lub by (rule lub_ID_reach) have"\n. d n\x = x \ d n\x = \" using decisive unfolding decisive_def by simp hence"range (\n. d n\x) \ {x, \}" by auto hence"finite (range (\n. d n\x))" by (rule finite_subset, simp) with 1 have"finite_chain (\n. d n\x)" by (rule finite_range_imp_finch) thenhave"\n. (\n. d n\x) = d n\x" unfolding finite_chain_def by (auto simp add: maxinch_is_thelub) with 2 show"\n. d n\x = x" by (auto elim: sym) qed
lemma lub_ID_finite_take_induct: assumes"chain d"and"(\n. d n) = ID" and "\n. decisive (d n)" shows"(\n. P (d n\x)) \ P x" using lub_ID_finite [OF assms] by metis
subsection \<open>Proofs about constructor functions\<close>
text\<open>Lemmas for proving nchotomy rule:\<close>
lemma ex_one_bottom_iff: "(\x. P x \ x \ \) = P ONE" by simp
lemma ex_up_bottom_iff: "(\x. P x \ x \ \) = (\x. P (up\x))" by (safe, case_tac x, auto)
lemma ex_sprod_bottom_iff: "(\y. P y \ y \ \) =
(\<exists>x y. (P (:x, y:) \<and> x \<noteq> \<bottom>) \<and> y \<noteq> \<bottom>)" by (safe, case_tac y, auto)
lemma ex_sprod_up_bottom_iff: "(\y. P y \ y \ \) =
(\<exists>x y. P (:up\<cdot>x, y:) \<and> y \<noteq> \<bottom>)" by (safe, case_tac y, simp, case_tac x, auto)
lemma ex_ssum_bottom_iff: "(\x. P x \ x \ \) =
((\<exists>x. P (sinl\<cdot>x) \<and> x \<noteq> \<bottom>) \<or>
(\<exists>x. P (sinr\<cdot>x) \<and> x \<noteq> \<bottom>))" by (safe, case_tac x, auto)
lemma exh_start: "p = \ \ (\x. p = x \ x \ \)" by auto
text\<open>Restore original typing constraints.\<close>
setup\<open>
fold Sign.add_const_constraint
[(\<^const_name>\<open>defl\<close>, SOME \<^typ>\<open>'a::domain itself \<Rightarrow> udom defl\<close>),
(\<^const_name>\<open>emb\<close>, SOME \<^typ>\<open>'a::domain \<rightarrow> udom\<close>),
(\<^const_name>\<open>prj\<close>, SOME \<^typ>\<open>udom \<rightarrow> 'a::domain\<close>),
(\<^const_name>\<open>liftdefl\<close>, SOME \<^typ>\<open>'a::predomain itself \<Rightarrow> udom u defl\<close>),
(\<^const_name>\<open>liftemb\<close>, SOME \<^typ>\<open>'a::predomain u \<rightarrow> udom u\<close>),
(\<^const_name>\<open>liftprj\<close>, SOME \<^typ>\<open>udom u \<rightarrow> 'a::predomain u\<close>)] \<close>
ML_file \<open>Tools/domaindef.ML\<close>
subsection \<open>Isomorphic deflations\<close>
definition isodefl :: "('a::domain \ 'a) \ udom defl \ bool" where"isodefl d t \ cast\t = emb oo d oo prj"
definition isodefl' :: "('a::predomain \<rightarrow> 'a) \<Rightarrow> udom u defl \<Rightarrow> bool" where"isodefl' d t \ cast\t = liftemb oo u_map\d oo liftprj"
lemma isodeflI: "(\x. cast\t\x = emb\(d\(prj\x))) \ isodefl d t" unfolding isodefl_def by (simp add: cfun_eqI)
lemma cast_isodefl: "isodefl d t \ cast\t = (\ x. emb\(d\(prj\x)))" unfolding isodefl_def by (simp add: cfun_eqI)
lemma isodefl_strict: "isodefl d t \ d\\ = \" unfolding isodefl_def by (drule cfun_fun_cong [where x="\"], simp)
lemma isodefl_imp_deflation: fixes d :: "'a::domain \ 'a" assumes"isodefl d t"shows"deflation d" proof note assms [unfolded isodefl_def, simp] fix x :: 'a show"d\(d\x) = d\x" using cast.idem [of t "emb\x"] by simp show"d\x \ x" using cast.below [of t "emb\x"] by simp qed
lemma isodefl_ID_DEFL: "isodefl (ID :: 'a \ 'a) DEFL('a::domain)" unfolding isodefl_def by (simp add: cast_DEFL)
lemma isodefl_LIFTDEFL: "isodefl' (ID :: 'a \ 'a) LIFTDEFL('a::predomain)" unfolding isodefl'_def by (simp add: cast_liftdefl u_map_ID)
lemma isodefl_abs_rep: fixes abs and rep and d assumes DEFL: "DEFL('b::domain) = DEFL('a::domain)" assumes abs_def: "(abs :: 'a \ 'b) \ prj oo emb" assumes rep_def: "(rep :: 'b \ 'a) \ prj oo emb" shows"isodefl d t \ isodefl (abs oo d oo rep) t" unfolding isodefl_def by (simp add: cfun_eq_iff assms prj_emb_prj emb_prj_emb)
lemma isodefl'_liftdefl_of: "isodefl d t \ isodefl' d (liftdefl_of\t)" unfolding isodefl_def isodefl'_def by (simp add: cast_liftdefl_of u_map_oo liftemb_eq liftprj_eq)
lemma isodefl_cfun: assumes"isodefl (u_map\d1) t1" and "isodefl d2 t2" shows"isodefl (cfun_map\d1\d2) (sfun_defl\t1\t2)" using isodefl_sfun [OF assms] unfolding isodefl_def by (simp add: emb_cfun_def prj_cfun_def cfcomp1 encode_cfun_map)
subsection \<open>Setting up the domain package\<close>
named_theorems domain_defl_simps "theorems like DEFL('a t) = t_defl$DEFL('a)" and domain_isodefl "theorems like isodefl d t ==> isodefl (foo_map$d) (foo_defl$t)"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.