src/Pure/Isar/isar_syn.ML
changeset 25462 dad0291cb76a
parent 25290 250c7a0205ca
child 25485 33840a854e63
equal deleted inserted replaced
25461:001dfba51869 25462:dad0291cb76a
   111 (* types *)
   111 (* types *)
   112 
   112 
   113 val _ =
   113 val _ =
   114   OuterSyntax.command "typedecl" "type declaration" K.thy_decl
   114   OuterSyntax.command "typedecl" "type declaration" K.thy_decl
   115     (P.type_args -- P.name -- P.opt_infix >> (fn ((args, a), mx) =>
   115     (P.type_args -- P.name -- P.opt_infix >> (fn ((args, a), mx) =>
   116       Toplevel.theory (Sign.add_typedecls [(a, args, mx)])));
   116       Toplevel.theory (Typedecl.add (a, args, mx) #> snd)));
   117 
   117 
   118 val _ =
   118 val _ =
   119   OuterSyntax.command "types" "declare type abbreviations" K.thy_decl
   119   OuterSyntax.command "types" "declare type abbreviations" K.thy_decl
   120     (Scan.repeat1
   120     (Scan.repeat1
   121       (P.type_args -- P.name -- (P.$$$ "=" |-- P.!!! (P.typ -- P.opt_infix')))
   121       (P.type_args -- P.name -- (P.$$$ "=" |-- P.!!! (P.typ -- P.opt_infix')))
   446 
   446 
   447 val _ =
   447 val _ =
   448   OuterSyntax.command "instance" "prove type arity or subclass relation" K.thy_goal
   448   OuterSyntax.command "instance" "prove type arity or subclass relation" K.thy_goal
   449   ((P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) >> Class.classrel_cmd ||
   449   ((P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) >> Class.classrel_cmd ||
   450     P.and_list1 P.arity -- Scan.repeat (SpecParse.opt_thm_name ":" -- P.prop)
   450     P.and_list1 P.arity -- Scan.repeat (SpecParse.opt_thm_name ":" -- P.prop)
   451       >> (fn (arities, defs) => Class.instance_cmd arities defs (fold Code.add_default_func (* FIXME ? *))))
   451       >> (fn (arities, defs) => Class.instance_cmd arities defs (fold Code.add_default_func)))
   452     >> (Toplevel.print oo Toplevel.theory_to_proof));
   452     >> (Toplevel.print oo Toplevel.theory_to_proof));
   453 
   453 
   454 val _ =
   454 val _ =
   455   OuterSyntax.command "instantiation" "prove type arity" K.thy_decl
   455   OuterSyntax.command "instantiation" "prove type arity" K.thy_decl
   456    (P.and_list1 P.arity -- P.opt_begin
   456    (P.and_list1 P.arity --| P.begin
   457      >> (fn (arities, begin) => (begin ? Toplevel.print) o
   457      >> (fn arities => Toplevel.print o
   458          Toplevel.begin_local_theory begin (Instance.begin_instantiation_cmd arities)));
   458          Toplevel.begin_local_theory true (Instance.instantiation_cmd arities)));
   459 
   459 
   460 val _ =  (* FIXME incorporate into "instance" *)
   460 val _ =  (* FIXME incorporate into "instance" *)
   461   OuterSyntax.command "instance_proof" "prove type arity relation" K.thy_goal
   461   OuterSyntax.command "instance_proof" "prove type arity relation" K.thy_goal
   462     (Scan.succeed (Toplevel.print o Toplevel.local_theory_to_proof NONE Instance.proof_instantiation));
   462     (Scan.succeed (Toplevel.print o Toplevel.local_theory_to_proof NONE (Class.proof_instantiation I)));
   463 
   463 
   464 
   464 
   465 (* code generation *)
   465 (* code generation *)
   466 
   466 
   467 val _ =
   467 val _ =