src/Pure/Isar/isar_syn.ML
changeset 22744 5cbe966d67a2
parent 22573 2ac646ab2f6c
child 22796 34c316d7b630
equal deleted inserted replaced
22743:e2b06bfe471a 22744:5cbe966d67a2
    87 val axclassP =
    87 val axclassP =
    88   OuterSyntax.command "axclass" "define axiomatic type class" K.thy_decl
    88   OuterSyntax.command "axclass" "define axiomatic type class" K.thy_decl
    89     (P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |--
    89     (P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |--
    90         P.!!! (P.list1 P.xname)) []
    90         P.!!! (P.list1 P.xname)) []
    91         -- Scan.repeat (SpecParse.thm_name ":" -- (P.prop >> single))
    91         -- Scan.repeat (SpecParse.thm_name ":" -- (P.prop >> single))
    92       >> (fn (x, y) => Toplevel.theory (snd o AxClass.define_class x [] y)));
    92       >> (fn (x, y) => Toplevel.theory (snd o ClassPackage.axclass_cmd x y)));
    93 
    93 
    94 
    94 
    95 (* types *)
    95 (* types *)
    96 
    96 
    97 val typedeclP =
    97 val typedeclP =
   430            >> ClassPackage.instance_sort_cmd (*experimental: by interpretation of locales*)
   430            >> ClassPackage.instance_sort_cmd (*experimental: by interpretation of locales*)
   431       || P.and_list1 P.arity -- Scan.repeat (SpecParse.opt_thm_name ":" -- P.prop)
   431       || P.and_list1 P.arity -- Scan.repeat (SpecParse.opt_thm_name ":" -- P.prop)
   432            >> (fn (arities, defs) => ClassPackage.instance_arity_cmd arities defs)
   432            >> (fn (arities, defs) => ClassPackage.instance_arity_cmd arities defs)
   433     ) >> (Toplevel.print oo Toplevel.theory_to_proof));
   433     ) >> (Toplevel.print oo Toplevel.theory_to_proof));
   434 
   434 
   435 val print_classesP =
       
   436   OuterSyntax.improper_command "print_classes" "print classes of this theory" K.diag
       
   437     (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory
       
   438       o Toplevel.keep (ClassPackage.print_classes o Toplevel.theory_of)));
       
   439 
       
   440 end;
   435 end;
   441 
   436 
   442 
   437 
   443 
   438 
   444 (** proof commands **)
   439 (** proof commands **)
   708   OuterSyntax.improper_command "kill" "kill current history node" K.control
   703   OuterSyntax.improper_command "kill" "kill current history node" K.control
   709     (Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.kill));
   704     (Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.kill));
   710 
   705 
   711 
   706 
   712 
   707 
       
   708 (** code generation **)
       
   709 
       
   710 val code_datatypeP =
       
   711   OuterSyntax.command "code_datatype" "define set of code datatype constructors" K.thy_decl (
       
   712     Scan.repeat1 P.term
       
   713     >> (Toplevel.theory o CodegenData.add_datatype_consts_cmd)
       
   714   );
       
   715 
       
   716 
       
   717 
   713 (** diagnostic commands (for interactive mode only) **)
   718 (** diagnostic commands (for interactive mode only) **)
   714 
   719 
   715 val opt_modes = Scan.optional (P.$$$ "(" |-- P.!!! (Scan.repeat1 P.xname --| P.$$$ ")")) [];
   720 val opt_modes = Scan.optional (P.$$$ "(" |-- P.!!! (Scan.repeat1 P.xname --| P.$$$ ")")) [];
   716 val opt_bang = Scan.optional (P.$$$ "!" >> K true) false;
   721 val opt_bang = Scan.optional (P.$$$ "!" >> K true) false;
   717 
   722 
   749     (Scan.succeed (Toplevel.no_timing o IsarCmd.print_theorems));
   754     (Scan.succeed (Toplevel.no_timing o IsarCmd.print_theorems));
   750 
   755 
   751 val print_localesP =
   756 val print_localesP =
   752   OuterSyntax.improper_command "print_locales" "print locales of this theory" K.diag
   757   OuterSyntax.improper_command "print_locales" "print locales of this theory" K.diag
   753     (Scan.succeed (Toplevel.no_timing o IsarCmd.print_locales));
   758     (Scan.succeed (Toplevel.no_timing o IsarCmd.print_locales));
       
   759 
       
   760 val print_classesP =
       
   761   OuterSyntax.improper_command "print_classes" "print classes of this theory" K.diag
       
   762     (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory
       
   763       o Toplevel.keep (ClassPackage.print_classes o Toplevel.theory_of)));
   754 
   764 
   755 val print_localeP =
   765 val print_localeP =
   756   OuterSyntax.improper_command "print_locale" "print locale expression in this theory" K.diag
   766   OuterSyntax.improper_command "print_locale" "print locale expression in this theory" K.diag
   757     (opt_bang -- locale_val >> (Toplevel.no_timing oo IsarCmd.print_locale));
   767     (opt_bang -- locale_val >> (Toplevel.no_timing oo IsarCmd.print_locale));
   758 
   768 
   858 
   868 
   859 val print_typeP =
   869 val print_typeP =
   860   OuterSyntax.improper_command "typ" "read and print type" K.diag
   870   OuterSyntax.improper_command "typ" "read and print type" K.diag
   861     (opt_modes -- P.typ >> (Toplevel.no_timing oo IsarCmd.print_type));
   871     (opt_modes -- P.typ >> (Toplevel.no_timing oo IsarCmd.print_type));
   862 
   872 
       
   873 val print_codesetupP =
       
   874   OuterSyntax.improper_command "print_codesetup" "print code generator setup of this theory" K.diag
       
   875     (Scan.succeed
       
   876       (Toplevel.no_timing o Toplevel.unknown_theory o Toplevel.keep
       
   877         (CodegenData.print_codesetup o Toplevel.theory_of)));
   863 
   878 
   864 
   879 
   865 (** system commands (for interactive mode only) **)
   880 (** system commands (for interactive mode only) **)
   866 
   881 
   867 val cdP =
   882 val cdP =
   992   qedP, terminal_proofP, default_proofP, immediate_proofP,
  1007   qedP, terminal_proofP, default_proofP, immediate_proofP,
   993   done_proofP, skip_proofP, forget_proofP, deferP, preferP, applyP,
  1008   done_proofP, skip_proofP, forget_proofP, deferP, preferP, applyP,
   994   apply_endP, proofP, alsoP, finallyP, moreoverP, ultimatelyP, backP,
  1009   apply_endP, proofP, alsoP, finallyP, moreoverP, ultimatelyP, backP,
   995   cannot_undoP, redoP, undos_proofP, undoP, killP, interpretationP,
  1010   cannot_undoP, redoP, undos_proofP, undoP, killP, interpretationP,
   996   interpretP,
  1011   interpretP,
       
  1012   (*code generation*)
       
  1013   code_datatypeP,
   997   (*diagnostic commands*)
  1014   (*diagnostic commands*)
   998   pretty_setmarginP, helpP, print_classesP, print_commandsP, print_contextP,
  1015   pretty_setmarginP, helpP, print_classesP, print_commandsP, print_contextP,
   999   print_theoryP, print_syntaxP, print_abbrevsP, print_factsP,
  1016   print_theoryP, print_syntaxP, print_abbrevsP, print_factsP,
  1000   print_theoremsP, print_localesP, print_localeP,
  1017   print_theoremsP, print_localesP, print_localeP,
  1001   print_registrationsP, print_attributesP, print_simpsetP,
  1018   print_registrationsP, print_attributesP, print_simpsetP,
  1002   print_rulesP, print_induct_rulesP, print_trans_rulesP,
  1019   print_rulesP, print_induct_rulesP, print_trans_rulesP,
  1003   print_methodsP, print_antiquotationsP, thy_depsP, class_depsP, thm_depsP,
  1020   print_methodsP, print_antiquotationsP, thy_depsP, class_depsP, thm_depsP,
  1004   find_theoremsP, print_bindsP, print_casesP, print_stmtsP,
  1021   find_theoremsP, print_bindsP, print_casesP, print_stmtsP,
  1005   print_thmsP, print_prfsP, print_full_prfsP, print_propP,
  1022   print_thmsP, print_prfsP, print_full_prfsP, print_propP,
  1006   print_termP, print_typeP,
  1023   print_termP, print_typeP, print_codesetupP,
  1007   (*system commands*)
  1024   (*system commands*)
  1008   cdP, pwdP, use_thyP, use_thy_onlyP, update_thyP, update_thy_onlyP,
  1025   cdP, pwdP, use_thyP, use_thy_onlyP, update_thyP, update_thy_onlyP,
  1009   touch_thyP, touch_all_thysP, touch_child_thysP, remove_thyP,
  1026   touch_thyP, touch_all_thysP, touch_child_thysP, remove_thyP,
  1010   kill_thyP, display_draftsP, print_draftsP, prP, disable_prP,
  1027   kill_thyP, display_draftsP, print_draftsP, prP, disable_prP,
  1011   enable_prP, commitP, quitP, exitP, init_toplevelP, welcomeP];
  1028   enable_prP, commitP, quitP, exitP, init_toplevelP, welcomeP];