src/Pure/Isar/code.ML
changeset 55721 1c2cfc06c96a
parent 55720 f3a2931a6656
child 55722 b6ed5f896ce9
equal deleted inserted replaced
55720:f3a2931a6656 55721:1c2cfc06c96a
   546       allow_consts = false, allow_pats = false } thm (lhs, rhs);
   546       allow_consts = false, allow_pats = false } thm (lhs, rhs);
   547     val _ = if forall2 (fn T => fn (_, sort) => Sign.of_sort thy (T, sort)) Ts vs' then ()
   547     val _ = if forall2 (fn T => fn (_, sort) => Sign.of_sort thy (T, sort)) Ts vs' then ()
   548       else error ("Type arguments do not satisfy sort constraints of abstype certificate.");
   548       else error ("Type arguments do not satisfy sort constraints of abstype certificate.");
   549   in (thm, tyco) end;
   549   in (thm, tyco) end;
   550 
   550 
   551 fun assert_eqn thy = error_thm (gen_assert_eqn thy true) thy;
   551 fun assert_eqn thy = gen_assert_eqn thy true;
   552 
   552 
   553 fun meta_rewrite thy = Local_Defs.meta_rewrite_rule (Proof_Context.init_global thy);
   553 fun meta_rewrite thy = Local_Defs.meta_rewrite_rule (Proof_Context.init_global thy);
   554 
   554 
   555 fun mk_eqn thy = error_thm (gen_assert_eqn thy false) thy o
   555 fun mk_eqn thy = error_thm (gen_assert_eqn thy false) thy o
   556   apfst (meta_rewrite thy);
   556   apfst (meta_rewrite thy);
   750 fun cert_of_eqns ctxt c [] = Equations (dummy_thm ctxt c, [])
   750 fun cert_of_eqns ctxt c [] = Equations (dummy_thm ctxt c, [])
   751   | cert_of_eqns ctxt c raw_eqns = 
   751   | cert_of_eqns ctxt c raw_eqns = 
   752       let
   752       let
   753         val thy = Proof_Context.theory_of ctxt;
   753         val thy = Proof_Context.theory_of ctxt;
   754         val eqns = burrow_fst (canonize_thms thy) raw_eqns;
   754         val eqns = burrow_fst (canonize_thms thy) raw_eqns;
   755         val _ = map (assert_eqn thy) eqns;
   755         val _ = map (error_thm (assert_eqn thy) thy) eqns;
   756         val (thms, propers) = split_list eqns;
   756         val (thms, propers) = split_list eqns;
   757         val _ = map (fn thm => if c = const_eqn thy thm then ()
   757         val _ = map (fn thm => if c = const_eqn thy thm then ()
   758           else error ("Wrong head of code equation,\nexpected constant "
   758           else error ("Wrong head of code equation,\nexpected constant "
   759             ^ string_of_const thy c ^ "\n" ^ Display.string_of_thm_global thy thm)) thms;
   759             ^ string_of_const thy c ^ "\n" ^ Display.string_of_thm_global thy thm)) thms;
   760         fun tvars_of T = rev (Term.add_tvarsT T []);
   760         fun tvars_of T = rev (Term.add_tvarsT T []);