src/Pure/Isar/object_logic.ML
changeset 28965 1de908189869
parent 28620 9846d772b306
child 29606 fedb8be05f24
equal deleted inserted replaced
28963:f6d9e0e0b153 28965:1de908189869
    87 (* typedecl *)
    87 (* typedecl *)
    88 
    88 
    89 fun typedecl (raw_name, vs, mx) thy =
    89 fun typedecl (raw_name, vs, mx) thy =
    90   let
    90   let
    91     val base_sort = get_base_sort thy;
    91     val base_sort = get_base_sort thy;
    92     val name = Sign.full_name thy (Syntax.type_name raw_name mx);
    92     val name = Sign.full_bname thy (Syntax.type_name raw_name mx);
    93     val _ = has_duplicates (op =) vs andalso
    93     val _ = has_duplicates (op =) vs andalso
    94       error ("Duplicate parameters in type declaration: " ^ quote name);
    94       error ("Duplicate parameters in type declaration: " ^ quote name);
    95     val n = length vs;
    95     val n = length vs;
    96     val T = Type (name, map (fn v => TFree (v, [])) vs);
    96     val T = Type (name, map (fn v => TFree (v, [])) vs);
    97   in
    97   in
   105 (* add judgment *)
   105 (* add judgment *)
   106 
   106 
   107 local
   107 local
   108 
   108 
   109 fun gen_add_judgment add_consts (bname, T, mx) thy =
   109 fun gen_add_judgment add_consts (bname, T, mx) thy =
   110   let val c = Sign.full_name thy (Syntax.const_name bname mx) in
   110   let val c = Sign.full_bname thy (Syntax.const_name bname mx) in
   111     thy
   111     thy
   112     |> add_consts [(bname, T, mx)]
   112     |> add_consts [(bname, T, mx)]
   113     |> (fn thy' => Theory.add_deps c (c, Sign.the_const_type thy' c) [] thy')
   113     |> (fn thy' => Theory.add_deps c (c, Sign.the_const_type thy' c) [] thy')
   114     |> map_data (fn (base_sort, judgment, atomize_rulify) =>
   114     |> map_data (fn (base_sort, judgment, atomize_rulify) =>
   115         if is_some judgment then error "Attempt to redeclare object-logic judgment"
   115         if is_some judgment then error "Attempt to redeclare object-logic judgment"