author | huffman |
Mon, 22 Mar 2010 12:52:51 -0700 | |
changeset 35900 | aa5dfb03eb1e |
parent 35794 | 8cd7134275cc |
child 35914 | 91a7311177c4 |
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:
15577
diff
changeset
|
12 |
text {* |
14e3228f18cc
arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
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:
2838
diff
changeset
|
14 |
of default class po |
15588
14e3228f18cc
arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset
|
15 |
*} |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
16 |
|
15565 | 17 |
defaultsort 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:
16564
diff
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:
18092
diff
changeset
|
21 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
22 |
monofun :: "('a \<Rightarrow> 'b) \<Rightarrow> bool" -- "monotonicity" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
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:
18092
diff
changeset
|
25 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
26 |
contlub :: "('a::cpo \<Rightarrow> 'b::cpo) \<Rightarrow> bool" -- "first cont. def" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
27 |
"contlub f = (\<forall>Y. chain Y \<longrightarrow> f (\<Squnion>i. Y i) = (\<Squnion>i. f (Y i)))" |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
28 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
29 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
30 |
cont :: "('a::cpo \<Rightarrow> 'b::cpo) \<Rightarrow> bool" -- "secnd cont. def" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
18092
diff
changeset
|
31 |
"cont f = (\<forall>Y. chain Y \<longrightarrow> range (\<lambda>i. f (Y i)) <<| f (\<Squnion>i. Y i))" |
15565 | 32 |
|
33 |
lemma contlubI: |
|
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:
16096
diff
changeset
|
34 |
"\<lbrakk>\<And>Y. chain Y \<Longrightarrow> f (\<Squnion>i. Y i) = (\<Squnion>i. f (Y i))\<rbrakk> \<Longrightarrow> contlub 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:
16096
diff
changeset
|
35 |
by (simp add: contlub_def) |
15565 | 36 |
|
37 |
lemma contlubE: |
|
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:
16096
diff
changeset
|
38 |
"\<lbrakk>contlub f; chain Y\<rbrakk> \<Longrightarrow> f (\<Squnion>i. Y i) = (\<Squnion>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:
16096
diff
changeset
|
39 |
by (simp add: contlub_def) |
15565 | 40 |
|
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:
16096
diff
changeset
|
41 |
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:
16096
diff
changeset
|
42 |
"\<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:
16096
diff
changeset
|
43 |
by (simp add: cont_def) |
15565 | 44 |
|
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:
16096
diff
changeset
|
45 |
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:
16096
diff
changeset
|
46 |
"\<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:
16096
diff
changeset
|
47 |
by (simp add: cont_def) |
15565 | 48 |
|
49 |
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:
16096
diff
changeset
|
50 |
"\<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:
16096
diff
changeset
|
51 |
by (simp add: monofun_def) |
15565 | 52 |
|
53 |
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:
16096
diff
changeset
|
54 |
"\<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:
16096
diff
changeset
|
55 |
by (simp add: monofun_def) |
15565 | 56 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
57 |
|
35900
aa5dfb03eb1e
remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents:
35794
diff
changeset
|
58 |
subsection {* Equivalence of alternate definition *} |
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
59 |
|
15588
14e3228f18cc
arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset
|
60 |
text {* monotone functions map chains to chains *} |
15565 | 61 |
|
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:
16096
diff
changeset
|
62 |
lemma ch2ch_monofun: "\<lbrakk>monofun f; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. f (Y i))" |
15565 | 63 |
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:
16096
diff
changeset
|
64 |
apply (erule monofunE) |
15565 | 65 |
apply (erule chainE) |
66 |
done |
|
67 |
||
15588
14e3228f18cc
arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset
|
68 |
text {* monotone functions map upper bound to upper bounds *} |
15565 | 69 |
|
70 |
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:
16096
diff
changeset
|
71 |
"\<lbrakk>monofun f; range Y <| u\<rbrakk> \<Longrightarrow> range (\<lambda>i. f (Y i)) <| f u" |
15565 | 72 |
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:
16096
diff
changeset
|
73 |
apply (erule monofunE) |
15565 | 74 |
apply (erule ub_rangeD) |
75 |
done |
|
76 |
||
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
77 |
text {* left to right: @{prop "monofun f \<and> contlub f \<Longrightarrow> cont f"} *} |
15565 | 78 |
|
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:
16096
diff
changeset
|
79 |
lemma monocontlub2cont: "\<lbrakk>monofun f; contlub f\<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:
16096
diff
changeset
|
80 |
apply (rule contI) |
15565 | 81 |
apply (rule thelubE) |
18088 | 82 |
apply (erule (1) ch2ch_monofun) |
83 |
apply (erule (1) contlubE [symmetric]) |
|
15565 | 84 |
done |
85 |
||
15588
14e3228f18cc
arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset
|
86 |
text {* first a lemma about binary chains *} |
15565 | 87 |
|
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:
16096
diff
changeset
|
88 |
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:
16096
diff
changeset
|
89 |
"\<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:
16096
diff
changeset
|
90 |
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:
16096
diff
changeset
|
91 |
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:
16096
diff
changeset
|
92 |
apply (erule contE) |
15565 | 93 |
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:
16096
diff
changeset
|
94 |
apply (rule_tac f=f in arg_cong) |
15565 | 95 |
apply (erule lub_bin_chain [THEN thelubI]) |
96 |
done |
|
97 |
||
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:
16096
diff
changeset
|
98 |
text {* right to left: @{prop "cont f \<Longrightarrow> monofun f \<and> contlub 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:
16096
diff
changeset
|
99 |
text {* part1: @{prop "cont f \<Longrightarrow> monofun f"} *} |
15565 | 100 |
|
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:
16096
diff
changeset
|
101 |
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:
16096
diff
changeset
|
102 |
apply (rule monofunI) |
18088 | 103 |
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:
16096
diff
changeset
|
104 |
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:
16096
diff
changeset
|
105 |
apply simp |
15565 | 106 |
done |
107 |
||
29532 | 108 |
lemmas cont2monofunE = cont2mono [THEN monofunE] |
109 |
||
16737 | 110 |
lemmas ch2ch_cont = cont2mono [THEN ch2ch_monofun] |
111 |
||
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:
16096
diff
changeset
|
112 |
text {* right to left: @{prop "cont f \<Longrightarrow> monofun f \<and> contlub 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:
16096
diff
changeset
|
113 |
text {* part2: @{prop "cont f \<Longrightarrow> contlub f"} *} |
15565 | 114 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
115 |
lemma cont2contlub: "cont f \<Longrightarrow> contlub f" |
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:
16096
diff
changeset
|
116 |
apply (rule contlubI) |
15565 | 117 |
apply (rule thelubI [symmetric]) |
18088 | 118 |
apply (erule (1) contE) |
15565 | 119 |
done |
120 |
||
16737 | 121 |
lemmas cont2contlubE = cont2contlub [THEN contlubE] |
122 |
||
25896 | 123 |
lemma contI2: |
124 |
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:
31041
diff
changeset
|
125 |
assumes below: "\<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. f (Y i))\<rbrakk> |
27413 | 126 |
\<Longrightarrow> f (\<Squnion>i. Y i) \<sqsubseteq> (\<Squnion>i. f (Y i))" |
25896 | 127 |
shows "cont f" |
128 |
apply (rule monocontlub2cont) |
|
129 |
apply (rule mono) |
|
130 |
apply (rule contlubI) |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
31041
diff
changeset
|
131 |
apply (rule below_antisym) |
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
31041
diff
changeset
|
132 |
apply (rule below, assumption) |
25896 | 133 |
apply (erule ch2ch_monofun [OF mono]) |
134 |
apply (rule is_lub_thelub) |
|
135 |
apply (erule ch2ch_monofun [OF mono]) |
|
136 |
apply (rule ub2ub_monofun [OF mono]) |
|
137 |
apply (rule is_lubD1) |
|
26027 | 138 |
apply (erule cpo_lubI) |
25896 | 139 |
done |
140 |
||
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
141 |
subsection {* Continuity simproc *} |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
142 |
|
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
143 |
ML {* |
31902 | 144 |
structure Cont2ContData = Named_Thms |
145 |
( |
|
146 |
val name = "cont2cont" |
|
147 |
val description = "continuity intro rule" |
|
148 |
) |
|
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
149 |
*} |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
150 |
|
31030 | 151 |
setup Cont2ContData.setup |
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
152 |
|
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
153 |
text {* |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
154 |
Given the term @{term "cont f"}, the procedure tries to construct the |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
155 |
theorem @{term "cont f == True"}. If this theorem cannot be completely |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
156 |
solved by the introduction rules, then the procedure returns a |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
157 |
conditional rewrite rule with the unsolved subgoals as premises. |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
158 |
*} |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
159 |
|
31030 | 160 |
simproc_setup cont_proc ("cont f") = {* |
161 |
fn phi => fn ss => fn ct => |
|
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
162 |
let |
31030 | 163 |
val tr = instantiate' [] [SOME ct] @{thm Eq_TrueI}; |
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
164 |
val rules = Cont2ContData.get (Simplifier.the_context ss); |
29541
35c2654a95da
use match_tac instead of resolve_tac for continuity simproc
huffman
parents:
29532
diff
changeset
|
165 |
val tac = REPEAT_ALL_NEW (match_tac rules); |
31030 | 166 |
in SINGLE (tac 1) tr end |
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
167 |
*} |
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
168 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
169 |
subsection {* Continuity of basic functions *} |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
170 |
|
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
171 |
text {* The identity function is continuous *} |
15565 | 172 |
|
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
173 |
lemma cont_id [cont2cont]: "cont (\<lambda>x. x)" |
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
174 |
apply (rule contI) |
26027 | 175 |
apply (erule cpo_lubI) |
15565 | 176 |
done |
177 |
||
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
178 |
text {* constant functions are continuous *} |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
179 |
|
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset
|
180 |
lemma cont_const [cont2cont]: "cont (\<lambda>x. c)" |
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
181 |
apply (rule contI) |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
182 |
apply (rule lub_const) |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
183 |
done |
15565 | 184 |
|
29532 | 185 |
text {* application of functions is continuous *} |
186 |
||
31041
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
187 |
lemma cont_apply: |
29532 | 188 |
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:
31030
diff
changeset
|
189 |
assumes 1: "cont (\<lambda>x. t x)" |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
190 |
assumes 2: "\<And>x. cont (\<lambda>y. f x y)" |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
191 |
assumes 3: "\<And>y. cont (\<lambda>x. f x y)" |
29532 | 192 |
shows "cont (\<lambda>x. (f x) (t x))" |
193 |
proof (rule monocontlub2cont [OF monofunI contlubI]) |
|
194 |
fix x y :: "'a" assume "x \<sqsubseteq> y" |
|
195 |
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:
31030
diff
changeset
|
196 |
by (auto intro: cont2monofunE [OF 1] |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
197 |
cont2monofunE [OF 2] |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
198 |
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:
31041
diff
changeset
|
199 |
below_trans) |
29532 | 200 |
next |
201 |
fix Y :: "nat \<Rightarrow> 'a" assume "chain Y" |
|
202 |
then show "f (\<Squnion>i. Y i) (t (\<Squnion>i. Y i)) = (\<Squnion>i. f (Y i) (t (Y i)))" |
|
31041
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
203 |
by (simp only: cont2contlubE [OF 1] ch2ch_cont [OF 1] |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
204 |
cont2contlubE [OF 2] ch2ch_cont [OF 2] |
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
205 |
cont2contlubE [OF 3] ch2ch_cont [OF 3] |
29532 | 206 |
diag_lub) |
207 |
qed |
|
208 |
||
31041
85b4843d9939
replace cont2cont_apply with cont_apply; add new cont2cont lemmas
huffman
parents:
31030
diff
changeset
|
209 |
lemma cont_compose: |
29532 | 210 |
"\<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:
31030
diff
changeset
|
211 |
by (rule cont_apply [OF _ _ cont_const]) |
29532 | 212 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
213 |
text {* if-then-else is continuous *} |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
214 |
|
26452
ed657432b8b9
declare cont_lemmas_ext as simp rules individually
huffman
parents:
26027
diff
changeset
|
215 |
lemma cont_if [simp]: |
ed657432b8b9
declare cont_lemmas_ext as simp rules individually
huffman
parents:
26027
diff
changeset
|
216 |
"\<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:
16564
diff
changeset
|
217 |
by (induct b) simp_all |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
218 |
|
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
219 |
subsection {* Finite chains and flat pcpos *} |
15565 | 220 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
221 |
text {* monotone functions map finite chains to finite chains *} |
15565 | 222 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
223 |
lemma monofun_finch2finch: |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
224 |
"\<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:
16564
diff
changeset
|
225 |
apply (unfold finite_chain_def) |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
226 |
apply (simp add: ch2ch_monofun) |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
227 |
apply (force simp add: max_in_chain_def) |
15565 | 228 |
done |
229 |
||
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
230 |
text {* The same holds for continuous functions *} |
15565 | 231 |
|
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
232 |
lemma cont_finch2finch: |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
233 |
"\<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:
16564
diff
changeset
|
234 |
by (rule cont2mono [THEN monofun_finch2finch]) |
15565 | 235 |
|
25825 | 236 |
lemma chfindom_monofun2cont: "monofun f \<Longrightarrow> cont (f::'a::chfin \<Rightarrow> 'b::cpo)" |
15565 | 237 |
apply (rule monocontlub2cont) |
238 |
apply assumption |
|
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:
16096
diff
changeset
|
239 |
apply (rule contlubI) |
15565 | 240 |
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:
16096
diff
changeset
|
241 |
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:
16096
diff
changeset
|
242 |
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:
16096
diff
changeset
|
243 |
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:
16096
diff
changeset
|
244 |
apply (force simp add: max_in_chain_def) |
15565 | 245 |
done |
246 |
||
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
247 |
text {* some properties of flat *} |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
248 |
|
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
249 |
lemma flatdom_strict2mono: "f \<bottom> = \<bottom> \<Longrightarrow> monofun (f::'a::flat \<Rightarrow> 'b::pcpo)" |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
250 |
apply (rule monofunI) |
25920 | 251 |
apply (drule ax_flat) |
16624
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
252 |
apply auto |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
253 |
done |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
254 |
|
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
255 |
lemma flatdom_strict2cont: "f \<bottom> = \<bottom> \<Longrightarrow> cont (f::'a::flat \<Rightarrow> 'b::pcpo)" |
645b9560f3fd
cleaned up; reorganized and added section headings
huffman
parents:
16564
diff
changeset
|
256 |
by (rule flatdom_strict2mono [THEN chfindom_monofun2cont]) |
15565 | 257 |
|
26024 | 258 |
text {* functions with discrete domain *} |
259 |
||
260 |
lemma cont_discrete_cpo [simp]: "cont (f::'a::discrete_cpo \<Rightarrow> 'b::cpo)" |
|
261 |
apply (rule contI) |
|
262 |
apply (drule discrete_chain_const, clarify) |
|
263 |
apply (simp add: lub_const) |
|
264 |
done |
|
265 |
||
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
266 |
end |