160 | (Abs (s, T, t), _) => getfuncs t |
160 | (Abs (s, T, t), _) => getfuncs t |
161 | _ => []; |
161 | _ => []; |
162 |
162 |
163 |
163 |
164 fun abstract_pres sg fm = |
164 fun abstract_pres sg fm = |
165 Library.foldr (fn (t, u) => |
165 foldr (fn (t, u) => |
166 let val T = fastype_of t |
166 let val T = fastype_of t |
167 in all T $ Abs ("x", T, abstract_over (t, u)) end) |
167 in all T $ Abs ("x", T, abstract_over (t, u)) end) |
168 (getfuncs fm, fm); |
168 fm (getfuncs fm); |
169 |
169 |
170 |
170 |
171 |
171 |
172 (* hasfuncs_on_bounds dont care of the type of the functions applied! |
172 (* hasfuncs_on_bounds dont care of the type of the functions applied! |
173 It returns true if there is a subterm coresponding to the application of |
173 It returns true if there is a subterm coresponding to the application of |
217 (HOLogic.all_const T $ Abs (s, T, P), n) |
217 (HOLogic.all_const T $ Abs (s, T, P), n) |
218 else (incr_boundvars ~1 P, n-1) |
218 else (incr_boundvars ~1 P, n-1) |
219 fun mk_all2 (v, t) = HOLogic.all_const (fastype_of v) $ lambda v t; |
219 fun mk_all2 (v, t) = HOLogic.all_const (fastype_of v) $ lambda v t; |
220 val (rhs,irhs) = List.partition (relevant (rev ps)) hs |
220 val (rhs,irhs) = List.partition (relevant (rev ps)) hs |
221 val np = length ps |
221 val np = length ps |
222 val (fm',np) = Library.foldr (fn ((x, T), (fm,n)) => mk_all ((x, T), (fm,n))) |
222 val (fm',np) = foldr (fn ((x, T), (fm,n)) => mk_all ((x, T), (fm,n))) |
223 (ps,(Library.foldr HOLogic.mk_imp (rhs, c), np)) |
223 (foldr HOLogic.mk_imp c rhs, np) ps |
224 val (vs, _) = List.partition (fn t => q orelse (type_of t) = nT) |
224 val (vs, _) = List.partition (fn t => q orelse (type_of t) = nT) |
225 (term_frees fm' @ term_vars fm'); |
225 (term_frees fm' @ term_vars fm'); |
226 val fm2 = Library.foldr mk_all2 (vs, fm') |
226 val fm2 = foldr mk_all2 fm' vs |
227 in (fm2, np + length vs, length rhs) end; |
227 in (fm2, np + length vs, length rhs) end; |
228 |
228 |
229 (*Object quantifier to meta --*) |
229 (*Object quantifier to meta --*) |
230 fun spec_step n th = if (n=0) then th else (spec_step (n-1) th) RS spec ; |
230 fun spec_step n th = if (n=0) then th else (spec_step (n-1) th) RS spec ; |
231 |
231 |