src/Pure/Isar/isar_syn.ML
author wenzelm
Tue Aug 29 20:13:45 2000 +0200 (2000-08-29 ago)
changeset 9731 3eb72671e5db
parent 9589 95a66548c883
child 9776 a126bc3b7376
permissions -rw-r--r--
pr: added prems limit;
wenzelm@5832
     1
(*  Title:      Pure/Isar/isar_syn.ML
wenzelm@5832
     2
    ID:         $Id$
wenzelm@5832
     3
    Author:     Markus Wenzel, TU Muenchen
wenzelm@8807
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
wenzelm@5832
     5
wenzelm@6353
     6
Isar/Pure outer syntax.
wenzelm@5832
     7
*)
wenzelm@5832
     8
wenzelm@5832
     9
signature ISAR_SYN =
wenzelm@5832
    10
sig
wenzelm@5832
    11
  val keywords: string list
wenzelm@5832
    12
  val parsers: OuterSyntax.parser list
wenzelm@5832
    13
end;
wenzelm@5832
    14
wenzelm@5832
    15
structure IsarSyn: ISAR_SYN =
wenzelm@5832
    16
struct
wenzelm@5832
    17
wenzelm@6723
    18
structure P = OuterParse and K = OuterSyntax.Keyword;
wenzelm@5832
    19
wenzelm@5832
    20
wenzelm@5832
    21
(** init and exit **)
wenzelm@5832
    22
wenzelm@5832
    23
val theoryP =
wenzelm@6723
    24
  OuterSyntax.command "theory" "begin theory" K.thy_begin
wenzelm@9129
    25
    (ThyHeader.args >> (Toplevel.print oo IsarThy.theory));
wenzelm@5832
    26
wenzelm@6687
    27
val end_excursionP =
wenzelm@6723
    28
  OuterSyntax.command "end" "end current excursion" K.thy_end
wenzelm@6687
    29
    (Scan.succeed (Toplevel.print o Toplevel.exit));
wenzelm@6687
    30
wenzelm@6245
    31
val contextP =
wenzelm@7102
    32
  OuterSyntax.improper_command "context" "switch theory context" K.thy_switch
wenzelm@6723
    33
    (P.name >> (Toplevel.print oo IsarThy.context));
wenzelm@6245
    34
wenzelm@5832
    35
wenzelm@5832
    36
wenzelm@7749
    37
(** markup commands **)
wenzelm@5832
    38
wenzelm@9129
    39
val headerP = OuterSyntax.markup_command IsarOutput.Markup "header" "theory header" K.diag
wenzelm@7733
    40
  (P.comment >> IsarThy.add_header);
wenzelm@6353
    41
wenzelm@9129
    42
val chapterP = OuterSyntax.markup_command IsarOutput.Markup "chapter" "chapter heading"
wenzelm@9129
    43
  K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_chapter));
wenzelm@5958
    44
wenzelm@9129
    45
val sectionP = OuterSyntax.markup_command IsarOutput.Markup "section" "section heading"
wenzelm@9129
    46
  K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_section));
wenzelm@5958
    47
wenzelm@9129
    48
val subsectionP = OuterSyntax.markup_command IsarOutput.Markup "subsection" "subsection heading"
wenzelm@9129
    49
  K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_subsection));
wenzelm@5958
    50
wenzelm@7749
    51
val subsubsectionP =
wenzelm@9129
    52
  OuterSyntax.markup_command IsarOutput.Markup "subsubsection" "subsubsection heading"
wenzelm@9129
    53
  K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_subsubsection));
wenzelm@5832
    54
wenzelm@9129
    55
val textP = OuterSyntax.markup_command IsarOutput.MarkupEnv "text" "formal comment (theory)"
wenzelm@9129
    56
  K.thy_decl (P.comment >> (Toplevel.theory o IsarThy.add_text));
wenzelm@7172
    57
wenzelm@9129
    58
val text_rawP = OuterSyntax.markup_command IsarOutput.Verbatim "text_raw"
wenzelm@9129
    59
  "raw document preparation text" K.thy_decl
wenzelm@9129
    60
  (P.comment >> (Toplevel.theory o IsarThy.add_text_raw));
wenzelm@7775
    61
wenzelm@7172
    62
wenzelm@9552
    63
val sectP = OuterSyntax.markup_command IsarOutput.Markup "sect" "formal comment (proof)"
wenzelm@9552
    64
  K.prf_heading (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_sect)));
wenzelm@7172
    65
wenzelm@9129
    66
val subsectP = OuterSyntax.markup_command IsarOutput.Markup "subsect" "formal comment (proof)"
wenzelm@9552
    67
  K.prf_heading (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_subsect)));
wenzelm@7172
    68
wenzelm@9129
    69
val subsubsectP = OuterSyntax.markup_command IsarOutput.Markup "subsubsect"
wenzelm@9552
    70
  "formal comment (proof)" K.prf_heading
wenzelm@7172
    71
  (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_subsubsect)));
wenzelm@7172
    72
wenzelm@9129
    73
val txtP = OuterSyntax.markup_command IsarOutput.MarkupEnv "txt" "formal comment (proof)"
wenzelm@9129
    74
  K.prf_decl (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_txt)));
wenzelm@7172
    75
wenzelm@9129
    76
val txt_rawP = OuterSyntax.markup_command IsarOutput.Verbatim "txt_raw"
wenzelm@9129
    77
  "raw document preparation text (proof)" K.prf_decl
wenzelm@9129
    78
  (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_txt_raw)));
wenzelm@7775
    79
wenzelm@5832
    80
wenzelm@6886
    81
wenzelm@6886
    82
(** theory sections **)
wenzelm@6886
    83
wenzelm@5832
    84
(* classes and sorts *)
wenzelm@5832
    85
wenzelm@5832
    86
val classesP =
wenzelm@6723
    87
  OuterSyntax.command "classes" "declare type classes" K.thy_decl
wenzelm@6723
    88
    (Scan.repeat1 (P.name -- Scan.optional (P.$$$ "<" |-- P.!!! (P.list1 P.xname)) [])
wenzelm@6727
    89
      -- P.marg_comment >> (Toplevel.theory o IsarThy.add_classes));
wenzelm@5832
    90
wenzelm@5832
    91
