src/Pure/thm.ML
changeset 79308 c9f253e91257
parent 79307 3114c98738e6
child 79309 cf8ccfec5059
equal deleted inserted replaced
79307:3114c98738e6 79308:c9f253e91257
   999       let val arity_digest = thm_digest (the_arity thy (a, (map o map) #2 dom, c))
   999       let val arity_digest = thm_digest (the_arity thy (a, (map o map) #2 dom, c))
  1000       in (fold o fold) (union_digest o #1) dom arity_digest end,
  1000       in (fold o fold) (union_digest o #1) dom arity_digest end,
  1001     type_variable = fn T => map (pair ([], [])) (Type.sort_of_atyp T)}
  1001     type_variable = fn T => map (pair ([], [])) (Type.sort_of_atyp T)}
  1002    (typ, sort);
  1002    (typ, sort);
  1003 
  1003 
       
  1004 fun bad_constraint_theory cert ({theory = thy, ...}: constraint) =
       
  1005   if Context.eq_thy_id (Context.certificate_theory_id cert, Context.theory_id thy)
       
  1006   then NONE else SOME thy;
       
  1007 
  1004 in
  1008 in
  1005 
  1009 
  1006 fun solve_constraints (thm as Thm (_, {constraints = [], ...})) = thm
  1010 fun solve_constraints (thm as Thm (der, args)) =
  1007   | solve_constraints (thm as Thm (der, args)) =
       
  1008       let
  1011       let
  1009         val {cert, tags, maxidx, constraints, shyps, hyps, tpairs, prop} = args;
  1012         val {cert, tags, maxidx, constraints, shyps, hyps, tpairs, prop} = args;
  1010 
  1013 
  1011         val thy = Context.certificate_theory cert
  1014         val bad_thys = map_filter (bad_constraint_theory cert) constraints;
  1012           handle ERROR msg => raise CONTEXT (msg, [], [], [thm], NONE);
  1015         val _ =
  1013         val bad_thys =
       
  1014           constraints |> map_filter (fn {theory = thy', ...} =>
       
  1015             if Context.eq_thy (thy, thy') then NONE else SOME thy');
       
  1016         val () =
       
  1017           if null bad_thys then ()
  1016           if null bad_thys then ()
  1018           else
  1017           else
  1019             raise THEORY ("solve_constraints: bad theories for theorem\n" ^
  1018             raise THEORY ("solve_constraints: bad theories for theorem\n" ^
  1020               Syntax.string_of_term_global thy (prop_of thm), thy :: bad_thys);
  1019               Syntax.string_of_term_global (hd bad_thys) (prop_of thm), bad_thys);
  1021 
  1020 
  1022         val Deriv {promises, body = PBody {oracles, thms, zboxes, zproof, proof}} = der;
  1021         val Deriv {promises, body = PBody {oracles, thms, zboxes, zproof, proof}} = der;
  1023         val (oracles', thms') = (oracles, thms)
  1022         val (oracles', thms') = (oracles, thms)
  1024           |> fold (fold union_digest o constraint_digest) constraints;
  1023           |> fold (fold union_digest o constraint_digest) constraints;
  1025       in
  1024       in