author | nipkow |
Wed, 26 Jul 2000 19:43:28 +0200 | |
changeset 9448 | 755330e55e18 |
parent 9248 | e1dee89de037 |
child 9969 | 4753185f1dd2 |
permissions | -rw-r--r-- |
9169 | 1 |
(* Title: HOLCF/Pcpo.ML |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
2 |
ID: $Id$ |
1461 | 3 |
Author: Franz Regensburger |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
4 |
Copyright 1993 Technische Universitaet Muenchen |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
5 |
|
9169 | 6 |
introduction of the classes cpo and pcpo |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
7 |
*) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
8 |
|
2640 | 9 |
|
10 |
(* ------------------------------------------------------------------------ *) |
|
11 |
(* derive the old rule minimal *) |
|
12 |
(* ------------------------------------------------------------------------ *) |
|
9169 | 13 |
|
14 |
Goalw [UU_def] "ALL z. UU << z"; |
|
15 |
by (rtac (select_eq_Ex RS iffD2) 1); |
|
16 |
by (rtac least 1); |
|
17 |
qed "UU_least"; |
|
2640 | 18 |
|
9169 | 19 |
bind_thm("minimal", UU_least RS spec); |
2640 | 20 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
21 |
AddIffs [minimal]; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
22 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
23 |
(* ------------------------------------------------------------------------ *) |
2839 | 24 |
(* in cpo's everthing equal to THE lub has lub properties for every chain *) |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
25 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
26 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
27 |
Goal "[| chain(S); lub(range(S)) = (l::'a::cpo) |] ==> range(S) <<| l "; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
28 |
by (blast_tac (claset() addDs [cpo] addIs [lubI]) 1); |
9169 | 29 |
qed "thelubE"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
30 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
31 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
32 |
(* Properties of the lub *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
33 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
34 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
35 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
36 |
Goal "chain (S::nat => 'a::cpo) ==> S(x) << lub(range(S))"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
37 |
by (blast_tac (claset() addDs [cpo] addIs [lubI RS is_ub_lub]) 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
38 |
qed "is_ub_thelub"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
39 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
40 |
Goal "[| chain (S::nat => 'a::cpo); range(S) <| x |] ==> lub(range S) << x"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
41 |
by (blast_tac (claset() addDs [cpo] addIs [lubI RS is_lub_lub]) 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
42 |
qed "is_lub_thelub"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
43 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
44 |
|
9169 | 45 |
Goal "chain Y ==> max_in_chain i Y = (lub(range(Y)) = ((Y i)::'a::cpo))"; |
46 |
by (rtac iffI 1); |
|
47 |
by (fast_tac (HOL_cs addSIs [thelubI,lub_finch1]) 1); |
|
48 |
by (rewtac max_in_chain_def); |
|
49 |
by (safe_tac (HOL_cs addSIs [antisym_less])); |
|
50 |
by (fast_tac (HOL_cs addSEs [chain_mono3]) 1); |
|
51 |
by (dtac sym 1); |
|
52 |
by (force_tac (HOL_cs addSEs [is_ub_thelub], simpset()) 1); |
|
53 |
qed "maxinch_is_thelub"; |
|
2354 | 54 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
55 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
56 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
57 |
(* the << relation between two chains is preserved by their lubs *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
58 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
59 |
|
9169 | 60 |
Goal "[|chain(C1::(nat=>'a::cpo));chain(C2); ALL k. C1(k) << C2(k)|]\ |
61 |
\ ==> lub(range(C1)) << lub(range(C2))"; |
|
62 |
by (etac is_lub_thelub 1); |
|
63 |
by (rtac ub_rangeI 1); |
|
64 |
by (rtac trans_less 1); |
|
65 |
by (etac spec 1); |
|
66 |
by (etac is_ub_thelub 1); |
|
67 |
qed "lub_mono"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
68 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
69 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
70 |
(* the = relation between two chains is preserved by their lubs *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
71 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
72 |
|
9169 | 73 |
Goal "[| chain(C1::(nat=>'a::cpo));chain(C2);ALL k. C1(k)=C2(k)|]\ |
74 |
\ ==> lub(range(C1))=lub(range(C2))"; |
|
75 |
by (rtac antisym_less 1); |
|
76 |
by (rtac lub_mono 1); |
|
77 |
by (atac 1); |
|
78 |
by (atac 1); |
|
79 |
by (strip_tac 1); |
|
80 |
by (rtac (antisym_less_inverse RS conjunct1) 1); |
|
81 |
by (etac spec 1); |
|
82 |
by (rtac lub_mono 1); |
|
83 |
by (atac 1); |
|
84 |
by (atac 1); |
|
85 |
by (strip_tac 1); |
|
86 |
by (rtac (antisym_less_inverse RS conjunct2) 1); |
|
87 |
by (etac spec 1); |
|
88 |
qed "lub_equal"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
89 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
90 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
91 |
(* more results about mono and = of lubs of chains *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
92 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
93 |
|
9169 | 94 |
Goal "[|EX j. ALL i. j<i --> X(i::nat)=Y(i);chain(X::nat=>'a::cpo);chain(Y)|]\ |
95 |
\ ==> lub(range(X))<<lub(range(Y))"; |
|
96 |
by (etac exE 1); |
|
97 |
by (rtac is_lub_thelub 1); |
|
98 |
by (assume_tac 1); |
|
99 |
by (rtac ub_rangeI 1); |
|
100 |
by (strip_tac 1); |
|
101 |
by (case_tac "j<i" 1); |
|
102 |
by (res_inst_tac [("s","Y(i)"),("t","X(i)")] subst 1); |
|
103 |
by (rtac sym 1); |
|
104 |
by (Fast_tac 1); |
|
105 |
by (rtac is_ub_thelub 1); |
|
106 |
by (assume_tac 1); |
|
107 |
by (res_inst_tac [("y","X(Suc(j))")] trans_less 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
108 |
by (rtac chain_mono 1); |
9169 | 109 |
by (assume_tac 1); |
110 |
by (rtac (not_less_eq RS subst) 1); |
|
111 |
by (atac 1); |
|
112 |
by (res_inst_tac [("s","Y(Suc(j))"),("t","X(Suc(j))")] subst 1); |
|
113 |
by (Asm_simp_tac 1); |
|
114 |
by (etac is_ub_thelub 1); |
|
115 |
qed "lub_mono2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
116 |
|
9169 | 117 |
Goal "[|EX j. ALL i. j<i --> X(i)=Y(i); chain(X::nat=>'a::cpo); chain(Y)|]\ |
118 |
\ ==> lub(range(X))=lub(range(Y))"; |
|
119 |
by (blast_tac (claset() addIs [antisym_less, lub_mono2, sym]) 1); |
|
120 |
qed "lub_equal2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
121 |
|
9169 | 122 |
Goal "[|chain(Y::nat=>'a::cpo);chain(X);\ |
123 |
\ALL i. EX j. Y(i)<< X(j)|]==> lub(range(Y))<<lub(range(X))"; |
|
124 |
by (rtac is_lub_thelub 1); |
|
125 |
by (atac 1); |
|
126 |
by (rtac ub_rangeI 1); |
|
127 |
by (strip_tac 1); |
|
128 |
by (etac allE 1); |
|
129 |
by (etac exE 1); |
|
130 |
by (rtac trans_less 1); |
|
131 |
by (rtac is_ub_thelub 2); |
|
132 |
by (atac 2); |
|
133 |
by (atac 1); |
|
134 |
qed "lub_mono3"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
135 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
136 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
137 |
(* usefull lemmas about UU *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
138 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
139 |
|
9169 | 140 |
Goal "(x=UU)=(x<<UU)"; |
141 |
by (rtac iffI 1); |
|
142 |
by (hyp_subst_tac 1); |
|
143 |
by (rtac refl_less 1); |
|
144 |
by (rtac antisym_less 1); |
|
145 |
by (atac 1); |
|
146 |
by (rtac minimal 1); |
|
147 |
qed "eq_UU_iff"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
148 |
|
9169 | 149 |
Goal "x << UU ==> x = UU"; |
150 |
by (stac eq_UU_iff 1); |
|
151 |
by (assume_tac 1); |
|
152 |
qed "UU_I"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
153 |
|
9169 | 154 |
Goal "~(x::'a::po)<<y ==> ~x=y"; |
155 |
by Auto_tac; |
|
156 |
qed "not_less2not_eq"; |
|
157 |
||
158 |
Goal "[|chain(Y);lub(range(Y))=UU|] ==> ALL i. Y(i)=UU"; |
|
159 |
by (rtac allI 1); |
|
160 |
by (rtac antisym_less 1); |
|
161 |
by (rtac minimal 2); |
|
162 |
by (etac subst 1); |
|
163 |
by (etac is_ub_thelub 1); |
|
164 |
qed "chain_UU_I"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
165 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
166 |
|
9169 | 167 |
Goal "ALL i. Y(i::nat)=UU ==> lub(range(Y::(nat=>'a::pcpo)))=UU"; |
168 |
by (rtac lub_chain_maxelem 1); |
|
169 |
by (etac spec 1); |
|
170 |
by (rtac allI 1); |
|
171 |
by (rtac (antisym_less_inverse RS conjunct1) 1); |
|
172 |
by (etac spec 1); |
|
173 |
qed "chain_UU_I_inverse"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
174 |
|
9169 | 175 |
Goal "~lub(range(Y::(nat=>'a::pcpo)))=UU ==> EX i.~ Y(i)=UU"; |
176 |
by (blast_tac (claset() addIs [chain_UU_I_inverse]) 1); |
|
177 |
qed "chain_UU_I_inverse2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
178 |
|
9169 | 179 |
Goal "[| x<<y; ~x=UU |] ==> ~y=UU"; |
180 |
by (blast_tac (claset() addIs [UU_I]) 1); |
|
181 |
qed "notUU_I"; |
|
182 |
||
183 |
Goal |
|
184 |
"[|EX j. ~Y(j)=UU;chain(Y::nat=>'a::pcpo)|] ==> EX j. ALL i. j<i-->~Y(i)=UU"; |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
185 |
by (blast_tac (claset() addDs [notUU_I, chain_mono]) 1); |
9169 | 186 |
qed "chain_mono2"; |
3326 | 187 |
|
188 |
(**************************************) |
|
189 |
(* some properties for chfin and flat *) |
|
190 |
(**************************************) |
|
191 |
||
192 |
(* ------------------------------------------------------------------------ *) |
|
4721
c8a8482a8124
renamed is_chain to chain, is_tord to tord, replaced chain_finite by chfin
oheimb
parents:
4098
diff
changeset
|
193 |
(* flat types are chfin *) |
3326 | 194 |
(* ------------------------------------------------------------------------ *) |
195 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
196 |
(*Used only in an "instance" declaration (Fun1.thy)*) |
9169 | 197 |
Goalw [max_in_chain_def] |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
198 |
"ALL Y::nat=>'a::flat. chain Y --> (EX n. max_in_chain n Y)"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
199 |
by (Clarify_tac 1); |
9169 | 200 |
by (case_tac "ALL i. Y(i)=UU" 1); |
201 |
by (res_inst_tac [("x","0")] exI 1); |
|
202 |
by (Asm_simp_tac 1); |
|
203 |
by (Asm_full_simp_tac 1); |
|
204 |
by (etac exE 1); |
|
205 |
by (res_inst_tac [("x","i")] exI 1); |
|
206 |
by (strip_tac 1); |
|
207 |
by (etac (le_imp_less_or_eq RS disjE) 1); |
|
208 |
by Safe_tac; |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
209 |
by (blast_tac (claset() addDs [chain_mono, ax_flat RS spec RS spec RS mp]) 1); |
9169 | 210 |
qed "flat_imp_chfin"; |
3326 | 211 |
|
212 |
(* flat subclass of chfin --> adm_flat not needed *) |
|
213 |
||
9169 | 214 |
Goal "(a::'a::flat) ~= UU ==> a << b = (a = b)"; |
215 |
by (safe_tac (HOL_cs addSIs [refl_less])); |
|
216 |
by (dtac (ax_flat RS spec RS spec RS mp) 1); |
|
217 |
by (fast_tac (HOL_cs addSIs [refl_less,ax_flat RS spec RS spec RS mp]) 1); |
|
218 |
qed "flat_eq"; |
|
3326 | 219 |
|
9169 | 220 |
Goal "chain (Y::nat=>'a::chfin) ==> finite_chain Y"; |
221 |
by (force_tac (HOL_cs, simpset() addsimps [chfin,finite_chain_def]) 1); |
|
222 |
qed "chfin2finch"; |
|
3326 | 223 |
|
224 |
(* ------------------------------------------------------------------------ *) |
|
225 |
(* lemmata for improved admissibility introdution rule *) |
|
226 |
(* ------------------------------------------------------------------------ *) |
|
227 |
||
9169 | 228 |
val prems = Goal |
229 |
"[|chain Y; ALL i. P (Y i); \ |
|
230 |
\ (!!Y. [| chain Y; ALL i. P (Y i); ~ finite_chain Y |] ==> P (lub(range Y)))\ |
|
231 |
\ |] ==> P (lub (range Y))"; |
|
232 |
by (cut_facts_tac prems 1); |
|
233 |
by (case_tac "finite_chain Y" 1); |
|
234 |
by (eresolve_tac prems 2); |
|
235 |
by (atac 2); |
|
236 |
by (atac 2); |
|
237 |
by (rewtac finite_chain_def); |
|
238 |
by (safe_tac HOL_cs); |
|
239 |
by (etac (lub_finch1 RS thelubI RS ssubst) 1); |
|
240 |
by (atac 1); |
|
241 |
by (etac spec 1); |
|
242 |
qed "infinite_chain_adm_lemma"; |
|
3326 | 243 |
|
9169 | 244 |
val prems = Goal |
245 |
"[|chain Y; ALL i. P (Y i); \ |
|
246 |
\ (!!Y. [| chain Y; ALL i. P (Y i); \ |
|
247 |
\ ALL i. EX j. i < j & Y i ~= Y j & Y i << Y j|]\ |
|
248 |
\ ==> P (lub (range Y))) |] ==> P (lub (range Y))"; |
|
249 |
by (cut_facts_tac prems 1); |
|
250 |
by (etac infinite_chain_adm_lemma 1); |
|
251 |
by (atac 1); |
|
252 |
by (etac thin_rl 1); |
|
253 |
by (rewtac finite_chain_def); |
|
254 |
by (rewtac max_in_chain_def); |
|
255 |
by (fast_tac (HOL_cs addIs prems |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9169
diff
changeset
|
256 |
addDs [le_imp_less_or_eq] addEs [chain_mono]) 1); |
9169 | 257 |
qed "increasing_chain_adm_lemma"; |