463 |
463 |
464 local structure P = OuterParse and K = OuterSyntax.Keyword in |
464 local structure P = OuterParse and K = OuterSyntax.Keyword in |
465 |
465 |
466 val axclassP = |
466 val axclassP = |
467 OuterSyntax.command "axclass" "define axiomatic type class" K.thy_decl |
467 OuterSyntax.command "axclass" "define axiomatic type class" K.thy_decl |
468 (((P.name -- Scan.optional (P.$$$ "<" |-- P.!!! (P.list1 P.xname)) []) --| P.marg_comment) |
468 (((P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- |
|
469 P.!!! (P.list1 P.xname)) []) --| P.marg_comment) |
469 -- Scan.repeat (P.spec_name --| P.marg_comment) |
470 -- Scan.repeat (P.spec_name --| P.marg_comment) |
470 >> (fn (cls, axs) => Toplevel.theory (#1 o add_axclass cls axs))); |
471 >> (fn (cls, axs) => Toplevel.theory (#1 o add_axclass cls axs))); |
471 |
472 |
472 val instanceP = |
473 val instanceP = |
473 OuterSyntax.command "instance" "prove type arity or subclass relation" K.thy_goal |
474 OuterSyntax.command "instance" "prove type arity or subclass relation" K.thy_goal |
474 ((P.xname -- (P.$$$ "<" |-- P.xname) -- P.marg_comment >> instance_subclass_proof || |
475 ((P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.xname) |
|
476 -- P.marg_comment >> instance_subclass_proof || |
475 (P.xname -- (P.$$$ "::" |-- P.simple_arity) >> P.triple2) -- P.marg_comment |
477 (P.xname -- (P.$$$ "::" |-- P.simple_arity) >> P.triple2) -- P.marg_comment |
476 >> instance_arity_proof) |
478 >> instance_arity_proof) |
477 >> (Toplevel.print oo Toplevel.theory_to_proof)); |
479 >> (Toplevel.print oo Toplevel.theory_to_proof)); |
478 |
480 |
479 val _ = OuterSyntax.add_parsers [axclassP, instanceP]; |
481 val _ = OuterSyntax.add_parsers [axclassP, instanceP]; |