equal
deleted
inserted
replaced
411 Outer_Syntax.command "locale" "define named proof context" Keyword.thy_decl |
411 Outer_Syntax.command "locale" "define named proof context" Keyword.thy_decl |
412 (Parse.binding -- |
412 (Parse.binding -- |
413 Scan.optional (Parse.$$$ "=" |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin |
413 Scan.optional (Parse.$$$ "=" |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin |
414 >> (fn ((name, (expr, elems)), begin) => |
414 >> (fn ((name, (expr, elems)), begin) => |
415 (begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
415 (begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
416 (Expression.add_locale_cmd name Binding.empty expr elems #> snd))); |
416 (Expression.add_locale_cmd I name Binding.empty expr elems #> snd))); |
417 |
417 |
418 fun parse_interpretation_arguments mandatory = |
418 fun parse_interpretation_arguments mandatory = |
419 Parse.!!! (Parse_Spec.locale_expression mandatory) -- |
419 Parse.!!! (Parse_Spec.locale_expression mandatory) -- |
420 Scan.optional |
420 Scan.optional |
421 (Parse.where_ |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
421 (Parse.where_ |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
424 Outer_Syntax.command "sublocale" |
424 Outer_Syntax.command "sublocale" |
425 "prove sublocale relation between a locale and a locale expression" Keyword.thy_goal |
425 "prove sublocale relation between a locale and a locale expression" Keyword.thy_goal |
426 (Parse.xname --| (Parse.$$$ "\\<subseteq>" || Parse.$$$ "<") -- |
426 (Parse.xname --| (Parse.$$$ "\\<subseteq>" || Parse.$$$ "<") -- |
427 parse_interpretation_arguments false |
427 parse_interpretation_arguments false |
428 >> (fn (loc, (expr, equations)) => |
428 >> (fn (loc, (expr, equations)) => |
429 Toplevel.print o Toplevel.theory_to_proof (Expression.sublocale_cmd loc expr equations))); |
429 Toplevel.print o Toplevel.theory_to_proof (Expression.sublocale_cmd I loc expr equations))); |
430 |
430 |
431 val _ = |
431 val _ = |
432 Outer_Syntax.command "interpretation" |
432 Outer_Syntax.command "interpretation" |
433 "prove interpretation of locale expression in theory" Keyword.thy_goal |
433 "prove interpretation of locale expression in theory" Keyword.thy_goal |
434 (parse_interpretation_arguments true |
434 (parse_interpretation_arguments true |
454 val _ = |
454 val _ = |
455 Outer_Syntax.command "class" "define type class" Keyword.thy_decl |
455 Outer_Syntax.command "class" "define type class" Keyword.thy_decl |
456 (Parse.binding -- Scan.optional (Parse.$$$ "=" |-- class_val) ([], []) -- Parse.opt_begin |
456 (Parse.binding -- Scan.optional (Parse.$$$ "=" |-- class_val) ([], []) -- Parse.opt_begin |
457 >> (fn ((name, (supclasses, elems)), begin) => |
457 >> (fn ((name, (supclasses, elems)), begin) => |
458 (begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
458 (begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
459 (Class_Declaration.class_cmd name supclasses elems #> snd))); |
459 (Class_Declaration.class_cmd I name supclasses elems #> snd))); |
460 |
460 |
461 val _ = |
461 val _ = |
462 Outer_Syntax.local_theory_to_proof "subclass" "prove a subclass relation" Keyword.thy_goal |
462 Outer_Syntax.local_theory_to_proof "subclass" "prove a subclass relation" Keyword.thy_goal |
463 (Parse.xname >> Class_Declaration.subclass_cmd); |
463 (Parse.xname >> Class_Declaration.subclass_cmd I); |
464 |
464 |
465 val _ = |
465 val _ = |
466 Outer_Syntax.command "instantiation" "instantiate and prove type arity" Keyword.thy_decl |
466 Outer_Syntax.command "instantiation" "instantiate and prove type arity" Keyword.thy_decl |
467 (Parse.multi_arity --| Parse.begin |
467 (Parse.multi_arity --| Parse.begin |
468 >> (fn arities => Toplevel.print o |
468 >> (fn arities => Toplevel.print o |