val classrelP =
wenzelm@6723
    92
  OuterSyntax.command "classrel" "state inclusion of type classes (axiomatic!)" K.thy_decl
wenzelm@6727
    93
    (P.xname -- (P.$$$ "<" |-- P.!!! P.xname) -- P.marg_comment
wenzelm@6727
    94
      >> (Toplevel.theory o IsarThy.add_classrel));
wenzelm@5832
    95
wenzelm@5832
    96
val defaultsortP =
wenzelm@6723
    97
  OuterSyntax.command "defaultsort" "declare default sort" K.thy_decl
wenzelm@6727
    98
    (P.sort -- P.marg_comment >> (Toplevel.theory o IsarThy.add_defsort));
wenzelm@5832
    99
wenzelm@5832
   100
wenzelm@5832
   101
(* types *)
wenzelm@5832
   102
wenzelm@5832
   103
val typedeclP =
wenzelm@6723
   104
  OuterSyntax.command "typedecl" "Pure type declaration" K.thy_decl
wenzelm@6727
   105
    (P.type_args -- P.name -- P.opt_infix -- P.marg_comment >> (fn (((args, a), mx), cmt) =>
wenzelm@6727
   106
      Toplevel.theory (IsarThy.add_typedecl ((a, args, mx), cmt))));
wenzelm@5832
   107
wenzelm@5832
   108
val typeabbrP =
wenzelm@6723
   109
  OuterSyntax.command "types" "declare type abbreviations" K.thy_decl
wenzelm@6727
   110
    (Scan.repeat1
wenzelm@9037
   111
      (P.type_args -- P.name -- (P.$$$ "=" |-- P.!!! (P.typ -- P.opt_infix')) -- P.marg_comment)
wenzelm@6727
   112
      >> (Toplevel.theory o IsarThy.add_tyabbrs o
wenzelm@6727
   113
        map (fn (((args, a), (T, mx)), cmt) => ((a, args, T, mx), cmt))));
wenzelm@5832
   114
wenzelm@5832
   115
val nontermP =
wenzelm@6370
   116
  OuterSyntax.command "nonterminals" "declare types treated as grammar nonterminal symbols"
wenzelm@6727
   117
    K.thy_decl (Scan.repeat1 (P.name -- P.marg_comment)
wenzelm@6727
   118
      >> (Toplevel.theory o IsarThy.add_nonterminals));
wenzelm@5832
   119
wenzelm@5832
   120
val aritiesP =
wenzelm@6723
   121
  OuterSyntax.command "arities" "state type arities (axiomatic!)" K.thy_decl
wenzelm@6727
   122
    (Scan.repeat1 ((P.xname -- (P.$$$ "::" |-- P.!!! P.arity) >> P.triple2) -- P.marg_comment)
wenzelm@6727
   123
      >> (Toplevel.theory o IsarThy.add_arities));
wenzelm@5832
   124
wenzelm@5832
   125
wenzelm@5832
   126
(* consts and syntax *)
wenzelm@5832
   127
wenzelm@8227
   128
val judgmentP =
wenzelm@8227
   129
  OuterSyntax.command "judgment" "declare object-logic judgment" K.thy_decl
wenzelm@8227
   130
    (P.const -- P.marg_comment >> (Toplevel.theory o IsarThy.add_judgment));
wenzelm@8227
   131
wenzelm@5832
   132
val constsP =
wenzelm@6723
   133
  OuterSyntax.command "consts" "declare constants" K.thy_decl
wenzelm@6727
   134
    (Scan.repeat1 (P.const -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_consts));
wenzelm@5832
   135
wenzelm@9731
   136
wenzelm@9731
   137
val mode_spec = 
wenzelm@9731
   138
  (P.$$$ "output" >> K ("", false)) || P.name -- Scan.optional (P.$$$ "output" >> K false) true;
wenzelm@9731
   139
wenzelm@9731
   140
val opt_mode = Scan.optional (P.$$$ "(" |-- P.!!! (mode_spec --| P.$$$ ")")) ("", true);
wenzelm@5832
   141
wenzelm@5832
   142
val syntaxP =
wenzelm@6723
   143
  OuterSyntax.command "syntax" "declare syntactic constants" K.thy_decl
wenzelm@6727
   144
    (opt_mode -- Scan.repeat1 (P.const -- P.marg_comment)
wenzelm@6727
   145
      >> (Toplevel.theory o uncurry IsarThy.add_modesyntax));
wenzelm@5832
   146
wenzelm@5832
   147
wenzelm@5832
   148
(* translations *)
wenzelm@5832
   149
wenzelm@5832
   150
val trans_pat =
wenzelm@6723
   151
  Scan.optional (P.$$$ "(" |-- P.!!! (P.xname --| P.$$$ ")")) "logic" -- P.string;
wenzelm@5832
   152
wenzelm@5832
   153
fun trans_arrow toks =
wenzelm@6723
   154
  (P.$$$ "=>" >> K Syntax.ParseRule ||
wenzelm@6723
   155
    P.$$$ "<=" >> K Syntax.PrintRule ||
wenzelm@6723
   156
    P.$$$ "==" >> K Syntax.ParsePrintRule) toks;
wenzelm@5832
   157
wenzelm@5832
   158
val trans_line =
wenzelm@6723
   159
  trans_pat -- P.!!! (trans_arrow -- trans_pat)
wenzelm@5832
   160
    >> (fn (left, (arr, right)) => arr (left, right));
wenzelm@5832
   161
wenzelm@5832
   162
val translationsP =
wenzelm@6723
   163
  OuterSyntax.command "translations" "declare syntax translation rules" K.thy_decl
wenzelm@6727
   164
    (Scan.repeat1 (trans_line -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_trrules));
wenzelm@5832
   165
wenzelm@5832
   166
wenzelm@5832
   167
(* axioms and definitions *)
wenzelm@5832
   168
wenzelm@5832
   169
val axiomsP =
wenzelm@6723
   170
  OuterSyntax.command "axioms" "state arbitrary propositions (axiomatic!)" K.thy_decl
wenzelm@6727
   171
    (Scan.repeat1 (P.spec_name -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_axioms));
wenzelm@5832
   172
wenzelm@9323
   173
val opt_overloaded =
wenzelm@9323
   174
  Scan.optional (P.$$$ "(" |-- P.!!! ((P.$$$ "overloaded" >> K true) --| P.$$$ ")")) false;
wenzelm@9323
   175
wenzelm@5832
   176
val defsP =
wenzelm@6723
   177
  OuterSyntax.command "defs" "define constants" K.thy_decl
wenzelm@9323
   178
    (opt_overloaded -- Scan.repeat1 (P.spec_name -- P.marg_comment)
wenzelm@9323
   179
  >> (Toplevel.theory o IsarThy.add_defs));
wenzelm@6370
   180
wenzelm@6370
   181
val constdefsP =
wenzelm@6723
   182
  OuterSyntax.command "constdefs" "declare and define constants" K.thy_decl
wenzelm@6727
   183
    (Scan.repeat1 ((P.const -- P.marg_comment) -- (P.term -- P.marg_comment))
wenzelm@6727
   184
      >> (Toplevel.theory o IsarThy.add_constdefs));
wenzelm@5832
   185
wenzelm@5832
   186
wenzelm@5914
   187
(* theorems *)
wenzelm@5914
   188
wenzelm@9197
   189
val name_facts = P.and_list1 (P.opt_thm_name "=" -- P.xthms1 -- P.marg_comment);
wenzelm@5914
   190
wenzelm@5914
   191
val theoremsP =
wenzelm@6723
   192
  OuterSyntax.command "theorems" "define theorems" K.thy_decl
wenzelm@9197
   193
    (name_facts >> (Toplevel.theory o IsarThy.have_theorems));
wenzelm@5914
   194
wenzelm@5914
   195
val lemmasP =
wenzelm@6723
   196
  OuterSyntax.command "lemmas" "define lemmas" K.thy_decl
wenzelm@9197
   197
    (name_facts >> (Toplevel.theory o IsarThy.have_lemmas));
wenzelm@5914
   198
wenzelm@9589
   199
val declareP =
wenzelm@9589
   200
  OuterSyntax.improper_command "declare" "declare theorems (improper)" K.thy_script
wenzelm@9589
   201
    (P.xthms1 -- P.marg_comment >> (Toplevel.theory o IsarThy.declare_theorems));
wenzelm@9589
   202
wenzelm@5914
   203
wenzelm@5832
   204
(* name space entry path *)
wenzelm@5832
   205
wenzelm@5832
   206
val globalP =
wenzelm@6723
   207
  OuterSyntax.command "global" "disable prefixing of theory name" K.thy_decl
wenzelm@8723
   208
    (P.marg_comment >> (Toplevel.theory o IsarThy.global_path));
wenzelm@5832
   209
wenzelm@5832
   210
val localP =
wenzelm@6723
   211
  OuterSyntax.command "local" "enable prefixing of theory name" K.thy_decl
wenzelm@8723
   212
    (P.marg_comment >> (Toplevel.theory o IsarThy.local_path));
wenzelm@8723
   213
wenzelm@8723
   214
val hideP =
wenzelm@8723
   215
  OuterSyntax.command "hide" "hide names from given name space" K.thy_decl
wenzelm@8723
   216
    (P.name -- Scan.repeat1 P.xname -- P.marg_comment >> (Toplevel.theory o IsarThy.hide_space));
wenzelm@5832
   217
wenzelm@5832
   218
wenzelm@5832
   219
(* use ML text *)
wenzelm@5832
   220
wenzelm@5832
   221
val useP =
wenzelm@6723
   222
  OuterSyntax.command "use" "eval ML text from file" K.diag
wenzelm@9273
   223
    (P.name -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.use));
wenzelm@5832
   224
wenzelm@5832
   225
val mlP =
wenzelm@7616
   226
  OuterSyntax.command "ML" "eval ML text (diagnostic)" K.diag
wenzelm@9273
   227
    (P.text -- P.marg_comment >> IsarCmd.use_mltext true);
wenzelm@7891
   228
wenzelm@7891
   229
val ml_commandP =
wenzelm@7891
   230
  OuterSyntax.command "ML_command" "eval ML text" K.diag
wenzelm@9273
   231
    (P.text -- P.marg_comment >> IsarCmd.use_mltext false);
wenzelm@7616
   232
wenzelm@7616
   233
val ml_setupP =
wenzelm@7616
   234
  OuterSyntax.command "ML_setup" "eval ML text (may change theory)" K.thy_decl
wenzelm@9273
   235
    (P.text -- P.marg_comment >> IsarCmd.use_mltext_theory);
wenzelm@5832
   236
wenzelm@5832
   237
val setupP =
wenzelm@7616
   238
  OuterSyntax.command "setup" "apply ML theory setup" K.thy_decl
wenzelm@9273
   239
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarCmd.use_setup));
wenzelm@5832
   240
