| author | Lars Hupel <lars.hupel@mytum.de> | 
| Tue, 22 Aug 2017 08:55:07 +0200 | |
| changeset 66481 | d35f7a9f92e2 | 
| parent 62175 | 8ffc4d0e652d | 
| child 67312 | 0d25e02759b7 | 
| permissions | -rw-r--r-- | 
| 42151 | 1 | (* Title: HOL/HOLCF/Cont.thy | 
| 1479 | 2 | Author: Franz Regensburger | 
| 35794 | 3 | Author: Brian Huffman | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 4 | *) | 
| 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 5 | |
| 62175 | 6 | section \<open>Continuity and monotonicity\<close> | 
| 15577 | 7 | |
| 8 | theory Cont | |
| 25786 | 9 | imports Pcpo | 
| 15577 | 10 | begin | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 11 | |
| 62175 | 12 | text \<open> | 
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 13 | Now we change the default class! Form now on all untyped type variables are | 
| 3323 
194ae2e0c193
eliminated the constant less by the introduction of the axclass sq_ord
 slotosch parents: 
2838diff
changeset | 14 | of default class po | 
| 62175 | 15 | \<close> | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 16 | |
| 36452 | 17 | default_sort po | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 18 | |
| 62175 | 19 | subsection \<open>Definitions\<close> | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 20 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 21 | definition | 
| 62175 | 22 |   monofun :: "('a \<Rightarrow> 'b) \<Rightarrow> bool"  \<comment> "monotonicity"  where
 | 
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 23 | "monofun f = (\<forall>x y. x \<sqsubseteq> y \<longrightarrow> f x \<sqsubseteq> f y)" | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 24 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 25 | definition | 
| 35914 | 26 |   cont :: "('a::cpo \<Rightarrow> 'b::cpo) \<Rightarrow> bool"
 | 
