author | paulson |
Fri, 17 Jul 1998 11:23:17 +0200 | |
changeset 5158 | 48ca9ef35fb0 |
parent 5147 | 825877190618 |
child 5265 | 9d1d4c43c76d |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: ZF/wf.ML |
0 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Tobias Nipkow and Lawrence C Paulson |
4515 | 4 |
Copyright 1998 University of Cambridge |
0 | 5 |
|
4515 | 6 |
Well-founded Recursion |
0 | 7 |
|
8 |
Derived first for transitive relations, and finally for arbitrary WF relations |
|
9 |
via wf_trancl and trans_trancl. |
|
10 |
||
11 |
It is difficult to derive this general case directly, using r^+ instead of |
|
12 |
r. In is_recfun, the two occurrences of the relation must have the same |
|
13 |
form. Inserting r^+ in the_recfun or wftrec yields a recursion rule with |
|
14 |
r^+ -`` {a} instead of r-``{a}. This recursion rule is stronger in |
|
15 |
principle, but harder to use, especially to prove wfrec_eclose_eq in |
|
16 |
epsilon.ML. Expanding out the definition of wftrec in wfrec would yield |
|
17 |
a mess. |
|
18 |
*) |
|
19 |
||
20 |
open WF; |
|
21 |
||
22 |
||
23 |
(*** Well-founded relations ***) |
|
24 |
||
435 | 25 |
(** Equivalences between wf and wf_on **) |
26 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
27 |
Goalw [wf_def, wf_on_def] "wf(r) ==> wf[A](r)"; |
4515 | 28 |
by (Clarify_tac 1); (*essential for Blast_tac's efficiency*) |
3016 | 29 |
by (Blast_tac 1); |
760 | 30 |
qed "wf_imp_wf_on"; |
435 | 31 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
32 |
Goalw [wf_def, wf_on_def] "wf[field(r)](r) ==> wf(r)"; |
2469 | 33 |
by (Fast_tac 1); |
760 | 34 |
qed "wf_on_field_imp_wf"; |
435 | 35 |
|
5067 | 36 |
Goal "wf(r) <-> wf[field(r)](r)"; |
4091 | 37 |
by (blast_tac (claset() addIs [wf_imp_wf_on, wf_on_field_imp_wf]) 1); |
760 | 38 |
qed "wf_iff_wf_on_field"; |
0 | 39 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
40 |
Goalw [wf_on_def, wf_def] "[| wf[A](r); B<=A |] ==> wf[B](r)"; |
4515 | 41 |
by (Clarify_tac 1); (*essential for Blast_tac's efficiency*) |
42 |
by (Blast_tac 1); |
|
760 | 43 |
qed "wf_on_subset_A"; |
435 | 44 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
45 |
Goalw [wf_on_def, wf_def] "[| wf[A](r); s<=r |] ==> wf[A](s)"; |
4515 | 46 |
by (Clarify_tac 1); (*essential for Blast_tac's efficiency*) |
47 |
by (Blast_tac 1); |
|
760 | 48 |
qed "wf_on_subset_r"; |
435 | 49 |
|
50 |
(** Introduction rules for wf_on **) |
|
51 |
||
52 |
(*If every non-empty subset of A has an r-minimal element then wf[A](r).*) |
|
53 |
val [prem] = goalw WF.thy [wf_on_def, wf_def] |
|
54 |
"[| !!Z u. [| Z<=A; u:Z; ALL x:Z. EX y:Z. <y,x>:r |] ==> False |] \ |
|
55 |
\ ==> wf[A](r)"; |
|
0 | 56 |
by (rtac (equals0I RS disjCI RS allI) 1); |
435 | 57 |
by (res_inst_tac [ ("Z", "Z") ] prem 1); |
3016 | 58 |
by (ALLGOALS Blast_tac); |
760 | 59 |
qed "wf_onI"; |
0 | 60 |
|
435 | 61 |
(*If r allows well-founded induction over A then wf[A](r) |
62 |
Premise is equivalent to |
|
63 |
!!B. ALL x:A. (ALL y. <y,x>: r --> y:B) --> x:B ==> A<=B *) |
|
64 |
val [prem] = goal WF.thy |
|
65 |
"[| !!y B. [| ALL x:A. (ALL y:A. <y,x>:r --> y:B) --> x:B; y:A \ |
|
66 |
\ |] ==> y:B |] \ |
|
67 |
\ ==> wf[A](r)"; |
|
437 | 68 |
by (rtac wf_onI 1); |
435 | 69 |
by (res_inst_tac [ ("c", "u") ] (prem RS DiffE) 1); |
70 |
by (contr_tac 3); |
|
3016 | 71 |
by (Blast_tac 2); |
2469 | 72 |
by (Fast_tac 1); |
760 | 73 |
qed "wf_onI2"; |
0 | 74 |
|
75 |
||
76 |
(** Well-founded Induction **) |
|
77 |
||
78 |
(*Consider the least z in domain(r) Un {a} such that P(z) does not hold...*) |
|
494 | 79 |
val [major,minor] = goalw WF.thy [wf_def] |
0 | 80 |
"[| wf(r); \ |
81 |
\ !!x.[| ALL y. <y,x>: r --> P(y) |] ==> P(x) \ |
|
82 |
\ |] ==> P(a)"; |
|
83 |
by (res_inst_tac [ ("x", "{z:domain(r) Un {a}. ~P(z)}") ] (major RS allE) 1); |
|
84 |
by (etac disjE 1); |
|
4091 | 85 |
by (blast_tac (claset() addEs [equalityE]) 1); |
86 |
by (asm_full_simp_tac (simpset() addsimps [domainI]) 1); |
|
87 |
by (blast_tac (claset() addSDs [minor]) 1); |
|
760 | 88 |
qed "wf_induct"; |
0 | 89 |
|
90 |
(*Perform induction on i, then prove the wf(r) subgoal using prems. *) |
|
91 |
fun wf_ind_tac a prems i = |
|
92 |
EVERY [res_inst_tac [("a",a)] wf_induct i, |
|
1461 | 93 |
rename_last_tac a ["1"] (i+1), |
94 |
ares_tac prems i]; |
|
0 | 95 |
|
485 | 96 |
(*The form of this rule is designed to match wfI*) |
0 | 97 |
val wfr::amem::prems = goal WF.thy |
98 |
"[| wf(r); a:A; field(r)<=A; \ |
|
99 |
\ !!x.[| x: A; ALL y. <y,x>: r --> P(y) |] ==> P(x) \ |
|
100 |
\ |] ==> P(a)"; |
|
101 |
by (rtac (amem RS rev_mp) 1); |
|
102 |
by (wf_ind_tac "a" [wfr] 1); |
|
103 |
by (rtac impI 1); |
|
104 |
by (eresolve_tac prems 1); |
|
4091 | 105 |
by (blast_tac (claset() addIs (prems RL [subsetD])) 1); |
760 | 106 |
qed "wf_induct2"; |
0 | 107 |
|
2469 | 108 |
goal domrange.thy "!!r A. field(r Int A*A) <= A"; |
3016 | 109 |
by (Blast_tac 1); |
760 | 110 |
qed "field_Int_square"; |
435 | 111 |
|
112 |
val wfr::amem::prems = goalw WF.thy [wf_on_def] |
|
1461 | 113 |
"[| wf[A](r); a:A; \ |
114 |
\ !!x.[| x: A; ALL y:A. <y,x>: r --> P(y) |] ==> P(x) \ |
|
435 | 115 |
\ |] ==> P(a)"; |
116 |
by (rtac ([wfr, amem, field_Int_square] MRS wf_induct2) 1); |
|
117 |
by (REPEAT (ares_tac prems 1)); |
|
3016 | 118 |
by (Blast_tac 1); |
760 | 119 |
qed "wf_on_induct"; |
435 | 120 |
|
121 |
fun wf_on_ind_tac a prems i = |
|
122 |
EVERY [res_inst_tac [("a",a)] wf_on_induct i, |
|
1461 | 123 |
rename_last_tac a ["1"] (i+2), |
124 |
REPEAT (ares_tac prems i)]; |
|
435 | 125 |
|
126 |
(*If r allows well-founded induction then wf(r)*) |
|
127 |
val [subs,indhyp] = goal WF.thy |
|
128 |
"[| field(r)<=A; \ |
|
129 |
\ !!y B. [| ALL x:A. (ALL y:A. <y,x>:r --> y:B) --> x:B; y:A \ |
|
130 |
\ |] ==> y:B |] \ |
|
131 |
\ ==> wf(r)"; |
|
437 | 132 |
by (rtac ([wf_onI2, subs] MRS (wf_on_subset_A RS wf_on_field_imp_wf)) 1); |
435 | 133 |
by (REPEAT (ares_tac [indhyp] 1)); |
760 | 134 |
qed "wfI"; |
435 | 135 |
|
136 |
||
137 |
(*** Properties of well-founded relations ***) |
|
138 |
||
5137 | 139 |
Goal "wf(r) ==> <a,a> ~: r"; |
435 | 140 |
by (wf_ind_tac "a" [] 1); |
3016 | 141 |
by (Blast_tac 1); |
760 | 142 |
qed "wf_not_refl"; |
435 | 143 |
|
5137 | 144 |
Goal "[| wf(r); <a,x>:r; <x,a>:r |] ==> P"; |
435 | 145 |
by (subgoal_tac "ALL x. <a,x>:r --> <x,a>:r --> P" 1); |
146 |
by (wf_ind_tac "a" [] 2); |
|
3016 | 147 |
by (Blast_tac 2); |
148 |
by (Blast_tac 1); |
|
760 | 149 |
qed "wf_asym"; |
0 | 150 |
|
5137 | 151 |
Goal "[| wf[A](r); a: A |] ==> <a,a> ~: r"; |
435 | 152 |
by (wf_on_ind_tac "a" [] 1); |
3016 | 153 |
by (Blast_tac 1); |
760 | 154 |
qed "wf_on_not_refl"; |
435 | 155 |
|
5137 | 156 |
Goal "[| wf[A](r); <a,b>:r; <b,a>:r; a:A; b:A |] ==> P"; |
435 | 157 |
by (subgoal_tac "ALL y:A. <a,y>:r --> <y,a>:r --> P" 1); |
158 |
by (wf_on_ind_tac "a" [] 2); |
|
3016 | 159 |
by (Blast_tac 2); |
160 |
by (Blast_tac 1); |
|
760 | 161 |
qed "wf_on_asym"; |
435 | 162 |
|
163 |
(*Needed to prove well_ordI. Could also reason that wf[A](r) means |
|
164 |
wf(r Int A*A); thus wf( (r Int A*A)^+ ) and use wf_not_refl *) |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
165 |
Goal "[| wf[A](r); <a,b>:r; <b,c>:r; <c,a>:r; a:A; b:A; c:A |] ==> P"; |
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
166 |
by (subgoal_tac "ALL y:A. ALL z:A. <a,y>:r --> <y,z>:r --> <z,a>:r --> P" 1); |
435 | 167 |
by (wf_on_ind_tac "a" [] 2); |
3016 | 168 |
by (Blast_tac 2); |
169 |
by (Blast_tac 1); |
|
760 | 170 |
qed "wf_on_chain3"; |
435 | 171 |
|
172 |
||
173 |
(*retains the universal formula for later use!*) |
|
174 |
val bchain_tac = EVERY' [rtac (bspec RS mp), assume_tac, assume_tac ]; |
|
175 |
||
176 |
(*transitive closure of a WF relation is WF provided A is downwards closed*) |
|
177 |
val [wfr,subs] = goal WF.thy |
|
178 |
"[| wf[A](r); r-``A <= A |] ==> wf[A](r^+)"; |
|
437 | 179 |
by (rtac wf_onI2 1); |
435 | 180 |
by (bchain_tac 1); |
181 |
by (eres_inst_tac [("a","y")] (wfr RS wf_on_induct) 1); |
|
182 |
by (cut_facts_tac [subs] 1); |
|
4091 | 183 |
by (blast_tac (claset() addEs [tranclE]) 1); |
760 | 184 |
qed "wf_on_trancl"; |
435 | 185 |
|
5137 | 186 |
Goal "wf(r) ==> wf(r^+)"; |
4091 | 187 |
by (asm_full_simp_tac (simpset() addsimps [wf_iff_wf_on_field]) 1); |
437 | 188 |
by (rtac (trancl_type RS field_rel_subset RSN (2, wf_on_subset_A)) 1); |
189 |
by (etac wf_on_trancl 1); |
|
3016 | 190 |
by (Blast_tac 1); |
760 | 191 |
qed "wf_trancl"; |
0 | 192 |
|
435 | 193 |
|
194 |
||
0 | 195 |
(** r-``{a} is the set of everything under a in r **) |
196 |
||
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
760
diff
changeset
|
197 |
bind_thm ("underI", (vimage_singleton_iff RS iffD2)); |
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
760
diff
changeset
|
198 |
bind_thm ("underD", (vimage_singleton_iff RS iffD1)); |
0 | 199 |
|
200 |
(** is_recfun **) |
|
201 |
||
202 |
val [major] = goalw WF.thy [is_recfun_def] |
|
203 |
"is_recfun(r,a,H,f) ==> f: r-``{a} -> range(f)"; |
|
2033 | 204 |
by (stac major 1); |
0 | 205 |
by (rtac (lamI RS rangeI RS lam_type) 1); |
206 |
by (assume_tac 1); |
|
760 | 207 |
qed "is_recfun_type"; |
0 | 208 |
|
209 |
val [isrec,rel] = goalw WF.thy [is_recfun_def] |
|
210 |
"[| is_recfun(r,a,H,f); <x,a>:r |] ==> f`x = H(x, restrict(f,r-``{x}))"; |
|
443
10884e64c241
added parentheses made necessary by new constrain precedence
clasohm
parents:
437
diff
changeset
|
211 |
by (res_inst_tac [("P", "%x.?t(x) = (?u::i)")] (isrec RS ssubst) 1); |
0 | 212 |
by (rtac (rel RS underI RS beta) 1); |
760 | 213 |
qed "apply_recfun"; |
0 | 214 |
|
215 |
(*eresolve_tac transD solves <a,b>:r using transitivity AT MOST ONCE |
|
216 |
spec RS mp instantiates induction hypotheses*) |
|
217 |
fun indhyp_tac hyps = |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
218 |
resolve_tac (TrueI::refl::hyps) ORELSE' |
0 | 219 |
(cut_facts_tac hyps THEN' |
220 |
DEPTH_SOLVE_1 o (ares_tac [TrueI, ballI] ORELSE' |
|
1461 | 221 |
eresolve_tac [underD, transD, spec RS mp])); |
0 | 222 |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
223 |
(*** NOTE! some simplifications need a different solver!! ***) |
4091 | 224 |
val wf_super_ss = simpset() setSolver indhyp_tac; |
0 | 225 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
226 |
Goalw [is_recfun_def] |
0 | 227 |
"[| wf(r); trans(r); is_recfun(r,a,H,f); is_recfun(r,b,H,g) |] ==> \ |
228 |
\ <x,a>:r --> <x,b>:r --> f`x=g`x"; |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
229 |
by (wf_ind_tac "x" [] 1); |
0 | 230 |
by (REPEAT (rtac impI 1 ORELSE etac ssubst 1)); |
231 |
by (rewtac restrict_def); |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
232 |
by (asm_simp_tac (wf_super_ss addsimps [vimage_singleton_iff]) 1); |
760 | 233 |
qed "is_recfun_equal_lemma"; |
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
760
diff
changeset
|
234 |
bind_thm ("is_recfun_equal", (is_recfun_equal_lemma RS mp RS mp)); |
0 | 235 |
|
236 |
val prems as [wfr,transr,recf,recg,_] = goal WF.thy |
|
237 |
"[| wf(r); trans(r); \ |
|
238 |
\ is_recfun(r,a,H,f); is_recfun(r,b,H,g); <b,a>:r |] ==> \ |
|
239 |
\ restrict(f, r-``{b}) = g"; |
|
240 |
by (cut_facts_tac prems 1); |
|
241 |
by (rtac (consI1 RS restrict_type RS fun_extension) 1); |
|
242 |
by (etac is_recfun_type 1); |
|
243 |
by (ALLGOALS |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
244 |
(asm_simp_tac (wf_super_ss addsimps |
1461 | 245 |
[ [wfr,transr,recf,recg] MRS is_recfun_equal ]))); |
760 | 246 |
qed "is_recfun_cut"; |
0 | 247 |
|
248 |
(*** Main Existence Lemma ***) |
|
249 |
||
250 |
val prems = goal WF.thy |
|
251 |
"[| wf(r); trans(r); is_recfun(r,a,H,f); is_recfun(r,a,H,g) |] ==> f=g"; |
|
252 |
by (cut_facts_tac prems 1); |
|
253 |
by (rtac fun_extension 1); |
|
254 |
by (REPEAT (ares_tac [is_recfun_equal] 1 |
|
255 |
ORELSE eresolve_tac [is_recfun_type,underD] 1)); |
|
760 | 256 |
qed "is_recfun_functional"; |
0 | 257 |
|
258 |
(*If some f satisfies is_recfun(r,a,H,-) then so does the_recfun(r,a,H) *) |
|
259 |
val prems = goalw WF.thy [the_recfun_def] |
|
260 |
"[| is_recfun(r,a,H,f); wf(r); trans(r) |] \ |
|
261 |
\ ==> is_recfun(r, a, H, the_recfun(r,a,H))"; |
|
262 |
by (rtac (ex1I RS theI) 1); |
|
263 |
by (REPEAT (ares_tac (prems@[is_recfun_functional]) 1)); |
|
760 | 264 |
qed "is_the_recfun"; |
0 | 265 |
|
266 |
val prems = goal WF.thy |
|
267 |
"[| wf(r); trans(r) |] ==> is_recfun(r, a, H, the_recfun(r,a,H))"; |
|
268 |
by (cut_facts_tac prems 1); |
|
269 |
by (wf_ind_tac "a" prems 1); |
|
270 |
by (res_inst_tac [("f", "lam y: r-``{a1}. wftrec(r,y,H)")] is_the_recfun 1); |
|
271 |
by (REPEAT (assume_tac 2)); |
|
272 |
by (rewrite_goals_tac [is_recfun_def, wftrec_def]); |
|
273 |
(*Applying the substitution: must keep the quantified assumption!!*) |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
274 |
by (REPEAT (dtac underD 1 ORELSE resolve_tac [refl, lam_cong] 1)); |
0 | 275 |
by (fold_tac [is_recfun_def]); |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
276 |
by (rtac (consI1 RS restrict_type RSN (2,fun_extension) RS subst_context) 1); |
0 | 277 |
by (rtac is_recfun_type 1); |
278 |
by (ALLGOALS |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
279 |
(asm_simp_tac |
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
280 |
(wf_super_ss addsimps [underI RS beta, apply_recfun, is_recfun_cut]))); |
760 | 281 |
qed "unfold_the_recfun"; |
0 | 282 |
|
283 |
||
284 |
(*** Unfolding wftrec ***) |
|
285 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
286 |
Goal "[| wf(r); trans(r); <b,a>:r |] ==> \ |
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
287 |
\ restrict(the_recfun(r,a,H), r-``{b}) = the_recfun(r,b,H)"; |
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
288 |
by (REPEAT (ares_tac [is_recfun_cut, unfold_the_recfun] 1)); |
760 | 289 |
qed "the_recfun_cut"; |
0 | 290 |
|
4515 | 291 |
(*NOT SUITABLE FOR REWRITING: it is recursive!*) |
5067 | 292 |
Goalw [wftrec_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
293 |
"[| wf(r); trans(r) |] ==> \ |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
294 |
\ wftrec(r,a,H) = H(a, lam x: r-``{a}. wftrec(r,x,H))"; |
2033 | 295 |
by (stac (rewrite_rule [is_recfun_def] unfold_the_recfun) 1); |
4515 | 296 |
by (ALLGOALS |
297 |
(asm_simp_tac |
|
298 |
(simpset() addsimps [vimage_singleton_iff RS iff_sym, the_recfun_cut]))); |
|
760 | 299 |
qed "wftrec"; |
0 | 300 |
|
301 |
(** Removal of the premise trans(r) **) |
|
302 |
||
4515 | 303 |
(*NOT SUITABLE FOR REWRITING: it is recursive!*) |
0 | 304 |
val [wfr] = goalw WF.thy [wfrec_def] |
305 |
"wf(r) ==> wfrec(r,a,H) = H(a, lam x:r-``{a}. wfrec(r,x,H))"; |
|
2033 | 306 |
by (stac (wfr RS wf_trancl RS wftrec) 1); |
0 | 307 |
by (rtac trans_trancl 1); |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
308 |
by (rtac (vimage_pair_mono RS restrict_lam_eq RS subst_context) 1); |
0 | 309 |
by (etac r_into_trancl 1); |
310 |
by (rtac subset_refl 1); |
|
760 | 311 |
qed "wfrec"; |
0 | 312 |
|
313 |
(*This form avoids giant explosions in proofs. NOTE USE OF == *) |
|
314 |
val rew::prems = goal WF.thy |
|
315 |
"[| !!x. h(x)==wfrec(r,x,H); wf(r) |] ==> \ |
|
316 |
\ h(a) = H(a, lam x: r-``{a}. h(x))"; |
|
317 |
by (rewtac rew); |
|
318 |
by (REPEAT (resolve_tac (prems@[wfrec]) 1)); |
|
760 | 319 |
qed "def_wfrec"; |
0 | 320 |
|
321 |
val prems = goal WF.thy |
|
322 |
"[| wf(r); a:A; field(r)<=A; \ |
|
323 |
\ !!x u. [| x: A; u: Pi(r-``{x}, B) |] ==> H(x,u) : B(x) \ |
|
324 |
\ |] ==> wfrec(r,a,H) : B(a)"; |
|
325 |
by (res_inst_tac [("a","a")] wf_induct2 1); |
|
2033 | 326 |
by (stac wfrec 4); |
0 | 327 |
by (REPEAT (ares_tac (prems@[lam_type]) 1 |
328 |
ORELSE eresolve_tac [spec RS mp, underD] 1)); |
|
760 | 329 |
qed "wfrec_type"; |
435 | 330 |
|
331 |
||
5067 | 332 |
Goalw [wf_on_def, wfrec_on_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
333 |
"[| wf[A](r); a: A |] ==> \ |
435 | 334 |
\ wfrec[A](r,a,H) = H(a, lam x: (r-``{a}) Int A. wfrec[A](r,x,H))"; |
437 | 335 |
by (etac (wfrec RS trans) 1); |
4091 | 336 |
by (asm_simp_tac (simpset() addsimps [vimage_Int_square, cons_subset_iff]) 1); |
760 | 337 |
qed "wfrec_on"; |
435 | 338 |