wenzelm@9197
   241
val method_setupP =
wenzelm@9197
   242
  OuterSyntax.command "method_setup" "define proof method in ML" K.thy_decl
wenzelm@9197
   243
    (((P.name -- P.!!! (P.$$$ "=" |-- P.text -- P.text) >> P.triple2)
wenzelm@9197
   244
      -- P.marg_comment) >> (Toplevel.theory o IsarThy.method_setup));
wenzelm@9197
   245
wenzelm@5832
   246
wenzelm@5832
   247
(* translation functions *)
wenzelm@5832
   248
wenzelm@5832
   249
val parse_ast_translationP =
wenzelm@6723
   250
  OuterSyntax.command "parse_ast_translation" "install parse ast translation functions" K.thy_decl
wenzelm@9273
   251
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.parse_ast_translation));
wenzelm@5832
   252
wenzelm@5832
   253
val parse_translationP =
wenzelm@6723
   254
  OuterSyntax.command "parse_translation" "install parse translation functions" K.thy_decl
wenzelm@9273
   255
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.parse_translation));
wenzelm@5832
   256
wenzelm@5832
   257
val print_translationP =
wenzelm@6723
   258
  OuterSyntax.command "print_translation" "install print translation functions" K.thy_decl
wenzelm@9273
   259
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.print_translation));
wenzelm@5832
   260
wenzelm@5832
   261
val typed_print_translationP =
wenzelm@6370
   262
  OuterSyntax.command "typed_print_translation" "install typed print translation functions"
wenzelm@9273
   263
    K.thy_decl (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.typed_print_translation));
wenzelm@5832
   264
wenzelm@5832
   265
