| author | nipkow | 
| Tue, 29 Oct 2024 10:26:06 +0100 | |
| changeset 81285 | 34f3ec8d4d24 | 
| parent 81095 | 49c04500c5f9 | 
| child 81545 | 6f8a56a6b391 | 
| permissions | -rw-r--r-- | 
| 42151 | 1 | (* Title: HOL/HOLCF/Cfun.thy | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 2 | Author: Franz Regensburger | 
| 35794 | 3 | Author: Brian Huffman | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 4 | *) | 
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 5 | |
| 62175 | 6 | section \<open>The type of continuous functions\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 7 | |
| 15577 | 8 | theory Cfun | 
| 67312 | 9 | imports Cpodef Fun_Cpo Product_Cpo | 
| 15577 | 10 | begin | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 11 | |
| 36452 | 12 | default_sort cpo | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 13 | |
| 67312 | 14 | |
| 62175 | 15 | subsection \<open>Definition of continuous function type\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 16 | |
| 67312 | 17 | definition "cfun = {f::'a \<Rightarrow> 'b. cont f}"
 | 
| 45695 | 18 | |
| 81095 | 19 | cpodef ('a, 'b) cfun (\<open>(\<open>notation=\<open>infix \<rightarrow>\<close>\<close>_ \<rightarrow>/ _)\<close> [1, 0] 0) = "cfun :: ('a \<Rightarrow> 'b) set"
 | 
| 67312 | 20 | by (auto simp: cfun_def intro: cont_const adm_cont) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 21 | |
| 61998 | 22 | type_notation (ASCII) | 
| 80914 
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
 wenzelm parents: 
80768diff
changeset | 23 | cfun (infixr \<open>->\<close> 0) | 
| 61998 | 24 | |
| 25 | notation (ASCII) | |
| 81095 | 26 | Rep_cfun (\<open>(\<open>notation=\<open>infix $\<close>\<close>_$/_)\<close> [999,1000] 999) | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 27 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23152diff
changeset | 28 | notation | 
| 81095 | 29 | Rep_cfun (\<open>(\<open>notation=\<open>infix \<cdot>\<close>\<close>_\<cdot>/_)\<close> [999,1000] 999) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 30 | |
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 31 | |
| 62175 | 32 | subsection \<open>Syntax for continuous lambda abstraction\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 33 | |
| 41479 | 34 | syntax "_cabs" :: "[logic, logic] \<Rightarrow> logic" | 
| 18078 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 huffman parents: 
18076diff
changeset | 35 | |
| 62175 | 36 | parse_translation \<open> | 
| 40327 | 37 | (* rewrite (_cabs x t) => (Abs_cfun (%x. t)) *) | 
| 69597 | 38 | [Syntax_Trans.mk_binder_tr (\<^syntax_const>\<open>_cabs\<close>, \<^const_syntax>\<open>Abs_cfun\<close>)] | 
| 62175 | 39 | \<close> | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 40 | |
| 62175 | 41 | print_translation \<open> | 
| 69597 | 42 | [(\<^const_syntax>\<open>Abs_cfun\<close>, fn _ => fn [Abs abs] => | 
| 42284 | 43 | let val (x, t) = Syntax_Trans.atomic_abs_tr' abs | 
| 69597 | 44 | in Syntax.const \<^syntax_const>\<open>_cabs\<close> $ x $ t end)] | 
| 62175 | 45 | \<close> \<comment> \<open>To avoid eta-contraction of body\<close> | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 46 | |
| 62175 | 47 | text \<open>Syntax for nested abstractions\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 48 | |
| 61998 | 49 | syntax (ASCII) | 
| 81095 | 50 | "_Lambda" :: "[cargs, logic] \<Rightarrow> logic" (\<open>(\<open>indent=3 notation=\<open>binder LAM\<close>\<close>LAM _./ _)\<close> [1000, 10] 10) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 51 | |
| 61998 | 52 | syntax | 
| 81095 | 53 | "_Lambda" :: "[cargs, logic] \<Rightarrow> logic" (\<open>(\<open>indent=3 notation=\<open>binder \<Lambda>\<close>\<close>\<Lambda> _./ _)\<close> [1000, 10] 10) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 54 | |
| 80768 | 55 | syntax_consts | 
| 56 | "_Lambda" \<rightleftharpoons> Abs_cfun | |
| 57 | ||
| 62175 | 58 | parse_ast_translation \<open> | 
| 35115 | 59 | (* rewrite (LAM x y z. t) => (_cabs x (_cabs y (_cabs z t))) *) | 
| 60 | (* cf. Syntax.lambda_ast_tr from src/Pure/Syntax/syn_trans.ML *) | |
| 18078 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 huffman parents: 
18076diff
changeset | 61 | let | 
| 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 huffman parents: 
18076diff
changeset | 62 | fun Lambda_ast_tr [pats, body] = | 
| 69597 | 63 | Ast.fold_ast_p \<^syntax_const>\<open>_cabs\<close> | 
| 64 | (Ast.unfold_ast \<^syntax_const>\<open>_cargs\<close> (Ast.strip_positions pats), body) | |
| 42224 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
 wenzelm parents: 
