# HG changeset patch # User wenzelm # Date 1734014729 -3600 # Node ID b6df830451782e6ab8c53ed639450e36017581a8 # Parent c3190d0b068c08f54e9ff2c7a0570c7f4c799141 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF; diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Algebraic.thy --- a/src/HOL/HOLCF/Algebraic.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Algebraic.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,12 +8,9 @@ imports Universal Map_Functions begin -default_sort bifinite - - subsection \Type constructor for finite deflations\ -typedef 'a fin_defl = "{d::'a \ 'a. finite_deflation d}" +typedef 'a::bifinite fin_defl = "{d::'a \ 'a. finite_deflation d}" by (fast intro: finite_deflation_bottom) instantiation fin_defl :: (bifinite) below @@ -76,7 +73,7 @@ subsection \Defining algebraic deflations by ideal completion\ -typedef 'a defl = "{S::'a fin_defl set. below.ideal S}" +typedef 'a::bifinite defl = "{S::'a fin_defl set. below.ideal S}" by (rule below.ex_ideal) instantiation defl :: (bifinite) below @@ -97,10 +94,10 @@ by (rule below.typedef_ideal_cpo) definition - defl_principal :: "'a fin_defl \ 'a defl" where + defl_principal :: "'a::bifinite fin_defl \ 'a defl" where "defl_principal t = Abs_defl {u. u \ t}" -lemma fin_defl_countable: "\f::'a fin_defl \ nat. inj f" +lemma fin_defl_countable: "\f::'a::bifinite fin_defl \ nat. inj f" proof - obtain f :: "'a compact_basis \ nat" where inj_f: "inj f" using compact_basis.countable .. @@ -153,7 +150,7 @@ subsection \Applying algebraic deflations\ definition - cast :: "'a defl \ 'a \ 'a" + cast :: "'a::bifinite defl \ 'a \ 'a" where "cast = defl.extension Rep_fin_defl" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Bifinite.thy --- a/src/HOL/HOLCF/Bifinite.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Bifinite.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,9 +8,6 @@ imports Map_Functions Cprod Sprod Sfun Up "HOL-Library.Countable" begin -default_sort cpo - - subsection \Chains of finite deflations\ locale approx_chain = diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Cfun.thy --- a/src/HOL/HOLCF/Cfun.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Cfun.thy Thu Dec 12 15:45:29 2024 +0100 @@ -9,9 +9,6 @@ imports Cpodef begin -default_sort cpo - - subsection \Definition of continuous function type\ definition "cfun = {f::'a \ 'b. cont f}" @@ -455,9 +452,7 @@ subsection \Strictified functions\ -default_sort pcpo - -definition seq :: "'a \ 'b \ 'b" +definition seq :: "'a::pcpo \ 'b::pcpo \ 'b" where "seq = (\ x. if x = \ then \ else ID)" lemma cont2cont_if_bottom [cont2cont, simp]: @@ -481,7 +476,7 @@ "x \ \ \ seq\x = ID" by (simp_all add: seq_conv_if) -definition strictify :: "('a \ 'b) \ 'a \ 'b" +definition strictify :: "('a::pcpo \ 'b::pcpo) \ 'a \ 'b" where "strictify = (\ f x. seq\x\(f\x))" lemma strictify_conv_if: "strictify\f\x = (if x = \ then \ else f\x)" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Compact_Basis.thy --- a/src/HOL/HOLCF/Compact_Basis.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Compact_Basis.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,14 +8,11 @@ imports Universal begin -default_sort bifinite - - subsection \A compact basis for powerdomains\ -definition "pd_basis = {S::'a compact_basis set. finite S \ S \ {}}" +definition "pd_basis = {S::'a::bifinite compact_basis set. finite S \ S \ {}}" -typedef 'a pd_basis = "pd_basis :: 'a compact_basis set set" +typedef 'a::bifinite pd_basis = "pd_basis :: 'a compact_basis set set" unfolding pd_basis_def apply (rule_tac x="{_}" in exI) apply simp @@ -29,7 +26,7 @@ text \The powerdomain basis type is countable.\ -lemma pd_basis_countable: "\f::'a pd_basis \ nat. inj f" +lemma pd_basis_countable: "\f::'a::bifinite pd_basis \ nat. inj f" proof - obtain g :: "'a compact_basis \ nat" where "inj g" using compact_basis.countable .. @@ -45,11 +42,11 @@ subsection \Unit and plus constructors\ definition - PDUnit :: "'a compact_basis \ 'a pd_basis" where + PDUnit :: "'a::bifinite compact_basis \ 'a pd_basis" where "PDUnit = (\x. Abs_pd_basis {x})" definition - PDPlus :: "'a pd_basis \ 'a pd_basis \ 'a pd_basis" where + PDPlus :: "'a::bifinite pd_basis \ 'a pd_basis \ 'a pd_basis" where "PDPlus t u = Abs_pd_basis (Rep_pd_basis t \ Rep_pd_basis u)" lemma Rep_PDUnit: @@ -98,7 +95,7 @@ definition fold_pd :: - "('a compact_basis \ 'b::type) \ ('b \ 'b \ 'b) \ 'a pd_basis \ 'b" + "('a::bifinite compact_basis \ 'b::type) \ ('b \ 'b \ 'b) \ 'a pd_basis \ 'b" where "fold_pd g f t = semilattice_set.F f (g ` Rep_pd_basis t)" lemma fold_pd_PDUnit: diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Completion.thy --- a/src/HOL/HOLCF/Completion.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Completion.thy Thu Dec 12 15:45:29 2024 +0100 @@ -146,8 +146,8 @@ hide_const (open) Filter.principal locale ideal_completion = preorder + - fixes principal :: "'a::type \ 'b::cpo" - fixes rep :: "'b::cpo \ 'a::type set" + fixes principal :: "'a::type \ 'b" + fixes rep :: "'b \ 'a::type set" assumes ideal_rep: "\x. ideal (rep x)" assumes rep_lub: "\Y. chain Y \ rep (\i. Y i) = (\i. rep (Y i))" assumes rep_principal: "\a. rep (principal a) = {b. b \ a}" @@ -302,11 +302,11 @@ subsection \Defining functions in terms of basis elements\ definition - extension :: "('a::type \ 'c::cpo) \ 'b \ 'c" where + extension :: "('a::type \ 'c) \ 'b \ 'c" where "extension = (\f. (\ x. lub (f ` rep x)))" lemma extension_lemma: - fixes f :: "'a::type \ 'c::cpo" + fixes f :: "'a::type \ 'c" assumes f_mono: "\a b. a \ b \ f a \ f b" shows "\u. f ` rep x <<| u" proof - @@ -336,7 +336,7 @@ qed lemma extension_beta: - fixes f :: "'a::type \ 'c::cpo" + fixes f :: "'a::type \ 'c" assumes f_mono: "\a b. a \ b \ f a \ f b" shows "extension f\x = lub (f ` rep x)" unfolding extension_def @@ -357,7 +357,7 @@ qed lemma extension_principal: - fixes f :: "'a::type \ 'c::cpo" + fixes f :: "'a::type \ 'c" assumes f_mono: "\a b. a \ b \ f a \ f b" shows "extension f\(principal a) = f a" apply (subst extension_beta, erule f_mono) @@ -406,7 +406,7 @@ end lemma (in preorder) typedef_ideal_completion: - fixes Abs :: "'a set \ 'b::cpo" + fixes Abs :: "'a set \ 'b" assumes type: "type_definition Rep Abs {S. ideal S}" assumes below: "\x y. x \ y \ Rep x \ Rep y" assumes principal: "\a. principal a = Abs {b. b \ a}" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/ConvexPD.thy --- a/src/HOL/HOLCF/ConvexPD.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/ConvexPD.thy Thu Dec 12 15:45:29 2024 +0100 @@ -11,7 +11,7 @@ subsection \Basis preorder\ definition - convex_le :: "'a pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where + convex_le :: "'a::bifinite pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where "convex_le = (\u v. u \\ v \ u \\ v)" lemma convex_le_refl [simp]: "t \\ t" @@ -119,7 +119,7 @@ subsection \Type definition\ -typedef 'a convex_pd (\(\notation=\postfix convex_pd\\'(_')\)\) = +typedef 'a::bifinite convex_pd (\(\notation=\postfix convex_pd\\'(_')\)\) = "{S::'a pd_basis set. convex_le.ideal S}" by (rule convex_le.ex_ideal) @@ -141,7 +141,7 @@ by (rule convex_le.typedef_ideal_cpo) definition - convex_principal :: "'a pd_basis \ 'a convex_pd" where + convex_principal :: "'a::bifinite pd_basis \ 'a convex_pd" where "convex_principal t = Abs_convex_pd {u. u \\ t}" interpretation convex_pd: @@ -165,16 +165,16 @@ subsection \Monadic unit and plus\ definition - convex_unit :: "'a \ 'a convex_pd" where + convex_unit :: "'a::bifinite \ 'a convex_pd" where "convex_unit = compact_basis.extension (\a. convex_principal (PDUnit a))" definition - convex_plus :: "'a convex_pd \ 'a convex_pd \ 'a convex_pd" where + convex_plus :: "'a::bifinite convex_pd \ 'a convex_pd \ 'a convex_pd" where "convex_plus = convex_pd.extension (\t. convex_pd.extension (\u. convex_principal (PDPlus t u)))" abbreviation - convex_add :: "'a convex_pd \ 'a convex_pd \ 'a convex_pd" + convex_add :: "'a::bifinite convex_pd \ 'a convex_pd \ 'a convex_pd" (infixl \\\\ 65) where "xs \\ ys == convex_plus\xs\ys" @@ -280,7 +280,7 @@ assumes P: "adm P" assumes unit: "\x. P {x}\" assumes insert: "\x ys. \P {x}\; P ys\ \ P ({x}\ \\ ys)" - shows "P (xs::'a convex_pd)" + shows "P (xs::'a::bifinite convex_pd)" apply (induct xs rule: convex_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct1) apply (simp only: convex_unit_Rep_compact_basis [symmetric]) @@ -295,7 +295,7 @@ assumes P: "adm P" assumes unit: "\x. P {x}\" assumes plus: "\xs ys. \P xs; P ys\ \ P (xs \\ ys)" - shows "P (xs::'a convex_pd)" + shows "P (xs::'a::bifinite convex_pd)" apply (induct xs rule: convex_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct) apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit) @@ -307,7 +307,7 @@ definition convex_bind_basis :: - "'a pd_basis \ ('a \ 'b convex_pd) \ 'b convex_pd" where + "'a::bifinite pd_basis \ ('a \ 'b convex_pd) \ 'b::bifinite convex_pd" where "convex_bind_basis = fold_pd (\a. \ f. f\(Rep_compact_basis a)) (\x y. \ f. x\f \\ y\f)" @@ -340,7 +340,7 @@ done definition - convex_bind :: "'a convex_pd \ ('a \ 'b convex_pd) \ 'b convex_pd" where + convex_bind :: "'a::bifinite convex_pd \ ('a \ 'b convex_pd) \ 'b::bifinite convex_pd" where "convex_bind = convex_pd.extension convex_bind_basis" syntax @@ -378,7 +378,7 @@ subsection \Map\ definition - convex_map :: "('a \ 'b) \ 'a convex_pd \ 'b convex_pd" where + convex_map :: "('a::bifinite \ 'b) \ 'a convex_pd \ 'b::bifinite convex_pd" where "convex_map = (\ f xs. convex_bind\xs\(\ x. {f\x}\))" lemma convex_map_unit [simp]: @@ -486,7 +486,7 @@ subsection \Join\ definition - convex_join :: "'a convex_pd convex_pd \ 'a convex_pd" where + convex_join :: "'a::bifinite convex_pd convex_pd \ 'a convex_pd" where "convex_join = (\ xss. convex_bind\xss\(\ xs. xs))" lemma convex_join_unit [simp]: @@ -522,7 +522,7 @@ unfolding convex_le_def by simp definition - convex_to_upper :: "'a convex_pd \ 'a upper_pd" where + convex_to_upper :: "'a::bifinite convex_pd \ 'a upper_pd" where "convex_to_upper = convex_pd.extension upper_principal" lemma convex_to_upper_principal [simp]: @@ -562,7 +562,7 @@ unfolding convex_le_def by simp definition - convex_to_lower :: "'a convex_pd \ 'a lower_pd" where + convex_to_lower :: "'a::bifinite convex_pd \ 'a lower_pd" where "convex_to_lower = convex_pd.extension lower_principal" lemma convex_to_lower_principal [simp]: diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Cpo.thy --- a/src/HOL/HOLCF/Cpo.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Cpo.thy Thu Dec 12 15:45:29 2024 +0100 @@ -353,6 +353,10 @@ class cpo = po + assumes cpo: "chain S \ \x. range S <<| x" + +default_sort cpo + +context cpo begin text \in cpo's everthing equal to THE lub has lub properties for every chain\ @@ -601,7 +605,7 @@ definition monofun :: "('a::po \ 'b::po) \ bool" \ \monotonicity\ where "monofun f \ (\x y. x \ y \ f x \ f y)" -definition cont :: "('a::cpo \ 'b::cpo) \ bool" +definition cont :: "('a \ 'b) \ bool" where "cont f = (\Y. chain Y \ range (\i. f (Y i)) <<| f (\i. Y i))" lemma contI: "(\Y. chain Y \ range (\i. f (Y i)) <<| f (\i. Y i)) \ cont f" @@ -667,7 +671,7 @@ done lemma contI2: - fixes f :: "'a::cpo \ 'b::cpo" + fixes f :: "'a \ 'b" assumes mono: "monofun f" assumes below: "\Y. \chain Y; chain (\i. f (Y i))\ \ f (\i. Y i) \ (\i. f (Y i))" shows "cont f" @@ -710,7 +714,7 @@ text \application of functions is continuous\ lemma cont_apply: - fixes f :: "'a::cpo \ 'b::cpo \ 'c::cpo" and t :: "'a \ 'b" + fixes f :: "'a \ 'b \ 'c" and t :: "'a \ 'b" assumes 1: "cont (\x. t x)" assumes 2: "\x. cont (\y. f x y)" assumes 3: "\y. cont (\x. f x y)" @@ -769,7 +773,7 @@ text \All monotone functions with chain-finite domain are continuous.\ lemma chfindom_monofun2cont: "monofun f \ cont f" - for f :: "'a::chfin \ 'b::cpo" + for f :: "'a::chfin \ 'b" apply (erule contI2) apply (frule chfin2finch) apply (clarsimp simp add: finite_chain_def) @@ -794,7 +798,7 @@ text \All functions with discrete domain are continuous.\ lemma cont_discrete_cpo [simp, cont2cont]: "cont f" - for f :: "'a::discrete_cpo \ 'b::cpo" + for f :: "'a::discrete_cpo \ 'b" apply (rule contI) apply (drule discrete_chain_const, clarify) apply simp @@ -803,9 +807,6 @@ section \Admissibility and compactness\ -default_sort cpo - - subsection \Definitions\ context cpo @@ -833,8 +834,7 @@ text \For chain-finite (easy) types every formula is admissible.\ -lemma adm_chfin [simp]: "adm P" - for P :: "'a::chfin \ bool" +lemma adm_chfin [simp]: "adm P" for P :: "'a::chfin \ bool" by (rule admI, frule chfin, auto simp add: maxinch_is_thelub) @@ -947,8 +947,7 @@ end -lemma compact_chfin [simp]: "compact x" - for x :: "'a::chfin" +lemma compact_chfin [simp]: "compact x" for x :: "'a::chfin" by (rule compactI [OF adm_chfin]) lemma compact_imp_max_in_chain: "chain Y \ compact (\i. Y i) \ \i. max_in_chain i Y" @@ -1002,16 +1001,12 @@ instance "fun" :: (type, po) po proof - fix f :: "'a \ 'b" + fix f g h :: "'a \ 'b" show "f \ f" by (simp add: below_fun_def) -next - fix f g :: "'a \ 'b" - assume "f \ g" and "g \ f" then show "f = g" + show "f \ g \ g \ f \ f = g" by (simp add: below_fun_def fun_eq_iff below_antisym) -next - fix f g h :: "'a \ 'b" - assume "f \ g" and "g \ h" then show "f \ h" + show "f \ g \ g \ h \ f \ h" unfolding below_fun_def by (fast elim: below_trans) qed @@ -1044,14 +1039,14 @@ by (simp add: is_lub_def is_ub_def below_fun_def) lemma is_lub_fun: "chain S \ range S <<| (\x. \i. S i x)" - for S :: "nat \ 'a::type \ 'b::cpo" + for S :: "nat \ 'a::type \ 'b" apply (rule is_lub_lambda) apply (rule cpo_lubI) apply (erule ch2ch_fun) done lemma lub_fun: "chain S \ (\i. S i) = (\x. \i. S i x)" - for S :: "nat \ 'a::type \ 'b::cpo" + for S :: "nat \ 'a::type \ 'b" by (rule is_lub_fun [THEN lub_eqI]) instance "fun" :: (type, cpo) cpo @@ -1125,7 +1120,7 @@ text \What D.A.Schmidt calls continuity of abstraction; never used here\ lemma contlub_lambda: "(\x. chain (\i. S i x)) \ (\x. \i. S i x) = (\i. (\x. S i x))" - for S :: "nat \ 'a::type \ 'b::cpo" + for S :: "nat \ 'a::type \ 'b" by (simp add: lub_fun ch2ch_lambda) @@ -1160,19 +1155,13 @@ instance prod :: (po, po) po proof - fix x :: "'a \ 'b" + fix x y z :: "'a \ 'b" show "x \ x" by (simp add: below_prod_def) -next - fix x y :: "'a \ 'b" - assume "x \ y" "y \ x" - then show "x = y" + show "x \ y \ y \ x \ x = y" unfolding below_prod_def prod_eq_iff by (fast intro: below_antisym) -next - fix x y z :: "'a \ 'b" - assume "x \ y" "y \ z" - then show "x \ z" + show "x \ y \ y \ z \ x \ z" unfolding below_prod_def by (fast intro: below_trans) qed @@ -1238,17 +1227,17 @@ by (simp add: is_lub_def is_ub_def below_prod_def) lemma lub_Pair: "chain A \ chain B \ (\i. (A i, B i)) = (\i. A i, \i. B i)" - for A :: "nat \ 'a::cpo" and B :: "nat \ 'b::cpo" + for A :: "nat \ 'a" and B :: "nat \ 'b" by (fast intro: lub_eqI is_lub_Pair elim: thelubE) lemma is_lub_prod: - fixes S :: "nat \ ('a::cpo \ 'b::cpo)" + fixes S :: "nat \ ('a \ 'b)" assumes "chain S" shows "range S <<| (\i. fst (S i), \i. snd (S i))" using assms by (auto elim: prod_chain_cases simp: is_lub_Pair cpo_lubI) lemma lub_prod: "chain S \ (\i. S i) = (\i. fst (S i), \i. snd (S i))" - for S :: "nat \ 'a::cpo \ 'b::cpo" + for S :: "nat \ 'a \ 'b" by (rule is_lub_prod [THEN lub_eqI]) instance prod :: (cpo, cpo) cpo @@ -1262,8 +1251,7 @@ instance prod :: (discrete_cpo, discrete_cpo) discrete_cpo proof - fix x y :: "'a \ 'b" - show "x \ y \ x = y" + show "x \ y \ x = y" for x y :: "'a \ 'b" by (simp add: below_prod_def prod_eq_iff) qed @@ -1392,12 +1380,10 @@ subsection \Compactness and chain-finiteness\ -lemma fst_below_iff: "fst x \ y \ x \ (y, snd x)" - for x :: "'a \ 'b" +lemma fst_below_iff: "fst x \ y \ x \ (y, snd x)" for x :: "'a \ 'b" by (simp add: below_prod_def) -lemma snd_below_iff: "snd x \ y \ x \ (fst x, y)" - for x :: "'a \ 'b" +lemma snd_below_iff: "snd x \ y \ x \ (fst x, y)" for x :: "'a \ 'b" by (simp add: below_prod_def) lemma compact_fst: "compact x \ compact (fst x)" @@ -1424,7 +1410,7 @@ section \Discrete cpo types\ -datatype 'a discr = Discr "'a :: type" +datatype 'a discr = Discr "'a::type" subsection \Discrete cpo class instance\ @@ -1441,7 +1427,7 @@ subsection \\emph{undiscr}\ -definition undiscr :: "('a::type)discr \ 'a" +definition undiscr :: "'a::type discr \ 'a" where "undiscr x = (case x of Discr y \ y)" lemma undiscr_Discr [simp]: "undiscr (Discr x) = x" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Cprod.thy --- a/src/HOL/HOLCF/Cprod.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Cprod.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,9 +8,6 @@ imports Cfun begin -default_sort cpo - - subsection \Continuous case function for unit type\ definition unit_when :: "'a \ unit \ 'a" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Deflation.thy --- a/src/HOL/HOLCF/Deflation.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Deflation.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,9 +8,6 @@ imports Cfun begin -default_sort cpo - - subsection \Continuous deflations\ locale deflation = diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Domain.thy --- a/src/HOL/HOLCF/Domain.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Domain.thy Thu Dec 12 15:45:29 2024 +0100 @@ -17,7 +17,7 @@ text \A locale for continuous isomorphisms\ locale iso = - fixes abs :: "'a \ 'b" + fixes abs :: "'a::pcpo \ 'b::pcpo" fixes rep :: "'b \ 'a" assumes abs_iso [simp]: "rep\(abs\x) = x" assumes rep_iso [simp]: "abs\(rep\y) = y" @@ -374,15 +374,13 @@ subsection \Representations of types\ -default_sort "domain" - -lemma emb_prj: "emb\((prj\x)::'a) = cast\DEFL('a)\x" +lemma emb_prj: "emb\((prj\x)::'a::domain) = cast\DEFL('a)\x" by (simp add: cast_DEFL) lemma emb_prj_emb: - fixes x :: "'a" + fixes x :: "'a::domain" assumes "DEFL('a) \ DEFL('b)" - shows "emb\(prj\(emb\x) :: 'b) = emb\x" + shows "emb\(prj\(emb\x) :: 'b::domain) = emb\x" unfolding emb_prj apply (rule cast.belowD) apply (rule monofun_cfun_arg [OF assms]) @@ -390,7 +388,7 @@ done lemma prj_emb_prj: - assumes "DEFL('a) \ DEFL('b)" + assumes "DEFL('a::domain) \ DEFL('b::domain)" shows "prj\(emb\(prj\x :: 'b)) = (prj\x :: 'a)" apply (rule emb_eq_iff [THEN iffD1]) apply (simp only: emb_prj) @@ -404,7 +402,7 @@ lemma domain_abs_iso: fixes abs and rep - assumes DEFL: "DEFL('b) = DEFL('a)" + 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 "rep\(abs\x) = x" @@ -413,7 +411,7 @@ lemma domain_rep_iso: fixes abs and rep - assumes DEFL: "DEFL('b) = DEFL('a)" + 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 "abs\(rep\x) = x" @@ -518,7 +516,7 @@ subsection \Isomorphic deflations\ -definition isodefl :: "('a \ 'a) \ udom defl \ bool" +definition isodefl :: "('a::domain \ 'a) \ udom defl \ bool" where "isodefl d t \ cast\t = emb oo d oo prj" definition isodefl' :: "('a::predomain \ 'a) \ udom u defl \ bool" @@ -535,7 +533,7 @@ by (drule cfun_fun_cong [where x="\"], simp) lemma isodefl_imp_deflation: - fixes d :: "'a \ 'a" + fixes d :: "'a::domain \ 'a" assumes "isodefl d t" shows "deflation d" proof note assms [unfolded isodefl_def, simp] @@ -546,14 +544,14 @@ using cast.below [of t "emb\x"] by simp qed -lemma isodefl_ID_DEFL: "isodefl (ID :: 'a \ 'a) DEFL('a)" +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_DEFL_imp_ID: "isodefl (d :: 'a \ 'a) DEFL('a) \ d = ID" +lemma isodefl_DEFL_imp_ID: "isodefl (d :: 'a \ 'a) DEFL('a::domain) \ d = ID" unfolding isodefl_def apply (simp add: cast_DEFL) apply (simp add: cfun_eq_iff) @@ -588,7 +586,7 @@ lemma isodefl_abs_rep: fixes abs and rep and d - assumes DEFL: "DEFL('b) = DEFL('a)" + 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" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Fixrec.thy --- a/src/HOL/HOLCF/Fixrec.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Fixrec.thy Thu Dec 12 15:45:29 2024 +0100 @@ -10,12 +10,9 @@ section \Fixed point operator and admissibility\ -default_sort pcpo - - subsection \Iteration\ -primrec iterate :: "nat \ ('a::cpo \ 'a) \ ('a \ 'a)" +primrec iterate :: "nat \ ('a \ 'a) \ ('a \ 'a)" where "iterate 0 = (\ F x. x)" | "iterate (Suc n) = (\ F x. F\(iterate n\F\x))" @@ -44,12 +41,12 @@ subsection \Least fixed point operator\ -definition "fix" :: "('a \ 'a) \ 'a" +definition "fix" :: "('a::pcpo \ 'a) \ 'a" where "fix = (\ F. \i. iterate i\F\\)" text \Binder syntax for \<^term>\fix\\ -abbreviation fix_syn :: "('a \ 'a) \ 'a" (binder \\ \ 10) +abbreviation fix_syn :: "('a::pcpo \ 'a) \ 'a" (binder \\ \ 10) where "fix_syn (\x. f x) \ fix\(\ x. f x)" notation (ASCII) @@ -209,9 +206,11 @@ \ lemma fix_cprod: - "fix\(F::'a \ 'b \ 'a \ 'b) = - (\ x. fst (F\(x, \ y. snd (F\(x, y)))), - \ y. snd (F\(\ x. fst (F\(x, \ y. snd (F\(x, y)))), y)))" + fixes F :: "'a::pcpo \ 'b::pcpo \ 'a \ 'b" + shows + "fix\F = + (\ x. fst (F\(x, \ y. snd (F\(x, y)))), + \ y. snd (F\(\ x. fst (F\(x, \ y. snd (F\(x, y)))), y)))" (is "fix\F = (?x, ?y)") proof (rule fix_eqI) have *: "fst (F\(?x, ?y)) = ?x" @@ -250,8 +249,6 @@ subsection \Pattern-match monad\ -default_sort cpo - pcpodef 'a match = "UNIV::(one ++ 'a u) set" by simp_all @@ -340,50 +337,48 @@ subsection \Match functions for built-in types\ -default_sort pcpo - definition - match_bottom :: "'a \ 'c match \ 'c match" + match_bottom :: "'a::pcpo \ 'c match \ 'c match" where "match_bottom = (\ x k. seq\x\fail)" definition - match_Pair :: "'a::cpo \ 'b::cpo \ ('a \ 'b \ 'c match) \ 'c match" + match_Pair :: "'a \ 'b \ ('a \ 'b \ 'c match) \ 'c match" where "match_Pair = (\ x k. csplit\k\x)" definition - match_spair :: "'a \ 'b \ ('a \ 'b \ 'c match) \ 'c match" + match_spair :: "'a::pcpo \ 'b::pcpo \ ('a \ 'b \ 'c match) \ 'c::pcpo match" where "match_spair = (\ x k. ssplit\k\x)" definition - match_sinl :: "'a \ 'b \ ('a \ 'c match) \ 'c match" + match_sinl :: "'a::pcpo \ 'b::pcpo \ ('a \ 'c::pcpo match) \ 'c match" where "match_sinl = (\ x k. sscase\k\(\ b. fail)\x)" definition - match_sinr :: "'a \ 'b \ ('b \ 'c match) \ 'c match" + match_sinr :: "'a::pcpo \ 'b::pcpo \ ('b \ 'c::pcpo match) \ 'c match" where "match_sinr = (\ x k. sscase\(\ a. fail)\k\x)" definition - match_up :: "'a::cpo u \ ('a \ 'c match) \ 'c match" + match_up :: "'a u \ ('a \ 'c::pcpo match) \ 'c match" where "match_up = (\ x k. fup\k\x)" definition - match_ONE :: "one \ 'c match \ 'c match" + match_ONE :: "one \ 'c::pcpo match \ 'c match" where "match_ONE = (\ ONE k. k)" definition - match_TT :: "tr \ 'c match \ 'c match" + match_TT :: "tr \ 'c::pcpo match \ 'c match" where "match_TT = (\ x k. If x then k else fail)" definition - match_FF :: "tr \ 'c match \ 'c match" + match_FF :: "tr \ 'c::pcpo match \ 'c match" where "match_FF = (\ x k. If x then fail else k)" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Lift.thy --- a/src/HOL/HOLCF/Lift.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Lift.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,15 +8,13 @@ imports Up begin -default_sort type - -pcpodef 'a lift = "UNIV :: 'a discr u set" +pcpodef 'a::type lift = "UNIV :: 'a discr u set" by simp_all lemmas inst_lift_pcpo = Abs_lift_strict [symmetric] definition - Def :: "'a \ 'a lift" where + Def :: "'a::type \ 'a lift" where "Def x = Abs_lift (up\(Discr x))" @@ -30,7 +28,7 @@ apply (simp add: Def_def) done -old_rep_datatype "\::'a lift" Def +old_rep_datatype "\::'a::type lift" Def by (erule lift_induct) (simp_all add: Def_def Abs_lift_inject inst_lift_pcpo) text \\<^term>\bottom\ and \<^term>\Def\\ @@ -88,7 +86,7 @@ subsection \Further operations\ definition - flift1 :: "('a \ 'b::pcpo) \ ('a lift \ 'b)" (binder \FLIFT \ 10) where + flift1 :: "('a::type \ 'b::pcpo) \ ('a lift \ 'b)" (binder \FLIFT \ 10) where "flift1 = (\f. (\ x. case_lift \ f x))" translations @@ -97,7 +95,7 @@ "\(CONST Def x). t" <= "FLIFT x. t" definition - flift2 :: "('a \ 'b) \ ('a lift \ 'b lift)" where + flift2 :: "('a::type \ 'b::type) \ ('a lift \ 'b lift)" where "flift2 f = (FLIFT x. Def (f x))" lemma flift1_Def [simp]: "flift1 f\(Def x) = (f x)" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/LowerPD.thy --- a/src/HOL/HOLCF/LowerPD.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/LowerPD.thy Thu Dec 12 15:45:29 2024 +0100 @@ -11,7 +11,7 @@ subsection \Basis preorder\ definition - lower_le :: "'a pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where + lower_le :: "'a::bifinite pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where "lower_le = (\u v. \x\Rep_pd_basis u. \y\Rep_pd_basis v. x \ y)" lemma lower_le_refl [simp]: "t \\ t" @@ -74,7 +74,7 @@ subsection \Type definition\ -typedef 'a lower_pd (\(\notation=\postfix lower_pd\\'(_')\)\) = +typedef 'a::bifinite lower_pd (\(\notation=\postfix lower_pd\\'(_')\)\) = "{S::'a pd_basis set. lower_le.ideal S}" by (rule lower_le.ex_ideal) @@ -96,7 +96,7 @@ by (rule lower_le.typedef_ideal_cpo) definition - lower_principal :: "'a pd_basis \ 'a lower_pd" where + lower_principal :: "'a::bifinite pd_basis \ 'a lower_pd" where "lower_principal t = Abs_lower_pd {u. u \\ t}" interpretation lower_pd: @@ -120,16 +120,16 @@ subsection \Monadic unit and plus\ definition - lower_unit :: "'a \ 'a lower_pd" where + lower_unit :: "'a::bifinite \ 'a lower_pd" where "lower_unit = compact_basis.extension (\a. lower_principal (PDUnit a))" definition - lower_plus :: "'a lower_pd \ 'a lower_pd \ 'a lower_pd" where + lower_plus :: "'a::bifinite lower_pd \ 'a lower_pd \ 'a lower_pd" where "lower_plus = lower_pd.extension (\t. lower_pd.extension (\u. lower_principal (PDPlus t u)))" abbreviation - lower_add :: "'a lower_pd \ 'a lower_pd \ 'a lower_pd" + lower_add :: "'a::bifinite lower_pd \ 'a lower_pd \ 'a lower_pd" (infixl \\\\ 65) where "xs \\ ys == lower_plus\xs\ys" @@ -151,7 +151,7 @@ lower_pd.extension_mono PDPlus_lower_mono) interpretation lower_add: semilattice lower_add proof - fix xs ys zs :: "'a lower_pd" + fix xs ys zs :: "'a::bifinite lower_pd" show "(xs \\ ys) \\ zs = xs \\ (ys \\ zs)" apply (induct xs rule: lower_pd.principal_induct, simp) apply (induct ys rule: lower_pd.principal_induct, simp) @@ -273,7 +273,7 @@ assumes unit: "\x. P {x}\" assumes insert: "\x ys. \P {x}\; P ys\ \ P ({x}\ \\ ys)" - shows "P (xs::'a lower_pd)" + shows "P (xs::'a::bifinite lower_pd)" apply (induct xs rule: lower_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct1) apply (simp only: lower_unit_Rep_compact_basis [symmetric]) @@ -288,7 +288,7 @@ assumes P: "adm P" assumes unit: "\x. P {x}\" assumes plus: "\xs ys. \P xs; P ys\ \ P (xs \\ ys)" - shows "P (xs::'a lower_pd)" + shows "P (xs::'a::bifinite lower_pd)" apply (induct xs rule: lower_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct) apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit) @@ -300,7 +300,7 @@ definition lower_bind_basis :: - "'a pd_basis \ ('a \ 'b lower_pd) \ 'b lower_pd" where + "'a::bifinite pd_basis \ ('a \ 'b lower_pd) \ 'b::bifinite lower_pd" where "lower_bind_basis = fold_pd (\a. \ f. f\(Rep_compact_basis a)) (\x y. \ f. x\f \\ y\f)" @@ -334,7 +334,7 @@ done definition - lower_bind :: "'a lower_pd \ ('a \ 'b lower_pd) \ 'b lower_pd" where + lower_bind :: "'a::bifinite lower_pd \ ('a \ 'b lower_pd) \ 'b::bifinite lower_pd" where "lower_bind = lower_pd.extension lower_bind_basis" syntax @@ -371,7 +371,7 @@ subsection \Map\ definition - lower_map :: "('a \ 'b) \ 'a lower_pd \ 'b lower_pd" where + lower_map :: "('a::bifinite \ 'b::bifinite) \ 'a lower_pd \ 'b lower_pd" where "lower_map = (\ f xs. lower_bind\xs\(\ x. {f\x}\))" lemma lower_map_unit [simp]: @@ -479,7 +479,7 @@ subsection \Join\ definition - lower_join :: "'a lower_pd lower_pd \ 'a lower_pd" where + lower_join :: "'a::bifinite lower_pd lower_pd \ 'a lower_pd" where "lower_join = (\ xss. lower_bind\xss\(\ xs. xs))" lemma lower_join_unit [simp]: diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Map_Functions.thy --- a/src/HOL/HOLCF/Map_Functions.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Map_Functions.thy Thu Dec 12 15:45:29 2024 +0100 @@ -10,8 +10,6 @@ subsection \Map operator for continuous function space\ -default_sort cpo - definition cfun_map :: "('b \ 'a) \ ('c \ 'd) \ ('a \ 'c) \ ('b \ 'd)" where "cfun_map = (\ a b f x. b\(f\(a\x)))" @@ -214,9 +212,7 @@ subsection \Map function for strict products\ -default_sort pcpo - -definition sprod_map :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" +definition sprod_map :: "('a::pcpo \ 'b::pcpo) \ ('c::pcpo \ 'd::pcpo) \ 'a \ 'c \ 'b \ 'd" where "sprod_map = (\ f g. ssplit\(\ x y. (:f\x, g\y:)))" lemma sprod_map_strict [simp]: "sprod_map\a\b\\ = \" @@ -315,7 +311,7 @@ subsection \Map function for strict sums\ -definition ssum_map :: "('a \ 'b) \ ('c \ 'd) \ 'a \ 'c \ 'b \ 'd" +definition ssum_map :: "('a::pcpo \ 'b::pcpo) \ ('c::pcpo \ 'd::pcpo) \ 'a \ 'c \ 'b \ 'd" where "ssum_map = (\ f g. sscase\(sinl oo f)\(sinr oo g))" lemma ssum_map_strict [simp]: "ssum_map\f\g\\ = \" @@ -422,7 +418,7 @@ subsection \Map operator for strict function space\ -definition sfun_map :: "('b \ 'a) \ ('c \ 'd) \ ('a \! 'c) \ ('b \! 'd)" +definition sfun_map :: "('b::pcpo \ 'a::pcpo) \ ('c::pcpo \ 'd::pcpo) \ ('a \! 'c) \ ('b \! 'd)" where "sfun_map = (\ a b. sfun_abs oo cfun_map\a\b oo sfun_rep)" lemma sfun_map_ID: "sfun_map\ID\ID = ID" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Representable.thy --- a/src/HOL/HOLCF/Representable.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Representable.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,9 +8,6 @@ imports Algebraic Map_Functions "HOL-Library.Countable" begin -default_sort cpo - - subsection \Class of representable domains\ text \ diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Sfun.thy --- a/src/HOL/HOLCF/Sfun.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Sfun.thy Thu Dec 12 15:45:29 2024 +0100 @@ -8,7 +8,7 @@ imports Cfun begin -pcpodef ('a, 'b) sfun (infixr \\!\ 0) = "{f :: 'a \ 'b. f\\ = \}" +pcpodef ('a::pcpo, 'b::pcpo) sfun (infixr \\!\ 0) = "{f :: 'a \ 'b. f\\ = \}" by simp_all type_notation (ASCII) @@ -16,10 +16,10 @@ text \TODO: Define nice syntax for abstraction, application.\ -definition sfun_abs :: "('a \ 'b) \ ('a \! 'b)" +definition sfun_abs :: "('a::pcpo \ 'b::pcpo) \ ('a \! 'b)" where "sfun_abs = (\ f. Abs_sfun (strictify\f))" -definition sfun_rep :: "('a \! 'b) \ 'a \ 'b" +definition sfun_rep :: "('a::pcpo \! 'b::pcpo) \ 'a \ 'b" where "sfun_rep = (\ f. Rep_sfun f)" lemma sfun_rep_beta: "sfun_rep\f = Rep_sfun f" diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Sprod.thy --- a/src/HOL/HOLCF/Sprod.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Sprod.thy Thu Dec 12 15:45:29 2024 +0100 @@ -9,14 +9,12 @@ imports Cfun begin -default_sort pcpo - - subsection \Definition of strict product type\ -definition "sprod = {p::'a \ 'b. p = \ \ (fst p \ \ \ snd p \ \)}" +definition "sprod = {p::'a::pcpo \ 'b::pcpo. p = \ \ (fst p \ \ \ snd p \ \)}" -pcpodef ('a, 'b) sprod (\(\notation=\infix strict product\\_ \/ _)\ [21,20] 20) = "sprod :: ('a \ 'b) set" +pcpodef ('a::pcpo, 'b::pcpo) sprod (\(\notation=\infix strict product\\_ \/ _)\ [21,20] 20) = + "sprod :: ('a \ 'b) set" by (simp_all add: sprod_def) instance sprod :: ("{chfin,pcpo}", "{chfin,pcpo}") chfin @@ -28,16 +26,16 @@ subsection \Definitions of constants\ -definition sfst :: "('a ** 'b) \ 'a" +definition sfst :: "('a::pcpo ** 'b::pcpo) \ 'a" where "sfst = (\ p. fst (Rep_sprod p))" -definition ssnd :: "('a ** 'b) \ 'b" +definition ssnd :: "('a::pcpo ** 'b::pcpo) \ 'b" where "ssnd = (\ p. snd (Rep_sprod p))" -definition spair :: "'a \ 'b \ ('a ** 'b)" +definition spair :: "'a::pcpo \ 'b::pcpo \ ('a ** 'b)" where "spair = (\ a b. Abs_sprod (seq\b\a, seq\a\b))" -definition ssplit :: "('a \ 'b \ 'c) \ ('a ** 'b) \ 'c" +definition ssplit :: "('a::pcpo \ 'b::pcpo \ 'c::pcpo) \ ('a ** 'b) \ 'c" where "ssplit = (\ f p. seq\p\(f\(sfst\p)\(ssnd\p)))" syntax diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Ssum.thy --- a/src/HOL/HOLCF/Ssum.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Ssum.thy Thu Dec 12 15:45:29 2024 +0100 @@ -9,17 +9,15 @@ imports Tr begin -default_sort pcpo - - subsection \Definition of strict sum type\ definition "ssum = - {p :: tr \ ('a \ 'b). p = \ \ + {p :: tr \ ('a::pcpo \ 'b::pcpo). p = \ \ (fst p = TT \ fst (snd p) \ \ \ snd (snd p) = \) \ (fst p = FF \ fst (snd p) = \ \ snd (snd p) \ \)}" -pcpodef ('a, 'b) ssum (\(\notation=\infix strict sum\\_ \/ _)\ [21, 20] 20) = "ssum :: (tr \ 'a \ 'b) set" +pcpodef ('a::pcpo, 'b::pcpo) ssum (\(\notation=\infix strict sum\\_ \/ _)\ [21, 20] 20) = + "ssum :: (tr \ 'a \ 'b) set" by (simp_all add: ssum_def) instance ssum :: ("{chfin,pcpo}", "{chfin,pcpo}") chfin @@ -31,10 +29,10 @@ subsection \Definitions of constructors\ -definition sinl :: "'a \ ('a ++ 'b)" +definition sinl :: "'a::pcpo \ ('a ++ 'b::pcpo)" where "sinl = (\ a. Abs_ssum (seq\a\TT, a, \))" -definition sinr :: "'b \ ('a ++ 'b)" +definition sinr :: "'b::pcpo \ ('a::pcpo ++ 'b)" where "sinr = (\ b. Abs_ssum (seq\b\FF, \, b))" lemma sinl_ssum: "(seq\a\TT, a, \) \ ssum" @@ -161,7 +159,7 @@ subsection \Case analysis combinator\ -definition sscase :: "('a \ 'c) \ ('b \ 'c) \ ('a ++ 'b) \ 'c" +definition sscase :: "('a::pcpo \ 'c::pcpo) \ ('b::pcpo \ 'c) \ ('a ++ 'b) \ 'c" where "sscase = (\ f g s. (\(t, x, y). If t then f\x else g\y) (Rep_ssum s))" translations diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Tr.thy --- a/src/HOL/HOLCF/Tr.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Tr.thy Thu Dec 12 15:45:29 2024 +0100 @@ -58,12 +58,10 @@ subsection \Case analysis\ -default_sort pcpo - -definition tr_case :: "'a \ 'a \ tr \ 'a" +definition tr_case :: "'a::pcpo \ 'a \ tr \ 'a" where "tr_case = (\ t e (Def b). if b then t else e)" -abbreviation cifte_syn :: "[tr, 'c, 'c] \ 'c" (\(\notation=\mixfix If expression\\If (_)/ then (_)/ else (_))\ [0, 0, 60] 60) +abbreviation cifte_syn :: "[tr, 'c::pcpo, 'c] \ 'c" (\(\notation=\mixfix If expression\\If (_)/ then (_)/ else (_))\ [0, 0, 60] 60) where "If b then e1 else e2 \ tr_case\e1\e2\b" translations @@ -94,7 +92,7 @@ definition neg :: "tr \ tr" where "neg = flift2 Not" -definition If2 :: "tr \ 'c \ 'c \ 'c" +definition If2 :: "tr \ 'c::pcpo \ 'c \ 'c" where "If2 Q x y = (If Q then x else y)" text \tactic for tr-thms with case split\ diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Universal.thy --- a/src/HOL/HOLCF/Universal.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Universal.thy Thu Dec 12 15:45:29 2024 +0100 @@ -255,7 +255,7 @@ by (rule typedef_po) definition - approximants :: "'a \ 'a compact_basis set" where + approximants :: "'a::pcpo \ 'a compact_basis set" where "approximants = (\x. {a. Rep_compact_basis a \ x})" definition diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/Up.thy --- a/src/HOL/HOLCF/Up.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/Up.thy Thu Dec 12 15:45:29 2024 +0100 @@ -9,9 +9,6 @@ imports Cfun begin -default_sort cpo - - subsection \Definition of new type for lifting\ datatype 'a u (\(\notation=\postfix lifting\\_\<^sub>\)\ [1000] 999) = Ibottom | Iup 'a diff -r c3190d0b068c -r b6df83045178 src/HOL/HOLCF/UpperPD.thy --- a/src/HOL/HOLCF/UpperPD.thy Thu Dec 12 12:35:59 2024 +0100 +++ b/src/HOL/HOLCF/UpperPD.thy Thu Dec 12 15:45:29 2024 +0100 @@ -11,7 +11,7 @@ subsection \Basis preorder\ definition - upper_le :: "'a pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where + upper_le :: "'a::bifinite pd_basis \ 'a pd_basis \ bool" (infix \\\\ 50) where "upper_le = (\u v. \y\Rep_pd_basis v. \x\Rep_pd_basis u. x \ y)" lemma upper_le_refl [simp]: "t \\ t" @@ -72,7 +72,7 @@ subsection \Type definition\ -typedef 'a upper_pd (\(\notation=\postfix upper_pd\\'(_')\)\) = +typedef 'a::bifinite upper_pd (\(\notation=\postfix upper_pd\\'(_')\)\) = "{S::'a pd_basis set. upper_le.ideal S}" by (rule upper_le.ex_ideal) @@ -94,7 +94,7 @@ by (rule upper_le.typedef_ideal_cpo) definition - upper_principal :: "'a pd_basis \ 'a upper_pd" where + upper_principal :: "'a::bifinite pd_basis \ 'a upper_pd" where "upper_principal t = Abs_upper_pd {u. u \\ t}" interpretation upper_pd: @@ -118,16 +118,16 @@ subsection \Monadic unit and plus\ definition - upper_unit :: "'a \ 'a upper_pd" where + upper_unit :: "'a::bifinite \ 'a upper_pd" where "upper_unit = compact_basis.extension (\a. upper_principal (PDUnit a))" definition - upper_plus :: "'a upper_pd \ 'a upper_pd \ 'a upper_pd" where + upper_plus :: "'a::bifinite upper_pd \ 'a upper_pd \ 'a upper_pd" where "upper_plus = upper_pd.extension (\t. upper_pd.extension (\u. upper_principal (PDPlus t u)))" abbreviation - upper_add :: "'a upper_pd \ 'a upper_pd \ 'a upper_pd" + upper_add :: "'a::bifinite upper_pd \ 'a upper_pd \ 'a upper_pd" (infixl \\\\ 65) where "xs \\ ys == upper_plus\xs\ys" @@ -266,7 +266,7 @@ assumes P: "adm P" assumes unit: "\x. P {x}\" assumes insert: "\x ys. \P {x}\; P ys\ \ P ({x}\ \\ ys)" - shows "P (xs::'a upper_pd)" + shows "P (xs::'a::bifinite upper_pd)" apply (induct xs rule: upper_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct1) apply (simp only: upper_unit_Rep_compact_basis [symmetric]) @@ -281,7 +281,7 @@ assumes P: "adm P" assumes unit: "\x. P {x}\" assumes plus: "\xs ys. \P xs; P ys\ \ P (xs \\ ys)" - shows "P (xs::'a upper_pd)" + shows "P (xs::'a::bifinite upper_pd)" apply (induct xs rule: upper_pd.principal_induct, rule P) apply (induct_tac a rule: pd_basis_induct) apply (simp only: upper_unit_Rep_compact_basis [symmetric] unit) @@ -293,7 +293,7 @@ definition upper_bind_basis :: - "'a pd_basis \ ('a \ 'b upper_pd) \ 'b upper_pd" where + "'a::bifinite pd_basis \ ('a \ 'b upper_pd) \ 'b::bifinite upper_pd" where "upper_bind_basis = fold_pd (\a. \ f. f\(Rep_compact_basis a)) (\x y. \ f. x\f \\ y\f)" @@ -327,7 +327,7 @@ done definition - upper_bind :: "'a upper_pd \ ('a \ 'b upper_pd) \ 'b upper_pd" where + upper_bind :: "'a::bifinite upper_pd \ ('a \ 'b upper_pd) \ 'b::bifinite upper_pd" where "upper_bind = upper_pd.extension upper_bind_basis" syntax @@ -364,7 +364,7 @@ subsection \Map\ definition - upper_map :: "('a \ 'b) \ 'a upper_pd \ 'b upper_pd" where + upper_map :: "('a::bifinite \ 'b::bifinite) \ 'a upper_pd \ 'b upper_pd" where "upper_map = (\ f xs. upper_bind\xs\(\ x. {f\x}\))" lemma upper_map_unit [simp]: @@ -472,7 +472,7 @@ subsection \Join\ definition - upper_join :: "'a upper_pd upper_pd \ 'a upper_pd" where + upper_join :: "'a::bifinite upper_pd upper_pd \ 'a upper_pd" where "upper_join = (\ xss. upper_bind\xss\(\ xs. xs))" lemma upper_join_unit [simp]: