src/Pure/Tools/class_package.ML
changeset 18804 d42708f5c186
parent 18755 eb3733779aa8
child 18829 ba72eac54f05
equal deleted inserted replaced
18803:93413dcee45b 18804:d42708f5c186
   212     fun interpret name_locale cs ax_axioms thy =
   212     fun interpret name_locale cs ax_axioms thy =
   213       thy
   213       thy
   214       |> Locale.interpretation (NameSpace.base name_locale, [])
   214       |> Locale.interpretation (NameSpace.base name_locale, [])
   215            (Locale.Locale name_locale)
   215            (Locale.Locale name_locale)
   216              (map (fn ((c, _), _) => SOME (Sign.intern_const thy c)) cs)
   216              (map (fn ((c, _), _) => SOME (Sign.intern_const thy c)) cs)
   217       |> Proof.global_terminal_proof (Method.Basic (Method.fact ax_axioms), NONE)
   217       |> Proof.global_terminal_proof (Method.Basic (Method.fact ax_axioms), NONE);
   218       |> swap;
       
   219     fun print_ctxt ctxt elem = 
   218     fun print_ctxt ctxt elem = 
   220       map Pretty.writeln (Element.pretty_ctxt ctxt elem)
   219       map Pretty.writeln (Element.pretty_ctxt ctxt elem)
   221   in
   220   in
   222     thy
   221     thy
   223     |> add_locale bname locexpr raw_body
   222     |> add_locale bname locexpr raw_body
   471   OuterSyntax.command classK "operational type classes" K.thy_decl
   470   OuterSyntax.command classK "operational type classes" K.thy_decl
   472     (P.name --| P.$$$ "="
   471     (P.name --| P.$$$ "="
   473      -- Scan.optional (Scan.repeat1 (P.name --| P.$$$ "+")) []
   472      -- Scan.optional (Scan.repeat1 (P.name --| P.$$$ "+")) []
   474      -- Scan.optional (P.!!! (Scan.repeat1 P.context_element)) []
   473      -- Scan.optional (P.!!! (Scan.repeat1 P.context_element)) []
   475       >> (Toplevel.theory_context
   474       >> (Toplevel.theory_context
   476           o (fn f => swap o f) o (fn ((bname, supclasses), elems) => add_class bname supclasses elems)));
   475           o (fn ((bname, supclasses), elems) => add_class bname supclasses elems)));
   477 
   476 
   478 val instanceP =
   477 val instanceP =
   479   OuterSyntax.command instanceK "declare instance for operational type class" K.thy_goal
   478   OuterSyntax.command instanceK "declare instance for operational type class" K.thy_goal
   480     (P.xname -- (P.$$$ "::" |-- P.!!! P.arity)
   479     (P.xname -- (P.$$$ "::" |-- P.!!! P.arity)
   481       -- Scan.repeat1 P.spec_name
   480       -- Scan.repeat1 P.spec_name