src/Pure/theory.ML
changeset 19135 2de31ba562d7
parent 18968 52639ad19a96
child 19428 43bfe55759b0
equal deleted inserted replaced
19134:47d337aefc21 19135:2de31ba562d7
   257     val (lhs_const, rhs) = Sign.cert_def pp tm;
   257     val (lhs_const, rhs) = Sign.cert_def pp tm;
   258     val rhs_consts = fold_aterms (fn Const const => insert (op =) const | _ => I) rhs [];
   258     val rhs_consts = fold_aterms (fn Const const => insert (op =) const | _ => I) rhs [];
   259     val _ = check_overloading thy overloaded lhs_const;
   259     val _ = check_overloading thy overloaded lhs_const;
   260   in
   260   in
   261     defs |> Defs.define (Sign.the_const_type thy)
   261     defs |> Defs.define (Sign.the_const_type thy)
   262       name (prep_const thy lhs_const) (map (prep_const thy) rhs_consts)
   262       ((true, Context.theory_name thy), name) (prep_const thy lhs_const)
       
   263       (map (prep_const thy) rhs_consts)
   263   end
   264   end
   264   handle ERROR msg => cat_error msg (Pretty.string_of (Pretty.block
   265   handle ERROR msg => cat_error msg (Pretty.string_of (Pretty.block
   265    [Pretty.str ("The error(s) above occurred in definition " ^ quote bname ^ ":"),
   266    [Pretty.str ("The error(s) above occurred in definition " ^ quote bname ^ ":"),
   266     Pretty.fbrk, Pretty.quote (Pretty.term (Sign.pp thy) tm)]));
   267     Pretty.fbrk, Pretty.quote (Pretty.term (Sign.pp thy) tm)]));
   267 
   268 
   293   let
   294   let
   294     fun const_of (Const const) = const
   295     fun const_of (Const const) = const
   295       | const_of (Free _) = error "Attempt to finalize variable (or undeclared constant)"
   296       | const_of (Free _) = error "Attempt to finalize variable (or undeclared constant)"
   296       | const_of _ = error "Attempt to finalize non-constant term";
   297       | const_of _ = error "Attempt to finalize non-constant term";
   297     fun specify (c, T) =
   298     fun specify (c, T) =
   298       Defs.define (Sign.the_const_type thy) (c ^ " axiom") (prep_const thy (c, T)) [];
   299       Defs.define (Sign.the_const_type thy) ((false, Context.theory_name thy), c ^ " axiom") (prep_const thy (c, T)) [];
   299     val finalize = specify o check_overloading thy overloaded o
   300     val finalize = specify o check_overloading thy overloaded o
   300       const_of o Sign.no_vars (Sign.pp thy) o prep_term thy;
   301       const_of o Sign.no_vars (Sign.pp thy) o prep_term thy;
   301   in thy |> map_defs (fold finalize args) end;
   302   in thy |> map_defs (fold finalize args) end;
   302 
   303 
   303 in
   304 in