equal
deleted
inserted
replaced
259 val defnames = map Thm.derivation_name defs; |
259 val defnames = map Thm.derivation_name defs; |
260 val prf' = |
260 val prf' = |
261 if r then |
261 if r then |
262 let |
262 let |
263 val cnames = map (fst o dest_Const o fst) defs'; |
263 val cnames = map (fst o dest_Const o fst) defs'; |
264 val thms = Proofterm.fold_proof_atoms true |
264 val expand = Proofterm.fold_proof_atoms true |
265 (fn PThm ({name, prop, ...}, _) => |
265 (fn PThm ({serial, name, prop, ...}, _) => |
266 if member (op =) defnames name orelse |
266 if member (op =) defnames name orelse |
267 not (exists_Const (member (op =) cnames o #1) prop) |
267 not (exists_Const (member (op =) cnames o #1) prop) |
268 then I |
268 then I |
269 else cons (name, SOME prop) |
269 else Inttab.update (serial, "") |
270 | _ => I) [prf] []; |
270 | _ => I) [prf] Inttab.empty; |
271 in Proofterm.expand_proof thy thms prf end |
271 in Proofterm.expand_proof thy (Inttab.lookup expand o #serial) prf end |
272 else prf; |
272 else prf; |
273 in |
273 in |
274 rewrite_terms (Pattern.rewrite_term thy defs' []) |
274 rewrite_terms (Pattern.rewrite_term thy defs' []) |
275 (fst (insert_refl defnames [] prf')) |
275 (fst (insert_refl defnames [] prf')) |
276 end; |
276 end; |
358 (fn T as TVar (ai, _) => TVar (ai, get_sort T) |
358 (fn T as TVar (ai, _) => TVar (ai, get_sort T) |
359 | T as TFree (a, _) => TFree (a, get_sort T)); |
359 | T as TFree (a, _) => TFree (a, get_sort T)); |
360 |
360 |
361 fun reconstruct prop = |
361 fun reconstruct prop = |
362 Proofterm.reconstruct_proof thy prop #> |
362 Proofterm.reconstruct_proof thy prop #> |
363 Proofterm.expand_proof thy [("", NONE)] #> |
363 Proofterm.expand_proof thy Proofterm.expand_name_empty #> |
364 Same.commit (Proofterm.map_proof_same Same.same Same.same of_class_index); |
364 Same.commit (Proofterm.map_proof_same Same.same Same.same of_class_index); |
365 in |
365 in |
366 map2 reconstruct (Logic.mk_of_sort (T, S)) |
366 map2 reconstruct (Logic.mk_of_sort (T, S)) |
367 (Proofterm.of_sort_proof (Sign.classes_of thy) (Thm.classrel_proof thy) (Thm.arity_proof thy) |
367 (Proofterm.of_sort_proof (Sign.classes_of thy) (Thm.classrel_proof thy) (Thm.arity_proof thy) |
368 (OfClass o apfst Type.strip_sorts) (subst T, S)) |
368 (OfClass o apfst Type.strip_sorts) (subst T, S)) |