val print_ast_translationP =
wenzelm@6723
   266
  OuterSyntax.command "print_ast_translation" "install print ast translation functions" K.thy_decl
wenzelm@9273
   267
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.print_ast_translation));
wenzelm@5832
   268
wenzelm@5832
   269
val token_translationP =
wenzelm@6723
   270
  OuterSyntax.command "token_translation" "install token translation functions" K.thy_decl
wenzelm@9273
   271
    (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.token_translation));
wenzelm@5832
   272
wenzelm@5832
   273
wenzelm@5832
   274
(* oracles *)
wenzelm@5832
   275
wenzelm@5832
   276
val oracleP =
wenzelm@6723
   277
  OuterSyntax.command "oracle" "install oracle" K.thy_decl
wenzelm@7140
   278
    ((P.name --| P.$$$ "=") -- P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.add_oracle));
wenzelm@5832
   279
wenzelm@5832
   280
wenzelm@5832
   281
wenzelm@5832
   282
(** proof commands **)
wenzelm@5832
   283
wenzelm@5832
   284
(* statements *)
wenzelm@5832
   285
wenzelm@6936
   286
fun statement f = (P.opt_thm_name ":" -- P.propp >> P.triple1) -- P.marg_comment >> f;
wenzelm@5832
   287
wenzelm@5832
   288
val theoremP =
wenzelm@6723
   289
  OuterSyntax.command "theorem" "state theorem" K.thy_goal
wenzelm@5832
   290
    (statement IsarThy.theorem >> (fn f => Toplevel.print o Toplevel.theory_to_proof f));
wenzelm@5832
   291
wenzelm@5832
   292
val lemmaP =
wenzelm@6723
   293
  OuterSyntax.command "lemma" "state lemma" K.thy_goal
wenzelm@5832
   294
    (statement IsarThy.lemma >> (fn f => Toplevel.print o Toplevel.theory_to_proof f));
wenzelm@5832
   295
wenzelm@5832
   296
val showP =
wenzelm@6723
   297
  OuterSyntax.command "show" "state local goal, solving current obligation" K.prf_goal
wenzelm@5832
   298
    (statement IsarThy.show >> (fn f => Toplevel.print o Toplevel.proof f));
wenzelm@5832
   299
wenzelm@5832
   300
val haveP =
wenzelm@6723
   301
  OuterSyntax.command "have" "state local goal" K.prf_goal
wenzelm@5832
   302
    (statement IsarThy.have >> (fn f => Toplevel.print o Toplevel.proof f));
wenzelm@5832
   303
wenzelm@6501
   304
val thusP =
wenzelm@6723
   305
  OuterSyntax.command "thus" "abbreviates \"then show\"" K.prf_goal
wenzelm@6501
   306
    (statement IsarThy.thus >> (fn f => Toplevel.print o Toplevel.proof f));
wenzelm@6501
   307
wenzelm@6501
   308
val henceP =
wenzelm@6723
   309
  OuterSyntax.command "hence" "abbreviates \"then have\"" K.prf_goal
wenzelm@6501
   310
    (statement IsarThy.hence >> (fn f => Toplevel.print o Toplevel.proof f));
wenzelm@6501
   311
wenzelm@5832
   312
wenzelm@5914
   313
(* facts *)
wenzelm@5832
   314
wenzelm@9197
   315
val facts = P.and_list1 (P.xthms1 -- P.marg_comment);
wenzelm@9197
   316
wenzelm@5832
   317
val thenP =
wenzelm@6723
   318
  OuterSyntax.command "then" "forward chaining" K.prf_chain
wenzelm@6727
   319
    (P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.chain)));
wenzelm@5832
   320
wenzelm@5832
   321
val fromP =
wenzelm@6723
   322
  OuterSyntax.command "from" "forward chaining from given facts" K.prf_chain
wenzelm@9197
   323
    (facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.from_facts)));
wenzelm@5914
   324
wenzelm@6878
   325
val withP =
wenzelm@6878
   326
  OuterSyntax.command "with" "forward chaining from given and current facts" K.prf_chain
wenzelm@9197
   327
    (facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.with_facts)));
wenzelm@6878
   328
wenzelm@6773
   329
val noteP =
wenzelm@6723
   330
  OuterSyntax.command "note" "define facts" K.prf_decl
wenzelm@9197
   331
    (name_facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.have_facts)));
wenzelm@5832
   332
wenzelm@5832
   333
wenzelm@5832
   334
(* proof context *)
wenzelm@5832
   335
wenzelm@5832
   336
val assumeP =
wenzelm@6869
   337
  OuterSyntax.command "assume" "assume propositions" K.prf_asm
wenzelm@7269
   338
    (P.and_list1 ((P.opt_thm_name ":" -- Scan.repeat1 P.propp >> P.triple1) -- P.marg_comment)
wenzelm@6727
   339
      >> (Toplevel.print oo (Toplevel.proof o IsarThy.assume)));
wenzelm@5832
   340
wenzelm@6850
   341
val presumeP =
wenzelm@6869
   342
  OuterSyntax.command "presume" "assume propositions, to be established later" K.prf_asm
wenzelm@7269
   343
    (P.and_list1 ((P.opt_thm_name ":" -- Scan.repeat1 P.propp >> P.triple1) -- P.marg_comment)
wenzelm@6850
   344
      >> (Toplevel.print oo (Toplevel.proof o IsarThy.presume)));
wenzelm@6850
   345
wenzelm@6953
   346
val defP =
wenzelm@6953
   347
  OuterSyntax.command "def" "local definition" K.prf_asm
wenzelm@9465
   348
    ((P.opt_thm_name ":" -- (P.name -- (P.$$$ "==" |-- P.!!! P.termp)) >> P.triple1)
wenzelm@9465
   349
      -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.local_def)));
wenzelm@6953
   350
wenzelm@5832
   351
val fixP =
wenzelm@6869
   352
  OuterSyntax.command "fix" "fix variables (Skolem constants)" K.prf_asm
wenzelm@7415
   353
    (P.and_list1 (Scan.repeat1 P.name -- Scan.option (P.$$$ "::" |-- P.typ) -- P.marg_comment)
wenzelm@6727
   354
      >> (Toplevel.print oo (Toplevel.proof o IsarThy.fix)));
wenzelm@5832
   355
wenzelm@5832
   356
