| author | haftmann | 
| Tue, 01 Jun 2010 09:12:12 +0200 | |
| changeset 37219 | 7c5311e54ea4 | 
| parent 37099 | 3636b08cbf51 | 
| child 40004 | 9f6ed6840e8d | 
| permissions | -rw-r--r-- | 
| 15600 | 1 | (* Title: 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 | |
| 15577 | 6 | header {* Continuity and monotonicity *}
 | 
| 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 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 12 | text {*
 | 
| 
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 | 
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 15 | *} | 
| 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 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 19 | subsection {* Definitions *}
 | 
| 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 | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 22 |   monofun :: "('a \<Rightarrow> 'b) \<Rightarrow> bool"  -- "monotonicity"  where
 | 
| 
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 | |
| 35914 | 25 | (* | 
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 26 | definition | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 27 |   contlub :: "('a::cpo \<Rightarrow> 'b::cpo) \<Rightarrow> bool"  -- "first cont. def" where
 | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 28 | "contlub f = (\<forall>Y. chain Y \<longrightarrow> f (\<Squnion>i. Y i) = (\<Squnion>i. f (Y i)))" | 
| 35914 | 29 | *) | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 30 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 31 | definition | 
| 35914 | 32 |   cont :: "('a::cpo \<Rightarrow> 'b::cpo) \<Rightarrow> bool"
 | 
| 33 | where | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
18092diff
changeset | 34 | "cont f = (\<forall>Y. chain Y \<longrightarrow> range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i))" | 
| 15565 | 35 | |
| 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 | 36 | 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 | 37 | "\<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 | 38 | by (simp add: cont_def) | 
| 15565 | 39 | |
| 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 | 40 | 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 | 41 | "\<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 | 42 | by (simp add: cont_def) | 
| 15565 | 43 | |
| 44 | 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 | 45 | "\<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 | 46 | by (simp add: monofun_def) | 
| 15565 | 47 | |
| 48 | 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 | 49 | "\<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 | 50 | by (simp add: monofun_def) | 
| 15565 | 51 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 52 | |
| 35900 
aa5dfb03eb1e
remove LaTeX hyperref warnings by avoiding antiquotations within section headings
 huffman parents: 
35794diff
changeset | 53 | subsection {* Equivalence of alternate definition *}
 | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 54 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 55 | text {* monotone functions map chains to chains *}
 | 
| 15565 | 56 | |
| 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 | 57 | lemma ch2ch_monofun: "\<lbrakk>monofun f; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. f (Y i))" | 
| 15565 | 58 | 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 | 59 | apply (erule monofunE) | 
| 15565 | 60 | apply (erule chainE) | 
| 61 | done | |
| 62 | ||
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 63 | text {* monotone functions map upper bound to upper bounds *}
 | 
| 15565 | 64 | |
| 65 | 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 | 66 | "\<lbrakk>monofun f; range Y <| u\<rbrakk> \<Longrightarrow> range (\<lambda>i. f (Y i)) <| f u" | 
| 15565 | 67 | 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 | 68 | apply (erule monofunE) | 
| 15565 | 69 | apply (erule ub_rangeD) | 
| 70 | done | |
| 71 | ||
| 35914 | 72 | text {* a lemma about binary chains *}
 | 
| 15565 | 73 | |
| 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 | 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 | 75 | "\<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 | 76 | 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 | 77 | 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 | 78 | apply (erule contE) | 
| 15565 | 79 | 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 | 80 | apply (rule_tac f=f in arg_cong) | 
| 15565 | 81 | apply (erule lub_bin_chain [THEN thelubI]) | 
| 82 | done | |
| 83 | ||
| 35914 | 84 | text {* continuity implies monotonicity *}
 | 
| 15565 | 85 | |
| 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 | 86 | 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 | 87 | apply (rule monofunI) | 
| 18088 | 88 | apply (drule (1) binchain_cont) | 
| 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 | 89 | apply (drule_tac i=0 in is_ub_lub) | 
| 
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 | 90 | apply simp | 
| 15565 | 91 | done | 
| 92 | ||
| 29532 | 93 | lemmas cont2monofunE = cont2mono [THEN monofunE] | 
| 94 | ||
| 16737 | 95 | lemmas ch2ch_cont = cont2mono [THEN ch2ch_monofun] | 
| 96 | ||
| 35914 | 97 | text {* continuity implies preservation of lubs *}
 | 
| 15565 | 98 | |
| 35914 | 99 | lemma cont2contlubE: | 
| 100 | "\<lbrakk>cont f; chain Y\<rbrakk> \<Longrightarrow> f (\<Squnion> i. Y i) = (\<Squnion> i. f (Y i))" | |
| 15565 | 101 | apply (rule thelubI [symmetric]) | 
| 18088 | 102 | apply (erule (1) contE) | 
| 15565 | 103 | done | 
| 104 | ||
| 25896 | 105 | lemma contI2: | 
| 106 | 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 | 107 | assumes below: "\<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. f (Y i))\<rbrakk> | 
| 27413 | 108 | \<Longrightarrow> f (\<Squnion>i. Y i) \<sqsubseteq> (\<Squnion>i. f (Y i))" | 
| 25896 | 109 | shows "cont f" | 
| 35914 | 110 | apply (rule contI) | 
| 111 | apply (rule thelubE) | |
| 112 | apply (erule ch2ch_monofun [OF mono]) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31041diff
changeset | 113 | apply (rule below_antisym) | 
| 25896 | 114 | apply (rule is_lub_thelub) | 
| 115 | apply (erule ch2ch_monofun [OF mono]) | |
| 116 | apply (rule ub2ub_monofun [OF mono]) | |
| 117 | apply (rule is_lubD1) | |
| 26027 | 118 | apply (erule cpo_lubI) | 
| 35914 | 119 | apply (rule below, assumption) | 
| 120 | apply (erule ch2ch_monofun [OF mono]) | |
| 25896 | 121 | done | 
| 122 | ||
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 123 | subsection {* Collection of continuity rules *}
 | 
| 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 | ML {*
 | 
| 31902 | 126 | structure Cont2ContData = Named_Thms | 
| 127 | ( | |
| 128 | val name = "cont2cont" | |
| 129 | val description = "continuity intro rule" | |
| 130 | ) | |
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 131 | *} | 
| 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 132 | |
| 31030 | 133 | setup Cont2ContData.setup | 
| 29530 
9905b660612b
change to simpler, more extensible continuity simproc
 huffman parents: 
29138diff
changeset | 134 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 135 | subsection {* Continuity of basic functions *}
 | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 136 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 137 | text {* The identity function is continuous *}
 | 
| 15565 | 138 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 139 | lemma cont_id [simp, cont2cont]: "cont (\<lambda>x. x)" | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 140 | apply (rule contI) | 
| 26027 | 141 | apply (erule cpo_lubI) | 
| 15565 | 142 | done | 
| 143 | ||
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 144 | text {* constant functions are continuous *}
 | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 145 | |
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 146 | lemma cont_const [simp, cont2cont]: "cont (\<lambda>x. c)" | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 147 | apply (rule contI) | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 148 | apply (rule lub_const) | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 149 | done | 
| 15565 | 150 | |
| 29532 | 151 | text {* application of functions is continuous *}
 | 
| 152 | ||
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 153 | lemma cont_apply: | 
| 29532 | 154 | 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 | 155 | assumes 1: "cont (\<lambda>x. t x)" | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 156 | 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 | 157 | assumes 3: "\<And>y. cont (\<lambda>x. f x y)" | 
| 29532 | 158 | shows "cont (\<lambda>x. (f x) (t x))" | 
| 35914 | 159 | proof (rule contI2 [OF monofunI]) | 
| 29532 | 160 | fix x y :: "'a" assume "x \<sqsubseteq> y" | 
| 161 | 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 | 162 | by (auto intro: cont2monofunE [OF 1] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 163 | cont2monofunE [OF 2] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 164 | 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 | 165 | below_trans) | 
| 29532 | 166 | next | 
| 167 | fix Y :: "nat \<Rightarrow> 'a" assume "chain Y" | |
| 35914 | 168 | 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 | 169 | 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 | 170 | cont2contlubE [OF 2] ch2ch_cont [OF 2] | 
| 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 171 | cont2contlubE [OF 3] ch2ch_cont [OF 3] | 
| 35914 | 172 | diag_lub below_refl) | 
| 29532 | 173 | qed | 
| 174 | ||
| 31041 
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
 huffman parents: 