| 27 | where | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 28 | "cont f = (\<forall>Y. chain Y \<longrightarrow> range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i))" | 
| 15565 | 29 | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 30 | lemma contI: | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 31 | "\<lbrakk>\<And>Y. chain Y \<Longrightarrow> range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i)\<rbrakk> \<Longrightarrow> cont f" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 32 | by (simp add: cont_def) | 
| 15565 | 33 | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 34 | lemma contE: | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 35 | "\<lbrakk>cont f; chain Y\<rbrakk> \<Longrightarrow> range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i)" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 36 | by (simp add: cont_def) | 
| 15565 | 37 | |
| 38 | lemma monofunI: | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 39 | "\<lbrakk>\<And>x y. x \<sqsubseteq> y \<Longrightarrow> f x \<sqsubseteq> f y\<rbrakk> \<Longrightarrow> monofun f" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 40 | by (simp add: monofun_def) | 
| 15565 | 41 | |
| 42 | lemma monofunE: | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 43 | "\<lbrakk>monofun f; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> f x \<sqsubseteq> f y" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 44 | by (simp add: monofun_def) | 
| 15565 | 45 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 46 | |
| 62175 | 47 | subsection \<open>Equivalence of alternate definition\<close> | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 48 | |
| 62175 | 49 | text \<open>monotone functions map chains to chains\<close> | 
| 15565 | 50 | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 51 | lemma ch2ch_monofun: "\<lbrakk>monofun f; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. f (Y i))" | 
| 15565 | 52 | apply (rule chainI) | 
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 53 | apply (erule monofunE) | 
| 15565 | 54 | apply (erule chainE) | 
| 55 | done | |
| 56 | ||
| 62175 | 57 | text \<open>monotone functions map upper bound to upper bounds\<close> | 
| 15565 | 58 | |
| 59 | lemma ub2ub_monofun: | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 60 | "\<lbrakk>monofun f; range Y <| u\<rbrakk> \<Longrightarrow> range (\<lambda>i. f (Y i)) <| f u" | 
| 15565 | 61 | apply (rule ub_rangeI) | 
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 62 | apply (erule monofunE) | 
| 15565 | 63 | apply (erule ub_rangeD) | 
| 64 | done | |
| 65 | ||
| 62175 | 66 | text \<open>a lemma about binary chains\<close> | 
| 15565 | 67 | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 68 | lemma binchain_cont: | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 69 | "\<lbrakk>cont f; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> range (\<lambda>i::nat. f (if i = 0 then x else y)) <<| f y" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 70 | apply (subgoal_tac "f (\<Squnion>i::nat. if i = 0 then x else y) = f y") | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 71 | apply (erule subst) | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 72 | apply (erule contE) | 
| 15565 | 73 | apply (erule bin_chain) | 
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 74 | apply (rule_tac f=f in arg_cong) | 
| 40771 | 75 | apply (erule is_lub_bin_chain [THEN lub_eqI]) | 
| 15565 | 76 | done | 
| 77 | ||
| 62175 | 78 | text \<open>continuity implies monotonicity\<close> | 
| 15565 | 79 | |
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 80 | lemma cont2mono: "cont f \<Longrightarrow> monofun f" | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 81 | apply (rule monofunI) | 
| 18088 | 82 | apply (drule (1) binchain_cont) | 
| 40771 | 83 | apply (drule_tac i=0 in is_lub_rangeD1) | 
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 84 | apply simp | 
| 15565 | 85 | done | 
| 86 | ||
| 29532 | 87 | lemmas cont2monofunE = cont2mono [THEN monofunE] | 
| 88 | ||
| 16737 | 89 | lemmas ch2ch_cont = cont2mono [THEN ch2ch_monofun] | 
| 90 | ||
| 62175 | 91 | text \<open>continuity implies preservation of lubs\<close> | 
| 15565 | 92 | |
| 35914 | 93 | lemma cont2contlubE: | 
| 60585 | 94 | "\<lbrakk>cont f; chain Y\<rbrakk> \<Longrightarrow> f (\<Squnion>i. Y i) = (\<Squnion>i. f (Y i))" | 
| 40771 | 95 | apply (rule lub_eqI [symmetric]) | 
| 18088 | 96 | apply (erule (1) contE) | 
| 15565 | 97 | done | 
| 98 | ||
| 25896 | 99 | lemma contI2: | 
| 40736 | 100 | fixes f :: "'a::cpo \<Rightarrow> 'b::cpo" | 
| 25896 | 101 | assumes mono: "monofun f" | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31041diff
changeset | 102 | assumes below: "\<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. f (Y i))\<rbrakk> | 
| 27413 | 103 | \<Longrightarrow> f (\<Squnion>i. Y i) \<sqsubseteq> (\<Squnion>i. f (Y i))" | 
| 25896 | 104 | shows "cont f" | 
| 40736 | 105 | proof (rule contI) | 
| 106 | fix Y :: "nat \<Rightarrow> 'a" | |
| 107 | assume Y: "chain Y" | |
| 108 | with mono have fY: "chain (\<lambda>i. f (Y i))" | |
| 109 | by (rule ch2ch_monofun) | |
| 110 | have "(\<Squnion>i. f (Y i)) = f (\<Squnion>i. Y i)" | |
| 111 | apply (rule below_antisym) | |
| 112 | apply (rule lub_below [OF fY]) | |
| 113 | apply (rule monofunE [OF mono]) | |
| 114 | apply (rule is_ub_thelub [OF Y]) | |
| 115 | apply (rule below [OF Y fY]) | |
| 116 | done | |
| 117 | with fY show "range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i)" | |
| 118 | by (rule thelubE) | |
| 119 | qed | |
| 25896 | 120 | |
| 62175 | 121 | subsection \<open>Collection of continuity rules\<close> | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 122 | |
| 57945 
cacb00a569e0
prefer 'named_theorems' over Named_Thms, with subtle change of semantics due to visual order vs. internal reverse order;
 wenzelm parents: 