val letP =
wenzelm@6723
   357
  OuterSyntax.command "let" "bind text variables" K.prf_decl
wenzelm@8669
   358
    (P.and_list1 (P.enum1 "and" P.term -- (P.$$$ "=" |-- P.term) -- P.marg_comment)
wenzelm@8615
   359
      >> (Toplevel.print oo (Toplevel.proof o IsarThy.let_bind)));
wenzelm@5832
   360
wenzelm@8370
   361
val caseP =
wenzelm@8370
   362
  OuterSyntax.command "case" "invoke local context" K.prf_asm
wenzelm@8450
   363
    (P.xthm -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.invoke_case)));
wenzelm@8370
   364
wenzelm@5832
   365
wenzelm@5832
   366
(* proof structure *)
wenzelm@5832
   367
wenzelm@5832
   368
val beginP =
wenzelm@9056
   369
  OuterSyntax.command "{" "begin explicit proof block" K.prf_open
wenzelm@9032
   370
    (P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.begin_block)));
wenzelm@5832
   371
wenzelm@6687
   372
val endP =
wenzelm@9056
   373
  OuterSyntax.command "}" "end explicit proof block" K.prf_close
wenzelm@9032
   374
    (P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.end_block)));
wenzelm@6687
   375
wenzelm@5832
   376
val nextP =
wenzelm@6723
   377
  OuterSyntax.command "next" "enter next proof block" K.prf_block
wenzelm@9032
   378
    (P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.next_block)));
wenzelm@5832
   379
wenzelm@5832
   380
wenzelm@5832
   381
(* end proof *)
wenzelm@5832
   382
wenzelm@6404
   383
val qedP =
wenzelm@6735
   384
  OuterSyntax.command "qed" "conclude (sub-)proof" K.qed_block
wenzelm@7002
   385
    (Scan.option (P.method -- P.interest) -- P.marg_comment >> IsarThy.qed);
wenzelm@5832
   386
wenzelm@6404
   387
val terminal_proofP =
wenzelm@6723
   388
  OuterSyntax.command "by" "terminal backward proof" K.qed
wenzelm@7002
   389
    (P.method -- P.interest -- Scan.option (P.method -- P.interest)
wenzelm@7002
   390
      -- P.marg_comment >> IsarThy.terminal_proof);
wenzelm@6404
   391
wenzelm@8966
   392
val default_proofP =
wenzelm@8966
   393
  OuterSyntax.command ".." "default proof" K.qed
wenzelm@8966
   394
    (P.marg_comment >> IsarThy.default_proof);
wenzelm@8966
   395
wenzelm@6404
   396
val immediate_proofP =
wenzelm@6723
   397
  OuterSyntax.command "." "immediate proof" K.qed
wenzelm@7002
   398
    (P.marg_comment >> IsarThy.immediate_proof);
wenzelm@6404
   399
wenzelm@8966
   400
val done_proofP =
wenzelm@8966
   401
  OuterSyntax.command "done" "done proof" K.qed
wenzelm@8966
   402
    (P.marg_comment >> IsarThy.done_proof);
wenzelm@5832
   403
wenzelm@6888
   404
val skip_proofP =
wenzelm@7172
   405
  OuterSyntax.improper_command "sorry" "skip proof (quick-and-dirty mode only!)" K.qed
wenzelm@7002
   406
    (P.marg_comment >> IsarThy.skip_proof);
wenzelm@6888
   407
wenzelm@8210
   408
val forget_proofP =
wenzelm@8521
   409
  OuterSyntax.command "oops" "forget proof" K.qed_global
wenzelm@8210
   410
    (P.marg_comment >> IsarThy.forget_proof);
wenzelm@8210
   411
wenzelm@8210
   412
wenzelm@5832
   413
wenzelm@5832
   414
(* proof steps *)
wenzelm@5832
   415
wenzelm@8165
   416
val deferP =
wenzelm@8681
   417
  OuterSyntax.command "defer" "shuffle internal proof state" K.prf_script
wenzelm@8681
   418
    (Scan.option P.nat -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.defer)));
wenzelm@8165
   419
wenzelm@8165
   420
val preferP =
wenzelm@8681
   421
  OuterSyntax.command "prefer" "shuffle internal proof state" K.prf_script
wenzelm@8681
   422
    (P.nat -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.prefer)));
wenzelm@8165
   423
wenzelm@6850
   424
val applyP =
wenzelm@8681
   425
  OuterSyntax.command "apply" "initial refinement step (unstructured)" K.prf_script
wenzelm@8681
   426
    (P.method -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.apply)));
wenzelm@5832
   427
wenzelm@8235
   428
val apply_endP =
wenzelm@8681
   429
  OuterSyntax.command "apply_end" "terminal refinement (unstructured)" K.prf_script
wenzelm@8681
   430
    (P.method -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.apply_end)));
wenzelm@5832
   431
wenzelm@6404
   432
val proofP =
wenzelm@6723
   433
  OuterSyntax.command "proof" "backward proof" K.prf_block
wenzelm@7002
   434
    (P.interest -- Scan.option (P.method -- P.interest) -- P.marg_comment
wenzelm@6727
   435
      >> (Toplevel.print oo (Toplevel.proof o IsarThy.proof)));
wenzelm@5832
   436
wenzelm@5832
   437
wenzelm@6773
   438
(* calculational proof commands *)
wenzelm@6773
   439
wenzelm@6878
   440
val calc_args =
wenzelm@6878
   441
  Scan.option (P.$$$ "(" |-- P.!!! ((P.xthms1 --| P.$$$ ")") -- P.interest));
wenzelm@6878
   442
wenzelm@6773
   443
val alsoP =
wenzelm@8562
   444
  OuterSyntax.command "also" "combine calculation and current facts" K.prf_decl
wenzelm@6878
   445
    (calc_args -- P.marg_comment >> IsarThy.also);
wenzelm@6773
   446
wenzelm@6773
   447
val finallyP =
wenzelm@8562
   448
  OuterSyntax.command "finally" "combine calculation and current facts, exhibit result" K.prf_chain
wenzelm@6878
   449
    (calc_args -- P.marg_comment >> IsarThy.finally);
wenzelm@6773
   450
wenzelm@8562
   451
val moreoverP =
wenzelm@8562
   452
  OuterSyntax.command "moreover" "augment calculation by current facts" K.prf_decl