42151diff
changeset | 65 |       | Lambda_ast_tr asts = raise Ast.AST ("Lambda_ast_tr", asts);
 | 
| 69597 | 66 | in [(\<^syntax_const>\<open>_Lambda\<close>, K Lambda_ast_tr)] end | 
| 62175 | 67 | \<close> | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 68 | |
| 62175 | 69 | print_ast_translation \<open> | 
| 35115 | 70 | (* rewrite (_cabs x (_cabs y (_cabs z t))) => (LAM x y z. t) *) | 
| 71 | (* cf. Syntax.abs_ast_tr' from src/Pure/Syntax/syn_trans.ML *) | |
| 18078 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 huffman parents: 
18076diff
changeset | 72 | let | 
| 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 huffman parents: 
18076diff
changeset | 73 | fun cabs_ast_tr' asts = | 
| 69597 | 74 | (case Ast.unfold_ast_p \<^syntax_const>\<open>_cabs\<close> | 
| 75 | (Ast.Appl (Ast.Constant \<^syntax_const>\<open>_cabs\<close> :: asts)) of | |
| 42224 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
 wenzelm parents: 
42151diff
changeset | 76 |         ([], _) => raise Ast.AST ("cabs_ast_tr'", asts)
 | 
| 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
 wenzelm parents: 
42151diff
changeset | 77 | | (xs, body) => Ast.Appl | 
| 69597 | 78 | [Ast.Constant \<^syntax_const>\<open>_Lambda\<close>, | 
| 79 | Ast.fold_ast \<^syntax_const>\<open>_cargs\<close> xs, body]); | |
| 80 | in [(\<^syntax_const>\<open>_cabs\<close>, K cabs_ast_tr')] end | |
| 62175 | 81 | \<close> | 
| 15641 | 82 | |
| 62175 | 83 | text \<open>Dummy patterns for continuous abstraction\<close> | 
| 18079 | 84 | translations | 
| 67312 | 85 | "\<Lambda> _. t" \<rightharpoonup> "CONST Abs_cfun (\<lambda>_. t)" | 
| 86 | ||
| 18087 | 87 | |
| 62175 | 88 | subsection \<open>Continuous function space is pointed\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 89 | |
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41400diff
changeset | 90 | lemma bottom_cfun: "\<bottom> \<in> cfun" | 
| 67312 | 91 | by (simp add: cfun_def inst_fun_pcpo) | 
| 16098 | 92 | |
| 35525 | 93 | instance cfun :: (cpo, discrete_cpo) discrete_cpo | 
| 67312 | 94 | by intro_classes (simp add: below_cfun_def Rep_cfun_inject) | 
| 26025 | 95 | |
| 35525 | 96 | instance cfun :: (cpo, pcpo) pcpo | 
| 67312 | 97 | by (rule typedef_pcpo [OF type_definition_cfun below_cfun_def bottom_cfun]) | 
| 16098 | 98 | |
| 40327 | 99 | lemmas Rep_cfun_strict = | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41400diff
changeset | 100 | typedef_Rep_strict [OF type_definition_cfun below_cfun_def bottom_cfun] | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 101 | |
| 40327 | 102 | lemmas Abs_cfun_strict = | 
| 41430 
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
 huffman parents: 
41400diff
changeset | 103 | typedef_Abs_strict [OF type_definition_cfun below_cfun_def bottom_cfun] | 
| 16098 | 104 | |
| 62175 | 105 | text \<open>function application is strict in its first argument\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 106 | |
| 40327 | 107 | lemma Rep_cfun_strict1 [simp]: "\<bottom>\<cdot>x = \<bottom>" | 
| 67312 | 108 | by (simp add: Rep_cfun_strict) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 109 | |
| 35641 | 110 | lemma LAM_strict [simp]: "(\<Lambda> x. \<bottom>) = \<bottom>" | 
| 67312 | 111 | by (simp add: inst_fun_pcpo [symmetric] Abs_cfun_strict) | 
| 35641 | 112 | |
| 62175 | 113 | text \<open>for compatibility with old HOLCF-Version\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 114 | lemma inst_cfun_pcpo: "\<bottom> = (\<Lambda> x. \<bottom>)" | 
| 67312 | 115 | by simp | 
| 116 | ||
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 117 | |
| 62175 | 118 | subsection \<open>Basic properties of continuous functions\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 119 | |
| 62175 | 120 | text \<open>Beta-equality for continuous functions\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 121 | |
| 40327 | 122 | lemma Abs_cfun_inverse2: "cont f \<Longrightarrow> Rep_cfun (Abs_cfun f) = f" | 
| 67312 | 123 | by (simp add: Abs_cfun_inverse cfun_def) | 
| 16098 | 124 | |
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 125 | lemma beta_cfun: "cont f \<Longrightarrow> (\<Lambda> x. f x)\<cdot>u = f u" | 
| 67312 | 126 | by (simp add: Abs_cfun_inverse2) | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 127 | |
| 67312 | 128 | |
| 129 | subsubsection \<open>Beta-reduction simproc\<close> | |
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 130 | |
| 62175 | 131 | text \<open> | 
| 69597 | 132 | Given the term \<^term>\<open>(\<Lambda> x. f x)\<cdot>y\<close>, the procedure tries to | 
| 133 | construct the theorem \<^term>\<open>(\<Lambda> x. f x)\<cdot>y \<equiv> f y\<close>. If this | |
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 134 | theorem cannot be completely solved by the cont2cont rules, then | 
| 62175 | 135 | the procedure returns the ordinary conditional \<open>beta_cfun\<close> | 
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 136 | rule. | 
| 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 137 | |
| 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 138 | The simproc does not solve any more goals that would be solved by | 
| 62175 | 139 | using \<open>beta_cfun\<close> as a simp rule. The advantage of the | 
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 140 | simproc is that it can avoid deeply-nested calls to the simplifier | 
| 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 141 | that would otherwise be caused by large continuity side conditions. | 
| 41322 
43a5b9a0ee8a
beta-reduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against eta-contraction
 huffman parents: 
41031diff
changeset | 142 | |
| 62175 | 143 | Update: The simproc now uses rule \<open>Abs_cfun_inverse2\<close> instead | 
| 144 | of \<open>beta_cfun\<close>, to avoid problems with eta-contraction. | |
| 145 | \<close> | |
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 146 | |
| 62175 | 147 | simproc_setup beta_cfun_proc ("Rep_cfun (Abs_cfun f)") = \<open>
 | 
| 78099 
4d9349989d94
more uniform simproc_setup: avoid vacuous abstraction over morphism, which sometimes captures context values in its functional closure;
 wenzelm parents: 
69597diff
changeset | 148 | K (fn ctxt => fn ct => | 
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 149 | let | 
| 67312 | 150 | val f = #2 (Thm.dest_comb (#2 (Thm.dest_comb ct))); | 
| 59586 | 151 | val [T, U] = Thm.dest_ctyp (Thm.ctyp_of_cterm f); | 
| 67312 | 152 |       val tr = Thm.instantiate' [SOME T, SOME U] [SOME f] (mk_meta_eq @{thm Abs_cfun_inverse2});
 | 
| 153 | val rules = Named_Theorems.get ctxt \<^named_theorems>\<open>cont2cont\<close>; | |
| 58957 | 154 | val tac = SOLVED' (REPEAT_ALL_NEW (match_tac ctxt (rev rules))); | 
| 78099 
4d9349989d94
more uniform simproc_setup: avoid vacuous abstraction over morphism, which sometimes captures context values in its functional closure;
 wenzelm parents: 
69597diff
changeset | 155 | in SOME (perhaps (SINGLE (tac 1)) tr) end) | 
| 62175 | 156 | \<close> | 
| 37083 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
 huffman parents: 
37079diff
changeset | 157 | |
| 62175 | 158 | text \<open>Eta-equality for continuous functions\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 159 | |
| 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 160 | lemma eta_cfun: "(\<Lambda> x. f\<cdot>x) = f" | 
| 67312 | 161 | by (rule Rep_cfun_inverse) | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 162 | |
| 62175 | 163 | text \<open>Extensionality for continuous functions\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 164 | |
| 40002 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
 huffman parents: 
40001diff
changeset | 165 | lemma cfun_eq_iff: "f = g \<longleftrightarrow> (\<forall>x. f\<cdot>x = g\<cdot>x)" | 
| 67312 | 166 | by (simp add: Rep_cfun_inject [symmetric] fun_eq_iff) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 167 | |
| 40002 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
 huffman parents: 
40001diff
changeset | 168 | lemma cfun_eqI: "(\<And>x. f\<cdot>x = g\<cdot>x) \<Longrightarrow> f = g" | 
| 67312 | 169 | by (simp add: cfun_eq_iff) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 170 | |
| 62175 | 171 | text \<open>Extensionality wrt. ordering for continuous functions\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 172 | |
| 67312 | 173 | lemma cfun_below_iff: "f \<sqsubseteq> g \<longleftrightarrow> (\<forall>x. f\<cdot>x \<sqsubseteq> g\<cdot>x)" | 
| 174 | by (simp add: below_cfun_def fun_below_iff) | |
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 175 | |
| 40002 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
 huffman parents: 
40001diff
changeset | 176 | lemma cfun_belowI: "(\<And>x. f\<cdot>x \<sqsubseteq> g\<cdot>x) \<Longrightarrow> f \<sqsubseteq> g" | 
| 67312 | 177 | by (simp add: cfun_below_iff) | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 178 | |
| 62175 | 179 | text \<open>Congruence for continuous function application\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 180 | |
| 67312 | 181 | lemma cfun_cong: "f = g \<Longrightarrow> x = y \<Longrightarrow> f\<cdot>x = g\<cdot>y" | 
| 182 | by simp | |
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 183 | |
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 184 | lemma cfun_fun_cong: "f = g \<Longrightarrow> f\<cdot>x = g\<cdot>x" | 
| 67312 | 185 | by simp | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 186 | |
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 187 | lemma cfun_arg_cong: "x = y \<Longrightarrow> f\<cdot>x = f\<cdot>y" | 
| 67312 | 188 | by simp | 
| 189 | ||
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 190 | |
| 62175 | 191 | subsection \<open>Continuity of application\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 192 | |
| 40327 | 193 | lemma cont_Rep_cfun1: "cont (\<lambda>f. f\<cdot>x)" | 
| 67312 | 194 | by (rule cont_Rep_cfun [OF cont_id, THEN cont2cont_fun]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 195 | |
| 40327 | 196 | lemma cont_Rep_cfun2: "cont (\<lambda>x. f\<cdot>x)" | 
| 67312 | 197 | using Rep_cfun [where x = f] by (simp add: cfun_def) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 198 | |
| 40327 | 199 | lemmas monofun_Rep_cfun = cont_Rep_cfun [THEN cont2mono] | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 200 | |
| 45606 | 201 | lemmas monofun_Rep_cfun1 = cont_Rep_cfun1 [THEN cont2mono] | 
| 202 | lemmas monofun_Rep_cfun2 = cont_Rep_cfun2 [THEN cont2mono] | |
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 203 | |
| 69597 | 204 | text \<open>contlub, cont properties of \<^term>\<open>Rep_cfun\<close> in each argument\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 205 | |
| 27413 | 206 | lemma contlub_cfun_arg: "chain Y \<Longrightarrow> f\<cdot>(\<Squnion>i. Y i) = (\<Squnion>i. f\<cdot>(Y i))" | 
| 67312 | 207 | by (rule cont_Rep_cfun2 [THEN cont2contlubE]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 208 | |
| 27413 | 209 | lemma contlub_cfun_fun: "chain F \<Longrightarrow> (\<Squnion>i. F i)\<cdot>x = (\<Squnion>i. F i\<cdot>x)" | 
| 67312 | 210 | by (rule cont_Rep_cfun1 [THEN cont2contlubE]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 211 | |
| 62175 | 212 | text \<open>monotonicity of application\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 213 | |
| 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 214 | lemma monofun_cfun_fun: "f \<sqsubseteq> g \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>x" | 
| 67312 | 215 | by (simp add: cfun_below_iff) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 216 | |
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 217 | lemma monofun_cfun_arg: "x \<sqsubseteq> y \<Longrightarrow> f\<cdot>x \<sqsubseteq> f\<cdot>y" | 
| 67312 | 218 | by (rule monofun_Rep_cfun2 [THEN monofunE]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 219 | |
| 67312 | 220 | lemma monofun_cfun: "f \<sqsubseteq> g \<Longrightarrow> x \<sqsubseteq> y \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>y" | 
| 221 | by (rule below_trans [OF monofun_cfun_fun monofun_cfun_arg]) | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 222 | |
| 69597 | 223 | text \<open>ch2ch - rules for the type \<^typ>\<open>'a \<rightarrow> 'b\<close>\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 224 | |
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 225 | lemma chain_monofun: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" | 
| 67312 | 226 | by (erule monofun_Rep_cfun2 [THEN ch2ch_monofun]) | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 227 | |
| 40327 | 228 | lemma ch2ch_Rep_cfunR: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" | 
| 67312 | 229 | by (rule monofun_Rep_cfun2 [THEN ch2ch_monofun]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 230 | |
| 40327 | 231 | lemma ch2ch_Rep_cfunL: "chain F \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>x)" | 
| 67312 | 232 | by (rule monofun_Rep_cfun1 [THEN ch2ch_monofun]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 233 | |
| 67312 | 234 | lemma ch2ch_Rep_cfun [simp]: "chain F \<Longrightarrow> chain Y \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>(Y i))" | 
| 235 | by (simp add: chain_def monofun_cfun) | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 236 | |
| 25884 | 237 | lemma ch2ch_LAM [simp]: | 
| 67312 | 238 | "(\<And>x. chain (\<lambda>i. S i x)) \<Longrightarrow> (\<And>i. cont (\<lambda>x. S i x)) \<Longrightarrow> chain (\<lambda>i. \<Lambda> x. S i x)" | 
| 239 | by (simp add: chain_def cfun_below_iff) | |
| 18092 
2c5d5da79a1e
renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
 huffman parents: 
18091diff
changeset | 240 | |
| 69597 | 241 | text \<open>contlub, cont properties of \<^term>\<open>Rep_cfun\<close> in both arguments\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 242 | |
| 67312 | 243 | lemma lub_APP: "chain F \<Longrightarrow> chain Y \<Longrightarrow> (\<Squnion>i. F i\<cdot>(Y i)) = (\<Squnion>i. F i)\<cdot>(\<Squnion>i. Y i)" | 
| 244 | by (simp add: contlub_cfun_fun contlub_cfun_arg diag_lub) | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 245 | |
| 41027 | 246 | lemma lub_LAM: | 
| 67312 | 247 | assumes "\<And>x. chain (\<lambda>i. F i x)" | 
| 248 | and "\<And>i. cont (\<lambda>x. F i x)" | |
| 249 | shows "(\<Squnion>i. \<Lambda> x. F i x) = (\<Lambda> x. \<Squnion>i. F i x)" | |
| 250 | using assms by (simp add: lub_cfun lub_fun ch2ch_lambda) | |
| 18092 
2c5d5da79a1e
renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
 huffman parents: 
18091diff
changeset | 251 | |
| 41027 | 252 | lemmas lub_distribs = lub_APP lub_LAM | 
| 25901 | 253 | |
| 62175 | 254 | text \<open>strictness\<close> | 
| 16209 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 255 | |
| 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
 huffman parents: 
16098diff
changeset | 256 | lemma strictI: "f\<cdot>x = \<bottom> \<Longrightarrow> f\<cdot>\<bottom> = \<bottom>" | 
| 67312 | 257 | apply (rule bottomI) | 
| 258 | apply (erule subst) | |
| 259 | apply (rule minimal [THEN monofun_cfun_arg]) | |
| 260 | done | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 261 | |
| 69597 | 262 | text \<open>type \<^typ>\<open>'a \<rightarrow> 'b\<close> is chain complete\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 263 | |
| 41031 | 264 | lemma lub_cfun: "chain F \<Longrightarrow> (\<Squnion>i. F i) = (\<Lambda> x. \<Squnion>i. F i\<cdot>x)" | 
| 67312 | 265 | by (simp add: lub_cfun lub_fun ch2ch_lambda) | 
| 266 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 267 | |
| 62175 | 268 | subsection \<open>Continuity simplification procedure\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 269 | |
| 69597 | 270 | text \<open>cont2cont lemma for \<^term>\<open>Rep_cfun\<close>\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 271 | |
| 40326 
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
 huffman parents: 
40093diff
changeset | 272 | lemma cont2cont_APP [simp, cont2cont]: | 
| 29049 | 273 | assumes f: "cont (\<lambda>x. f x)" | 
| 274 | assumes t: "cont (\<lambda>x. t x)" | |
| 275 | shows "cont (\<lambda>x. (f x)\<cdot>(t x))" | |
| 276 | proof - | |
| 67312 | 277 | from cont_Rep_cfun1 f have "cont (\<lambda>x. (f x)\<cdot>y)" for y | 
| 278 | by (rule cont_compose) | |
| 279 | with t cont_Rep_cfun2 show "cont (\<lambda>x. (f x)\<cdot>(t x))" | |
| 280 | by (rule cont_apply) | |
| 29049 | 281 | qed | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 282 | |
| 62175 | 283 | text \<open> | 
| 40008 | 284 | Two specific lemmas for the combination of LCF and HOL terms. | 
| 69597 | 285 | These lemmas are needed in theories that use types like \<^typ>\<open>'a \<rightarrow> 'b \<Rightarrow> 'c\<close>. | 
| 62175 | 286 | \<close> | 
| 40008 | 287 | |
| 67312 | 288 | lemma cont_APP_app [simp]: "cont f \<Longrightarrow> cont g \<Longrightarrow> cont (\<lambda>x. ((f x)\<cdot>(g x)) s)" | 
| 289 | by (rule cont2cont_APP [THEN cont2cont_fun]) | |
| 40008 | 290 | |
| 67312 | 291 | lemma cont_APP_app_app [simp]: "cont f \<Longrightarrow> cont g \<Longrightarrow> cont (\<lambda>x. ((f x)\<cdot>(g x)) s t)" | 
| 292 | by (rule cont_APP_app [THEN cont2cont_fun]) | |
| 40008 | 293 | |
| 294 | ||
| 69597 | 295 | text \<open>cont2mono Lemma for \<^term>\<open>\<lambda>x. LAM y. c1(x)(y)\<close>\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 296 | |
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 297 | lemma cont2mono_LAM: | 
| 29049 | 298 | "\<lbrakk>\<And>x. cont (\<lambda>y. f x y); \<And>y. monofun (\<lambda>x. f x y)\<rbrakk> | 
| 299 | \<Longrightarrow> monofun (\<lambda>x. \<Lambda> y. f x y)" | |
| 67312 | 300 | by (simp add: monofun_def cfun_below_iff) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 301 | |
| 69597 | 302 | text \<open>cont2cont Lemma for \<^term>\<open>\<lambda>x. LAM y. f x y\<close>\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 303 | |
| 62175 | 304 | text \<open> | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 305 | Not suitable as a cont2cont rule, because on nested lambdas | 
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 306 | it causes exponential blow-up in the number of subgoals. | 
| 62175 | 307 | \<close> | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 308 | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 309 | lemma cont2cont_LAM: | 
| 29049 | 310 | assumes f1: "\<And>x. cont (\<lambda>y. f x y)" | 
| 311 | assumes f2: "\<And>y. cont (\<lambda>x. f x y)" | |
| 312 | shows "cont (\<lambda>x. \<Lambda> y. f x y)" | |
| 40327 | 313 | proof (rule cont_Abs_cfun) | 
| 67312 | 314 | from f1 show "f x \<in> cfun" for x | 
| 315 | by (simp add: cfun_def) | |
| 316 | from f2 show "cont f" | |
| 317 | by (rule cont2cont_lambda) | |
| 29049 | 318 | qed | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 319 | |
| 62175 | 320 | text \<open> | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 321 | This version does work as a cont2cont rule, since it | 
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 322 | has only a single subgoal. | 
| 62175 | 323 | \<close> | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 324 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36452diff
changeset | 325 | lemma cont2cont_LAM' [simp, cont2cont]: | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 326 | fixes f :: "'a::cpo \<Rightarrow> 'b::cpo \<Rightarrow> 'c::cpo" | 
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 327 | assumes f: "cont (\<lambda>p. f (fst p) (snd p))" | 
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 328 | shows "cont (\<lambda>x. \<Lambda> y. f x y)" | 
| 67312 | 329 | using assms by (simp add: cont2cont_LAM prod_cont_iff) | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 330 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36452diff
changeset | 331 | lemma cont2cont_LAM_discrete [simp, cont2cont]: | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 332 | "(\<And>y::'a::discrete_cpo. cont (\<lambda>x. f x y)) \<Longrightarrow> cont (\<lambda>x. \<Lambda> y. f x y)" | 
| 67312 | 333 | by (simp add: cont2cont_LAM) | 
| 334 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 335 | |
| 62175 | 336 | subsection \<open>Miscellaneous\<close> | 
| 17832 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
 huffman parents: 
17817diff
changeset | 337 | |
| 69597 | 338 | text \<open>Monotonicity of \<^term>\<open>Abs_cfun\<close>\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 339 | |
| 67312 | 340 | lemma monofun_LAM: "cont f \<Longrightarrow> cont g \<Longrightarrow> (\<And>x. f x \<sqsubseteq> g x) \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)" | 
| 341 | by (simp add: cfun_below_iff) | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 342 | |
| 62175 | 343 | text \<open>some lemmata for functions with flat/chfin domain/range types\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 344 | |
| 67312 | 345 | lemma chfin_Rep_cfunR: "chain Y \<Longrightarrow> \<forall>s. \<exists>n. (LUB i. Y i)\<cdot>s = Y n\<cdot>s" | 
| 346 | for Y :: "nat \<Rightarrow> 'a::cpo \<rightarrow> 'b::chfin" | |
| 347 | apply (rule allI) | |
| 348 | apply (subst contlub_cfun_fun) | |
| 349 | apply assumption | |
| 350 | apply (fast intro!: lub_eqI chfin lub_finch2 chfin2finch ch2ch_Rep_cfunL) | |
| 351 | done | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 352 | |
| 18089 | 353 | lemma adm_chfindom: "adm (\<lambda>(u::'a::cpo \<rightarrow> 'b::chfin). P(u\<cdot>s))" | 
| 67312 | 354 | by (rule adm_subst, simp, rule adm_chfin) | 
| 355 | ||
| 18089 | 356 | |
| 62175 | 357 | subsection \<open>Continuous injection-retraction pairs\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 358 | |
| 62175 | 359 | text \<open>Continuous retractions are strict.\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 360 | |
| 67312 | 361 | lemma retraction_strict: "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> f\<cdot>\<bottom> = \<bottom>" | 
| 362 | apply (rule bottomI) | |
| 363 | apply (drule_tac x="\<bottom>" in spec) | |
| 364 | apply (erule subst) | |
| 365 | apply (rule monofun_cfun_arg) | |
| 366 | apply (rule minimal) | |
| 367 | done | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 368 | |
| 67312 | 369 | lemma injection_eq: "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x = g\<cdot>y) = (x = y)" | 
| 370 | apply (rule iffI) | |
| 371 | apply (drule_tac f=f in cfun_arg_cong) | |
| 372 | apply simp | |
| 373 | apply simp | |
| 374 | done | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 375 | |
| 67312 | 376 | lemma injection_below: "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x \<sqsubseteq> g\<cdot>y) = (x \<sqsubseteq> y)" | 
| 377 | apply (rule iffI) | |
| 378 | apply (drule_tac f=f in monofun_cfun_arg) | |
| 379 | apply simp | |
| 380 | apply (erule monofun_cfun_arg) | |
| 381 | done | |
| 16314 | 382 | |
| 67312 | 383 | lemma injection_defined_rev: "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> g\<cdot>z = \<bottom> \<Longrightarrow> z = \<bottom>" | 
| 384 | apply (drule_tac f=f in cfun_arg_cong) | |
| 385 | apply (simp add: retraction_strict) | |
| 386 | done | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 387 | |
| 67312 | 388 | lemma injection_defined: "\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> z \<noteq> \<bottom> \<Longrightarrow> g\<cdot>z \<noteq> \<bottom>" | 
| 389 | by (erule contrapos_nn, rule injection_defined_rev) | |
| 390 | ||
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 391 | |
| 62175 | 392 | text \<open>a result about functions with flat codomain\<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 393 | |
| 67312 | 394 | lemma flat_eqI: "x \<sqsubseteq> y \<Longrightarrow> x \<noteq> \<bottom> \<Longrightarrow> x = y" | 
| 395 | for x y :: "'a::flat" | |
| 396 | by (drule ax_flat) simp | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 397 | |
| 67312 | 398 | lemma flat_codom: "f\<cdot>x = c \<Longrightarrow> f\<cdot>\<bottom> = \<bottom> \<or> (\<forall>z. f\<cdot>z = c)" | 
| 399 | for c :: "'b::flat" | |
| 68383 | 400 | apply (cases "f\<cdot>x = \<bottom>") | 
| 67312 | 401 | apply (rule disjI1) | 
| 402 | apply (rule bottomI) | |
| 403 | apply (erule_tac t="\<bottom>" in subst) | |
| 404 | apply (rule minimal [THEN monofun_cfun_arg]) | |
| 405 | apply clarify | |
| 406 | apply (rule_tac a = "f\<cdot>\<bottom>" in refl [THEN box_equals]) | |
| 407 | apply (erule minimal [THEN monofun_cfun_arg, THEN flat_eqI]) | |
| 408 | apply (erule minimal [THEN monofun_cfun_arg, THEN flat_eqI]) | |
| 409 | done | |
| 410 | ||
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 411 | |
| 62175 | 412 | subsection \<open>Identity and composition\<close> | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 413 | |
| 67312 | 414 | definition ID :: "'a \<rightarrow> 'a" | 
| 415 | where "ID = (\<Lambda> x. x)" | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
25131diff
changeset | 416 | |
| 67312 | 417 | definition cfcomp  :: "('b \<rightarrow> 'c) \<rightarrow> ('a \<rightarrow> 'b) \<rightarrow> 'a \<rightarrow> 'c"
 | 
| 418 | where oo_def: "cfcomp = (\<Lambda> f g x. f\<cdot>(g\<cdot>x))" | |
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 419 | |
| 80914 
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
 wenzelm parents: 
80768diff
changeset | 420 | abbreviation cfcomp_syn :: "['b \<rightarrow> 'c, 'a \<rightarrow> 'b] \<Rightarrow> 'a \<rightarrow> 'c" (infixr \<open>oo\<close> 100) | 
| 67312 | 421 | where "f oo g == cfcomp\<cdot>f\<cdot>g" | 
| 15589 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 422 | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 423 | lemma ID1 [simp]: "ID\<cdot>x = x" | 
| 67312 | 424 | by (simp add: ID_def) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 425 | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 426 | lemma cfcomp1: "(f oo g) = (\<Lambda> x. f\<cdot>(g\<cdot>x))" | 
| 67312 | 427 | by (simp add: oo_def) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 428 | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 429 | lemma cfcomp2 [simp]: "(f oo g)\<cdot>x = f\<cdot>(g\<cdot>x)" | 
| 67312 | 430 | by (simp add: cfcomp1) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 431 | |
| 27274 | 432 | lemma cfcomp_LAM: "cont g \<Longrightarrow> f oo (\<Lambda> x. g x) = (\<Lambda> x. f\<cdot>(g x))" | 
| 67312 | 433 | by (simp add: cfcomp1) | 
| 27274 | 434 | |
| 19709 | 435 | lemma cfcomp_strict [simp]: "\<bottom> oo f = \<bottom>" | 
| 67312 | 436 | by (simp add: cfun_eq_iff) | 
| 19709 | 437 | |
| 62175 | 438 | text \<open> | 
| 67312 | 439 | Show that interpretation of (pcpo, \<open>_\<rightarrow>_\<close>) is a category. | 
| 440 | \<^item> The class of objects is interpretation of syntactical class pcpo. | |
| 69597 | 441 | \<^item> The class of arrows between objects \<^typ>\<open>'a\<close> and \<^typ>\<open>'b\<close> is interpret. of \<^typ>\<open>'a \<rightarrow> 'b\<close>. | 
| 442 | \<^item> The identity arrow is interpretation of \<^term>\<open>ID\<close>. | |
| 67312 | 443 | \<^item> The composition of f and g is interpretation of \<open>oo\<close>. | 
| 62175 | 444 | \<close> | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 445 | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 446 | lemma ID2 [simp]: "f oo ID = f" | 
| 67312 | 447 | by (rule cfun_eqI, simp) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 448 | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 449 | lemma ID3 [simp]: "ID oo f = f" | 
| 67312 | 450 | by (rule cfun_eqI) simp | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 451 | |
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 452 | lemma assoc_oo: "f oo (g oo h) = (f oo g) oo h" | 
| 67312 | 453 | by (rule cfun_eqI) simp | 
| 454 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 455 | |
| 62175 | 456 | subsection \<open>Strictified functions\<close> | 
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 457 | |
| 36452 | 458 | default_sort pcpo | 
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 459 | |
| 67312 | 460 | definition seq :: "'a \<rightarrow> 'b \<rightarrow> 'b" | 
| 461 | where "seq = (\<Lambda> x. if x = \<bottom> then \<bottom> else ID)" | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 462 | |
| 40794 | 463 | lemma cont2cont_if_bottom [cont2cont, simp]: | 
| 67312 | 464 | assumes f: "cont (\<lambda>x. f x)" | 
| 465 | and g: "cont (\<lambda>x. g x)" | |
| 40794 | 466 | shows "cont (\<lambda>x. if f x = \<bottom> then \<bottom> else g x)" | 
| 467 | proof (rule cont_apply [OF f]) | |
| 67312 | 468 | show "cont (\<lambda>y. if y = \<bottom> then \<bottom> else g x)" for x | 
| 40794 | 469 | unfolding cont_def is_lub_def is_ub_def ball_simps | 
| 470 | by (simp add: lub_eq_bottom_iff) | |
| 67312 | 471 | show "cont (\<lambda>x. if y = \<bottom> then \<bottom> else g x)" for y | 
| 40794 | 472 | by (simp add: g) | 
| 473 | qed | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 474 | |
| 40767 
a3e505b236e7
rename function 'strict' to 'seq', which is its name in Haskell
 huffman parents: 
40502diff
changeset | 475 | lemma seq_conv_if: "seq\<cdot>x = (if x = \<bottom> then \<bottom> else ID)" | 
| 67312 | 476 | by (simp add: seq_def) | 
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 477 | |
| 41400 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
 huffman parents: 
41322diff
changeset | 478 | lemma seq_simps [simp]: | 
| 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
 huffman parents: 
41322diff
changeset | 479 | "seq\<cdot>\<bottom> = \<bottom>" | 
| 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
 huffman parents: 
41322diff
changeset | 480 | "seq\<cdot>x\<cdot>\<bottom> = \<bottom>" | 
| 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
 huffman parents: 
41322diff
changeset | 481 | "x \<noteq> \<bottom> \<Longrightarrow> seq\<cdot>x = ID" | 
| 67312 | 482 | by (simp_all add: seq_conv_if) | 
| 40093 | 483 | |
| 67312 | 484 | definition strictify  :: "('a \<rightarrow> 'b) \<rightarrow> 'a \<rightarrow> 'b"
 | 
| 485 | where "strictify = (\<Lambda> f x. seq\<cdot>x\<cdot>(f\<cdot>x))" | |
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 486 | |
| 17815 | 487 | lemma strictify_conv_if: "strictify\<cdot>f\<cdot>x = (if x = \<bottom> then \<bottom> else f\<cdot>x)" | 
| 67312 | 488 | by (simp add: strictify_def) | 
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 489 | |
| 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 490 | lemma strictify1 [simp]: "strictify\<cdot>f\<cdot>\<bottom> = \<bottom>" | 
| 67312 | 491 | by (simp add: strictify_conv_if) | 
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 492 | |
| 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 493 | lemma strictify2 [simp]: "x \<noteq> \<bottom> \<Longrightarrow> strictify\<cdot>f\<cdot>x = f\<cdot>x" | 
| 67312 | 494 | by (simp add: strictify_conv_if) | 
| 495 | ||
| 16085 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
 huffman parents: 
16070diff
changeset | 496 | |
| 62175 | 497 | subsection \<open>Continuity of let-bindings\<close> | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 498 | |
| 35933 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 499 | lemma cont2cont_Let: | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 500 | assumes f: "cont (\<lambda>x. f x)" | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 501 | assumes g1: "\<And>y. cont (\<lambda>x. g x y)" | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 502 | assumes g2: "\<And>x. cont (\<lambda>y. g x y)" | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 503 | shows "cont (\<lambda>x. let y = f x in g x y)" | 
| 67312 | 504 | unfolding Let_def using f g2 g1 by (rule cont_apply) | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 505 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36452diff
changeset | 506 | lemma cont2cont_Let' [simp, cont2cont]: | 
| 35933 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 507 | assumes f: "cont (\<lambda>x. f x)" | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 508 | assumes g: "cont (\<lambda>p. g (fst p) (snd p))" | 
| 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 509 | shows "cont (\<lambda>x. let y = f x in g x y)" | 
| 67312 | 510 | using f | 
| 35933 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 511 | proof (rule cont2cont_Let) | 
| 67312 | 512 | from g show "cont (\<lambda>y. g x y)" for x | 
| 513 | by (simp add: prod_cont_iff) | |
| 514 | from g show "cont (\<lambda>x. g x y)" for y | |
| 515 | by (simp add: prod_cont_iff) | |
| 35933 
f135ebcc835c
remove continuous let-binding function CLet; add cont2cont rule ordinary Let
 huffman parents: 
35914diff
changeset | 516 | qed | 
| 17816 
9942c5ed866a
new syntax translations for continuous lambda abstraction
 huffman parents: 
17815diff
changeset | 517 | |
| 62175 | 518 | text \<open>The simple version (suggested by Joachim Breitner) is needed if | 
| 519 | the type of the defined term is not a cpo.\<close> | |
| 39145 | 520 | |
| 521 | lemma cont2cont_Let_simple [simp, cont2cont]: | |
| 522 | assumes "\<And>y. cont (\<lambda>x. g x y)" | |
| 523 | shows "cont (\<lambda>x. let y = t in g x y)" | |
| 67312 | 524 | unfolding Let_def using assms . | 
| 39145 | 525 | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: diff
changeset | 526 | end |