45294diff
changeset | 123 | named_theorems cont2cont "continuity intro rule" | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 124 | |
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 125 | |
| 62175 | 126 | subsection \<open>Continuity of basic functions\<close> | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 127 | |
| 62175 | 128 | text \<open>The identity function is continuous\<close> | 
| 15565 | 129 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 130 | lemma cont_id [simp, cont2cont]: "cont (\<lambda>x. x)" | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 131 | apply (rule contI) | 
| 26027 | 132 | apply (erule cpo_lubI) | 
| 15565 | 133 | done | 
| 134 | ||
| 62175 | 135 | text \<open>constant functions are continuous\<close> | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 136 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 137 | lemma cont_const [simp, cont2cont]: "cont (\<lambda>x. c)" | 
| 40771 | 138 | using is_lub_const by (rule contI) | 
| 15565 | 139 | |
| 62175 | 140 | text \<open>application of functions is continuous\<close> | 
| 29532 | 141 | |
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 142 | lemma cont_apply: | 
| 29532 | 143 | fixes f :: "'a::cpo \<Rightarrow> 'b::cpo \<Rightarrow> 'c::cpo" and t :: "'a \<Rightarrow> 'b" | 
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 144 | assumes 1: "cont (\<lambda>x. t x)" | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 145 | assumes 2: "\<And>x. cont (\<lambda>y. f x y)" | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 146 | assumes 3: "\<And>y. cont (\<lambda>x. f x y)" | 
| 29532 | 147 | shows "cont (\<lambda>x. (f x) (t x))" | 
| 35914 | 148 | proof (rule contI2 [OF monofunI]) | 
| 29532 | 149 | fix x y :: "'a" assume "x \<sqsubseteq> y" | 
| 150 | then show "f x (t x) \<sqsubseteq> f y (t y)" | |
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 151 | by (auto intro: cont2monofunE [OF 1] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 152 | cont2monofunE [OF 2] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 153 | cont2monofunE [OF 3] | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31041diff
changeset | 154 | below_trans) | 
| 29532 | 155 | next | 
| 156 | fix Y :: "nat \<Rightarrow> 'a" assume "chain Y" | |
| 35914 | 157 | then show "f (\<Squnion>i. Y i) (t (\<Squnion>i. Y i)) \<sqsubseteq> (\<Squnion>i. f (Y i) (t (Y i)))" | 
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 158 | by (simp only: cont2contlubE [OF 1] ch2ch_cont [OF 1] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 159 | cont2contlubE [OF 2] ch2ch_cont [OF 2] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 160 | cont2contlubE [OF 3] ch2ch_cont [OF 3] | 
| 35914 | 161 | diag_lub below_refl) | 
| 29532 | 162 | qed | 
| 163 | ||
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 164 | lemma cont_compose: | 
| 29532 | 165 | "\<lbrakk>cont c; cont (\<lambda>x. f x)\<rbrakk> \<Longrightarrow> cont (\<lambda>x. c (f x))" | 
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 166 | by (rule cont_apply [OF _ _ cont_const]) | 
| 29532 | 167 | |
| 62175 | 168 | text \<open>Least upper bounds preserve continuity\<close> | 
| 40004 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 169 | |
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 170 | lemma cont2cont_lub [simp]: | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 171 | assumes chain: "\<And>x. chain (\<lambda>i. F i x)" and cont: "\<And>i. cont (\<lambda>x. F i x)" | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 172 | shows "cont (\<lambda>x. \<Squnion>i. F i x)" | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 173 | apply (rule contI2) | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 174 | apply (simp add: monofunI cont2monofunE [OF cont] lub_mono chain) | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 175 | apply (simp add: cont2contlubE [OF cont]) | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 176 | apply (simp add: diag_lub ch2ch_cont [OF cont] chain) | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 177 | done | 
| 
9f6ed6840e8d
reformulate lemma cont2cont_lub and move to Cont.thy
 huffman parents: 