wenzelm@8562
   453
    (P.marg_comment >> IsarThy.moreover);
wenzelm@8562
   454
wenzelm@8588
   455
val ultimatelyP =
wenzelm@8588
   456
  OuterSyntax.command "ultimately" "augment calculation by current facts, exhibit result"
wenzelm@8588
   457
    K.prf_chain (P.marg_comment >> IsarThy.ultimately);
wenzelm@8588
   458
wenzelm@6773
   459
wenzelm@6742
   460
(* proof navigation *)
wenzelm@5944
   461
wenzelm@5832
   462
val backP =
wenzelm@8235
   463
  OuterSyntax.command "back" "backtracking of proof command" K.prf_script
wenzelm@9273
   464
    (Scan.optional (P.$$$ "!" >> K true) false -- P.marg_comment >>
wenzelm@9273
   465
      (Toplevel.print oo IsarCmd.back));
wenzelm@5832
   466
wenzelm@5832
   467
wenzelm@6742
   468
(* history *)
wenzelm@6742
   469
wenzelm@6742
   470
val cannot_undoP =
wenzelm@6742
   471
  OuterSyntax.improper_command "cannot_undo" "report 'cannot undo' error message" K.control
wenzelm@9010
   472
    (P.name >> (Toplevel.no_timing oo IsarCmd.cannot_undo));
wenzelm@6742
   473
wenzelm@7733
   474
val clear_undosP =
wenzelm@7733
   475
  OuterSyntax.improper_command "clear_undos" "clear theory-level undo information" K.control
wenzelm@9010
   476
    (P.nat >> (Toplevel.no_timing oo IsarCmd.clear_undos_theory));
wenzelm@6742
   477
wenzelm@6742
   478
val redoP =
wenzelm@6742
   479
  OuterSyntax.improper_command "redo" "redo last command" K.control
wenzelm@9010
   480
    (Scan.succeed (Toplevel.no_timing o Toplevel.print o IsarCmd.redo));
wenzelm@6742
   481
wenzelm@6742
   482
val undos_proofP =
wenzelm@6742
   483
  OuterSyntax.improper_command "undos_proof" "undo last proof commands" K.control
wenzelm@9010
   484
    (P.nat >> ((Toplevel.no_timing o Toplevel.print) oo IsarCmd.undos_proof));
wenzelm@6742
   485
wenzelm@6742
   486
val undoP =
wenzelm@6742
   487
  OuterSyntax.improper_command "undo" "undo last command" K.control
wenzelm@9010
   488
    (Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.undo));
wenzelm@6742
   489
wenzelm@8500
   490
val killP =
wenzelm@8500
   491
  OuterSyntax.improper_command "kill" "kill current history node" K.control
wenzelm@9010
   492
    (Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.kill));
wenzelm@8500
   493
wenzelm@6742
   494
wenzelm@5832
   495
wenzelm@5832
   496
(** diagnostic commands (for interactive mode only) **)
wenzelm@5832
   497
wenzelm@8464
   498
val opt_modes = Scan.optional (P.$$$ "(" |-- P.!!! (Scan.repeat1 P.xname --| P.$$$ ")")) [];
wenzelm@8464
   499
wenzelm@8464
   500
wenzelm@7124
   501
val pretty_setmarginP =
wenzelm@7124
   502
  OuterSyntax.improper_command "pretty_setmargin" "change default margin for pretty printing"
wenzelm@9010
   503
    K.diag (P.nat >> (Toplevel.no_timing oo IsarCmd.pretty_setmargin));
wenzelm@7124
   504
wenzelm@5832
   505
val print_commandsP =
wenzelm@9221
   506
  OuterSyntax.improper_command "print_commands" "print outer syntax (global)" K.diag
wenzelm@9221
   507
    (Scan.succeed (Toplevel.no_timing o OuterSyntax.print_commands));
wenzelm@5832
   508
wenzelm@7308
   509
val print_contextP =
wenzelm@7308
   510
  OuterSyntax.improper_command "print_context" "print theory context name" K.diag
wenzelm@9010
   511
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_context));
wenzelm@7308
   512
wenzelm@5832
   513
val print_theoryP =
wenzelm@6723
   514
  OuterSyntax.improper_command "print_theory" "print logical theory contents (verbose!)" K.diag
wenzelm@9010
   515
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_theory));
wenzelm@5832
   516
wenzelm@5832
   517
val print_syntaxP =
wenzelm@6723
   518
  OuterSyntax.improper_command "print_syntax" "print inner syntax of theory (verbose!)" K.diag
wenzelm@9010
   519
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_syntax));
wenzelm@5832
   520
wenzelm@5881
   521
val print_theoremsP =
wenzelm@6723
   522
  OuterSyntax.improper_command "print_theorems" "print theorems known in this theory" K.diag
wenzelm@9010
   523
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_theorems));
wenzelm@5881
   524
wenzelm@5832
   525
val print_attributesP =
wenzelm@6723
   526
  OuterSyntax.improper_command "print_attributes" "print attributes known in this theory" K.diag
wenzelm@9010
   527
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_attributes));
wenzelm@5832
   528
wenzelm@9221
   529
val print_trans_rulesP =
wenzelm@9221
   530
  OuterSyntax.improper_command "print_trans_rules" "print transitivity rules in this theory" K.diag
wenzelm@9221
   531
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_trans_rules));
wenzelm@9221
   532
wenzelm@5832
   533
val print_methodsP =
wenzelm@6723
   534
  OuterSyntax.improper_command "print_methods" "print methods known in this theory" K.diag
wenzelm@9010
   535
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_methods));
wenzelm@5832
   536
wenzelm@9221
   537
val print_antiquotationsP =
wenzelm@9221
   538
  OuterSyntax.improper_command "print_antiquotations" "print antiquotations (global)" K.diag
wenzelm@9221
   539
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_antiquotations));
wenzelm@9221
   540
wenzelm@7616
   541
val thms_containingP =
wenzelm@7616
   542
  OuterSyntax.improper_command "thms_containing" "print theorems containing all given constants"
wenzelm@9010
   543
    K.diag (Scan.repeat P.xname >> (Toplevel.no_timing oo IsarCmd.print_thms_containing));
wenzelm@7616
   544
wenzelm@9454
   545
