src/Pure/thm.ML
changeset 36621 2fd4e2c76636
parent 36619 deadcd0ec431
child 36742 6f8bbe9ca8a2
equal deleted inserted replaced
36620:e6bb250402b5 36621:2fd4e2c76636
   510   in make_deriv ps oras thms prf end;
   510   in make_deriv ps oras thms prf end;
   511 
   511 
   512 fun deriv_rule1 f = deriv_rule2 (K f) empty_deriv;
   512 fun deriv_rule1 f = deriv_rule2 (K f) empty_deriv;
   513 fun deriv_rule0 prf = deriv_rule1 I (make_deriv [] [] [] prf);
   513 fun deriv_rule0 prf = deriv_rule1 I (make_deriv [] [] [] prf);
   514 
   514 
       
   515 fun deriv_rule_unconditional f (Deriv {promises, body = PBody {oracles, thms, proof}}) =
       
   516   make_deriv promises oracles thms (f proof);
       
   517 
   515 
   518 
   516 (* fulfilled proofs *)
   519 (* fulfilled proofs *)
   517 
   520 
   518 fun raw_body (Thm (Deriv {body, ...}, _)) = body;
   521 fun raw_body (Thm (Deriv {body, ...}, _)) = body;
   519 
   522 
  1202 (*Remove extra sorts that are witnessed by type signature information*)
  1205 (*Remove extra sorts that are witnessed by type signature information*)
  1203 fun strip_shyps (thm as Thm (_, {shyps = [], ...})) = thm
  1206 fun strip_shyps (thm as Thm (_, {shyps = [], ...})) = thm
  1204   | strip_shyps (thm as Thm (der, {thy_ref, tags, maxidx, shyps, hyps, tpairs, prop})) =
  1207   | strip_shyps (thm as Thm (der, {thy_ref, tags, maxidx, shyps, hyps, tpairs, prop})) =
  1205       let
  1208       let
  1206         val thy = Theory.deref thy_ref;
  1209         val thy = Theory.deref thy_ref;
  1207         val present = (fold_terms o fold_types o fold_atyps_sorts) (insert (eq_snd op =)) thm [];
  1210         val algebra = Sign.classes_of thy;
       
  1211 
       
  1212         val present = (fold_terms o fold_types o fold_atyps_sorts) (insert (eq_fst op =)) thm [];
  1208         val extra = fold (Sorts.remove_sort o #2) present shyps;
  1213         val extra = fold (Sorts.remove_sort o #2) present shyps;
  1209         val witnessed = Sign.witness_sorts thy present extra;
  1214         val witnessed = Sign.witness_sorts thy present extra;
  1210         val extra' = fold (Sorts.remove_sort o #2) witnessed extra
  1215         val extra' = fold (Sorts.remove_sort o #2) witnessed extra
  1211           |> Sorts.minimal_sorts (Sign.classes_of thy);
  1216           |> Sorts.minimal_sorts algebra;
  1212         val shyps' = fold (Sorts.insert_sort o #2) present extra';
  1217         val shyps' = fold (Sorts.insert_sort o #2) present extra';
  1213       in
  1218       in
  1214         Thm (der, {thy_ref = Theory.check_thy thy, tags = tags, maxidx = maxidx,
  1219         Thm (deriv_rule_unconditional (Pt.strip_shyps_proof algebra present witnessed extra') der,
       
  1220          {thy_ref = Theory.check_thy thy, tags = tags, maxidx = maxidx,
  1215           shyps = shyps', hyps = hyps, tpairs = tpairs, prop = prop})
  1221           shyps = shyps', hyps = hyps, tpairs = tpairs, prop = prop})
  1216       end;
  1222       end;
  1217 
  1223 
  1218 (*Internalize sort constraints of type variable*)
  1224 (*Internalize sort constraints of type variable*)
  1219 fun unconstrainT
  1225 fun unconstrainT