37099diff
changeset | 178 | |
| 62175 | 179 | text \<open>if-then-else is continuous\<close> | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 180 | |
| 37099 | 181 | lemma cont_if [simp, cont2cont]: | 
| 26452 
ed657432b8b9
declare cont_lemmas_ext as simp rules individually
 huffman parents: 
26027diff
changeset | 182 | "\<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. if b then f x else g x)" | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 183 | by (induct b) simp_all | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 184 | |
| 62175 | 185 | subsection \<open>Finite chains and flat pcpos\<close> | 
| 15565 | 186 | |
| 62175 | 187 | text \<open>Monotone functions map finite chains to finite chains.\<close> | 
| 15565 | 188 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 189 | lemma monofun_finch2finch: | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 190 | "\<lbrakk>monofun f; finite_chain Y\<rbrakk> \<Longrightarrow> finite_chain (\<lambda>n. f (Y n))" | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 191 | apply (unfold finite_chain_def) | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 192 | apply (simp add: ch2ch_monofun) | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 193 | apply (force simp add: max_in_chain_def) | 
| 15565 | 194 | done | 
| 195 | ||
| 62175 | 196 | text \<open>The same holds for continuous functions.\<close> | 
| 15565 | 197 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 198 | lemma cont_finch2finch: | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 199 | "\<lbrakk>cont f; finite_chain Y\<rbrakk> \<Longrightarrow> finite_chain (\<lambda>n. f (Y n))" | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 200 | by (rule cont2mono [THEN monofun_finch2finch]) | 
| 15565 | 201 | |
| 62175 | 202 | text \<open>All monotone functions with chain-finite domain are continuous.\<close> | 
| 40010 | 203 | |
| 25825 | 204 | lemma chfindom_monofun2cont: "monofun f \<Longrightarrow> cont (f::'a::chfin \<Rightarrow> 'b::cpo)" | 
| 35914 | 205 | apply (erule contI2) | 
| 15565 | 206 | apply (frule chfin2finch) | 
| 16204 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 207 | apply (clarsimp simp add: finite_chain_def) | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 208 | apply (subgoal_tac "max_in_chain i (\<lambda>i. f (Y i))") | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 209 | apply (simp add: maxinch_is_thelub ch2ch_monofun) | 
| 
5dd79d3f0105
renamed theorems monofun, contlub, cont to monofun_def, etc.; changed intro/elim rules for these predicates into more useful rule_format; removed all MF2 lemmas (Pcpo.thy has more general versions now); cleaned up many proofs.
 huffman parents: 
16096diff
changeset | 210 | apply (force simp add: max_in_chain_def) | 
| 15565 | 211 | done | 
| 212 | ||
| 62175 | 213 | text \<open>All strict functions with flat domain are continuous.\<close> | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 214 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 215 | lemma flatdom_strict2mono: "f \<bottom> = \<bottom> \<Longrightarrow> monofun (f::'a::flat \<Rightarrow> 'b::pcpo)" | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 216 | apply (rule monofunI) | 
| 25920 | 217 | apply (drule ax_flat) | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 218 | apply auto | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 219 | done | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 220 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 221 | lemma flatdom_strict2cont: "f \<bottom> = \<bottom> \<Longrightarrow> cont (f::'a::flat \<Rightarrow> 'b::pcpo)" | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 222 | by (rule flatdom_strict2mono [THEN chfindom_monofun2cont]) | 
| 15565 | 223 | |
| 62175 | 224 | text \<open>All functions with discrete domain are continuous.\<close> | 
| 26024 | 225 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 226 | lemma cont_discrete_cpo [simp, cont2cont]: "cont (f::'a::discrete_cpo \<Rightarrow> 'b::cpo)" | 
| 26024 | 227 | apply (rule contI) | 
| 228 | apply (drule discrete_chain_const, clarify) | |
| 40771 | 229 | apply (simp add: is_lub_const) | 
| 26024 | 230 | done | 
| 231 | ||
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 232 | end |