equal
deleted
inserted
replaced
204 val ps = outer_params (Thm.term_of goal) |
204 val ps = outer_params (Thm.term_of goal) |
205 |> map (fn (x, T) => Var ((x, maxidx + 1), Logic.incr_tvar (maxidx + 1) T)); |
205 |> map (fn (x, T) => Var ((x, maxidx + 1), Logic.incr_tvar (maxidx + 1) T)); |
206 val Ts = map Term.fastype_of ps; |
206 val Ts = map Term.fastype_of ps; |
207 val inst = |
207 val inst = |
208 Thm.fold_terms Term.add_vars th [] |
208 Thm.fold_terms Term.add_vars th [] |
209 |> map (fn (xi, T) => ((xi, T), Term.list_comb (Var (xi, Ts ---> T), ps))); |
209 |> map (fn (xi, T) => ((xi, T), Thm.cterm_of ctxt (Term.list_comb (Var (xi, Ts ---> T), ps)))); |
210 in |
210 in |
211 th |
211 th |
212 |> Thm.certify_instantiate ctxt ([], inst) |
212 |> Thm.instantiate ([], inst) |
213 |> fold_rev (Thm.forall_intr o Thm.cterm_of ctxt) ps |
213 |> fold_rev (Thm.forall_intr o Thm.cterm_of ctxt) ps |
214 end; |
214 end; |
215 |
215 |
216 (*direct generalization*) |
216 (*direct generalization*) |
217 fun generalize names th = Thm.generalize names (Thm.maxidx_of th + 1) th; |
217 fun generalize names th = Thm.generalize names (Thm.maxidx_of th + 1) th; |
228 (*Reset Var indexes to zero, renaming to preserve distinctness*) |
228 (*Reset Var indexes to zero, renaming to preserve distinctness*) |
229 fun zero_var_indexes_list [] = [] |
229 fun zero_var_indexes_list [] = [] |
230 | zero_var_indexes_list ths = |
230 | zero_var_indexes_list ths = |
231 let |
231 let |
232 val thy = Theory.merge_list (map Thm.theory_of_thm ths); |
232 val thy = Theory.merge_list (map Thm.theory_of_thm ths); |
233 val insts = Term_Subst.zero_var_indexes_inst (map Thm.full_prop_of ths); |
233 val (instT, inst) = Term_Subst.zero_var_indexes_inst (map Thm.full_prop_of ths); |
234 in map (Thm.adjust_maxidx_thm ~1 o Thm.global_certify_instantiate thy insts) ths end; |
234 val insts' = |
|
235 (map (apsnd (Thm.global_ctyp_of thy)) instT, |
|
236 map (apsnd (Thm.global_cterm_of thy)) inst); |
|
237 in map (Thm.adjust_maxidx_thm ~1 o Thm.instantiate insts') ths end; |
235 |
238 |
236 val zero_var_indexes = singleton zero_var_indexes_list; |
239 val zero_var_indexes = singleton zero_var_indexes_list; |
237 |
240 |
238 |
241 |
239 (** Standard form of object-rule: no hypotheses, flexflex constraints, |
242 (** Standard form of object-rule: no hypotheses, flexflex constraints, |