src/Pure/Isar/overloading.ML
changeset 59876 8564d7abe5c5
parent 59150 71b416020f42
child 60246 1f9cd721ece2
equal deleted inserted replaced
59875:9779b0c59ad4 59876:8564d7abe5c5
   187   in lthy end;
   187   in lthy end;
   188 
   188 
   189 fun gen_overloading prep_const raw_overloading thy =
   189 fun gen_overloading prep_const raw_overloading thy =
   190   let
   190   let
   191     val ctxt = Proof_Context.init_global thy;
   191     val ctxt = Proof_Context.init_global thy;
   192     val naming = Sign.naming_of thy;
       
   193     val _ = if null raw_overloading then error "At least one parameter must be given" else ();
   192     val _ = if null raw_overloading then error "At least one parameter must be given" else ();
   194     val overloading = raw_overloading |> map (fn (v, const, checked) =>
   193     val overloading = raw_overloading |> map (fn (v, const, checked) =>
   195       (Term.dest_Const (prep_const ctxt const), (v, checked)));
   194       (Term.dest_Const (prep_const ctxt const), (v, checked)));
   196   in
   195   in
   197     thy
   196     thy
   199     |> Proof_Context.init_global
   198     |> Proof_Context.init_global
   200     |> Data.put overloading
   199     |> Data.put overloading
   201     |> fold (fn ((_, ty), (v, _)) => Variable.declare_names (Free (v, ty))) overloading
   200     |> fold (fn ((_, ty), (v, _)) => Variable.declare_names (Free (v, ty))) overloading
   202     |> activate_improvable_syntax
   201     |> activate_improvable_syntax
   203     |> synchronize_syntax
   202     |> synchronize_syntax
   204     |> Local_Theory.init naming
   203     |> Local_Theory.init (Sign.naming_of thy)
   205        {define = Generic_Target.define foundation,
   204        {define = Generic_Target.define foundation,
   206         notes = Generic_Target.notes Generic_Target.theory_notes,
   205         notes = Generic_Target.notes Generic_Target.theory_notes,
   207         abbrev = Generic_Target.abbrev Generic_Target.theory_abbrev,
   206         abbrev = Generic_Target.abbrev Generic_Target.theory_abbrev,
   208         declaration = K Generic_Target.theory_declaration,
   207         declaration = K Generic_Target.theory_declaration,
   209         subscription = Generic_Target.theory_registration,
   208         subscription = Generic_Target.theory_registration,