31030diff
changeset | 175 | lemma cont_compose: | 
| 29532 | 176 | "\<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 | 177 | by (rule cont_apply [OF _ _ cont_const]) | 
| 29532 | 178 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 179 | text {* if-then-else is continuous *}
 | 
| 
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 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 185 | subsection {* Finite chains and flat pcpos *}
 | 
| 15565 | 186 | |
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 187 | text {* monotone functions map finite chains to finite chains *}
 | 
| 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 | ||
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 196 | text {* The same holds for continuous functions *}
 | 
| 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 | |
| 25825 | 202 | lemma chfindom_monofun2cont: "monofun f \<Longrightarrow> cont (f::'a::chfin \<Rightarrow> 'b::cpo)" | 
| 35914 | 203 | apply (erule contI2) | 
| 15565 | 204 | 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 | 205 | 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 | 206 | 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 | 207 | 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 | 208 | apply (force simp add: max_in_chain_def) | 
| 15565 | 209 | done | 
| 210 | ||
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 211 | text {* some properties of flat *}
 | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 212 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 213 | 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 | 214 | apply (rule monofunI) | 
| 25920 | 215 | apply (drule ax_flat) | 
| 16624 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 216 | apply auto | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 217 | done | 
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 218 | |
| 
645b9560f3fd
cleaned up; reorganized and added section headings
 huffman parents: 
16564diff
changeset | 219 | 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 | 220 | by (rule flatdom_strict2mono [THEN chfindom_monofun2cont]) | 
| 15565 | 221 | |
| 26024 | 222 | text {* functions with discrete domain *}
 | 
| 223 | ||
| 37079 
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
 huffman parents: 
36658diff
changeset | 224 | lemma cont_discrete_cpo [simp, cont2cont]: "cont (f::'a::discrete_cpo \<Rightarrow> 'b::cpo)" | 
| 26024 | 225 | apply (rule contI) | 
| 226 | apply (drule discrete_chain_const, clarify) | |
| 227 | apply (simp add: lub_const) | |
| 228 | done | |
| 229 | ||
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 230 | end |