val thm_depsP =
wenzelm@9454
   546
  OuterSyntax.improper_command "thm_deps" "visualize theorem dependencies"
wenzelm@9454
   547
    K.diag (P.xthms1 >> (Toplevel.no_timing oo IsarCmd.thm_deps));
wenzelm@9454
   548
wenzelm@5832
   549
val print_bindsP =
wenzelm@6723
   550
  OuterSyntax.improper_command "print_binds" "print term bindings of proof context" K.diag
wenzelm@9010
   551
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_binds));
wenzelm@5832
   552
wenzelm@5832
   553
val print_lthmsP =
wenzelm@8370
   554
  OuterSyntax.improper_command "print_facts" "print facts of proof context" K.diag
wenzelm@9010
   555
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_lthms));
wenzelm@5832
   556
wenzelm@8370
   557
val print_casesP =
wenzelm@8370
   558
  OuterSyntax.improper_command "print_cases" "print cases of proof context" K.diag
wenzelm@9010
   559
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_cases));
wenzelm@8370
   560
wenzelm@5896
   561
val print_thmsP =
wenzelm@8464
   562
  OuterSyntax.improper_command "thm" "print theorems" K.diag
wenzelm@9010
   563
    (opt_modes -- P.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_thms));
wenzelm@5832
   564
wenzelm@5832
   565
val print_propP =
wenzelm@6723
   566
  OuterSyntax.improper_command "prop" "read and print proposition" K.diag
wenzelm@9010
   567
    (opt_modes -- P.term >> (Toplevel.no_timing oo IsarCmd.print_prop));
wenzelm@5832
   568
wenzelm@5832
   569
val print_termP =
wenzelm@6723
   570
  OuterSyntax.improper_command "term" "read and print term" K.diag
wenzelm@9010
   571
    (opt_modes -- P.term >> (Toplevel.no_timing oo IsarCmd.print_term));
wenzelm@5832
   572
wenzelm@5832
   573
val print_typeP =
wenzelm@6723
   574
  OuterSyntax.improper_command "typ" "read and print type" K.diag
wenzelm@9010
   575
    (opt_modes -- P.typ >> (Toplevel.no_timing oo IsarCmd.print_type));
wenzelm@5832
   576
wenzelm@5832
   577
wenzelm@5832
   578
wenzelm@5832
   579
(** system commands (for interactive mode only) **)
wenzelm@5832
   580
wenzelm@5832
   581
val cdP =
wenzelm@8650
   582
  OuterSyntax.improper_command "cd" "change current working directory" K.diag
wenzelm@9010
   583
    (P.name >> (Toplevel.no_timing oo IsarCmd.cd));
wenzelm@5832
   584
wenzelm@5832
   585
val pwdP =
wenzelm@6723
   586
  OuterSyntax.improper_command "pwd" "print current working directory" K.diag
wenzelm@9010
   587
    (Scan.succeed (Toplevel.no_timing o IsarCmd.pwd));
wenzelm@5832
   588
wenzelm@5832
   589
val use_thyP =
wenzelm@6723
   590
  OuterSyntax.improper_command "use_thy" "use theory file" K.diag
wenzelm@9010
   591
    (P.name >> (Toplevel.no_timing oo IsarCmd.use_thy));
wenzelm@5832
   592
wenzelm@6694
   593
val use_thy_onlyP =
wenzelm@7102
   594
  OuterSyntax.improper_command "use_thy_only" "use theory file only, ignoring associated ML"
wenzelm@9010
   595
    K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.use_thy_only));
wenzelm@6694
   596
wenzelm@6196
   597
val update_thyP =
wenzelm@6723
   598
  OuterSyntax.improper_command "update_thy" "update theory file" K.diag
wenzelm@9010
   599
    (P.name >> (Toplevel.no_timing oo IsarCmd.update_thy));
wenzelm@5832
   600
wenzelm@7102
   601
val update_thy_onlyP =
wenzelm@7102
   602
  OuterSyntax.improper_command "update_thy_only" "update theory file, ignoring associated ML"
wenzelm@9010
   603
    K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.update_thy_only));
wenzelm@7102
   604
wenzelm@7102
   605
val touch_thyP =
wenzelm@7102
   606
  OuterSyntax.improper_command "touch_thy" "outdate theory, including descendants" K.diag
wenzelm@9010
   607
    (P.name >> (Toplevel.no_timing oo IsarCmd.touch_thy));
wenzelm@7102
   608
wenzelm@7102
   609
val touch_all_thysP =
wenzelm@7102
   610
  OuterSyntax.improper_command "touch_all_thys" "outdate all non-finished theories" K.diag
wenzelm@9010
   611
    (Scan.succeed (Toplevel.no_timing o IsarCmd.touch_all_thys));
wenzelm@7102
   612
wenzelm@7908
   613
val touch_child_thysP =
wenzelm@7908
   614
  OuterSyntax.improper_command "touch_child_thys" "outdate child theories" K.diag
wenzelm@9010
   615
    (P.name >> (Toplevel.no_timing oo IsarCmd.touch_child_thys));
wenzelm@7908
   616
wenzelm@7102
   617
val remove_thyP =
wenzelm@7102
   618
  OuterSyntax.improper_command "remove_thy" "remove theory from loader database" K.diag
wenzelm@9010
   619
    (P.name >> (Toplevel.no_timing oo IsarCmd.remove_thy));
wenzelm@7102
   620
wenzelm@7931
   621
val kill_thyP =
wenzelm@7931
   622
  OuterSyntax.improper_command "kill_thy" "kill theory -- try to remove from loader database"
wenzelm@9010
   623
    K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.kill_thy));
wenzelm@7931
   624
wenzelm@9731
   625
val opt_limits =
wenzelm@9731
   626
  Scan.option P.nat -- Scan.option (P.$$$ "," |-- P.!!! P.nat);
wenzelm@9731
   627
wenzelm@5832
   628
val prP =
wenzelm@8886
   629
  OuterSyntax.improper_command "pr" "print current proof state (if present)" K.diag
wenzelm@9731
   630
    (opt_modes -- opt_limits >> (Toplevel.no_timing oo IsarCmd.pr));
wenzelm@7199
   631
wenzelm@7222
   632
val disable_prP =
wenzelm@7222
   633
  OuterSyntax.improper_command "disable_pr" "disable printing of toplevel state" K.diag
