103 |
103 |
104 instance "->" :: (finite_po, finite_po) finite_po |
104 instance "->" :: (finite_po, finite_po) finite_po |
105 by (rule typedef_finite_po [OF type_definition_CFun]) |
105 by (rule typedef_finite_po [OF type_definition_CFun]) |
106 |
106 |
107 instance "->" :: (finite_po, chfin) chfin |
107 instance "->" :: (finite_po, chfin) chfin |
108 by (rule typedef_chfin [OF type_definition_CFun less_CFun_def]) |
108 by (rule typedef_chfin [OF type_definition_CFun below_CFun_def]) |
109 |
109 |
110 instance "->" :: (cpo, discrete_cpo) discrete_cpo |
110 instance "->" :: (cpo, discrete_cpo) discrete_cpo |
111 by intro_classes (simp add: less_CFun_def Rep_CFun_inject) |
111 by intro_classes (simp add: below_CFun_def Rep_CFun_inject) |
112 |
112 |
113 instance "->" :: (cpo, pcpo) pcpo |
113 instance "->" :: (cpo, pcpo) pcpo |
114 by (rule typedef_pcpo [OF type_definition_CFun less_CFun_def UU_CFun]) |
114 by (rule typedef_pcpo [OF type_definition_CFun below_CFun_def UU_CFun]) |
115 |
115 |
116 lemmas Rep_CFun_strict = |
116 lemmas Rep_CFun_strict = |
117 typedef_Rep_strict [OF type_definition_CFun less_CFun_def UU_CFun] |
117 typedef_Rep_strict [OF type_definition_CFun below_CFun_def UU_CFun] |
118 |
118 |
119 lemmas Abs_CFun_strict = |
119 lemmas Abs_CFun_strict = |
120 typedef_Abs_strict [OF type_definition_CFun less_CFun_def UU_CFun] |
120 typedef_Abs_strict [OF type_definition_CFun below_CFun_def UU_CFun] |
121 |
121 |
122 text {* function application is strict in its first argument *} |
122 text {* function application is strict in its first argument *} |
123 |
123 |
124 lemma Rep_CFun_strict1 [simp]: "\<bottom>\<cdot>x = \<bottom>" |
124 lemma Rep_CFun_strict1 [simp]: "\<bottom>\<cdot>x = \<bottom>" |
125 by (simp add: Rep_CFun_strict) |
125 by (simp add: Rep_CFun_strict) |
151 lemma ext_cfun: "(\<And>x. f\<cdot>x = g\<cdot>x) \<Longrightarrow> f = g" |
151 lemma ext_cfun: "(\<And>x. f\<cdot>x = g\<cdot>x) \<Longrightarrow> f = g" |
152 by (simp add: expand_cfun_eq) |
152 by (simp add: expand_cfun_eq) |
153 |
153 |
154 text {* Extensionality wrt. ordering for continuous functions *} |
154 text {* Extensionality wrt. ordering for continuous functions *} |
155 |
155 |
156 lemma expand_cfun_less: "f \<sqsubseteq> g = (\<forall>x. f\<cdot>x \<sqsubseteq> g\<cdot>x)" |
156 lemma expand_cfun_below: "f \<sqsubseteq> g = (\<forall>x. f\<cdot>x \<sqsubseteq> g\<cdot>x)" |
157 by (simp add: less_CFun_def expand_fun_less) |
157 by (simp add: below_CFun_def expand_fun_below) |
158 |
158 |
159 lemma less_cfun_ext: "(\<And>x. f\<cdot>x \<sqsubseteq> g\<cdot>x) \<Longrightarrow> f \<sqsubseteq> g" |
159 lemma below_cfun_ext: "(\<And>x. f\<cdot>x \<sqsubseteq> g\<cdot>x) \<Longrightarrow> f \<sqsubseteq> g" |
160 by (simp add: expand_cfun_less) |
160 by (simp add: expand_cfun_below) |
161 |
161 |
162 text {* Congruence for continuous function application *} |
162 text {* Congruence for continuous function application *} |
163 |
163 |
164 lemma cfun_cong: "\<lbrakk>f = g; x = y\<rbrakk> \<Longrightarrow> f\<cdot>x = g\<cdot>y" |
164 lemma cfun_cong: "\<lbrakk>f = g; x = y\<rbrakk> \<Longrightarrow> f\<cdot>x = g\<cdot>y" |
165 by simp |
165 by simp |
203 by (rule cont_Rep_CFun1 [THEN contE]) |
203 by (rule cont_Rep_CFun1 [THEN contE]) |
204 |
204 |
205 text {* monotonicity of application *} |
205 text {* monotonicity of application *} |
206 |
206 |
207 lemma monofun_cfun_fun: "f \<sqsubseteq> g \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>x" |
207 lemma monofun_cfun_fun: "f \<sqsubseteq> g \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>x" |
208 by (simp add: expand_cfun_less) |
208 by (simp add: expand_cfun_below) |
209 |
209 |
210 lemma monofun_cfun_arg: "x \<sqsubseteq> y \<Longrightarrow> f\<cdot>x \<sqsubseteq> f\<cdot>y" |
210 lemma monofun_cfun_arg: "x \<sqsubseteq> y \<Longrightarrow> f\<cdot>x \<sqsubseteq> f\<cdot>y" |
211 by (rule monofun_Rep_CFun2 [THEN monofunE]) |
211 by (rule monofun_Rep_CFun2 [THEN monofunE]) |
212 |
212 |
213 lemma monofun_cfun: "\<lbrakk>f \<sqsubseteq> g; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>y" |
213 lemma monofun_cfun: "\<lbrakk>f \<sqsubseteq> g; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>y" |
214 by (rule trans_less [OF monofun_cfun_fun monofun_cfun_arg]) |
214 by (rule below_trans [OF monofun_cfun_fun monofun_cfun_arg]) |
215 |
215 |
216 text {* ch2ch - rules for the type @{typ "'a -> 'b"} *} |
216 text {* ch2ch - rules for the type @{typ "'a -> 'b"} *} |
217 |
217 |
218 lemma chain_monofun: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" |
218 lemma chain_monofun: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" |
219 by (erule monofun_Rep_CFun2 [THEN ch2ch_monofun]) |
219 by (erule monofun_Rep_CFun2 [THEN ch2ch_monofun]) |
228 "\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>(Y i))" |
228 "\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>(Y i))" |
229 by (simp add: chain_def monofun_cfun) |
229 by (simp add: chain_def monofun_cfun) |
230 |
230 |
231 lemma ch2ch_LAM [simp]: |
231 lemma ch2ch_LAM [simp]: |
232 "\<lbrakk>\<And>x. chain (\<lambda>i. S i x); \<And>i. cont (\<lambda>x. S i x)\<rbrakk> \<Longrightarrow> chain (\<lambda>i. \<Lambda> x. S i x)" |
232 "\<lbrakk>\<And>x. chain (\<lambda>i. S i x); \<And>i. cont (\<lambda>x. S i x)\<rbrakk> \<Longrightarrow> chain (\<lambda>i. \<Lambda> x. S i x)" |
233 by (simp add: chain_def expand_cfun_less) |
233 by (simp add: chain_def expand_cfun_below) |
234 |
234 |
235 text {* contlub, cont properties of @{term Rep_CFun} in both arguments *} |
235 text {* contlub, cont properties of @{term Rep_CFun} in both arguments *} |
236 |
236 |
237 lemma contlub_cfun: |
237 lemma contlub_cfun: |
238 "\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> (\<Squnion>i. F i)\<cdot>(\<Squnion>i. Y i) = (\<Squnion>i. F i\<cdot>(Y i))" |
238 "\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> (\<Squnion>i. F i)\<cdot>(\<Squnion>i. Y i) = (\<Squnion>i. F i\<cdot>(Y i))" |
314 text {* cont2mono Lemma for @{term "%x. LAM y. c1(x)(y)"} *} |
314 text {* cont2mono Lemma for @{term "%x. LAM y. c1(x)(y)"} *} |
315 |
315 |
316 lemma cont2mono_LAM: |
316 lemma cont2mono_LAM: |
317 "\<lbrakk>\<And>x. cont (\<lambda>y. f x y); \<And>y. monofun (\<lambda>x. f x y)\<rbrakk> |
317 "\<lbrakk>\<And>x. cont (\<lambda>y. f x y); \<And>y. monofun (\<lambda>x. f x y)\<rbrakk> |
318 \<Longrightarrow> monofun (\<lambda>x. \<Lambda> y. f x y)" |
318 \<Longrightarrow> monofun (\<lambda>x. \<Lambda> y. f x y)" |
319 unfolding monofun_def expand_cfun_less by simp |
319 unfolding monofun_def expand_cfun_below by simp |
320 |
320 |
321 text {* cont2cont Lemma for @{term "%x. LAM y. f x y"} *} |
321 text {* cont2cont Lemma for @{term "%x. LAM y. f x y"} *} |
322 |
322 |
323 text {* |
323 text {* |
324 Not suitable as a cont2cont rule, because on nested lambdas |
324 Not suitable as a cont2cont rule, because on nested lambdas |
363 |
363 |
364 text {* Monotonicity of @{term Abs_CFun} *} |
364 text {* Monotonicity of @{term Abs_CFun} *} |
365 |
365 |
366 lemma semi_monofun_Abs_CFun: |
366 lemma semi_monofun_Abs_CFun: |
367 "\<lbrakk>cont f; cont g; f \<sqsubseteq> g\<rbrakk> \<Longrightarrow> Abs_CFun f \<sqsubseteq> Abs_CFun g" |
367 "\<lbrakk>cont f; cont g; f \<sqsubseteq> g\<rbrakk> \<Longrightarrow> Abs_CFun f \<sqsubseteq> Abs_CFun g" |
368 by (simp add: less_CFun_def Abs_CFun_inverse2) |
368 by (simp add: below_CFun_def Abs_CFun_inverse2) |
369 |
369 |
370 text {* some lemmata for functions with flat/chfin domain/range types *} |
370 text {* some lemmata for functions with flat/chfin domain/range types *} |
371 |
371 |
372 lemma chfin_Rep_CFunR: "chain (Y::nat => 'a::cpo->'b::chfin) |
372 lemma chfin_Rep_CFunR: "chain (Y::nat => 'a::cpo->'b::chfin) |
373 ==> !s. ? n. (LUB i. Y i)$s = Y n$s" |
373 ==> !s. ? n. (LUB i. Y i)$s = Y n$s" |
399 apply (drule_tac f=f in cfun_arg_cong) |
399 apply (drule_tac f=f in cfun_arg_cong) |
400 apply simp |
400 apply simp |
401 apply simp |
401 apply simp |
402 done |
402 done |
403 |
403 |
404 lemma injection_less: |
404 lemma injection_below: |
405 "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x \<sqsubseteq> g\<cdot>y) = (x \<sqsubseteq> y)" |
405 "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x \<sqsubseteq> g\<cdot>y) = (x \<sqsubseteq> y)" |
406 apply (rule iffI) |
406 apply (rule iffI) |
407 apply (drule_tac f=f in monofun_cfun_arg) |
407 apply (drule_tac f=f in monofun_cfun_arg) |
408 apply simp |
408 apply simp |
409 apply (erule monofun_cfun_arg) |
409 apply (erule monofun_cfun_arg) |