author | wenzelm |
Mon, 04 Dec 2000 23:17:23 +0100 | |
changeset 10581 | 74e542a299f0 |
parent 10230 | 5eb935d6cc69 |
child 10834 | a7897aebbffc |
permissions | -rw-r--r-- |
2640 | 1 |
(* Title: HOLCF/Fix.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 |
|
9245 | 6 |
fixed point operator and admissibility |
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 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
9 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
10 |
(* derive inductive properties of iterate from primitive recursion *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
11 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
12 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
13 |
Goal "iterate (Suc n) F x = iterate n F (F`x)"; |
9245 | 14 |
by (induct_tac "n" 1); |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
15 |
by Auto_tac; |
9245 | 16 |
qed "iterate_Suc2"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
17 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
18 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
19 |
(* the sequence of function itertaions is a chain *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
20 |
(* This property is essential since monotonicity of iterate makes no sense *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
21 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
22 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
23 |
Goalw [chain] "x << F`x ==> chain (%i. iterate i F x)"; |
9245 | 24 |
by (strip_tac 1); |
25 |
by (induct_tac "i" 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
26 |
by Auto_tac; |
9245 | 27 |
by (etac monofun_cfun_arg 1); |
28 |
qed "chain_iterate2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
29 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
30 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
31 |
Goal "chain (%i. iterate i F UU)"; |
9245 | 32 |
by (rtac chain_iterate2 1); |
33 |
by (rtac minimal 1); |
|
34 |
qed "chain_iterate"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
35 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
36 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
37 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
38 |
(* Kleene's fixed point theorems for continuous functions in pointed *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
39 |
(* omega cpo's *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
40 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
41 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
42 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
43 |
Goalw [Ifix_def] "Ifix F =F`(Ifix F)"; |
9245 | 44 |
by (stac contlub_cfun_arg 1); |
45 |
by (rtac chain_iterate 1); |
|
46 |
by (rtac antisym_less 1); |
|
47 |
by (rtac lub_mono 1); |
|
48 |
by (rtac chain_iterate 1); |
|
49 |
by (rtac ch2ch_Rep_CFunR 1); |
|
50 |
by (rtac chain_iterate 1); |
|
51 |
by (rtac allI 1); |
|
52 |
by (rtac (iterate_Suc RS subst) 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
53 |
by (rtac (chain_iterate RS chainE) 1); |
9245 | 54 |
by (rtac is_lub_thelub 1); |
55 |
by (rtac ch2ch_Rep_CFunR 1); |
|
56 |
by (rtac chain_iterate 1); |
|
57 |
by (rtac ub_rangeI 1); |
|
58 |
by (rtac (iterate_Suc RS subst) 1); |
|
59 |
by (rtac is_ub_thelub 1); |
|
60 |
by (rtac chain_iterate 1); |
|
61 |
qed "Ifix_eq"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
62 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
63 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
64 |
Goalw [Ifix_def] "F`x=x ==> Ifix(F) << x"; |
9245 | 65 |
by (rtac is_lub_thelub 1); |
66 |
by (rtac chain_iterate 1); |
|
67 |
by (rtac ub_rangeI 1); |
|
68 |
by (strip_tac 1); |
|
69 |
by (induct_tac "i" 1); |
|
70 |
by (Asm_simp_tac 1); |
|
71 |
by (Asm_simp_tac 1); |
|
72 |
by (res_inst_tac [("t","x")] subst 1); |
|
73 |
by (atac 1); |
|
74 |
by (etac monofun_cfun_arg 1); |
|
75 |
qed "Ifix_least"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
76 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
77 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
78 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
79 |
(* monotonicity and continuity of iterate *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
80 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
81 |
|
9245 | 82 |
Goalw [monofun] "monofun(iterate(i))"; |
83 |
by (strip_tac 1); |
|
84 |
by (induct_tac "i" 1); |
|
85 |
by (Asm_simp_tac 1); |
|
86 |
by (asm_full_simp_tac (simpset() addsimps [less_fun, monofun_cfun]) 1); |
|
87 |
qed "monofun_iterate"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
88 |
|
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 |
(* the following lemma uses contlub_cfun which itself is based on a *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
91 |
(* diagonalisation lemma for continuous functions with two arguments. *) |
5291 | 92 |
(* In this special case it is the application function Rep_CFun *) |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
93 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
94 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
95 |
Goalw [contlub] "contlub(iterate(i))"; |
9245 | 96 |
by (strip_tac 1); |
97 |
by (induct_tac "i" 1); |
|
98 |
by (Asm_simp_tac 1); |
|
99 |
by (rtac (lub_const RS thelubI RS sym) 1); |
|
100 |
by (asm_simp_tac (simpset() delsimps [range_composition]) 1); |
|
101 |
by (rtac ext 1); |
|
102 |
by (stac thelub_fun 1); |
|
103 |
by (rtac chainI 1); |
|
104 |
by (rtac (less_fun RS iffD2) 1); |
|
105 |
by (rtac allI 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
106 |
by (rtac (chainE) 1); |
9245 | 107 |
by (rtac (monofun_Rep_CFun1 RS ch2ch_MF2LR) 1); |
108 |
by (rtac allI 1); |
|
109 |
by (rtac monofun_Rep_CFun2 1); |
|
110 |
by (atac 1); |
|
111 |
by (rtac ch2ch_fun 1); |
|
112 |
by (rtac (monofun_iterate RS ch2ch_monofun) 1); |
|
113 |
by (atac 1); |
|
114 |
by (stac thelub_fun 1); |
|
115 |
by (rtac (monofun_iterate RS ch2ch_monofun) 1); |
|
116 |
by (atac 1); |
|
117 |
by (rtac contlub_cfun 1); |
|
118 |
by (atac 1); |
|
119 |
by (etac (monofun_iterate RS ch2ch_monofun RS ch2ch_fun) 1); |
|
120 |
qed "contlub_iterate"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
121 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
122 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
123 |
Goal "cont(iterate(i))"; |
9245 | 124 |
by (rtac monocontlub2cont 1); |
125 |
by (rtac monofun_iterate 1); |
|
126 |
by (rtac contlub_iterate 1); |
|
127 |
qed "cont_iterate"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
128 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
129 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
130 |
(* a lemma about continuity of iterate in its third argument *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
131 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
132 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
133 |
Goal "monofun(iterate n F)"; |
9245 | 134 |
by (rtac monofunI 1); |
135 |
by (strip_tac 1); |
|
136 |
by (induct_tac "n" 1); |
|
137 |
by (Asm_simp_tac 1); |
|
138 |
by (Asm_simp_tac 1); |
|
139 |
by (etac monofun_cfun_arg 1); |
|
140 |
qed "monofun_iterate2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
141 |
|
9245 | 142 |
Goal "contlub(iterate n F)"; |
143 |
by (rtac contlubI 1); |
|
144 |
by (strip_tac 1); |
|
145 |
by (induct_tac "n" 1); |
|
146 |
by (Simp_tac 1); |
|
147 |
by (Simp_tac 1); |
|
148 |
by (res_inst_tac [("t","iterate n F (lub(range(%u. Y u)))"), |
|
149 |
("s","lub(range(%i. iterate n F (Y i)))")] ssubst 1); |
|
150 |
by (atac 1); |
|
151 |
by (rtac contlub_cfun_arg 1); |
|
152 |
by (etac (monofun_iterate2 RS ch2ch_monofun) 1); |
|
153 |
qed "contlub_iterate2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
154 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
155 |
Goal "cont (iterate n F)"; |
9245 | 156 |
by (rtac monocontlub2cont 1); |
157 |
by (rtac monofun_iterate2 1); |
|
158 |
by (rtac contlub_iterate2 1); |
|
159 |
qed "cont_iterate2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
160 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
161 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
162 |
(* monotonicity and continuity of Ifix *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
163 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
164 |
|
9245 | 165 |
Goalw [monofun,Ifix_def] "monofun(Ifix)"; |
166 |
by (strip_tac 1); |
|
167 |
by (rtac lub_mono 1); |
|
168 |
by (rtac chain_iterate 1); |
|
169 |
by (rtac chain_iterate 1); |
|
170 |
by (rtac allI 1); |
|
171 |
by (rtac (less_fun RS iffD1 RS spec) 1 THEN |
|
172 |
etac (monofun_iterate RS monofunE RS spec RS spec RS mp) 1); |
|
173 |
qed "monofun_Ifix"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
174 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
175 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
176 |
(* since iterate is not monotone in its first argument, special lemmas must *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
177 |
(* be derived for lubs in this argument *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
178 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
179 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
180 |
Goal |
9245 | 181 |
"chain(Y) ==> chain(%i. lub(range(%ia. iterate ia (Y i) UU)))"; |
182 |
by (rtac chainI 1); |
|
183 |
by (strip_tac 1); |
|
184 |
by (rtac lub_mono 1); |
|
185 |
by (rtac chain_iterate 1); |
|
186 |
by (rtac chain_iterate 1); |
|
187 |
by (strip_tac 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
188 |
by (etac (monofun_iterate RS ch2ch_monofun RS ch2ch_fun RS chainE) 1); |
9245 | 189 |
qed "chain_iterate_lub"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
190 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
191 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
192 |
(* this exchange lemma is analog to the one for monotone functions *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
193 |
(* observe that monotonicity is not really needed. The propagation of *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
194 |
(* chains is the essential argument which is usually derived from monot. *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
195 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
196 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
197 |
Goal "chain(Y) ==>iterate n (lub(range Y)) y = lub(range(%i. iterate n (Y i) y))"; |
9245 | 198 |
by (rtac (thelub_fun RS subst) 1); |
199 |
by (etac (monofun_iterate RS ch2ch_monofun) 1); |
|
200 |
by (asm_simp_tac (simpset() addsimps [contlub_iterate RS contlubE]) 1); |
|
201 |
qed "contlub_Ifix_lemma1"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
202 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
203 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
204 |
Goal "chain(Y) ==>\ |
1168
74be52691d62
The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents:
892
diff
changeset
|
205 |
\ lub(range(%i. lub(range(%ia. iterate i (Y ia) UU)))) =\ |
9245 | 206 |
\ lub(range(%i. lub(range(%ia. iterate ia (Y i) UU))))"; |
207 |
by (rtac antisym_less 1); |
|
208 |
by (rtac is_lub_thelub 1); |
|
209 |
by (rtac (contlub_Ifix_lemma1 RS ext RS subst) 1); |
|
210 |
by (atac 1); |
|
211 |
by (rtac chain_iterate 1); |
|
212 |
by (rtac ub_rangeI 1); |
|
213 |
by (strip_tac 1); |
|
214 |
by (rtac lub_mono 1); |
|
215 |
by (etac (monofun_iterate RS ch2ch_monofun RS ch2ch_fun) 1); |
|
216 |
by (etac chain_iterate_lub 1); |
|
217 |
by (strip_tac 1); |
|
218 |
by (rtac is_ub_thelub 1); |
|
219 |
by (rtac chain_iterate 1); |
|
220 |
by (rtac is_lub_thelub 1); |
|
221 |
by (etac chain_iterate_lub 1); |
|
222 |
by (rtac ub_rangeI 1); |
|
223 |
by (strip_tac 1); |
|
224 |
by (rtac lub_mono 1); |
|
225 |
by (rtac chain_iterate 1); |
|
226 |
by (rtac (contlub_Ifix_lemma1 RS ext RS subst) 1); |
|
227 |
by (atac 1); |
|
228 |
by (rtac chain_iterate 1); |
|
229 |
by (strip_tac 1); |
|
230 |
by (rtac is_ub_thelub 1); |
|
231 |
by (etac (monofun_iterate RS ch2ch_monofun RS ch2ch_fun) 1); |
|
232 |
qed "ex_lub_iterate"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
233 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
234 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
235 |
Goalw [contlub,Ifix_def] "contlub(Ifix)"; |
9245 | 236 |
by (strip_tac 1); |
237 |
by (stac (contlub_Ifix_lemma1 RS ext) 1); |
|
238 |
by (atac 1); |
|
239 |
by (etac ex_lub_iterate 1); |
|
240 |
qed "contlub_Ifix"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
241 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
242 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
243 |
Goal "cont(Ifix)"; |
9245 | 244 |
by (rtac monocontlub2cont 1); |
245 |
by (rtac monofun_Ifix 1); |
|
246 |
by (rtac contlub_Ifix 1); |
|
247 |
qed "cont_Ifix"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
248 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
249 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
250 |
(* propagate properties of Ifix to its continuous counterpart *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
251 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
252 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
253 |
Goalw [fix_def] "fix`F = F`(fix`F)"; |
9245 | 254 |
by (asm_simp_tac (simpset() addsimps [cont_Ifix]) 1); |
255 |
by (rtac Ifix_eq 1); |
|
256 |
qed "fix_eq"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
257 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
258 |
Goalw [fix_def] "F`x = x ==> fix`F << x"; |
9245 | 259 |
by (asm_simp_tac (simpset() addsimps [cont_Ifix]) 1); |
260 |
by (etac Ifix_least 1); |
|
261 |
qed "fix_least"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
262 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
263 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
264 |
Goal |
9245 | 265 |
"[| F`x = x; !z. F`z = z --> x << z |] ==> x = fix`F"; |
266 |
by (rtac antisym_less 1); |
|
267 |
by (etac allE 1); |
|
268 |
by (etac mp 1); |
|
269 |
by (rtac (fix_eq RS sym) 1); |
|
270 |
by (etac fix_least 1); |
|
271 |
qed "fix_eqI"; |
|
1274 | 272 |
|
273 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
274 |
Goal "f == fix`F ==> f = F`f"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
275 |
by (asm_simp_tac (simpset() addsimps [fix_eq RS sym]) 1); |
9245 | 276 |
qed "fix_eq2"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
277 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
278 |
Goal "f == fix`F ==> f`x = F`f`x"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
279 |
by (etac (fix_eq2 RS cfun_fun_cong) 1); |
9245 | 280 |
qed "fix_eq3"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
281 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
282 |
fun fix_tac3 thm i = ((rtac trans i) THEN (rtac (thm RS fix_eq3) i)); |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
283 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
284 |
Goal "f = fix`F ==> f = F`f"; |
9245 | 285 |
by (hyp_subst_tac 1); |
286 |
by (rtac fix_eq 1); |
|
287 |
qed "fix_eq4"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
288 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
289 |
Goal "f = fix`F ==> f`x = F`f`x"; |
9245 | 290 |
by (rtac trans 1); |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
291 |
by (etac (fix_eq4 RS cfun_fun_cong) 1); |
9245 | 292 |
by (rtac refl 1); |
293 |
qed "fix_eq5"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
294 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
295 |
fun fix_tac5 thm i = ((rtac trans i) THEN (rtac (thm RS fix_eq5) i)); |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
296 |
|
3652 | 297 |
(* proves the unfolding theorem for function equations f = fix`... *) |
298 |
fun fix_prover thy fixeq s = prove_goal thy s (fn prems => [ |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
299 |
(rtac trans 1), |
3652 | 300 |
(rtac (fixeq RS fix_eq4) 1), |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
301 |
(rtac trans 1), |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
302 |
(rtac beta_cfun 1), |
2566 | 303 |
(Simp_tac 1) |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
304 |
]); |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
305 |
|
3652 | 306 |
(* proves the unfolding theorem for function definitions f == fix`... *) |
307 |
fun fix_prover2 thy fixdef s = prove_goal thy s (fn prems => [ |
|
1461 | 308 |
(rtac trans 1), |
309 |
(rtac (fix_eq2) 1), |
|
310 |
(rtac fixdef 1), |
|
311 |
(rtac beta_cfun 1), |
|
2566 | 312 |
(Simp_tac 1) |
1168
74be52691d62
The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents:
892
diff
changeset
|
313 |
]); |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
314 |
|
3652 | 315 |
(* proves an application case for a function from its unfolding thm *) |
316 |
fun case_prover thy unfold s = prove_goal thy s (fn prems => [ |
|
317 |
(cut_facts_tac prems 1), |
|
318 |
(rtac trans 1), |
|
319 |
(stac unfold 1), |
|
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4423
diff
changeset
|
320 |
Auto_tac |
3652 | 321 |
]); |
322 |
||
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
323 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
324 |
(* better access to definitions *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
325 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
326 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
327 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
328 |
Goal "Ifix=(%x. lub(range(%i. iterate i x UU)))"; |
9245 | 329 |
by (rtac ext 1); |
330 |
by (rewtac Ifix_def); |
|
331 |
by (rtac refl 1); |
|
332 |
qed "Ifix_def2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
333 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
334 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
335 |
(* direct connection between fix and iteration without Ifix *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
336 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
337 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
338 |
Goalw [fix_def] "fix`F = lub(range(%i. iterate i F UU))"; |
9245 | 339 |
by (fold_goals_tac [Ifix_def]); |
340 |
by (asm_simp_tac (simpset() addsimps [cont_Ifix]) 1); |
|
341 |
qed "fix_def2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
342 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
343 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
344 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
345 |
(* Lemmas about admissibility and fixed point induction *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
346 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
347 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
348 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
349 |
(* access to definitions *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
350 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
351 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
352 |
val prems = Goalw [adm_def] |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
353 |
"(!!Y. [| chain(Y); !i. P(Y(i)) |] ==> P(lub(range(Y)))) ==> adm(P)"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
354 |
by (blast_tac (claset() addIs prems) 1); |
9245 | 355 |
qed "admI"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
356 |
|
9245 | 357 |
Goalw [adm_def] "[| adm(P); chain(Y); !i. P(Y(i)) |] ==> P(lub(range(Y)))"; |
358 |
by (Blast_tac 1); |
|
359 |
qed "admD"; |
|
360 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
361 |
Goalw [admw_def] "admw(P) = (!F.(!n. P(iterate n F UU)) -->\ |
9245 | 362 |
\ P (lub(range(%i. iterate i F UU))))"; |
363 |
by (rtac refl 1); |
|
364 |
qed "admw_def2"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
365 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
366 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
367 |
(* an admissible formula is also weak admissible *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
368 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
369 |
|
10230 | 370 |
Goalw [admw_def] "adm(P)==>admw(P)"; |
9245 | 371 |
by (strip_tac 1); |
372 |
by (etac admD 1); |
|
373 |
by (rtac chain_iterate 1); |
|
374 |
by (atac 1); |
|
375 |
qed "adm_impl_admw"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
376 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
377 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
378 |
(* fixed point induction *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
379 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
380 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
381 |
val major::prems = Goal |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
382 |
"[| adm(P); P(UU); !!x. P(x) ==> P(F`x)|] ==> P(fix`F)"; |
9245 | 383 |
by (stac fix_def2 1); |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
384 |
by (rtac (major RS admD) 1); |
9245 | 385 |
by (rtac chain_iterate 1); |
386 |
by (rtac allI 1); |
|
387 |
by (induct_tac "i" 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
388 |
by (asm_simp_tac (simpset() addsimps (iterate_0::prems)) 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
389 |
by (asm_simp_tac (simpset() addsimps (iterate_Suc::prems)) 1); |
9245 | 390 |
qed "fix_ind"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
391 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
392 |
val prems = Goal "[| f == fix`F; adm(P); \ |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
393 |
\ P(UU); !!x. P(x) ==> P(F`x)|] ==> P f"; |
9245 | 394 |
by (cut_facts_tac prems 1); |
395 |
by (asm_simp_tac HOL_ss 1); |
|
396 |
by (etac fix_ind 1); |
|
397 |
by (atac 1); |
|
398 |
by (eresolve_tac prems 1); |
|
399 |
qed "def_fix_ind"; |
|
2568 | 400 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
401 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
402 |
(* computational induction for weak admissible formulae *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
403 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
404 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
405 |
Goal "[| admw(P); !n. P(iterate n F UU)|] ==> P(fix`F)"; |
9245 | 406 |
by (stac fix_def2 1); |
407 |
by (rtac (admw_def2 RS iffD1 RS spec RS mp) 1); |
|
408 |
by (atac 1); |
|
409 |
by (rtac allI 1); |
|
410 |
by (etac spec 1); |
|
411 |
qed "wfix_ind"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
412 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
413 |
Goal "[| f == fix`F; admw(P); \ |
9245 | 414 |
\ !n. P(iterate n F UU) |] ==> P f"; |
415 |
by (asm_simp_tac HOL_ss 1); |
|
416 |
by (etac wfix_ind 1); |
|
417 |
by (atac 1); |
|
418 |
qed "def_wfix_ind"; |
|
2568 | 419 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
420 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
421 |
(* for chain-finite (easy) types every formula is admissible *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
422 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
423 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
424 |
Goalw [adm_def] |
9245 | 425 |
"!Y. chain(Y::nat=>'a) --> (? n. max_in_chain n Y) ==> adm(P::'a=>bool)"; |
426 |
by (strip_tac 1); |
|
427 |
by (rtac exE 1); |
|
428 |
by (rtac mp 1); |
|
429 |
by (etac spec 1); |
|
430 |
by (atac 1); |
|
431 |
by (stac (lub_finch1 RS thelubI) 1); |
|
432 |
by (atac 1); |
|
433 |
by (atac 1); |
|
434 |
by (etac spec 1); |
|
435 |
qed "adm_max_in_chain"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
436 |
|
4720 | 437 |
bind_thm ("adm_chfin" ,chfin RS adm_max_in_chain); |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
438 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
439 |
(* ------------------------------------------------------------------------ *) |
4720 | 440 |
(* some lemmata for functions with flat/chfin domain/range types *) |
2354 | 441 |
(* ------------------------------------------------------------------------ *) |
442 |
||
9245 | 443 |
val _ = goalw thy [adm_def] "adm (%(u::'a::cpo->'b::chfin). P(u`s))"; |
444 |
by (strip_tac 1); |
|
445 |
by (dtac chfin_Rep_CFunR 1); |
|
446 |
by (eres_inst_tac [("x","s")] allE 1); |
|
447 |
by (fast_tac (HOL_cs addss (simpset() addsimps [chfin])) 1); |
|
448 |
qed "adm_chfindom"; |
|
2354 | 449 |
|
3324 | 450 |
(* adm_flat not needed any more, since it is a special case of adm_chfindom *) |
2354 | 451 |
|
1992 | 452 |
(* ------------------------------------------------------------------------ *) |
3326 | 453 |
(* improved admisibility introduction *) |
1992 | 454 |
(* ------------------------------------------------------------------------ *) |
455 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
456 |
val prems = Goalw [adm_def] |
4720 | 457 |
"(!!Y. [| chain Y; !i. P (Y i); !i. ? j. i < j & Y i ~= Y j & Y i << Y j |]\ |
9245 | 458 |
\ ==> P(lub (range Y))) ==> adm P"; |
459 |
by (strip_tac 1); |
|
460 |
by (etac increasing_chain_adm_lemma 1); |
|
461 |
by (atac 1); |
|
462 |
by (eresolve_tac prems 1); |
|
463 |
by (atac 1); |
|
464 |
by (atac 1); |
|
465 |
qed "admI2"; |
|
1992 | 466 |
|
467 |
||
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
468 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
469 |
(* admissibility of special formulae and propagation *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
470 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
471 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
472 |
Goalw [adm_def] "[|cont u;cont v|]==> adm(%x. u x << v x)"; |
9245 | 473 |
by (strip_tac 1); |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
474 |
by (forw_inst_tac [("f","u")] (cont2mono RS ch2ch_monofun) 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
475 |
by (assume_tac 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
476 |
by (forw_inst_tac [("f","v")] (cont2mono RS ch2ch_monofun) 1); |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
477 |
by (assume_tac 1); |
9245 | 478 |
by (etac (cont2contlub RS contlubE RS spec RS mp RS ssubst) 1); |
479 |
by (atac 1); |
|
480 |
by (etac (cont2contlub RS contlubE RS spec RS mp RS ssubst) 1); |
|
481 |
by (atac 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
482 |
by (blast_tac (claset() addIs [lub_mono]) 1); |
9245 | 483 |
qed "adm_less"; |
3460 | 484 |
Addsimps [adm_less]; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
485 |
|
10230 | 486 |
Goal "[| adm P; adm Q |] ==> adm(%x. P x & Q x)"; |
9245 | 487 |
by (fast_tac (HOL_cs addEs [admD] addIs [admI]) 1); |
488 |
qed "adm_conj"; |
|
3460 | 489 |
Addsimps [adm_conj]; |
490 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
491 |
Goalw [adm_def] "adm(%x. t)"; |
9245 | 492 |
by (fast_tac HOL_cs 1); |
493 |
qed "adm_not_free"; |
|
3460 | 494 |
Addsimps [adm_not_free]; |
495 |
||
10230 | 496 |
Goalw [adm_def] "cont t ==> adm(%x.~ (t x) << u)"; |
9245 | 497 |
by (strip_tac 1); |
10230 | 498 |
by (rtac contrapos_nn 1); |
9245 | 499 |
by (etac spec 1); |
500 |
by (rtac trans_less 1); |
|
501 |
by (atac 2); |
|
502 |
by (etac (cont2mono RS monofun_fun_arg) 1); |
|
503 |
by (rtac is_ub_thelub 1); |
|
504 |
by (atac 1); |
|
505 |
qed "adm_not_less"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
506 |
|
10230 | 507 |
Goal "!y. adm(P y) ==> adm(%x.!y. P y x)"; |
9245 | 508 |
by (fast_tac (HOL_cs addIs [admI] addEs [admD]) 1); |
509 |
qed "adm_all"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
510 |
|
1779 | 511 |
bind_thm ("adm_all2", allI RS adm_all); |
625 | 512 |
|
10230 | 513 |
Goal "[|cont t; adm P|] ==> adm(%x. P (t x))"; |
9245 | 514 |
by (rtac admI 1); |
515 |
by (stac (cont2contlub RS contlubE RS spec RS mp) 1); |
|
516 |
by (atac 1); |
|
517 |
by (atac 1); |
|
518 |
by (etac admD 1); |
|
519 |
by (etac (cont2mono RS ch2ch_monofun) 1); |
|
520 |
by (atac 1); |
|
521 |
by (atac 1); |
|
522 |
qed "adm_subst"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
523 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
524 |
Goal "adm(%x.~ UU << t(x))"; |
9245 | 525 |
by (Simp_tac 1); |
526 |
qed "adm_UU_not_less"; |
|
3460 | 527 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
528 |
|
9245 | 529 |
Goalw [adm_def] "cont(t)==> adm(%x.~ (t x) = UU)"; |
530 |
by (strip_tac 1); |
|
10230 | 531 |
by (rtac contrapos_nn 1); |
9245 | 532 |
by (etac spec 1); |
533 |
by (rtac (chain_UU_I RS spec) 1); |
|
534 |
by (etac (cont2mono RS ch2ch_monofun) 1); |
|
535 |
by (atac 1); |
|
536 |
by (etac (cont2contlub RS contlubE RS spec RS mp RS subst) 1); |
|
537 |
by (atac 1); |
|
538 |
by (atac 1); |
|
539 |
qed "adm_not_UU"; |
|
540 |
||
541 |
Goal "[|cont u ; cont v|]==> adm(%x. u x = v x)"; |
|
542 |
by (asm_simp_tac (simpset() addsimps [po_eq_conv]) 1); |
|
543 |
qed "adm_eq"; |
|
3460 | 544 |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
545 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
546 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
547 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
548 |
(* admissibility for disjunction is hard to prove. It takes 10 Lemmas *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
549 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
550 |
|
1992 | 551 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
552 |
Goal "!n. P(Y n)|Q(Y n) ==> (? i.!j. R i j --> Q(Y(j))) | (!i.? j. R i j & P(Y(j)))"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
553 |
by (Fast_tac 1); |
9245 | 554 |
qed "adm_disj_lemma1"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
555 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
556 |
Goal "[| adm(Q); ? X. chain(X) & (!n. Q(X(n))) &\ |
9245 | 557 |
\ lub(range(Y))=lub(range(X))|] ==> Q(lub(range(Y)))"; |
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
558 |
by (force_tac (claset() addEs [admD], simpset()) 1); |
9245 | 559 |
qed "adm_disj_lemma2"; |
2619 | 560 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
561 |
Goalw [chain] "chain(Y) ==> chain(%m. if m < Suc i then Y(Suc i) else Y m)"; |
9245 | 562 |
by (Asm_simp_tac 1); |
563 |
by (safe_tac HOL_cs); |
|
564 |
by (subgoal_tac "ia = i" 1); |
|
565 |
by (ALLGOALS Asm_simp_tac); |
|
566 |
qed "adm_disj_lemma3"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
567 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
568 |
Goal "!j. i < j --> Q(Y(j)) ==> !n. Q( if n < Suc i then Y(Suc i) else Y n)"; |
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
569 |
by (Asm_simp_tac 1); |
9245 | 570 |
qed "adm_disj_lemma4"; |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
571 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
572 |
Goal |
4720 | 573 |
"!!Y::nat=>'a::cpo. [| chain(Y); ! j. i < j --> Q(Y(j)) |] ==>\ |
9245 | 574 |
\ lub(range(Y)) = lub(range(%m. if m< Suc(i) then Y(Suc(i)) else Y m))"; |
575 |
by (safe_tac (HOL_cs addSIs [lub_equal2,adm_disj_lemma3])); |
|
576 |
by (atac 2); |
|
577 |
by (res_inst_tac [("x","i")] exI 1); |
|
578 |
by (Asm_simp_tac 1); |
|
579 |
qed "adm_disj_lemma5"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
580 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
581 |
Goal |
4720 | 582 |
"[| chain(Y::nat=>'a::cpo); ? i. ! j. i < j --> Q(Y(j)) |] ==>\ |
9245 | 583 |
\ ? X. chain(X) & (! n. Q(X(n))) & lub(range(Y)) = lub(range(X))"; |
584 |
by (etac exE 1); |
|
585 |
by (res_inst_tac [("x","%m. if m<Suc(i) then Y(Suc(i)) else Y m")] exI 1); |
|
586 |
by (rtac conjI 1); |
|
587 |
by (rtac adm_disj_lemma3 1); |
|
588 |
by (atac 1); |
|
589 |
by (rtac conjI 1); |
|
590 |
by (rtac adm_disj_lemma4 1); |
|
591 |
by (atac 1); |
|
592 |
by (rtac adm_disj_lemma5 1); |
|
593 |
by (atac 1); |
|
594 |
by (atac 1); |
|
595 |
qed "adm_disj_lemma6"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
596 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
597 |
Goal |
4720 | 598 |
"[| chain(Y::nat=>'a::cpo); ! i. ? j. i < j & P(Y(j)) |] ==>\ |
9245 | 599 |
\ chain(%m. Y(Least(%j. m<j & P(Y(j)))))"; |
600 |
by (rtac chainI 1); |
|
601 |
by (rtac chain_mono3 1); |
|
602 |
by (atac 1); |
|
603 |
by (rtac Least_le 1); |
|
604 |
by (rtac conjI 1); |
|
605 |
by (rtac Suc_lessD 1); |
|
606 |
by (etac allE 1); |
|
607 |
by (etac exE 1); |
|
608 |
by (rtac (LeastI RS conjunct1) 1); |
|
609 |
by (atac 1); |
|
610 |
by (etac allE 1); |
|
611 |
by (etac exE 1); |
|
612 |
by (rtac (LeastI RS conjunct2) 1); |
|
613 |
by (atac 1); |
|
614 |
qed "adm_disj_lemma7"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
615 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
616 |
Goal |
9245 | 617 |
"[| ! i. ? j. i < j & P(Y(j)) |] ==> ! m. P(Y(LEAST j::nat. m<j & P(Y(j))))"; |
618 |
by (strip_tac 1); |
|
619 |
by (etac allE 1); |
|
620 |
by (etac exE 1); |
|
621 |
by (etac (LeastI RS conjunct2) 1); |
|
622 |
qed "adm_disj_lemma8"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
623 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
624 |
Goal |
4720 | 625 |
"[| chain(Y::nat=>'a::cpo); ! i. ? j. i < j & P(Y(j)) |] ==>\ |
9245 | 626 |
\ lub(range(Y)) = lub(range(%m. Y(Least(%j. m<j & P(Y(j))))))"; |
627 |
by (rtac antisym_less 1); |
|
628 |
by (rtac lub_mono 1); |
|
629 |
by (atac 1); |
|
630 |
by (rtac adm_disj_lemma7 1); |
|
631 |
by (atac 1); |
|
632 |
by (atac 1); |
|
633 |
by (strip_tac 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
634 |
by (rtac (chain_mono) 1); |
9245 | 635 |
by (atac 1); |
636 |
by (etac allE 1); |
|
637 |
by (etac exE 1); |
|
638 |
by (rtac (LeastI RS conjunct1) 1); |
|
639 |
by (atac 1); |
|
640 |
by (rtac lub_mono3 1); |
|
641 |
by (rtac adm_disj_lemma7 1); |
|
642 |
by (atac 1); |
|
643 |
by (atac 1); |
|
644 |
by (atac 1); |
|
645 |
by (strip_tac 1); |
|
646 |
by (rtac exI 1); |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
647 |
by (rtac (chain_mono) 1); |
9245 | 648 |
by (atac 1); |
649 |
by (rtac lessI 1); |
|
650 |
qed "adm_disj_lemma9"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
651 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
652 |
Goal "[| chain(Y::nat=>'a::cpo); ! i. ? j. i < j & P(Y(j)) |] ==>\ |
9245 | 653 |
\ ? X. chain(X) & (! n. P(X(n))) & lub(range(Y)) = lub(range(X))"; |
654 |
by (res_inst_tac [("x","%m. Y(Least(%j. m<j & P(Y(j))))")] exI 1); |
|
655 |
by (rtac conjI 1); |
|
656 |
by (rtac adm_disj_lemma7 1); |
|
657 |
by (atac 1); |
|
658 |
by (atac 1); |
|
659 |
by (rtac conjI 1); |
|
660 |
by (rtac adm_disj_lemma8 1); |
|
661 |
by (atac 1); |
|
662 |
by (rtac adm_disj_lemma9 1); |
|
663 |
by (atac 1); |
|
664 |
by (atac 1); |
|
665 |
qed "adm_disj_lemma10"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
666 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
667 |
Goal "[| adm(P); chain(Y);? i. ! j. i < j --> P(Y(j))|]==>P(lub(range(Y)))"; |
9245 | 668 |
by (etac adm_disj_lemma2 1); |
669 |
by (etac adm_disj_lemma6 1); |
|
670 |
by (atac 1); |
|
671 |
qed "adm_disj_lemma12"; |
|
430 | 672 |
|
1992 | 673 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
674 |
Goal |
9245 | 675 |
"[| adm(P); chain(Y); ! i. ? j. i < j & P(Y(j)) |]==>P(lub(range(Y)))"; |
676 |
by (etac adm_disj_lemma2 1); |
|
677 |
by (etac adm_disj_lemma10 1); |
|
678 |
by (atac 1); |
|
679 |
qed "adm_lemma11"; |
|
430 | 680 |
|
10230 | 681 |
Goal "[| adm P; adm Q |] ==> adm(%x. P x | Q x)"; |
9245 | 682 |
by (rtac admI 1); |
683 |
by (rtac (adm_disj_lemma1 RS disjE) 1); |
|
684 |
by (atac 1); |
|
685 |
by (rtac disjI2 1); |
|
686 |
by (etac adm_disj_lemma12 1); |
|
687 |
by (atac 1); |
|
688 |
by (atac 1); |
|
689 |
by (rtac disjI1 1); |
|
690 |
by (etac adm_lemma11 1); |
|
691 |
by (atac 1); |
|
692 |
by (atac 1); |
|
693 |
qed "adm_disj"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
694 |
|
1992 | 695 |
|
696 |
bind_thm("adm_lemma11",adm_lemma11); |
|
697 |
bind_thm("adm_disj",adm_disj); |
|
430 | 698 |
|
10230 | 699 |
Goal "[| adm(%x.~(P x)); adm Q |] ==> adm(%x. P x --> Q x)"; |
9245 | 700 |
by (subgoal_tac "(%x. P x --> Q x) = (%x. ~P x | Q x)" 1); |
701 |
by (etac ssubst 1); |
|
702 |
by (etac adm_disj 1); |
|
703 |
by (atac 1); |
|
704 |
by (Simp_tac 1); |
|
705 |
qed "adm_imp"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
706 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5068
diff
changeset
|
707 |
Goal "[| adm (%x. P x --> Q x); adm (%x. Q x --> P x) |] \ |
3460 | 708 |
\ ==> adm (%x. P x = Q x)"; |
4423 | 709 |
by (subgoal_tac "(%x. P x = Q x) = (%x. (P x --> Q x) & (Q x --> P x))" 1); |
3460 | 710 |
by (Asm_simp_tac 1); |
711 |
by (rtac ext 1); |
|
712 |
by (fast_tac HOL_cs 1); |
|
713 |
qed"adm_iff"; |
|
714 |
||
715 |
||
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
716 |
Goal "[| adm (%x. ~ P x); adm (%x. ~ Q x) |] ==> adm (%x. ~ (P x & Q x))"; |
9245 | 717 |
by (subgoal_tac "(%x. ~ (P x & Q x)) = (%x. ~ P x | ~ Q x)" 1); |
718 |
by (rtac ext 2); |
|
719 |
by (fast_tac HOL_cs 2); |
|
720 |
by (etac ssubst 1); |
|
721 |
by (etac adm_disj 1); |
|
722 |
by (atac 1); |
|
723 |
qed "adm_not_conj"; |
|
1675 | 724 |
|
7661 | 725 |
bind_thms ("adm_lemmas", [adm_imp,adm_disj,adm_eq,adm_not_UU,adm_UU_not_less, |
726 |
adm_all2,adm_not_less,adm_not_conj,adm_iff]); |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
727 |
|
2566 | 728 |
Addsimps adm_lemmas; |