wenzelm@9010
   634
    (Scan.succeed (Toplevel.no_timing o IsarCmd.disable_pr));
wenzelm@5832
   635
wenzelm@7222
   636
val enable_prP =
wenzelm@7222
   637
  OuterSyntax.improper_command "enable_pr" "enable printing of toplevel state" K.diag
wenzelm@9010
   638
    (Scan.succeed (Toplevel.no_timing o IsarCmd.enable_pr));
wenzelm@7222
   639
wenzelm@5832
   640
val commitP =
wenzelm@6723
   641
  OuterSyntax.improper_command "commit" "commit current session to ML database" K.diag
wenzelm@9010
   642
    (P.opt_unit >> (Toplevel.no_timing oo K IsarCmd.use_commit));
wenzelm@5832
   643
wenzelm@5832
   644
val quitP =
wenzelm@6723
   645
  OuterSyntax.improper_command "quit" "quit Isabelle" K.control
wenzelm@9010
   646
    (P.opt_unit >> (Toplevel.no_timing oo K IsarCmd.quit));
wenzelm@5832
   647
wenzelm@5832
   648
val exitP =
wenzelm@6723
   649
  OuterSyntax.improper_command "exit" "exit Isar loop" K.control
wenzelm@9010
   650
    (Scan.succeed (Toplevel.no_timing o IsarCmd.exit));
wenzelm@5832
   651
wenzelm@7102
   652
val init_toplevelP =
wenzelm@7102
   653
  OuterSyntax.improper_command "init_toplevel" "restart Isar toplevel loop" K.control
wenzelm@9010
   654
    (Scan.succeed (Toplevel.no_timing o IsarCmd.init_toplevel));
wenzelm@5991
   655
wenzelm@7462
   656
val welcomeP =
wenzelm@8678
   657
  OuterSyntax.improper_command "welcome" "print welcome message" K.diag
wenzelm@9010
   658
    (Scan.succeed (Toplevel.no_timing o IsarCmd.welcome));
wenzelm@7462
   659
wenzelm@5832
   660
wenzelm@5832
   661
wenzelm@5832
   662
(** the Pure outer syntax **)
wenzelm@5832
   663
wenzelm@5832
   664
(*keep keywords consistent with the parsers, including those in
wenzelm@5832
   665
  outer_parse.ML, otherwise be prepared for unexpected errors*)
wenzelm@5832
   666
wenzelm@5832
   667
val keywords =
wenzelm@7415
   668
 ["!", "!!", "%", "%%", "(", ")", "+", ",", "--", ":", "::", ";", "<",
wenzelm@8669
   669
  "<=", "=", "==", "=>", "?", "[", "]", "and", "binder", "concl",
wenzelm@9323
   670
  "files", "in", "infixl", "infixr", "is", "output", "overloaded", "|"];
wenzelm@5832
   671
wenzelm@5832
   672
val parsers = [
wenzelm@5832
   673
  (*theory structure*)
wenzelm@8500
   674
  theoryP, end_excursionP, contextP,
wenzelm@7775
   675
  (*markup commands*)
wenzelm@7733
   676
  headerP, chapterP, sectionP, subsectionP, subsubsectionP, textP,
wenzelm@7862
   677
  text_rawP, sectP, subsectP, subsubsectP, txtP, txt_rawP,
wenzelm@5832
   678
  (*theory sections*)
wenzelm@7172
   679
  classesP, classrelP, defaultsortP, typedeclP, typeabbrP, nontermP,
wenzelm@8227
   680
  aritiesP, judgmentP, constsP, syntaxP, translationsP, axiomsP,
wenzelm@9589
   681
  defsP, constdefsP, theoremsP, lemmasP, declareP, globalP, localP,
wenzelm@9589
   682
  hideP, useP, mlP, ml_commandP, ml_setupP, setupP, method_setupP,
wenzelm@9197
   683
  parse_ast_translationP, parse_translationP, print_translationP,
wenzelm@9197
   684
  typed_print_translationP, print_ast_translationP,
wenzelm@9197
   685
  token_translationP, oracleP,
wenzelm@5832
   686
  (*proof commands*)
wenzelm@6850
   687
  theoremP, lemmaP, showP, haveP, thusP, henceP, assumeP, presumeP,
wenzelm@8464
   688
  defP, fixP, letP, caseP, thenP, fromP, withP, noteP, beginP, endP,
wenzelm@8966
   689
  nextP, qedP, terminal_proofP, default_proofP, immediate_proofP,
wenzelm@8966
   690
  done_proofP, skip_proofP, forget_proofP, deferP, preferP, applyP,
wenzelm@8966
   691
  apply_endP, proofP, alsoP, finallyP, moreoverP, ultimatelyP, backP,
wenzelm@8588
   692
  cannot_undoP, clear_undosP, redoP, undos_proofP, undoP, killP,
wenzelm@5832
   693
  (*diagnostic commands*)
wenzelm@7308
   694
  pretty_setmarginP, print_commandsP, print_contextP, print_theoryP,
wenzelm@9221
   695
  print_syntaxP, print_theoremsP, print_attributesP,
wenzelm@9221
   696
  print_trans_rulesP, print_methodsP, print_antiquotationsP,
wenzelm@9454
   697
  thms_containingP, thm_depsP, print_bindsP, print_lthmsP,
wenzelm@9454
   698
  print_casesP, print_thmsP, print_propP, print_termP, print_typeP,
wenzelm@5832
   699
  (*system commands*)
wenzelm@7102
   700
  cdP, pwdP, use_thyP, use_thy_onlyP, update_thyP, update_thy_onlyP,
wenzelm@7931
   701
  touch_thyP, touch_all_thysP, touch_child_thysP, remove_thyP,
wenzelm@7931
   702
  kill_thyP, prP, disable_prP, enable_prP, commitP, quitP, exitP,
wenzelm@7931
   703
  init_toplevelP, welcomeP];
wenzelm@5832
   704
wenzelm@5832
   705
wenzelm@5832
   706
end;
wenzelm@5832
   707
wenzelm@5832
   708
wenzelm@6196
   709
(*install the Pure outer syntax*)
wenzelm@5832
   710
OuterSyntax.add_keywords IsarSyn.keywords;
wenzelm@5832
   711
OuterSyntax.add_parsers IsarSyn.parsers;