26 |
26 |
27 (** init and exit **) |
27 (** init and exit **) |
28 |
28 |
29 val _ = |
29 val _ = |
30 Outer_Syntax.command "theory" "begin theory" (Keyword.tag_theory Keyword.thy_begin) |
30 Outer_Syntax.command "theory" "begin theory" (Keyword.tag_theory Keyword.thy_begin) |
31 (Thy_Header.args >> (Toplevel.print oo IsarCmd.init_theory)); |
31 (Thy_Header.args >> (Toplevel.print oo Isar_Cmd.init_theory)); |
32 |
32 |
33 val _ = |
33 val _ = |
34 Outer_Syntax.command "end" "end (local) theory" (Keyword.tag_theory Keyword.thy_end) |
34 Outer_Syntax.command "end" "end (local) theory" (Keyword.tag_theory Keyword.thy_end) |
35 (Scan.succeed (Toplevel.exit o Toplevel.end_local_theory)); |
35 (Scan.succeed (Toplevel.exit o Toplevel.end_local_theory)); |
36 |
36 |
37 |
37 |
38 |
38 |
39 (** markup commands **) |
39 (** markup commands **) |
40 |
40 |
41 val _ = Outer_Syntax.markup_command ThyOutput.Markup "header" "theory header" Keyword.diag |
41 val _ = Outer_Syntax.markup_command Thy_Output.Markup "header" "theory header" Keyword.diag |
42 (Parse.doc_source >> IsarCmd.header_markup); |
42 (Parse.doc_source >> Isar_Cmd.header_markup); |
43 |
43 |
44 val _ = Outer_Syntax.markup_command ThyOutput.Markup "chapter" "chapter heading" |
44 val _ = Outer_Syntax.markup_command Thy_Output.Markup "chapter" "chapter heading" |
45 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
45 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
46 |
46 |
47 val _ = Outer_Syntax.markup_command ThyOutput.Markup "section" "section heading" |
47 val _ = Outer_Syntax.markup_command Thy_Output.Markup "section" "section heading" |
48 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
48 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
49 |
49 |
50 val _ = Outer_Syntax.markup_command ThyOutput.Markup "subsection" "subsection heading" |
50 val _ = Outer_Syntax.markup_command Thy_Output.Markup "subsection" "subsection heading" |
51 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
51 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
52 |
52 |
53 val _ = |
53 val _ = |
54 Outer_Syntax.markup_command ThyOutput.Markup "subsubsection" "subsubsection heading" |
54 Outer_Syntax.markup_command Thy_Output.Markup "subsubsection" "subsubsection heading" |
55 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
55 Keyword.thy_heading (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
56 |
56 |
57 val _ = Outer_Syntax.markup_command ThyOutput.MarkupEnv "text" "formal comment (theory)" |
57 val _ = Outer_Syntax.markup_command Thy_Output.MarkupEnv "text" "formal comment (theory)" |
58 Keyword.thy_decl (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
58 Keyword.thy_decl (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
59 |
59 |
60 val _ = Outer_Syntax.markup_command ThyOutput.Verbatim "text_raw" "raw document preparation text" |
60 val _ = Outer_Syntax.markup_command Thy_Output.Verbatim "text_raw" "raw document preparation text" |
61 Keyword.thy_decl (Parse.opt_target -- Parse.doc_source >> IsarCmd.local_theory_markup); |
61 Keyword.thy_decl (Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
62 |
62 |
63 val _ = Outer_Syntax.markup_command ThyOutput.Markup "sect" "formal comment (proof)" |
63 val _ = Outer_Syntax.markup_command Thy_Output.Markup "sect" "formal comment (proof)" |
64 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> IsarCmd.proof_markup); |
64 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> Isar_Cmd.proof_markup); |
65 |
65 |
66 val _ = Outer_Syntax.markup_command ThyOutput.Markup "subsect" "formal comment (proof)" |
66 val _ = Outer_Syntax.markup_command Thy_Output.Markup "subsect" "formal comment (proof)" |
67 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> IsarCmd.proof_markup); |
67 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> Isar_Cmd.proof_markup); |
68 |
68 |
69 val _ = Outer_Syntax.markup_command ThyOutput.Markup "subsubsect" "formal comment (proof)" |
69 val _ = Outer_Syntax.markup_command Thy_Output.Markup "subsubsect" "formal comment (proof)" |
70 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> IsarCmd.proof_markup); |
70 (Keyword.tag_proof Keyword.prf_heading) (Parse.doc_source >> Isar_Cmd.proof_markup); |
71 |
71 |
72 val _ = Outer_Syntax.markup_command ThyOutput.MarkupEnv "txt" "formal comment (proof)" |
72 val _ = Outer_Syntax.markup_command Thy_Output.MarkupEnv "txt" "formal comment (proof)" |
73 (Keyword.tag_proof Keyword.prf_decl) (Parse.doc_source >> IsarCmd.proof_markup); |
73 (Keyword.tag_proof Keyword.prf_decl) (Parse.doc_source >> Isar_Cmd.proof_markup); |
74 |
74 |
75 val _ = Outer_Syntax.markup_command ThyOutput.Verbatim "txt_raw" |
75 val _ = Outer_Syntax.markup_command Thy_Output.Verbatim "txt_raw" |
76 "raw document preparation text (proof)" (Keyword.tag_proof Keyword.prf_decl) |
76 "raw document preparation text (proof)" (Keyword.tag_proof Keyword.prf_decl) |
77 (Parse.doc_source >> IsarCmd.proof_markup); |
77 (Parse.doc_source >> Isar_Cmd.proof_markup); |
78 |
78 |
79 |
79 |
80 |
80 |
81 (** theory commands **) |
81 (** theory commands **) |
82 |
82 |
329 Toplevel.proof (Proof.map_context (Context.proof_map |
329 Toplevel.proof (Proof.map_context (Context.proof_map |
330 (ML_Context.exec (fn () => ML_Context.eval_text true pos txt))) #> propagate_env_prf))); |
330 (ML_Context.exec (fn () => ML_Context.eval_text true pos txt))) #> propagate_env_prf))); |
331 |
331 |
332 val _ = |
332 val _ = |
333 Outer_Syntax.command "ML_val" "diagnostic ML text" (Keyword.tag_ml Keyword.diag) |
333 Outer_Syntax.command "ML_val" "diagnostic ML text" (Keyword.tag_ml Keyword.diag) |
334 (Parse.ML_source >> IsarCmd.ml_diag true); |
334 (Parse.ML_source >> Isar_Cmd.ml_diag true); |
335 |
335 |
336 val _ = |
336 val _ = |
337 Outer_Syntax.command "ML_command" "diagnostic ML text (silent)" (Keyword.tag_ml Keyword.diag) |
337 Outer_Syntax.command "ML_command" "diagnostic ML text (silent)" (Keyword.tag_ml Keyword.diag) |
338 (Parse.ML_source >> (Toplevel.no_timing oo IsarCmd.ml_diag false)); |
338 (Parse.ML_source >> (Toplevel.no_timing oo Isar_Cmd.ml_diag false)); |
339 |
339 |
340 val _ = |
340 val _ = |
341 Outer_Syntax.command "setup" "ML theory setup" (Keyword.tag_ml Keyword.thy_decl) |
341 Outer_Syntax.command "setup" "ML theory setup" (Keyword.tag_ml Keyword.thy_decl) |
342 (Parse.ML_source >> (Toplevel.theory o IsarCmd.global_setup)); |
342 (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.global_setup)); |
343 |
343 |
344 val _ = |
344 val _ = |
345 Outer_Syntax.local_theory "local_setup" "ML local theory setup" (Keyword.tag_ml Keyword.thy_decl) |
345 Outer_Syntax.local_theory "local_setup" "ML local theory setup" (Keyword.tag_ml Keyword.thy_decl) |
346 (Parse.ML_source >> IsarCmd.local_setup); |
346 (Parse.ML_source >> Isar_Cmd.local_setup); |
347 |
347 |
348 val _ = |
348 val _ = |
349 Outer_Syntax.command "attribute_setup" "define attribute in ML" (Keyword.tag_ml Keyword.thy_decl) |
349 Outer_Syntax.command "attribute_setup" "define attribute in ML" (Keyword.tag_ml Keyword.thy_decl) |
350 (Parse.position Parse.name -- Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Parse.text) |
350 (Parse.position Parse.name -- Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Parse.text) |
351 >> (fn (name, (txt, cmt)) => Toplevel.theory (Attrib.attribute_setup name txt cmt))); |
351 >> (fn (name, (txt, cmt)) => Toplevel.theory (Attrib.attribute_setup name txt cmt))); |
355 (Parse.position Parse.name -- Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Parse.text) |
355 (Parse.position Parse.name -- Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Parse.text) |
356 >> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt))); |
356 >> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt))); |
357 |
357 |
358 val _ = |
358 val _ = |
359 Outer_Syntax.local_theory "declaration" "generic ML declaration" (Keyword.tag_ml Keyword.thy_decl) |
359 Outer_Syntax.local_theory "declaration" "generic ML declaration" (Keyword.tag_ml Keyword.thy_decl) |
360 (Parse.opt_keyword "pervasive" -- Parse.ML_source >> uncurry IsarCmd.declaration); |
360 (Parse.opt_keyword "pervasive" -- Parse.ML_source >> uncurry Isar_Cmd.declaration); |
361 |
361 |
362 val _ = |
362 val _ = |
363 Outer_Syntax.local_theory "simproc_setup" "define simproc in ML" (Keyword.tag_ml Keyword.thy_decl) |
363 Outer_Syntax.local_theory "simproc_setup" "define simproc in ML" (Keyword.tag_ml Keyword.thy_decl) |
364 (Parse.name -- |
364 (Parse.name -- |
365 (Parse.$$$ "(" |-- Parse.enum1 "|" Parse.term --| Parse.$$$ ")" --| Parse.$$$ "=") -- |
365 (Parse.$$$ "(" |-- Parse.enum1 "|" Parse.term --| Parse.$$$ ")" --| Parse.$$$ "=") -- |
366 Parse.ML_source -- Scan.optional (Parse.$$$ "identifier" |-- Scan.repeat1 Parse.xname) [] |
366 Parse.ML_source -- Scan.optional (Parse.$$$ "identifier" |-- Scan.repeat1 Parse.xname) [] |
367 >> (fn (((a, b), c), d) => IsarCmd.simproc_setup a b c d)); |
367 >> (fn (((a, b), c), d) => Isar_Cmd.simproc_setup a b c d)); |
368 |
368 |
369 |
369 |
370 (* translation functions *) |
370 (* translation functions *) |
371 |
371 |
372 val trfun = Parse.opt_keyword "advanced" -- Parse.ML_source; |
372 val trfun = Parse.opt_keyword "advanced" -- Parse.ML_source; |
373 |
373 |
374 val _ = |
374 val _ = |
375 Outer_Syntax.command "parse_ast_translation" "install parse ast translation functions" |
375 Outer_Syntax.command "parse_ast_translation" "install parse ast translation functions" |
376 (Keyword.tag_ml Keyword.thy_decl) |
376 (Keyword.tag_ml Keyword.thy_decl) |
377 (trfun >> (Toplevel.theory o IsarCmd.parse_ast_translation)); |
377 (trfun >> (Toplevel.theory o Isar_Cmd.parse_ast_translation)); |
378 |
378 |
379 val _ = |
379 val _ = |
380 Outer_Syntax.command "parse_translation" "install parse translation functions" |
380 Outer_Syntax.command "parse_translation" "install parse translation functions" |
381 (Keyword.tag_ml Keyword.thy_decl) |
381 (Keyword.tag_ml Keyword.thy_decl) |
382 (trfun >> (Toplevel.theory o IsarCmd.parse_translation)); |
382 (trfun >> (Toplevel.theory o Isar_Cmd.parse_translation)); |
383 |
383 |
384 val _ = |
384 val _ = |
385 Outer_Syntax.command "print_translation" "install print translation functions" |
385 Outer_Syntax.command "print_translation" "install print translation functions" |
386 (Keyword.tag_ml Keyword.thy_decl) |
386 (Keyword.tag_ml Keyword.thy_decl) |
387 (trfun >> (Toplevel.theory o IsarCmd.print_translation)); |
387 (trfun >> (Toplevel.theory o Isar_Cmd.print_translation)); |
388 |
388 |
389 val _ = |
389 val _ = |
390 Outer_Syntax.command "typed_print_translation" "install typed print translation functions" |
390 Outer_Syntax.command "typed_print_translation" "install typed print translation functions" |
391 (Keyword.tag_ml Keyword.thy_decl) |
391 (Keyword.tag_ml Keyword.thy_decl) |
392 (trfun >> (Toplevel.theory o IsarCmd.typed_print_translation)); |
392 (trfun >> (Toplevel.theory o Isar_Cmd.typed_print_translation)); |
393 |
393 |
394 val _ = |
394 val _ = |
395 Outer_Syntax.command "print_ast_translation" "install print ast translation functions" |
395 Outer_Syntax.command "print_ast_translation" "install print ast translation functions" |
396 (Keyword.tag_ml Keyword.thy_decl) |
396 (Keyword.tag_ml Keyword.thy_decl) |
397 (trfun >> (Toplevel.theory o IsarCmd.print_ast_translation)); |
397 (trfun >> (Toplevel.theory o Isar_Cmd.print_ast_translation)); |
398 |
398 |
399 |
399 |
400 (* oracles *) |
400 (* oracles *) |
401 |
401 |
402 val _ = |
402 val _ = |
403 Outer_Syntax.command "oracle" "declare oracle" (Keyword.tag_ml Keyword.thy_decl) |
403 Outer_Syntax.command "oracle" "declare oracle" (Keyword.tag_ml Keyword.thy_decl) |
404 (Parse.position Parse.name -- (Parse.$$$ "=" |-- Parse.ML_source) >> |
404 (Parse.position Parse.name -- (Parse.$$$ "=" |-- Parse.ML_source) >> |
405 (fn (x, y) => Toplevel.theory (IsarCmd.oracle x y))); |
405 (fn (x, y) => Toplevel.theory (Isar_Cmd.oracle x y))); |
406 |
406 |
407 |
407 |
408 (* local theories *) |
408 (* local theories *) |
409 |
409 |
410 val _ = |
410 val _ = |
535 Attrib.empty_binding [] (Element.Shows []) false #> Proof.enter_forward)); |
535 Attrib.empty_binding [] (Element.Shows []) false #> Proof.enter_forward)); |
536 |
536 |
537 val _ = |
537 val _ = |
538 Outer_Syntax.command "have" "state local goal" |
538 Outer_Syntax.command "have" "state local goal" |
539 (Keyword.tag_proof Keyword.prf_goal) |
539 (Keyword.tag_proof Keyword.prf_goal) |
540 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.have)); |
540 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.have)); |
541 |
541 |
542 val _ = |
542 val _ = |
543 Outer_Syntax.command "hence" "abbreviates \"then have\"" |
543 Outer_Syntax.command "hence" "abbreviates \"then have\"" |
544 (Keyword.tag_proof Keyword.prf_goal) |
544 (Keyword.tag_proof Keyword.prf_goal) |
545 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.hence)); |
545 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.hence)); |
546 |
546 |
547 val _ = |
547 val _ = |
548 Outer_Syntax.command "show" "state local goal, solving current obligation" |
548 Outer_Syntax.command "show" "state local goal, solving current obligation" |
549 (Keyword.tag_proof Keyword.prf_asm_goal) |
549 (Keyword.tag_proof Keyword.prf_asm_goal) |
550 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.show)); |
550 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.show)); |
551 |
551 |
552 val _ = |
552 val _ = |
553 Outer_Syntax.command "thus" "abbreviates \"then show\"" |
553 Outer_Syntax.command "thus" "abbreviates \"then show\"" |
554 (Keyword.tag_proof Keyword.prf_asm_goal) |
554 (Keyword.tag_proof Keyword.prf_asm_goal) |
555 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.thus)); |
555 (Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.thus)); |
556 |
556 |
557 |
557 |
558 (* facts *) |
558 (* facts *) |
559 |
559 |
560 val facts = Parse.and_list1 Parse_Spec.xthms1; |
560 val facts = Parse.and_list1 Parse_Spec.xthms1; |
671 (* end proof *) |
671 (* end proof *) |
672 |
672 |
673 val _ = |
673 val _ = |
674 Outer_Syntax.command "qed" "conclude (sub-)proof" |
674 Outer_Syntax.command "qed" "conclude (sub-)proof" |
675 (Keyword.tag_proof Keyword.qed_block) |
675 (Keyword.tag_proof Keyword.qed_block) |
676 (Scan.option Method.parse >> IsarCmd.qed); |
676 (Scan.option Method.parse >> Isar_Cmd.qed); |
677 |
677 |
678 val _ = |
678 val _ = |
679 Outer_Syntax.command "by" "terminal backward proof" |
679 Outer_Syntax.command "by" "terminal backward proof" |
680 (Keyword.tag_proof Keyword.qed) |
680 (Keyword.tag_proof Keyword.qed) |
681 (Method.parse -- Scan.option Method.parse >> IsarCmd.terminal_proof); |
681 (Method.parse -- Scan.option Method.parse >> Isar_Cmd.terminal_proof); |
682 |
682 |
683 val _ = |
683 val _ = |
684 Outer_Syntax.command ".." "default proof" |
684 Outer_Syntax.command ".." "default proof" |
685 (Keyword.tag_proof Keyword.qed) |
685 (Keyword.tag_proof Keyword.qed) |
686 (Scan.succeed IsarCmd.default_proof); |
686 (Scan.succeed Isar_Cmd.default_proof); |
687 |
687 |
688 val _ = |
688 val _ = |
689 Outer_Syntax.command "." "immediate proof" |
689 Outer_Syntax.command "." "immediate proof" |
690 (Keyword.tag_proof Keyword.qed) |
690 (Keyword.tag_proof Keyword.qed) |
691 (Scan.succeed IsarCmd.immediate_proof); |
691 (Scan.succeed Isar_Cmd.immediate_proof); |
692 |
692 |
693 val _ = |
693 val _ = |
694 Outer_Syntax.command "done" "done proof" |
694 Outer_Syntax.command "done" "done proof" |
695 (Keyword.tag_proof Keyword.qed) |
695 (Keyword.tag_proof Keyword.qed) |
696 (Scan.succeed IsarCmd.done_proof); |
696 (Scan.succeed Isar_Cmd.done_proof); |
697 |
697 |
698 val _ = |
698 val _ = |
699 Outer_Syntax.command "sorry" "skip proof (quick-and-dirty mode only!)" |
699 Outer_Syntax.command "sorry" "skip proof (quick-and-dirty mode only!)" |
700 (Keyword.tag_proof Keyword.qed) |
700 (Keyword.tag_proof Keyword.qed) |
701 (Scan.succeed IsarCmd.skip_proof); |
701 (Scan.succeed Isar_Cmd.skip_proof); |
702 |
702 |
703 val _ = |
703 val _ = |
704 Outer_Syntax.command "oops" "forget proof" |
704 Outer_Syntax.command "oops" "forget proof" |
705 (Keyword.tag_proof Keyword.qed_global) |
705 (Keyword.tag_proof Keyword.qed_global) |
706 (Scan.succeed Toplevel.forget_proof); |
706 (Scan.succeed Toplevel.forget_proof); |
806 Outer_Syntax.improper_command "print_commands" "print outer syntax commands" Keyword.diag |
806 Outer_Syntax.improper_command "print_commands" "print outer syntax commands" Keyword.diag |
807 (Scan.succeed (Toplevel.no_timing o Toplevel.imperative Outer_Syntax.print_outer_syntax)); |
807 (Scan.succeed (Toplevel.no_timing o Toplevel.imperative Outer_Syntax.print_outer_syntax)); |
808 |
808 |
809 val _ = |
809 val _ = |
810 Outer_Syntax.improper_command "print_configs" "print configuration options" Keyword.diag |
810 Outer_Syntax.improper_command "print_configs" "print configuration options" Keyword.diag |
811 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_configs)); |
811 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_configs)); |
812 |
812 |
813 val _ = |
813 val _ = |
814 Outer_Syntax.improper_command "print_context" "print theory context name" Keyword.diag |
814 Outer_Syntax.improper_command "print_context" "print theory context name" Keyword.diag |
815 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_context)); |
815 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_context)); |
816 |
816 |
817 val _ = |
817 val _ = |
818 Outer_Syntax.improper_command "print_theory" "print logical theory contents (verbose!)" |
818 Outer_Syntax.improper_command "print_theory" "print logical theory contents (verbose!)" |
819 Keyword.diag (opt_bang >> (Toplevel.no_timing oo IsarCmd.print_theory)); |
819 Keyword.diag (opt_bang >> (Toplevel.no_timing oo Isar_Cmd.print_theory)); |
820 |
820 |
821 val _ = |
821 val _ = |
822 Outer_Syntax.improper_command "print_syntax" "print inner syntax of context (verbose!)" |
822 Outer_Syntax.improper_command "print_syntax" "print inner syntax of context (verbose!)" |
823 Keyword.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.print_syntax)); |
823 Keyword.diag (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_syntax)); |
824 |
824 |
825 val _ = |
825 val _ = |
826 Outer_Syntax.improper_command "print_abbrevs" "print constant abbreviation of context" |
826 Outer_Syntax.improper_command "print_abbrevs" "print constant abbreviation of context" |
827 Keyword.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.print_abbrevs)); |
827 Keyword.diag (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_abbrevs)); |
828 |
828 |
829 val _ = |
829 val _ = |
830 Outer_Syntax.improper_command "print_theorems" |
830 Outer_Syntax.improper_command "print_theorems" |
831 "print theorems of local theory or proof context" Keyword.diag |
831 "print theorems of local theory or proof context" Keyword.diag |
832 (opt_bang >> (Toplevel.no_timing oo IsarCmd.print_theorems)); |
832 (opt_bang >> (Toplevel.no_timing oo Isar_Cmd.print_theorems)); |
833 |
833 |
834 val _ = |
834 val _ = |
835 Outer_Syntax.improper_command "print_locales" "print locales of this theory" Keyword.diag |
835 Outer_Syntax.improper_command "print_locales" "print locales of this theory" Keyword.diag |
836 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_locales)); |
836 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_locales)); |
837 |
837 |
838 val _ = |
838 val _ = |
839 Outer_Syntax.improper_command "print_classes" "print classes of this theory" Keyword.diag |
839 Outer_Syntax.improper_command "print_classes" "print classes of this theory" Keyword.diag |
840 (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory |
840 (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory |
841 o Toplevel.keep (Class.print_classes o Toplevel.theory_of))); |
841 o Toplevel.keep (Class.print_classes o Toplevel.theory_of))); |
842 |
842 |
843 val _ = |
843 val _ = |
844 Outer_Syntax.improper_command "print_locale" "print locale of this theory" Keyword.diag |
844 Outer_Syntax.improper_command "print_locale" "print locale of this theory" Keyword.diag |
845 (opt_bang -- Parse.xname >> (Toplevel.no_timing oo IsarCmd.print_locale)); |
845 (opt_bang -- Parse.xname >> (Toplevel.no_timing oo Isar_Cmd.print_locale)); |
846 |
846 |
847 val _ = |
847 val _ = |
848 Outer_Syntax.improper_command "print_interps" |
848 Outer_Syntax.improper_command "print_interps" |
849 "print interpretations of locale for this theory" Keyword.diag |
849 "print interpretations of locale for this theory" Keyword.diag |
850 (Parse.xname >> (Toplevel.no_timing oo IsarCmd.print_registrations)); |
850 (Parse.xname >> (Toplevel.no_timing oo Isar_Cmd.print_registrations)); |
851 |
851 |
852 val _ = |
852 val _ = |
853 Outer_Syntax.improper_command "print_attributes" "print attributes of this theory" Keyword.diag |
853 Outer_Syntax.improper_command "print_attributes" "print attributes of this theory" Keyword.diag |
854 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_attributes)); |
854 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_attributes)); |
855 |
855 |
856 val _ = |
856 val _ = |
857 Outer_Syntax.improper_command "print_simpset" "print context of Simplifier" Keyword.diag |
857 Outer_Syntax.improper_command "print_simpset" "print context of Simplifier" Keyword.diag |
858 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_simpset)); |
858 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_simpset)); |
859 |
859 |
860 val _ = |
860 val _ = |
861 Outer_Syntax.improper_command "print_rules" "print intro/elim rules" Keyword.diag |
861 Outer_Syntax.improper_command "print_rules" "print intro/elim rules" Keyword.diag |
862 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_rules)); |
862 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_rules)); |
863 |
863 |
864 val _ = |
864 val _ = |
865 Outer_Syntax.improper_command "print_trans_rules" "print transitivity rules" Keyword.diag |
865 Outer_Syntax.improper_command "print_trans_rules" "print transitivity rules" Keyword.diag |
866 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_trans_rules)); |
866 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_trans_rules)); |
867 |
867 |
868 val _ = |
868 val _ = |
869 Outer_Syntax.improper_command "print_methods" "print methods of this theory" Keyword.diag |
869 Outer_Syntax.improper_command "print_methods" "print methods of this theory" Keyword.diag |
870 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_methods)); |
870 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_methods)); |
871 |
871 |
872 val _ = |
872 val _ = |
873 Outer_Syntax.improper_command "print_antiquotations" "print antiquotations (global)" Keyword.diag |
873 Outer_Syntax.improper_command "print_antiquotations" "print antiquotations (global)" Keyword.diag |
874 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_antiquotations)); |
874 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_antiquotations)); |
875 |
875 |
876 val _ = |
876 val _ = |
877 Outer_Syntax.improper_command "thy_deps" "visualize theory dependencies" |
877 Outer_Syntax.improper_command "thy_deps" "visualize theory dependencies" |
878 Keyword.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.thy_deps)); |
878 Keyword.diag (Scan.succeed (Toplevel.no_timing o Isar_Cmd.thy_deps)); |
879 |
879 |
880 val _ = |
880 val _ = |
881 Outer_Syntax.improper_command "class_deps" "visualize class dependencies" |
881 Outer_Syntax.improper_command "class_deps" "visualize class dependencies" |
882 Keyword.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.class_deps)); |
882 Keyword.diag (Scan.succeed (Toplevel.no_timing o Isar_Cmd.class_deps)); |
883 |
883 |
884 val _ = |
884 val _ = |
885 Outer_Syntax.improper_command "thm_deps" "visualize theorem dependencies" |
885 Outer_Syntax.improper_command "thm_deps" "visualize theorem dependencies" |
886 Keyword.diag (Parse_Spec.xthms1 >> (Toplevel.no_timing oo IsarCmd.thm_deps)); |
886 Keyword.diag (Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.thm_deps)); |
887 |
887 |
888 val _ = |
888 val _ = |
889 Outer_Syntax.improper_command "print_binds" "print term bindings of proof context" Keyword.diag |
889 Outer_Syntax.improper_command "print_binds" "print term bindings of proof context" Keyword.diag |
890 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_binds)); |
890 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_binds)); |
891 |
891 |
892 val _ = |
892 val _ = |
893 Outer_Syntax.improper_command "print_facts" "print facts of proof context" Keyword.diag |
893 Outer_Syntax.improper_command "print_facts" "print facts of proof context" Keyword.diag |
894 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_facts)); |
894 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_facts)); |
895 |
895 |
896 val _ = |
896 val _ = |
897 Outer_Syntax.improper_command "print_cases" "print cases of proof context" Keyword.diag |
897 Outer_Syntax.improper_command "print_cases" "print cases of proof context" Keyword.diag |
898 (Scan.succeed (Toplevel.no_timing o IsarCmd.print_cases)); |
898 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_cases)); |
899 |
899 |
900 val _ = |
900 val _ = |
901 Outer_Syntax.improper_command "print_statement" "print theorems as long statements" Keyword.diag |
901 Outer_Syntax.improper_command "print_statement" "print theorems as long statements" Keyword.diag |
902 (opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_stmts)); |
902 (opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_stmts)); |
903 |
903 |
904 val _ = |
904 val _ = |
905 Outer_Syntax.improper_command "thm" "print theorems" Keyword.diag |
905 Outer_Syntax.improper_command "thm" "print theorems" Keyword.diag |
906 (opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_thms)); |
906 (opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_thms)); |
907 |
907 |
908 val _ = |
908 val _ = |
909 Outer_Syntax.improper_command "prf" "print proof terms of theorems" Keyword.diag |
909 Outer_Syntax.improper_command "prf" "print proof terms of theorems" Keyword.diag |
910 (opt_modes -- Scan.option Parse_Spec.xthms1 |
910 (opt_modes -- Scan.option Parse_Spec.xthms1 |
911 >> (Toplevel.no_timing oo IsarCmd.print_prfs false)); |
911 >> (Toplevel.no_timing oo Isar_Cmd.print_prfs false)); |
912 |
912 |
913 val _ = |
913 val _ = |
914 Outer_Syntax.improper_command "full_prf" "print full proof terms of theorems" Keyword.diag |
914 Outer_Syntax.improper_command "full_prf" "print full proof terms of theorems" Keyword.diag |
915 (opt_modes -- Scan.option Parse_Spec.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_prfs true)); |
915 (opt_modes -- Scan.option Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_prfs true)); |
916 |
916 |
917 val _ = |
917 val _ = |
918 Outer_Syntax.improper_command "prop" "read and print proposition" Keyword.diag |
918 Outer_Syntax.improper_command "prop" "read and print proposition" Keyword.diag |
919 (opt_modes -- Parse.term >> (Toplevel.no_timing oo IsarCmd.print_prop)); |
919 (opt_modes -- Parse.term >> (Toplevel.no_timing oo Isar_Cmd.print_prop)); |
920 |
920 |
921 val _ = |
921 val _ = |
922 Outer_Syntax.improper_command "term" "read and print term" Keyword.diag |
922 Outer_Syntax.improper_command "term" "read and print term" Keyword.diag |
923 (opt_modes -- Parse.term >> (Toplevel.no_timing oo IsarCmd.print_term)); |
923 (opt_modes -- Parse.term >> (Toplevel.no_timing oo Isar_Cmd.print_term)); |
924 |
924 |
925 val _ = |
925 val _ = |
926 Outer_Syntax.improper_command "typ" "read and print type" Keyword.diag |
926 Outer_Syntax.improper_command "typ" "read and print type" Keyword.diag |
927 (opt_modes -- Parse.typ >> (Toplevel.no_timing oo IsarCmd.print_type)); |
927 (opt_modes -- Parse.typ >> (Toplevel.no_timing oo Isar_Cmd.print_type)); |
928 |
928 |
929 val _ = |
929 val _ = |
930 Outer_Syntax.improper_command "print_codesetup" "print code generator setup" Keyword.diag |
930 Outer_Syntax.improper_command "print_codesetup" "print code generator setup" Keyword.diag |
931 (Scan.succeed |
931 (Scan.succeed |
932 (Toplevel.no_timing o Toplevel.unknown_theory o Toplevel.keep |
932 (Toplevel.no_timing o Toplevel.unknown_theory o Toplevel.keep |
934 |
934 |
935 val _ = |
935 val _ = |
936 Outer_Syntax.improper_command "unused_thms" "find unused theorems" Keyword.diag |
936 Outer_Syntax.improper_command "unused_thms" "find unused theorems" Keyword.diag |
937 (Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) -- |
937 (Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) -- |
938 Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> |
938 Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> |
939 (Toplevel.no_timing oo IsarCmd.unused_thms)); |
939 (Toplevel.no_timing oo Isar_Cmd.unused_thms)); |
940 |
940 |
941 |
941 |
942 |
942 |
943 (** system commands (for interactive mode only) **) |
943 (** system commands (for interactive mode only) **) |
944 |
944 |
945 val _ = |
945 val _ = |
946 Outer_Syntax.improper_command "cd" "change current working directory" Keyword.diag |
946 Outer_Syntax.improper_command "cd" "change current working directory" Keyword.diag |
947 (Parse.path >> (Toplevel.no_timing oo IsarCmd.cd)); |
947 (Parse.path >> (Toplevel.no_timing oo Isar_Cmd.cd)); |
948 |
948 |
949 val _ = |
949 val _ = |
950 Outer_Syntax.improper_command "pwd" "print current working directory" Keyword.diag |
950 Outer_Syntax.improper_command "pwd" "print current working directory" Keyword.diag |
951 (Scan.succeed (Toplevel.no_timing o IsarCmd.pwd)); |
951 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.pwd)); |
952 |
952 |
953 val _ = |
953 val _ = |
954 Outer_Syntax.improper_command "use_thy" "use theory file" Keyword.diag |
954 Outer_Syntax.improper_command "use_thy" "use theory file" Keyword.diag |
955 (Parse.name >> (fn name => |
955 (Parse.name >> (fn name => |
956 Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.use_thy name))); |
956 Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.use_thy name))); |
957 |
957 |
958 val _ = |
958 val _ = |
959 Outer_Syntax.improper_command "touch_thy" "outdate theory, including descendants" Keyword.diag |
959 Outer_Syntax.improper_command "touch_thy" "outdate theory, including descendants" Keyword.diag |
960 (Parse.name >> (fn name => |
960 (Parse.name >> (fn name => |
961 Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.touch_thy name))); |
961 Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.touch_thy name))); |
962 |
962 |
963 val _ = |
963 val _ = |
964 Outer_Syntax.improper_command "remove_thy" "remove theory from loader database" Keyword.diag |
964 Outer_Syntax.improper_command "remove_thy" "remove theory from loader database" Keyword.diag |
965 (Parse.name >> (fn name => |
965 (Parse.name >> (fn name => |
966 Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.remove_thy name))); |
966 Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.remove_thy name))); |
967 |
967 |
968 val _ = |
968 val _ = |
969 Outer_Syntax.improper_command "kill_thy" "kill theory -- try to remove from loader database" |
969 Outer_Syntax.improper_command "kill_thy" "kill theory -- try to remove from loader database" |
970 Keyword.diag (Parse.name >> (fn name => |
970 Keyword.diag (Parse.name >> (fn name => |
971 Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.kill_thy name))); |
971 Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.kill_thy name))); |
972 |
972 |
973 val _ = |
973 val _ = |
974 Outer_Syntax.improper_command "display_drafts" "display raw source files with symbols" |
974 Outer_Syntax.improper_command "display_drafts" "display raw source files with symbols" |
975 Keyword.diag (Scan.repeat1 Parse.path >> (Toplevel.no_timing oo IsarCmd.display_drafts)); |
975 Keyword.diag (Scan.repeat1 Parse.path >> (Toplevel.no_timing oo Isar_Cmd.display_drafts)); |
976 |
976 |
977 val _ = |
977 val _ = |
978 Outer_Syntax.improper_command "print_drafts" "print raw source files with symbols" |
978 Outer_Syntax.improper_command "print_drafts" "print raw source files with symbols" |
979 Keyword.diag (Scan.repeat1 Parse.path >> (Toplevel.no_timing oo IsarCmd.print_drafts)); |
979 Keyword.diag (Scan.repeat1 Parse.path >> (Toplevel.no_timing oo Isar_Cmd.print_drafts)); |
980 |
980 |
981 val opt_limits = |
981 val opt_limits = |
982 Scan.option Parse.nat -- Scan.option (Parse.$$$ "," |-- Parse.!!! Parse.nat); |
982 Scan.option Parse.nat -- Scan.option (Parse.$$$ "," |-- Parse.!!! Parse.nat); |
983 |
983 |
984 val _ = |
984 val _ = |
985 Outer_Syntax.improper_command "pr" "print current proof state (if present)" Keyword.diag |
985 Outer_Syntax.improper_command "pr" "print current proof state (if present)" Keyword.diag |
986 (opt_modes -- opt_limits >> (Toplevel.no_timing oo IsarCmd.pr)); |
986 (opt_modes -- opt_limits >> (Toplevel.no_timing oo Isar_Cmd.pr)); |
987 |
987 |
988 val _ = |
988 val _ = |
989 Outer_Syntax.improper_command "disable_pr" "disable printing of toplevel state" Keyword.diag |
989 Outer_Syntax.improper_command "disable_pr" "disable printing of toplevel state" Keyword.diag |
990 (Scan.succeed (Toplevel.no_timing o IsarCmd.disable_pr)); |
990 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.disable_pr)); |
991 |
991 |
992 val _ = |
992 val _ = |
993 Outer_Syntax.improper_command "enable_pr" "enable printing of toplevel state" Keyword.diag |
993 Outer_Syntax.improper_command "enable_pr" "enable printing of toplevel state" Keyword.diag |
994 (Scan.succeed (Toplevel.no_timing o IsarCmd.enable_pr)); |
994 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.enable_pr)); |
995 |
995 |
996 val _ = |
996 val _ = |
997 Outer_Syntax.improper_command "commit" "commit current session to ML database" Keyword.diag |
997 Outer_Syntax.improper_command "commit" "commit current session to ML database" Keyword.diag |
998 (Parse.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit)); |
998 (Parse.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit)); |
999 |
999 |
1000 val _ = |
1000 val _ = |
1001 Outer_Syntax.improper_command "quit" "quit Isabelle" Keyword.control |
1001 Outer_Syntax.improper_command "quit" "quit Isabelle" Keyword.control |
1002 (Parse.opt_unit >> (Toplevel.no_timing oo K IsarCmd.quit)); |
1002 (Parse.opt_unit >> (Toplevel.no_timing oo K Isar_Cmd.quit)); |
1003 |
1003 |
1004 val _ = |
1004 val _ = |
1005 Outer_Syntax.improper_command "exit" "exit Isar loop" Keyword.control |
1005 Outer_Syntax.improper_command "exit" "exit Isar loop" Keyword.control |
1006 (Scan.succeed (Toplevel.no_timing o IsarCmd.exit)); |
1006 (Scan.succeed (Toplevel.no_timing o Isar_Cmd.exit)); |
1007 |
1007 |
1008 end; |
1008 end; |
1009 |
1009 |