src/Pure/Isar/isar_syn.ML
author ballarin
Tue Sep 02 17:31:20 2008 +0200 (2008-09-02 ago)
changeset 28085 914183e229e9
parent 28084 a05ca48ef263
child 28114 2637fb838f74
permissions -rw-r--r--
Interpretation commands no longer accept interpretation attributes.
wenzelm@5832
     1
(*  Title:      Pure/Isar/isar_syn.ML
wenzelm@5832
     2
    ID:         $Id$
wenzelm@5832
     3
    Author:     Markus Wenzel, TU Muenchen
wenzelm@5832
     4
wenzelm@6353
     5
Isar/Pure outer syntax.
wenzelm@5832
     6
*)
wenzelm@5832
     7
wenzelm@17353
     8
structure IsarSyn: sig end =
wenzelm@5832
     9
struct
wenzelm@5832
    10
wenzelm@17068
    11
structure P = OuterParse and K = OuterKeyword;
wenzelm@5832
    12
wenzelm@5832
    13
wenzelm@24868
    14
(** keywords **)
wenzelm@24868
    15
wenzelm@24868
    16
(*keep keywords consistent with the parsers, otherwise be prepared for
wenzelm@24868
    17
  unexpected errors*)
wenzelm@24868
    18
wenzelm@27353
    19
val _ = List.app OuterKeyword.keyword
wenzelm@24868
    20
 ["!!", "!", "%", "(", ")", "+", ",", "--", ":", "::", ";", "<", "<=",
wenzelm@24868
    21
  "=", "==", "=>", "?", "[", "\\<equiv>", "\\<leftharpoondown>",
wenzelm@24868
    22
  "\\<rightharpoonup>", "\\<rightleftharpoons>", "\\<subseteq>", "]",
wenzelm@26888
    23
  "advanced", "and", "assumes", "attach", "begin", "binder",
wenzelm@24868
    24
  "constrains", "defines", "fixes", "for", "identifier", "if",
wenzelm@24868
    25
  "imports", "in", "includes", "infix", "infixl", "infixr", "is",
haftmann@25003
    26
  "notes", "obtains", "open", "output", "overloaded", "shows",
wenzelm@24868
    27
  "structure", "unchecked", "uses", "where", "|"];
wenzelm@24868
    28
wenzelm@24868
    29
wenzelm@5832
    30
(** init and exit **)
wenzelm@5832
    31
wenzelm@24868
    32
val _ =
wenzelm@17068
    33
  OuterSyntax.command "theory" "begin theory" (K.tag_theory K.thy_begin)
wenzelm@27575
    34
    (ThyHeader.args >> (Toplevel.print oo IsarCmd.init_theory));
wenzelm@5832
    35
wenzelm@24868
    36
val _ =
wenzelm@20958
    37
  OuterSyntax.command "end" "end (local) theory" (K.tag_theory K.thy_end)
wenzelm@21004
    38
    (Scan.succeed (Toplevel.exit o Toplevel.end_local_theory));
wenzelm@6687
    39
wenzelm@5832
    40
wenzelm@7749
    41
(** markup commands **)
wenzelm@5832
    42
wenzelm@24868
    43
val _ = OuterSyntax.markup_command ThyOutput.Markup "header" "theory header" K.diag
wenzelm@27872
    44
  (P.doc_source >> IsarCmd.header_markup);
wenzelm@6353
    45
wenzelm@24868
    46
val _ = OuterSyntax.markup_command ThyOutput.Markup "chapter" "chapter heading"
wenzelm@27872
    47
  K.thy_heading (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@5958
    48
wenzelm@24868
    49
val _ = OuterSyntax.markup_command ThyOutput.Markup "section" "section heading"
wenzelm@27872
    50
  K.thy_heading (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@5958
    51
wenzelm@24868
    52
val _ = OuterSyntax.markup_command ThyOutput.Markup "subsection" "subsection heading"
wenzelm@27872
    53
  K.thy_heading (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@5958
    54
wenzelm@24868
    55
val _ =
wenzelm@22117
    56
  OuterSyntax.markup_command ThyOutput.Markup "subsubsection" "subsubsection heading"
wenzelm@27872
    57
  K.thy_heading (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@5832
    58
wenzelm@24868
    59
val _ = OuterSyntax.markup_command ThyOutput.MarkupEnv "text" "formal comment (theory)"
wenzelm@27872
    60
  K.thy_decl (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@7172
    61
wenzelm@27872
    62
val _ = OuterSyntax.markup_command ThyOutput.Verbatim "text_raw" "raw document preparation text"
wenzelm@27872
    63
  K.thy_decl (P.opt_target -- P.doc_source >> IsarCmd.local_theory_markup);
wenzelm@7172
    64
wenzelm@24868
    65
val _ = OuterSyntax.markup_command ThyOutput.Markup "sect" "formal comment (proof)"
wenzelm@27872
    66
  (K.tag_proof K.prf_heading) (P.doc_source >> IsarCmd.proof_markup);
wenzelm@7172
    67
wenzelm@24868
    68
val _ = OuterSyntax.markup_command ThyOutput.Markup "subsect" "formal comment (proof)"
wenzelm@27872
    69
  (K.tag_proof K.prf_heading) (P.doc_source >> IsarCmd.proof_markup);
wenzelm@7172
    70
wenzelm@27872
    71
val _ = OuterSyntax.markup_command ThyOutput.Markup "subsubsect" "formal comment (proof)"
wenzelm@27872
    72
  (K.tag_proof K.prf_heading) (P.doc_source >> IsarCmd.proof_markup);
wenzelm@7172
    73
wenzelm@24868
    74
val _ = OuterSyntax.markup_command ThyOutput.MarkupEnv "txt" "formal comment (proof)"
wenzelm@27872
    75
  (K.tag_proof K.prf_decl) (P.doc_source >> IsarCmd.proof_markup);
wenzelm@7172
    76
wenzelm@24868
    77
val _ = OuterSyntax.markup_command ThyOutput.Verbatim "txt_raw"
wenzelm@17068
    78
  "raw document preparation text (proof)" (K.tag_proof K.prf_decl)
wenzelm@27872
    79
  (P.doc_source >> IsarCmd.proof_markup);
wenzelm@7775
    80
wenzelm@5832
    81
wenzelm@6886
    82
wenzelm@6886
    83
(** theory sections **)
wenzelm@6886
    84
wenzelm@5832
    85
(* classes and sorts *)
wenzelm@5832
    86
wenzelm@24868
    87
val _ =
wenzelm@6723
    88
  OuterSyntax.command "classes" "declare type classes" K.thy_decl
wenzelm@11101
    89
    (Scan.repeat1 (P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |--
wenzelm@24932
    90
        P.!!! (P.list1 P.xname)) []) >> (Toplevel.theory o fold AxClass.axiomatize_class_cmd));
wenzelm@5832
    91
wenzelm@24868
    92
val _ =
wenzelm@6723
    93
  OuterSyntax.command "classrel" "state inclusion of type classes (axiomatic!)" K.thy_decl
wenzelm@14779
    94
    (P.and_list1 (P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname))
wenzelm@24932
    95
    >> (Toplevel.theory o AxClass.axiomatize_classrel_cmd));
wenzelm@5832
    96
wenzelm@24868
    97
val _ =
wenzelm@6723
    98
  OuterSyntax.command "defaultsort" "declare default sort" K.thy_decl
wenzelm@22796
    99
    (P.sort >> (Toplevel.theory o Sign.add_defsort));
wenzelm@5832
   100
wenzelm@24868
   101
val _ =
wenzelm@19245
   102
  OuterSyntax.command "axclass" "define axiomatic type class" K.thy_decl
haftmann@21462
   103
    (P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |--
haftmann@21462
   104
        P.!!! (P.list1 P.xname)) []
wenzelm@22117
   105
        -- Scan.repeat (SpecParse.thm_name ":" -- (P.prop >> single))
haftmann@24219
   106
      >> (fn (x, y) => Toplevel.theory (snd o Class.axclass_cmd x y)));
wenzelm@19245
   107
wenzelm@5832
   108
wenzelm@5832
   109
(* types *)
wenzelm@5832
   110
wenzelm@24868
   111
val _ =
wenzelm@12624
   112
  OuterSyntax.command "typedecl" "type declaration" K.thy_decl
wenzelm@12876
   113
    (P.type_args -- P.name -- P.opt_infix >> (fn ((args, a), mx) =>
wenzelm@25495
   114
      Toplevel.theory (ObjectLogic.typedecl (a, args, mx) #> snd)));
wenzelm@5832
   115
wenzelm@24868
   116
val _ =
wenzelm@6723
   117
  OuterSyntax.command "types" "declare type abbreviations" K.thy_decl
wenzelm@6727
   118
    (Scan.repeat1
wenzelm@12876
   119
      (P.type_args -- P.name -- (P.$$$ "=" |-- P.!!! (P.typ -- P.opt_infix')))
wenzelm@22796
   120
      >> (Toplevel.theory o Sign.add_tyabbrs o
wenzelm@12876
   121
        map (fn ((args, a), (T, mx)) => (a, args, T, mx))));
wenzelm@5832
   122
wenzelm@24868
   123
val _ =
wenzelm@6370
   124
  OuterSyntax.command "nonterminals" "declare types treated as grammar nonterminal symbols"
wenzelm@22796
   125
    K.thy_decl (Scan.repeat1 P.name >> (Toplevel.theory o Sign.add_nonterminals));
wenzelm@5832
   126
wenzelm@24868
   127
val _ =
wenzelm@6723
   128
  OuterSyntax.command "arities" "state type arities (axiomatic!)" K.thy_decl
wenzelm@24932
   129
    (Scan.repeat1 P.arity >> (Toplevel.theory o fold AxClass.axiomatize_arity_cmd));
wenzelm@5832
   130
wenzelm@5832
   131
wenzelm@5832
   132
(* consts and syntax *)
wenzelm@5832
   133
wenzelm@24868
   134
val _ =
wenzelm@8227
   135
  OuterSyntax.command "judgment" "declare object-logic judgment" K.thy_decl
wenzelm@12876
   136
    (P.const >> (Toplevel.theory o ObjectLogic.add_judgment));
wenzelm@8227
   137
wenzelm@24868
   138
val _ =
wenzelm@6723
   139
  OuterSyntax.command "consts" "declare constants" K.thy_decl
wenzelm@22796
   140
    (Scan.repeat1 P.const >> (Toplevel.theory o Sign.add_consts));
wenzelm@5832
   141
wenzelm@14642
   142
val opt_overloaded = P.opt_keyword "overloaded";
skalberg@14223
   143
wenzelm@24868
   144
val _ =
skalberg@14223
   145
  OuterSyntax.command "finalconsts" "declare constants as final" K.thy_decl
skalberg@14223
   146
    (opt_overloaded -- Scan.repeat1 P.term >> (uncurry (Toplevel.theory oo Theory.add_finals)));
wenzelm@9731
   147
wenzelm@12142
   148
val mode_spec =
wenzelm@9731
   149
  (P.$$$ "output" >> K ("", false)) || P.name -- Scan.optional (P.$$$ "output" >> K false) true;
wenzelm@9731
   150
wenzelm@14900
   151
val opt_mode =
wenzelm@24960
   152
  Scan.optional (P.$$$ "(" |-- P.!!! (mode_spec --| P.$$$ ")")) Syntax.mode_default;
wenzelm@5832
   153
wenzelm@24868
   154
val _ =
wenzelm@6723
   155
  OuterSyntax.command "syntax" "declare syntactic constants" K.thy_decl
wenzelm@22796
   156
    (opt_mode -- Scan.repeat1 P.const >> (Toplevel.theory o uncurry Sign.add_modesyntax));
wenzelm@5832
   157
wenzelm@24868
   158
val _ =
wenzelm@15748
   159
  OuterSyntax.command "no_syntax" "delete syntax declarations" K.thy_decl
wenzelm@22796
   160
    (opt_mode -- Scan.repeat1 P.const >> (Toplevel.theory o uncurry Sign.del_modesyntax));
wenzelm@15748
   161
wenzelm@5832
   162
wenzelm@5832
   163
(* translations *)
wenzelm@5832
   164
wenzelm@5832
   165
val trans_pat =
wenzelm@6723
   166
  Scan.optional (P.$$$ "(" |-- P.!!! (P.xname --| P.$$$ ")")) "logic" -- P.string;
wenzelm@5832
   167
wenzelm@5832
   168
fun trans_arrow toks =
wenzelm@10688
   169
  ((P.$$$ "\\<rightharpoonup>" || P.$$$ "=>") >> K Syntax.ParseRule ||
wenzelm@10688
   170
    (P.$$$ "\\<leftharpoondown>" || P.$$$ "<=") >> K Syntax.PrintRule ||
wenzelm@10688
   171
    (P.$$$ "\\<rightleftharpoons>" || P.$$$ "==") >> K Syntax.ParsePrintRule) toks;
wenzelm@5832
   172
wenzelm@5832
   173
val trans_line =
wenzelm@6723
   174
  trans_pat -- P.!!! (trans_arrow -- trans_pat)
wenzelm@5832
   175
    >> (fn (left, (arr, right)) => arr (left, right));
wenzelm@5832
   176
wenzelm@24868
   177
val _ =
wenzelm@6723
   178
  OuterSyntax.command "translations" "declare syntax translation rules" K.thy_decl
wenzelm@22796
   179
    (Scan.repeat1 trans_line >> (Toplevel.theory o Sign.add_trrules));
wenzelm@5832
   180
wenzelm@24868
   181
val _ =
wenzelm@19260
   182
  OuterSyntax.command "no_translations" "remove syntax translation rules" K.thy_decl
wenzelm@22796
   183
    (Scan.repeat1 trans_line >> (Toplevel.theory o Sign.del_trrules));
wenzelm@19260
   184
wenzelm@5832
   185
wenzelm@5832
   186
(* axioms and definitions *)
wenzelm@5832
   187
wenzelm@24868
   188
val _ =
wenzelm@6723
   189
  OuterSyntax.command "axioms" "state arbitrary propositions (axiomatic!)" K.thy_decl
wenzelm@22117
   190
    (Scan.repeat1 SpecParse.spec_name >> (Toplevel.theory o IsarCmd.add_axioms));
wenzelm@5832
   191
wenzelm@19631
   192
val opt_unchecked_overloaded =
wenzelm@19631
   193
  Scan.optional (P.$$$ "(" |-- P.!!!
wenzelm@19631
   194
    (((P.$$$ "unchecked" >> K true) -- Scan.optional (P.$$$ "overloaded" >> K true) false ||
wenzelm@19631
   195
      P.$$$ "overloaded" >> K (false, true)) --| P.$$$ ")")) (false, false);
wenzelm@19631
   196
wenzelm@24868
   197
val _ =
wenzelm@6723
   198
  OuterSyntax.command "defs" "define constants" K.thy_decl
wenzelm@22117
   199
    (opt_unchecked_overloaded -- Scan.repeat1 SpecParse.spec_name
wenzelm@21350
   200
      >> (Toplevel.theory o IsarCmd.add_defs));
wenzelm@6370
   201
wenzelm@14642
   202
wenzelm@21601
   203
(* old constdefs *)
wenzelm@14642
   204
wenzelm@21601
   205
val old_constdecl =
wenzelm@28083
   206
  P.binding --| P.where_ >> (fn x => (x, NONE, NoSyn)) ||
wenzelm@28083
   207
  P.binding -- (P.$$$ "::" |-- P.!!! P.typ >> SOME) -- P.opt_mixfix'
wenzelm@21601
   208
    --| Scan.option P.where_ >> P.triple1 ||
wenzelm@28083
   209
  P.binding -- (P.mixfix >> pair NONE) --| Scan.option P.where_ >> P.triple2;
wenzelm@19076
   210
wenzelm@22117
   211
val old_constdef = Scan.option old_constdecl -- (SpecParse.opt_thm_name ":" -- P.prop);
wenzelm@14642
   212
wenzelm@19076
   213
val structs =
wenzelm@19076
   214
  Scan.optional ((P.$$$ "(" -- P.$$$ "structure") |-- P.!!! (P.simple_fixes --| P.$$$ ")")) [];
wenzelm@19076
   215
wenzelm@24868
   216
val _ =
wenzelm@19076
   217
  OuterSyntax.command "constdefs" "old-style constant definition" K.thy_decl
wenzelm@21601
   218
    (structs -- Scan.repeat1 old_constdef >> (Toplevel.theory o Constdefs.add_constdefs));
wenzelm@21601
   219
wenzelm@21601
   220
wenzelm@21601
   221
(* constant definitions and abbreviations *)
wenzelm@21601
   222
wenzelm@21601
   223
val constdecl =
wenzelm@28083
   224
  P.binding --
wenzelm@21601
   225
    (P.where_ >> K (NONE, NoSyn) ||
wenzelm@21601
   226
      P.$$$ "::" |-- P.!!! ((P.typ >> SOME) -- P.opt_mixfix' --| P.where_) ||
wenzelm@21601
   227
      Scan.ahead (P.$$$ "(") |-- P.!!! (P.mixfix' --| P.where_ >> pair NONE))
wenzelm@21601
   228
  >> P.triple2;
wenzelm@21601
   229
wenzelm@22117
   230
val constdef = Scan.option constdecl -- (SpecParse.opt_thm_name ":" -- P.prop);
wenzelm@5832
   231
wenzelm@24868
   232
val _ =
wenzelm@26988
   233
  OuterSyntax.local_theory "definition" "constant definition" K.thy_decl
wenzelm@26988
   234
    (constdef >> (fn args => #2 o Specification.definition_cmd args));
wenzelm@18780
   235
wenzelm@24868
   236
val _ =
wenzelm@26988
   237
  OuterSyntax.local_theory "abbreviation" "constant abbreviation" K.thy_decl
wenzelm@26988
   238
    (opt_mode -- (Scan.option constdecl -- P.prop)
wenzelm@26988
   239
    >> (fn (mode, args) => Specification.abbreviation_cmd mode args));
wenzelm@19659
   240
wenzelm@24868
   241
val _ =
wenzelm@26988
   242
  OuterSyntax.local_theory "notation" "add notation for constants / fixed variables" K.thy_decl
wenzelm@26988
   243
    (opt_mode -- P.and_list1 (P.xname -- SpecParse.locale_mixfix)
wenzelm@26988
   244
    >> (fn (mode, args) => Specification.notation_cmd true mode args));
wenzelm@24950
   245
wenzelm@24950
   246
val _ =
wenzelm@26988
   247
  OuterSyntax.local_theory "no_notation" "delete notation for constants / fixed variables" K.thy_decl
wenzelm@26988
   248
    (opt_mode -- P.and_list1 (P.xname -- SpecParse.locale_mixfix)
wenzelm@26988
   249
    >> (fn (mode, args) => Specification.notation_cmd false mode args));
wenzelm@19076
   250
wenzelm@5832
   251
wenzelm@18616
   252
(* constant specifications *)
wenzelm@18616
   253
wenzelm@24868
   254
val _ =
wenzelm@26988
   255
  OuterSyntax.local_theory "axiomatization" "axiomatic constant specification" K.thy_decl
wenzelm@26988
   256
    (Scan.optional P.fixes [] --
wenzelm@26988
   257
      Scan.optional (P.where_ |-- P.!!! (P.and_list1 SpecParse.spec)) []
wenzelm@26988
   258
    >> (fn (x, y) => #2 o Specification.axiomatization_cmd x y));
wenzelm@18616
   259
wenzelm@18616
   260
wenzelm@5914
   261
(* theorems *)
wenzelm@5914
   262
wenzelm@26988
   263
fun theorems kind =
wenzelm@26988
   264
  SpecParse.name_facts >> (fn args => #2 o Specification.theorems_cmd kind args);
wenzelm@12712
   265
wenzelm@24868
   266
val _ =
wenzelm@26988
   267
  OuterSyntax.local_theory "theorems" "define theorems" K.thy_decl (theorems Thm.theoremK);
wenzelm@5914
   268
wenzelm@24868
   269
val _ =
wenzelm@26988
   270
  OuterSyntax.local_theory "lemmas" "define lemmas" K.thy_decl (theorems Thm.lemmaK);
wenzelm@5914
   271
wenzelm@24868
   272
val _ =
wenzelm@26988
   273
  OuterSyntax.local_theory "declare" "declare theorems (improper)" K.thy_decl
wenzelm@26988
   274
    (P.and_list1 SpecParse.xthms1
wenzelm@28084
   275
      >> (fn args => #2 o Specification.theorems_cmd "" [(Attrib.no_binding, flat args)]));
wenzelm@9589
   276
wenzelm@5914
   277
wenzelm@5832
   278
(* name space entry path *)
wenzelm@5832
   279
wenzelm@24868
   280
val _ =
wenzelm@6723
   281
  OuterSyntax.command "global" "disable prefixing of theory name" K.thy_decl
wenzelm@16447
   282
    (Scan.succeed (Toplevel.theory Sign.root_path));
wenzelm@5832
   283
wenzelm@24868
   284
val _ =
wenzelm@6723
   285
  OuterSyntax.command "local" "enable prefixing of theory name" K.thy_decl
wenzelm@16447
   286
    (Scan.succeed (Toplevel.theory Sign.local_path));
wenzelm@8723
   287
wenzelm@24868
   288
val _ =
wenzelm@8723
   289
  OuterSyntax.command "hide" "hide names from given name space" K.thy_decl
wenzelm@17397
   290
    ((P.opt_keyword "open" >> not) -- (P.name -- Scan.repeat1 P.xname) >>
wenzelm@26672
   291
      (Toplevel.theory o uncurry IsarCmd.hide_names));
wenzelm@5832
   292
wenzelm@5832
   293
wenzelm@5832
   294
(* use ML text *)
wenzelm@5832
   295
wenzelm@24868
   296
val _ =
wenzelm@26490
   297
  OuterSyntax.command "use" "eval ML text from file" (K.tag_ml K.thy_decl)
wenzelm@26490
   298
    (P.path >> (Toplevel.generic_theory o ThyInfo.exec_file false));
wenzelm@5832
   299
wenzelm@24868
   300
val _ =
wenzelm@26490
   301
  OuterSyntax.command "ML" "eval ML text (diagnostic)" (K.tag_ml K.thy_decl)
wenzelm@27877
   302
    (P.ML_source >> (fn (txt, pos) =>
wenzelm@26490
   303
      Toplevel.generic_theory (ML_Context.exec (fn () => ML_Context.eval true pos txt))));
wenzelm@7891
   304
wenzelm@24868
   305
val _ =
wenzelm@26396
   306
  OuterSyntax.command "ML_val" "eval ML text (diagnostic)" (K.tag_ml K.diag)
wenzelm@27877
   307
    (P.ML_source >> IsarCmd.ml_diag true);
wenzelm@26396
   308
wenzelm@26396
   309
val _ =
wenzelm@26396
   310
  OuterSyntax.command "ML_command" "silently eval ML text (diagnostic)" (K.tag_ml K.diag)
wenzelm@27877
   311
    (P.ML_source >> (Toplevel.no_timing oo IsarCmd.ml_diag false));
wenzelm@5832
   312
wenzelm@24868
   313
val _ =
wenzelm@17068
   314
  OuterSyntax.command "setup" "apply ML theory setup" (K.tag_ml K.thy_decl)
wenzelm@27877
   315
    (P.ML_source >> (Toplevel.theory o IsarCmd.generic_setup));
wenzelm@5832
   316
wenzelm@24868
   317
val _ =
wenzelm@17068
   318
  OuterSyntax.command "method_setup" "define proof method in ML" (K.tag_ml K.thy_decl)
wenzelm@27877
   319
    (P.name -- P.!!! (P.$$$ "=" |-- P.ML_source -- P.text)
wenzelm@26385
   320
    >> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt)));
wenzelm@9197
   321
wenzelm@24868
   322
val _ =
wenzelm@26988
   323
  OuterSyntax.local_theory "declaration" "generic ML declaration" (K.tag_ml K.thy_decl)
wenzelm@27877
   324
    (P.ML_source >> IsarCmd.declaration);
wenzelm@22088
   325
wenzelm@24868
   326
val _ =
wenzelm@26988
   327
  OuterSyntax.local_theory "simproc_setup" "define simproc in ML" (K.tag_ml K.thy_decl)
wenzelm@26988
   328
    (P.name -- (P.$$$ "(" |-- P.enum1 "|" P.term --| P.$$$ ")" --| P.$$$ "=") --
wenzelm@27877
   329
      P.ML_source -- Scan.optional (P.$$$ "identifier" |-- Scan.repeat1 P.xname) []
wenzelm@26988
   330
    >> (fn (((a, b), c), d) => IsarCmd.simproc_setup a b c d));
wenzelm@22202
   331
wenzelm@5832
   332
wenzelm@5832
   333
(* translation functions *)
wenzelm@5832
   334
wenzelm@27877
   335
val trfun = P.opt_keyword "advanced" -- P.ML_source;
wenzelm@14642
   336
wenzelm@24868
   337
val _ =
wenzelm@17068
   338
  OuterSyntax.command "parse_ast_translation" "install parse ast translation functions"
wenzelm@17068
   339
    (K.tag_ml K.thy_decl)
wenzelm@22117
   340
    (trfun >> (Toplevel.theory o IsarCmd.parse_ast_translation));
wenzelm@5832
   341
wenzelm@24868
   342
val _ =
wenzelm@17068
   343
  OuterSyntax.command "parse_translation" "install parse translation functions"
wenzelm@17068
   344
    (K.tag_ml K.thy_decl)
wenzelm@22117
   345
    (trfun >> (Toplevel.theory o IsarCmd.parse_translation));
wenzelm@5832
   346
wenzelm@24868
   347
val _ =
wenzelm@17068
   348
  OuterSyntax.command "print_translation" "install print translation functions"
wenzelm@17068
   349
    (K.tag_ml K.thy_decl)
wenzelm@22117
   350
    (trfun >> (Toplevel.theory o IsarCmd.print_translation));
wenzelm@5832
   351
wenzelm@24868
   352
val _ =
wenzelm@6370
   353
  OuterSyntax.command "typed_print_translation" "install typed print translation functions"
wenzelm@17068
   354
    (K.tag_ml K.thy_decl)
wenzelm@22117
   355
    (trfun >> (Toplevel.theory o IsarCmd.typed_print_translation));
wenzelm@5832
   356
wenzelm@24868
   357
val _ =
wenzelm@17068
   358
  OuterSyntax.command "print_ast_translation" "install print ast translation functions"
wenzelm@17068
   359
    (K.tag_ml K.thy_decl)
wenzelm@22117
   360
    (trfun >> (Toplevel.theory o IsarCmd.print_ast_translation));
wenzelm@5832
   361
wenzelm@5832
   362
wenzelm@5832
   363
(* oracles *)
wenzelm@5832
   364
wenzelm@24868
   365
val _ =
wenzelm@17068
   366
  OuterSyntax.command "oracle" "declare oracle" (K.tag_ml K.thy_decl)
wenzelm@27877
   367
    (P.name -- (P.$$$ "(" |-- P.ML_source --| P.$$$ ")" --| P.$$$ "=")
wenzelm@27877
   368
      -- P.ML_source >> (fn ((x, y), z) => Toplevel.theory (IsarCmd.oracle x y z)));
wenzelm@5832
   369
wenzelm@5832
   370
wenzelm@21306
   371
(* local theories *)
wenzelm@21306
   372
wenzelm@24868
   373
val _ =
wenzelm@21306
   374
  OuterSyntax.command "context" "enter local theory context" K.thy_decl
wenzelm@21306
   375
    (P.name --| P.begin >> (fn name =>
wenzelm@25290
   376
      Toplevel.print o Toplevel.begin_local_theory true (TheoryTarget.context name)));
wenzelm@21306
   377
wenzelm@21306
   378
wenzelm@12061
   379
(* locales *)
wenzelm@12061
   380
wenzelm@12758
   381
val locale_val =
wenzelm@24868
   382
  SpecParse.locale_expr --
wenzelm@22117
   383
    Scan.optional (P.$$$ "+" |-- P.!!! (Scan.repeat1 SpecParse.context_element)) [] ||
wenzelm@24868
   384
  Scan.repeat1 SpecParse.context_element >> pair Locale.empty;
wenzelm@12061
   385
wenzelm@24868
   386
val _ =
wenzelm@12061
   387
  OuterSyntax.command "locale" "define named proof context" K.thy_decl
haftmann@27681
   388
    (P.name -- Scan.optional (P.$$$ "=" |-- P.!!! locale_val) (Locale.empty, []) -- P.opt_begin
haftmann@27681
   389
      >> (fn ((name, (expr, elems)), begin) =>
wenzelm@21843
   390
          (begin ? Toplevel.print) o Toplevel.begin_local_theory begin
haftmann@27681
   391
            (Locale.add_locale "" name expr elems #-> TheoryTarget.begin)));
wenzelm@12061
   392
ballarin@28085
   393
val opt_prefix = Scan.optional (P.binding --| P.$$$ ":") Name.no_binding;
ballarin@28085
   394
wenzelm@24868
   395
val _ =
ballarin@15598
   396
  OuterSyntax.command "interpretation"
ballarin@16736
   397
    "prove and register interpretation of locale expression in theory or locale" K.thy_goal
wenzelm@22117
   398
    (P.xname --| (P.$$$ "\\<subseteq>" || P.$$$ "<") -- P.!!! SpecParse.locale_expr
wenzelm@20365
   399
      >> (Toplevel.print oo (Toplevel.theory_to_proof o Locale.interpretation_in_locale I)) ||
ballarin@28085
   400
      opt_prefix  -- SpecParse.locale_expr -- SpecParse.locale_insts
ballarin@28085
   401
        >> (fn ((name, expr), insts) => Toplevel.print o
wenzelm@28083
   402
            Toplevel.theory_to_proof
ballarin@28085
   403
              (Locale.interpretation I (true, Name.name_of name) expr insts)));
wenzelm@12061
   404
wenzelm@24868
   405
val _ =
ballarin@15624
   406
  OuterSyntax.command "interpret"
wenzelm@17068
   407
    "prove and register interpretation of locale expression in proof context"
wenzelm@17068
   408
    (K.tag_proof K.prf_goal)
ballarin@28085
   409
    (opt_prefix -- SpecParse.locale_expr -- SpecParse.locale_insts
ballarin@28085
   410
      >> (fn ((name, expr), insts) => Toplevel.print o
wenzelm@28083
   411
          Toplevel.proof'
ballarin@28085
   412
            (Locale.interpret Seq.single (true, Name.name_of name) expr insts)));
wenzelm@15703
   413
wenzelm@15703
   414
haftmann@22299
   415
(* classes *)
haftmann@22299
   416
wenzelm@24868
   417
val class_val =
wenzelm@24868
   418
  SpecParse.class_expr --
haftmann@26248
   419
    Scan.optional (P.$$$ "+" |-- P.!!! (Scan.repeat1 SpecParse.context_element)) [] ||
haftmann@26248
   420
  Scan.repeat1 SpecParse.context_element >> pair [];
haftmann@22299
   421
wenzelm@24868
   422
val _ =
wenzelm@24868
   423
  OuterSyntax.command "class" "define type class" K.thy_decl
haftmann@26516
   424
   (P.name -- (P.$$$ "=" |-- class_val) -- P.opt_begin
haftmann@26516
   425
    >> (fn ((name, (supclasses, elems)), begin) =>
wenzelm@24938
   426
        (begin ? Toplevel.print) o Toplevel.begin_local_theory begin
haftmann@26516
   427
          (Class.class_cmd name supclasses elems #-> TheoryTarget.begin)));
haftmann@22299
   428
wenzelm@24868
   429
val _ =
wenzelm@26988
   430
  OuterSyntax.local_theory_to_proof "subclass" "prove a subclass relation" K.thy_goal
wenzelm@26988
   431
    (P.xname >> Subclass.subclass_cmd);
haftmann@24914
   432
haftmann@24914
   433
val _ =
haftmann@25519
   434
  OuterSyntax.command "instantiation" "instantiate and prove type arity" K.thy_decl
haftmann@25536
   435
   (P.multi_arity --| P.begin
haftmann@25462
   436
     >> (fn arities => Toplevel.print o
haftmann@25462
   437
         Toplevel.begin_local_theory true (Instance.instantiation_cmd arities)));
haftmann@24589
   438
haftmann@25485
   439
val _ =
haftmann@25485
   440
  OuterSyntax.command "instance" "prove type arity or subclass relation" K.thy_goal
haftmann@25485
   441
  ((P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) >> Class.classrel_cmd ||
haftmann@27113
   442
    P.arity >> Class.instance_arity_cmd)
haftmann@25485
   443
    >> (Toplevel.print oo Toplevel.theory_to_proof)
haftmann@25485
   444
  || Scan.succeed (Toplevel.print o Toplevel.local_theory_to_proof NONE (Class.instantiation_instance I)));
haftmann@22299
   445
haftmann@22299
   446
haftmann@25519
   447
(* arbitrary overloading *)
haftmann@25519
   448
haftmann@25519
   449
val _ =
haftmann@25519
   450
  OuterSyntax.command "overloading" "overloaded definitions" K.thy_decl
haftmann@25861
   451
   (Scan.repeat1 (P.name --| (P.$$$ "\\<equiv>" || P.$$$ "==") -- P.term --
wenzelm@26048
   452
      Scan.optional (P.$$$ "(" |-- (P.$$$ "unchecked" >> K false) --| P.$$$ ")") true
wenzelm@26048
   453
      >> P.triple1) --| P.begin
haftmann@25519
   454
   >> (fn operations => Toplevel.print o
haftmann@25519
   455
         Toplevel.begin_local_theory true (TheoryTarget.overloading_cmd operations)));
haftmann@25519
   456
haftmann@25519
   457
wenzelm@22866
   458
(* code generation *)
wenzelm@22866
   459
wenzelm@24868
   460
val _ =
wenzelm@22866
   461
  OuterSyntax.command "code_datatype" "define set of code datatype constructors" K.thy_decl
haftmann@24423
   462
    (Scan.repeat1 P.term >> (Toplevel.theory o Code.add_datatype_cmd));
wenzelm@22866
   463
wenzelm@22866
   464
wenzelm@5832
   465
wenzelm@5832
   466
(** proof commands **)
wenzelm@5832
   467
wenzelm@5832
   468
(* statements *)
wenzelm@5832
   469
wenzelm@17353
   470
fun gen_theorem kind =
wenzelm@26988
   471
  OuterSyntax.local_theory_to_proof' kind ("state " ^ kind) K.thy_goal
wenzelm@26988
   472
    (Scan.optional (SpecParse.opt_thm_name ":" --|
wenzelm@28084
   473
      Scan.ahead (SpecParse.locale_keyword || SpecParse.statement_keyword)) Attrib.no_binding --
wenzelm@26988
   474
      SpecParse.general_statement >> (fn (a, (elems, concl)) =>
wenzelm@26988
   475
        (Specification.theorem_cmd kind NONE (K I) a elems concl)));
wenzelm@5832
   476
wenzelm@24868
   477
val _ = gen_theorem Thm.theoremK;
wenzelm@24868
   478
val _ = gen_theorem Thm.lemmaK;
wenzelm@24868
   479
val _ = gen_theorem Thm.corollaryK;
wenzelm@5832
   480
wenzelm@24868
   481
val _ =
wenzelm@17353
   482
  OuterSyntax.command "have" "state local goal"
wenzelm@17353
   483
    (K.tag_proof K.prf_goal)
wenzelm@22117
   484
    (SpecParse.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.have));
wenzelm@17353
   485
wenzelm@24868
   486
val _ =
wenzelm@17353
   487
  OuterSyntax.command "hence" "abbreviates \"then have\""
wenzelm@17353
   488
    (K.tag_proof K.prf_goal)
wenzelm@22117
   489
    (SpecParse.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.hence));
wenzelm@17353
   490
wenzelm@24868
   491
val _ =
wenzelm@17068
   492
  OuterSyntax.command "show" "state local goal, solving current obligation"
wenzelm@21800
   493
    (K.tag_proof K.prf_asm_goal)
wenzelm@22117
   494
    (SpecParse.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.show));
wenzelm@5832
   495
wenzelm@24868
   496
val _ =
wenzelm@17068
   497
  OuterSyntax.command "thus" "abbreviates \"then show\""
wenzelm@21800
   498
    (K.tag_proof K.prf_asm_goal)
wenzelm@22117
   499
    (SpecParse.statement >> ((Toplevel.print oo Toplevel.proof') o IsarCmd.thus));
wenzelm@6501
   500
wenzelm@5832
   501
wenzelm@5914
   502
(* facts *)
wenzelm@5832
   503
wenzelm@22117
   504
val facts = P.and_list1 SpecParse.xthms1;
wenzelm@9197
   505
wenzelm@24868
   506
val _ =
wenzelm@17068
   507
  OuterSyntax.command "then" "forward chaining"
wenzelm@17068
   508
    (K.tag_proof K.prf_chain)
wenzelm@17900
   509
    (Scan.succeed (Toplevel.print o Toplevel.proof Proof.chain));
wenzelm@5832
   510
wenzelm@24868
   511
val _ =
wenzelm@17068
   512
  OuterSyntax.command "from" "forward chaining from given facts"
wenzelm@17068
   513
    (K.tag_proof K.prf_chain)
wenzelm@17900
   514
    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.from_thmss)));
wenzelm@5914
   515
wenzelm@24868
   516
val _ =
wenzelm@17068
   517
  OuterSyntax.command "with" "forward chaining from given and current facts"
wenzelm@17068
   518
    (K.tag_proof K.prf_chain)
wenzelm@17900
   519
    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.with_thmss)));
wenzelm@6878
   520
wenzelm@24868
   521
val _ =
wenzelm@17068
   522
  OuterSyntax.command "note" "define facts"
wenzelm@17068
   523
    (K.tag_proof K.prf_decl)
wenzelm@22117
   524
    (SpecParse.name_facts >> (Toplevel.print oo (Toplevel.proof o Proof.note_thmss)));
wenzelm@5832
   525
wenzelm@24868
   526
val _ =
wenzelm@17068
   527
  OuterSyntax.command "using" "augment goal facts"
wenzelm@17068
   528
    (K.tag_proof K.prf_decl)
wenzelm@18544
   529
    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.using)));
wenzelm@18544
   530
wenzelm@24868
   531
val _ =
wenzelm@18544
   532
  OuterSyntax.command "unfolding" "unfold definitions in goal and facts"
wenzelm@18544
   533
    (K.tag_proof K.prf_decl)
wenzelm@18544
   534
    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.unfolding)));
wenzelm@12926
   535
wenzelm@5832
   536
wenzelm@5832
   537
(* proof context *)
wenzelm@5832
   538
wenzelm@24868
   539
val _ =
wenzelm@17068
   540
  OuterSyntax.command "fix" "fix local variables (Skolem constants)"
wenzelm@17068
   541
    (K.tag_proof K.prf_asm)
wenzelm@19844
   542
    (P.fixes >> (Toplevel.print oo (Toplevel.proof o Proof.fix)));
wenzelm@11890
   543
wenzelm@24868
   544
val _ =
wenzelm@17068
   545
  OuterSyntax.command "assume" "assume propositions"
wenzelm@17068
   546
    (K.tag_proof K.prf_asm)
wenzelm@22117
   547
    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.assume)));
wenzelm@5832
   548
wenzelm@24868
   549
val _ =
wenzelm@17068
   550
  OuterSyntax.command "presume" "assume propositions, to be established later"
wenzelm@17068
   551
    (K.tag_proof K.prf_asm)
wenzelm@22117
   552
    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.presume)));
wenzelm@6850
   553
wenzelm@24868
   554
val _ =
wenzelm@17068
   555
  OuterSyntax.command "def" "local definition"
wenzelm@17068
   556
    (K.tag_proof K.prf_asm)
wenzelm@18308
   557
    (P.and_list1
wenzelm@22117
   558
      (SpecParse.opt_thm_name ":" --
wenzelm@28083
   559
        ((P.binding -- P.opt_mixfix) -- ((P.$$$ "\\<equiv>" || P.$$$ "==") |-- P.!!! P.termp)))
wenzelm@18308
   560
    >> (Toplevel.print oo (Toplevel.proof o Proof.def)));
wenzelm@6953
   561
wenzelm@24868
   562
val _ =
wenzelm@11890
   563
  OuterSyntax.command "obtain" "generalized existence"
wenzelm@17068
   564
    (K.tag_proof K.prf_asm_goal)
wenzelm@22117
   565
    (P.parname -- Scan.optional (P.fixes --| P.where_) [] -- SpecParse.statement
wenzelm@18895
   566
      >> (fn ((x, y), z) => Toplevel.print o Toplevel.proof' (Obtain.obtain x y z)));
wenzelm@5832
   567
wenzelm@24868
   568
val _ =
wenzelm@17854
   569
  OuterSyntax.command "guess" "wild guessing (unstructured)"
wenzelm@17854
   570
    (K.tag_proof K.prf_asm_goal)
wenzelm@19844
   571
    (Scan.optional P.fixes [] >> (Toplevel.print oo (Toplevel.proof' o Obtain.guess)));
wenzelm@17854
   572
wenzelm@24868
   573
val _ =
wenzelm@17068
   574
  OuterSyntax.command "let" "bind text variables"
wenzelm@17068
   575
    (K.tag_proof K.prf_decl)
wenzelm@27378
   576
    (P.and_list1 (P.and_list1 P.term -- (P.$$$ "=" |-- P.term))
wenzelm@17900
   577
      >> (Toplevel.print oo (Toplevel.proof o Proof.let_bind)));
wenzelm@5832
   578
wenzelm@11793
   579
val case_spec =
wenzelm@15703
   580
  (P.$$$ "(" |-- P.!!! (P.xname -- Scan.repeat1 (P.maybe P.name) --| P.$$$ ")") ||
wenzelm@22117
   581
    P.xname >> rpair []) -- SpecParse.opt_attribs >> P.triple1;
wenzelm@11793
   582
wenzelm@24868
   583
val _ =
wenzelm@17068
   584
  OuterSyntax.command "case" "invoke local context"
wenzelm@17068
   585
    (K.tag_proof K.prf_asm)
wenzelm@17900
   586
    (case_spec >> (Toplevel.print oo (Toplevel.proof o Proof.invoke_case)));
wenzelm@8370
   587
wenzelm@5832
   588
wenzelm@5832
   589
(* proof structure *)
wenzelm@5832
   590
wenzelm@24868
   591
val _ =
wenzelm@17068
   592
  OuterSyntax.command "{" "begin explicit proof block"
wenzelm@17068
   593
    (K.tag_proof K.prf_open)
wenzelm@17900
   594
    (Scan.succeed (Toplevel.print o Toplevel.proof Proof.begin_block));
wenzelm@5832
   595
wenzelm@24868
   596
val _ =
wenzelm@17068
   597
  OuterSyntax.command "}" "end explicit proof block"
wenzelm@17068
   598
    (K.tag_proof K.prf_close)
wenzelm@20305
   599
    (Scan.succeed (Toplevel.print o Toplevel.proof Proof.end_block));
wenzelm@6687
   600
wenzelm@24868
   601
val _ =
wenzelm@17068
   602
  OuterSyntax.command "next" "enter next proof block"
wenzelm@17068
   603
    (K.tag_proof K.prf_block)
wenzelm@17900
   604
    (Scan.succeed (Toplevel.print o Toplevel.proof Proof.next_block));
wenzelm@5832
   605
wenzelm@5832
   606
wenzelm@5832
   607
(* end proof *)
wenzelm@5832
   608
wenzelm@24868
   609
val _ =
wenzelm@17068
   610
  OuterSyntax.command "qed" "conclude (sub-)proof"
wenzelm@17068
   611
    (K.tag_proof K.qed_block)
wenzelm@26676
   612
    (Scan.option Method.parse >> IsarCmd.qed);
wenzelm@5832
   613
wenzelm@24868
   614
val _ =
wenzelm@17068
   615
  OuterSyntax.command "by" "terminal backward proof"
wenzelm@17068
   616
    (K.tag_proof K.qed)
wenzelm@26676
   617
    (Method.parse -- Scan.option Method.parse >> IsarCmd.terminal_proof);
wenzelm@6404
   618
wenzelm@24868
   619
val _ =
wenzelm@17068
   620
  OuterSyntax.command ".." "default proof"
wenzelm@17068
   621
    (K.tag_proof K.qed)
wenzelm@26676
   622
    (Scan.succeed IsarCmd.default_proof);
wenzelm@8966
   623
wenzelm@24868
   624
val _ =
wenzelm@17068
   625
  OuterSyntax.command "." "immediate proof"
wenzelm@17068
   626
    (K.tag_proof K.qed)
wenzelm@26676
   627
    (Scan.succeed IsarCmd.immediate_proof);
wenzelm@6404
   628
wenzelm@24868
   629
val _ =
wenzelm@17068
   630
  OuterSyntax.command "done" "done proof"
wenzelm@17068
   631
    (K.tag_proof K.qed)
wenzelm@26676
   632
    (Scan.succeed IsarCmd.done_proof);
wenzelm@5832
   633
wenzelm@24868
   634
val _ =
wenzelm@25108
   635
  OuterSyntax.command "sorry" "skip proof (quick-and-dirty mode only!)"
wenzelm@17068
   636
    (K.tag_proof K.qed)
wenzelm@26676
   637
    (Scan.succeed IsarCmd.skip_proof);
wenzelm@6888
   638
wenzelm@24868
   639
val _ =
wenzelm@17068
   640
  OuterSyntax.command "oops" "forget proof"
wenzelm@17068
   641
    (K.tag_proof K.qed_global)
wenzelm@18561
   642
    (Scan.succeed Toplevel.forget_proof);
wenzelm@8210
   643
wenzelm@5832
   644
wenzelm@5832
   645
(* proof steps *)
wenzelm@5832
   646
wenzelm@24868
   647
val _ =
wenzelm@17068
   648
  OuterSyntax.command "defer" "shuffle internal proof state"
wenzelm@17068
   649
    (K.tag_proof K.prf_script)
wenzelm@17900
   650
    (Scan.option P.nat >> (Toplevel.print oo (Toplevel.proofs o Proof.defer)));
wenzelm@8165
   651
wenzelm@24868
   652
val _ =
wenzelm@17068
   653
  OuterSyntax.command "prefer" "shuffle internal proof state"
wenzelm@17068
   654
    (K.tag_proof K.prf_script)
wenzelm@17900
   655
    (P.nat >> (Toplevel.print oo (Toplevel.proofs o Proof.prefer)));
wenzelm@8165
   656
wenzelm@24868
   657
val _ =
wenzelm@17068
   658
  OuterSyntax.command "apply" "initial refinement step (unstructured)"
wenzelm@17068
   659
    (K.tag_proof K.prf_script)
wenzelm@22117
   660
    (Method.parse >> (Toplevel.print oo (Toplevel.proofs o Proof.apply)));
wenzelm@5832
   661
wenzelm@24868
   662
val _ =
wenzelm@17068
   663
  OuterSyntax.command "apply_end" "terminal refinement (unstructured)"
wenzelm@17068
   664
    (K.tag_proof K.prf_script)
wenzelm@22117
   665
    (Method.parse >> (Toplevel.print oo (Toplevel.proofs o Proof.apply_end)));
wenzelm@5832
   666
wenzelm@24868
   667
val _ =
wenzelm@17068
   668
  OuterSyntax.command "proof" "backward proof"
wenzelm@17068
   669
    (K.tag_proof K.prf_block)
wenzelm@22117
   670
    (Scan.option Method.parse >> (fn m => Toplevel.print o
wenzelm@27563
   671
      Toplevel.actual_proof (ProofNode.applys (Proof.proof m)) o
wenzelm@27563
   672
      Toplevel.skip_proof (fn i => i + 1)));
wenzelm@5832
   673
wenzelm@5832
   674
wenzelm@6773
   675
(* calculational proof commands *)
wenzelm@6773
   676
wenzelm@6878
   677
val calc_args =
wenzelm@22117
   678
  Scan.option (P.$$$ "(" |-- P.!!! ((SpecParse.xthms1 --| P.$$$ ")")));
wenzelm@6878
   679
wenzelm@24868
   680
val _ =
wenzelm@17068
   681
  OuterSyntax.command "also" "combine calculation and current facts"
wenzelm@17068
   682
    (K.tag_proof K.prf_decl)
wenzelm@17900
   683
    (calc_args >> (Toplevel.proofs' o Calculation.also));
wenzelm@6773
   684
wenzelm@24868
   685
val _ =
wenzelm@17068
   686
  OuterSyntax.command "finally" "combine calculation and current facts, exhibit result"
wenzelm@17068
   687
    (K.tag_proof K.prf_chain)
wenzelm@22573
   688
    (calc_args >> (Toplevel.proofs' o Calculation.finally_));
wenzelm@6773
   689
wenzelm@24868
   690
val _ =
wenzelm@17068
   691
  OuterSyntax.command "moreover" "augment calculation by current facts"
wenzelm@17068
   692
    (K.tag_proof K.prf_decl)
wenzelm@17900
   693
    (Scan.succeed (Toplevel.proof' Calculation.moreover));
wenzelm@8562
   694
wenzelm@24868
   695
val _ =
wenzelm@8588
   696
  OuterSyntax.command "ultimately" "augment calculation by current facts, exhibit result"
wenzelm@17068
   697
    (K.tag_proof K.prf_chain)
wenzelm@17900
   698
    (Scan.succeed (Toplevel.proof' Calculation.ultimately));
wenzelm@8588
   699
wenzelm@6773
   700
wenzelm@6742
   701
(* proof navigation *)
wenzelm@5944
   702
wenzelm@24868
   703
val _ =
wenzelm@17068
   704
  OuterSyntax.command "back" "backtracking of proof command"
wenzelm@17068
   705
    (K.tag_proof K.prf_script)
wenzelm@27563
   706
    (Scan.succeed (Toplevel.print o Toplevel.actual_proof ProofNode.back o Toplevel.skip_proof I));
wenzelm@6742
   707
haftmann@22744
   708
wenzelm@27614
   709
(* nested commands *)
wenzelm@25578
   710
wenzelm@27719
   711
val props_text =
wenzelm@27719
   712
  Scan.optional P.properties [] -- P.position P.string >> (fn (props, (str, pos)) =>
wenzelm@27719
   713
    (Position.of_properties (Position.default_properties pos props), str));
wenzelm@27719
   714
wenzelm@25578
   715
val _ =
wenzelm@25578
   716
  OuterSyntax.improper_command "Isabelle.command" "nested Isabelle command" K.control
wenzelm@27719
   717
    (props_text :|-- (fn (pos, str) =>
wenzelm@27838
   718
      (case OuterSyntax.parse pos str of
wenzelm@27838
   719
        [tr] => Scan.succeed (K tr)
wenzelm@27838
   720
      | _ => Scan.fail_with (K "exactly one command expected"))
wenzelm@27838
   721
      handle ERROR msg => Scan.fail_with (K msg)));
wenzelm@25578
   722
wenzelm@25578
   723
wenzelm@27563
   724
(* global history commands *)
wenzelm@27525
   725
wenzelm@27525
   726
val _ =
wenzelm@27617
   727
  OuterSyntax.improper_command "Isar.command" "define command (Isar editor model)" K.control
wenzelm@27719
   728
    (props_text >> (fn (pos, str) =>
wenzelm@27827
   729
      Toplevel.no_timing o Toplevel.imperative (fn () =>
wenzelm@27838
   730
        ignore (Isar.create_command (OuterSyntax.prepare_command pos str)))));
wenzelm@27617
   731
wenzelm@27617
   732
val _ =
wenzelm@27617
   733
  OuterSyntax.improper_command "Isar.insert" "insert command (Isar editor model)" K.control
wenzelm@27617
   734
    (P.string -- P.string >> (fn (prev, id) =>
wenzelm@27617
   735
      Toplevel.no_timing o Toplevel.imperative (fn () => Isar.insert_command prev id)));
wenzelm@27617
   736
wenzelm@27617
   737
val _ =
wenzelm@27617
   738
  OuterSyntax.improper_command "Isar.remove" "remove command (Isar editor model)" K.control
wenzelm@27617
   739
    (P.string >> (fn id =>
wenzelm@27617
   740
      Toplevel.no_timing o Toplevel.imperative (fn () => Isar.remove_command id)));
wenzelm@27617
   741
wenzelm@27617
   742
val _ =
wenzelm@27534
   743
  OuterSyntax.improper_command "init_toplevel" "init toplevel point-of-interest" K.control
wenzelm@27531
   744
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative Isar.init_point));
wenzelm@27531
   745
wenzelm@27531
   746
val _ =
wenzelm@27534
   747
  OuterSyntax.improper_command "linear_undo" "undo commands" K.control
wenzelm@27529
   748
    (Scan.optional P.nat 1 >>
wenzelm@27529
   749
      (fn n => Toplevel.no_timing o Toplevel.imperative (fn () => Isar.linear_undo n)));
wenzelm@27529
   750
wenzelm@27529
   751
val _ =
wenzelm@27534
   752
  OuterSyntax.improper_command "undo" "undo commands (skipping closed proofs)" K.control
wenzelm@27525
   753
    (Scan.optional P.nat 1 >>
wenzelm@27525
   754
      (fn n => Toplevel.no_timing o Toplevel.imperative (fn () => Isar.undo n)));
wenzelm@27525
   755
wenzelm@27531
   756
val _ =
wenzelm@27534
   757
  OuterSyntax.improper_command "undos_proof" "undo commands (skipping closed proofs)" K.control
wenzelm@27534
   758
    (Scan.optional P.nat 1 >> (fn n => Toplevel.no_timing o
wenzelm@27534
   759
      Toplevel.keep (fn state =>
wenzelm@27534
   760
        if Toplevel.is_proof state then (Isar.undo n; Isar.print ()) else raise Toplevel.UNDEF)));
wenzelm@27534
   761
wenzelm@27534
   762
val _ =
wenzelm@27563
   763
  OuterSyntax.improper_command "cannot_undo" "partial undo -- Proof General legacy" K.control
wenzelm@27563
   764
    (P.name >>
wenzelm@27563
   765
      (fn "end" => Toplevel.no_timing o Toplevel.imperative (fn () => Isar.undo 1)
wenzelm@27563
   766
        | txt => Toplevel.imperative (fn () => error ("Cannot undo " ^ quote txt))));
wenzelm@27563
   767
wenzelm@27563
   768
val _ =
wenzelm@27534
   769
  OuterSyntax.improper_command "kill" "kill partial proof or theory development" K.control
wenzelm@27531
   770
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative Isar.kill));
wenzelm@27531
   771
wenzelm@27525
   772
haftmann@22744
   773
wenzelm@5832
   774
(** diagnostic commands (for interactive mode only) **)
wenzelm@5832
   775
wenzelm@8464
   776
val opt_modes = Scan.optional (P.$$$ "(" |-- P.!!! (Scan.repeat1 P.xname --| P.$$$ ")")) [];
wenzelm@20621
   777
val opt_bang = Scan.optional (P.$$$ "!" >> K true) false;
wenzelm@8464
   778
wenzelm@24868
   779
val _ =
wenzelm@7124
   780
  OuterSyntax.improper_command "pretty_setmargin" "change default margin for pretty printing"
wenzelm@9010
   781
    K.diag (P.nat >> (Toplevel.no_timing oo IsarCmd.pretty_setmargin));
wenzelm@7124
   782
wenzelm@24868
   783
val _ =
wenzelm@21714
   784
  OuterSyntax.improper_command "help" "print outer syntax commands" K.diag
wenzelm@24871
   785
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative OuterSyntax.print_outer_syntax));
wenzelm@21714
   786
wenzelm@24868
   787
val _ =
wenzelm@21714
   788
  OuterSyntax.improper_command "print_commands" "print outer syntax commands" K.diag
wenzelm@24871
   789
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative OuterSyntax.print_outer_syntax));
wenzelm@5832
   790
wenzelm@24868
   791
val _ =
wenzelm@24115
   792
  OuterSyntax.improper_command "print_configs" "print configuration options" K.diag
wenzelm@24115
   793
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_configs));
wenzelm@23989
   794
wenzelm@24868
   795
val _ =
wenzelm@7308
   796
  OuterSyntax.improper_command "print_context" "print theory context name" K.diag
wenzelm@9010
   797
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_context));
wenzelm@7308
   798
wenzelm@24868
   799
val _ =
wenzelm@6723
   800
  OuterSyntax.improper_command "print_theory" "print logical theory contents (verbose!)" K.diag
wenzelm@20621
   801
    (opt_bang >> (Toplevel.no_timing oo IsarCmd.print_theory));
wenzelm@5832
   802
wenzelm@24868
   803
val _ =
wenzelm@21726
   804
  OuterSyntax.improper_command "print_syntax" "print inner syntax of context (verbose!)" K.diag
wenzelm@9010
   805
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_syntax));
wenzelm@5832
   806
wenzelm@24868
   807
val _ =
wenzelm@21726
   808
  OuterSyntax.improper_command "print_abbrevs" "print constant abbreviation of context" K.diag
wenzelm@21726
   809
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_abbrevs));
wenzelm@21726
   810
wenzelm@24868
   811
val _ =
wenzelm@17068
   812
  OuterSyntax.improper_command "print_theorems"
wenzelm@17068
   813
      "print theorems of local theory or proof context" K.diag
wenzelm@9010
   814
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_theorems));
wenzelm@5881
   815
wenzelm@24868
   816
val _ =
wenzelm@12061
   817
  OuterSyntax.improper_command "print_locales" "print locales of this theory" K.diag
wenzelm@12061
   818
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_locales));
wenzelm@12061
   819
wenzelm@24868
   820
val _ =
haftmann@22744
   821
  OuterSyntax.improper_command "print_classes" "print classes of this theory" K.diag
haftmann@22744
   822
    (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory
haftmann@24219
   823
      o Toplevel.keep (Class.print_classes o Toplevel.theory_of)));
haftmann@22744
   824
wenzelm@24868
   825
val _ =
ballarin@15596
   826
  OuterSyntax.improper_command "print_locale" "print locale expression in this theory" K.diag
wenzelm@20621
   827
    (opt_bang -- locale_val >> (Toplevel.no_timing oo IsarCmd.print_locale));
wenzelm@12061
   828
wenzelm@24868
   829
val _ =
ballarin@15598
   830
  OuterSyntax.improper_command "print_interps"
ballarin@16102
   831
    "print interpretations of named locale" K.diag
wenzelm@18670
   832
    (Scan.optional (P.$$$ "!" >> K true) false -- P.xname
wenzelm@18670
   833
      >> (Toplevel.no_timing oo uncurry IsarCmd.print_registrations));
ballarin@15596
   834
wenzelm@24868
   835
val _ =
wenzelm@12061
   836
  OuterSyntax.improper_command "print_attributes" "print attributes of this theory" K.diag
wenzelm@9010
   837
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_attributes));
wenzelm@5832
   838
wenzelm@24868
   839
val _ =
wenzelm@16027
   840
  OuterSyntax.improper_command "print_simpset" "print context of Simplifier" K.diag
wenzelm@16027
   841
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_simpset));
wenzelm@16027
   842
wenzelm@24868
   843
val _ =
wenzelm@12383
   844
  OuterSyntax.improper_command "print_rules" "print intro/elim rules" K.diag
wenzelm@12383
   845
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_rules));
wenzelm@12383
   846
wenzelm@24868
   847
val _ =
wenzelm@11666
   848
  OuterSyntax.improper_command "print_trans_rules" "print transitivity rules" K.diag
wenzelm@9221
   849
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_trans_rules));
wenzelm@9221
   850
wenzelm@24868
   851
val _ =
wenzelm@12061
   852
  OuterSyntax.improper_command "print_methods" "print methods of this theory" K.diag
wenzelm@9010
   853
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_methods));
wenzelm@5832
   854
wenzelm@24868
   855
val _ =
wenzelm@9221
   856
  OuterSyntax.improper_command "print_antiquotations" "print antiquotations (global)" K.diag
wenzelm@9221
   857
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_antiquotations));
wenzelm@9221
   858
wenzelm@24868
   859
val _ =
haftmann@22485
   860
  OuterSyntax.improper_command "thy_deps" "visualize theory dependencies"
haftmann@22485
   861
    K.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.thy_deps));
haftmann@22485
   862
wenzelm@24868
   863
val _ =
wenzelm@20574
   864
  OuterSyntax.improper_command "class_deps" "visualize class dependencies"
wenzelm@20574
   865
    K.diag (Scan.succeed (Toplevel.no_timing o IsarCmd.class_deps));
wenzelm@20574
   866
wenzelm@24868
   867
val _ =
wenzelm@9454
   868
  OuterSyntax.improper_command "thm_deps" "visualize theorem dependencies"
wenzelm@22117
   869
    K.diag (SpecParse.xthms1 >> (Toplevel.no_timing oo IsarCmd.thm_deps));
wenzelm@9454
   870
wenzelm@22866
   871
local
wenzelm@22866
   872
wenzelm@16027
   873
val criterion =
wenzelm@16027
   874
  P.reserved "name" |-- P.!!! (P.$$$ ":" |-- P.xname) >> FindTheorems.Name ||
wenzelm@16027
   875
  P.reserved "intro" >> K FindTheorems.Intro ||
wenzelm@16027
   876
  P.reserved "elim" >> K FindTheorems.Elim ||
wenzelm@16027
   877
  P.reserved "dest" >> K FindTheorems.Dest ||
kleing@16074
   878
  P.reserved "simp" |-- P.!!! (P.$$$ ":" |-- P.term) >> FindTheorems.Simp ||
wenzelm@16027
   879
  P.term >> FindTheorems.Pattern;
wenzelm@16027
   880
wenzelm@22866
   881
val options =
wenzelm@22866
   882
  Scan.optional
wenzelm@22866
   883
    (P.$$$ "(" |--
wenzelm@22866
   884
      P.!!! (Scan.option P.nat -- Scan.optional (P.reserved "with_dups" >> K false) true
wenzelm@22866
   885
        --| P.$$$ ")")) (NONE, true);
wenzelm@22866
   886
in
wenzelm@22866
   887
wenzelm@24868
   888
val _ =
wenzelm@22866
   889
  OuterSyntax.improper_command "find_theorems" "print theorems meeting specified criteria" K.diag
wenzelm@22866
   890
    (options -- Scan.repeat (((Scan.option P.minus >> is_none) -- criterion))
wenzelm@17219
   891
      >> (Toplevel.no_timing oo IsarCmd.find_theorems));
wenzelm@17219
   892
wenzelm@22866
   893
end;
wenzelm@22866
   894
wenzelm@24868
   895
val _ =
wenzelm@6723
   896
  OuterSyntax.improper_command "print_binds" "print term bindings of proof context" K.diag
wenzelm@9010
   897
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_binds));
wenzelm@5832
   898
wenzelm@24868
   899
val _ =
wenzelm@8370
   900
  OuterSyntax.improper_command "print_facts" "print facts of proof context" K.diag
wenzelm@21004
   901
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_facts));
wenzelm@5832
   902
wenzelm@24868
   903
val _ =
wenzelm@8370
   904
  OuterSyntax.improper_command "print_cases" "print cases of proof context" K.diag
wenzelm@9010
   905
    (Scan.succeed (Toplevel.no_timing o IsarCmd.print_cases));
wenzelm@8370
   906
wenzelm@24868
   907
val _ =
wenzelm@19269
   908
  OuterSyntax.improper_command "print_statement" "print theorems as long statements" K.diag
wenzelm@22117
   909
    (opt_modes -- SpecParse.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_stmts));
wenzelm@19269
   910
wenzelm@24868
   911
val _ =
wenzelm@8464
   912
  OuterSyntax.improper_command "thm" "print theorems" K.diag
wenzelm@22117
   913
    (opt_modes -- SpecParse.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_thms));
wenzelm@5832
   914
wenzelm@24868
   915
val _ =
berghofe@11524
   916
  OuterSyntax.improper_command "prf" "print proof terms of theorems" K.diag
wenzelm@22866
   917
    (opt_modes -- Scan.option SpecParse.xthms1
wenzelm@22866
   918
      >> (Toplevel.no_timing oo IsarCmd.print_prfs false));
berghofe@11524
   919
wenzelm@24868
   920
val _ =
berghofe@11524
   921
  OuterSyntax.improper_command "full_prf" "print full proof terms of theorems" K.diag
wenzelm@22117
   922
    (opt_modes -- Scan.option SpecParse.xthms1 >> (Toplevel.no_timing oo IsarCmd.print_prfs true));
berghofe@11524
   923
wenzelm@24868
   924
val _ =
wenzelm@6723
   925
  OuterSyntax.improper_command "prop" "read and print proposition" K.diag
wenzelm@12876
   926
    (opt_modes -- P.term >> (Toplevel.no_timing oo IsarCmd.print_prop));
wenzelm@5832
   927
wenzelm@24868
   928
val _ =
wenzelm@6723
   929
  OuterSyntax.improper_command "term" "read and print term" K.diag
wenzelm@12876
   930
    (opt_modes -- P.term >> (Toplevel.no_timing oo IsarCmd.print_term));
wenzelm@5832
   931
wenzelm@24868
   932
val _ =
wenzelm@6723
   933
  OuterSyntax.improper_command "typ" "read and print type" K.diag
wenzelm@12876
   934
    (opt_modes -- P.typ >> (Toplevel.no_timing oo IsarCmd.print_type));
wenzelm@5832
   935
wenzelm@24868
   936
val _ =
haftmann@22744
   937
  OuterSyntax.improper_command "print_codesetup" "print code generator setup of this theory" K.diag
haftmann@22744
   938
    (Scan.succeed
haftmann@22744
   939
      (Toplevel.no_timing o Toplevel.unknown_theory o Toplevel.keep
haftmann@24219
   940
        (Code.print_codesetup o Toplevel.theory_of)));
wenzelm@5832
   941
berghofe@26184
   942
val _ =
berghofe@26184
   943
  OuterSyntax.improper_command "unused_thms" "find unused theorems" K.diag
berghofe@26184
   944
    (Scan.option ((Scan.repeat1 (Scan.unless P.minus P.name) --| P.minus) --
berghofe@26184
   945
       Scan.option (Scan.repeat1 (Scan.unless P.minus P.name))) >>
berghofe@26184
   946
         (Toplevel.no_timing oo IsarCmd.unused_thms));
berghofe@26184
   947
wenzelm@5832
   948
wenzelm@5832
   949
(** system commands (for interactive mode only) **)
wenzelm@5832
   950
wenzelm@24868
   951
val _ =
wenzelm@8650
   952
  OuterSyntax.improper_command "cd" "change current working directory" K.diag
wenzelm@14950
   953
    (P.path >> (Toplevel.no_timing oo IsarCmd.cd));
wenzelm@5832
   954
wenzelm@24868
   955
val _ =
wenzelm@6723
   956
  OuterSyntax.improper_command "pwd" "print current working directory" K.diag
wenzelm@9010
   957
    (Scan.succeed (Toplevel.no_timing o IsarCmd.pwd));
wenzelm@5832
   958
wenzelm@24868
   959
val _ =
wenzelm@6723
   960
  OuterSyntax.improper_command "use_thy" "use theory file" K.diag
wenzelm@26404
   961
    (P.name >> (fn name =>
wenzelm@26404
   962
      Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.use_thy name)));
wenzelm@5832
   963
wenzelm@24868
   964
val _ =
wenzelm@7102
   965
  OuterSyntax.improper_command "touch_thy" "outdate theory, including descendants" K.diag
wenzelm@27494
   966
    (P.name >> (fn name =>
wenzelm@27494
   967
      Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.touch_thy name)));
wenzelm@7908
   968
wenzelm@24868
   969
val _ =
wenzelm@7102
   970
  OuterSyntax.improper_command "remove_thy" "remove theory from loader database" K.diag
wenzelm@27494
   971
    (P.name >> (fn name =>
wenzelm@27494
   972
      Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.remove_thy name)));
wenzelm@7102
   973
wenzelm@24868
   974
val _ =
wenzelm@7931
   975
  OuterSyntax.improper_command "kill_thy" "kill theory -- try to remove from loader database"
wenzelm@27494
   976
    K.diag (P.name >> (fn name =>
wenzelm@27494
   977
      Toplevel.no_timing o Toplevel.imperative (fn () => ThyInfo.kill_thy name)));
wenzelm@7931
   978
wenzelm@24868
   979
val _ =
wenzelm@14934
   980
  OuterSyntax.improper_command "display_drafts" "display raw source files with symbols"
wenzelm@14950
   981
    K.diag (Scan.repeat1 P.path >> (Toplevel.no_timing oo IsarCmd.display_drafts));
wenzelm@14934
   982
wenzelm@24868
   983
val _ =
wenzelm@14934
   984
  OuterSyntax.improper_command "print_drafts" "print raw source files with symbols"
wenzelm@14950
   985
    K.diag (Scan.repeat1 P.path >> (Toplevel.no_timing oo IsarCmd.print_drafts));
wenzelm@14934
   986
wenzelm@9731
   987
val opt_limits =
wenzelm@9731
   988
  Scan.option P.nat -- Scan.option (P.$$$ "," |-- P.!!! P.nat);
wenzelm@9731
   989
wenzelm@24868
   990
val _ =
wenzelm@8886
   991
  OuterSyntax.improper_command "pr" "print current proof state (if present)" K.diag
wenzelm@9731
   992
    (opt_modes -- opt_limits >> (Toplevel.no_timing oo IsarCmd.pr));
wenzelm@7199
   993
wenzelm@24868
   994
val _ =
wenzelm@7222
   995
  OuterSyntax.improper_command "disable_pr" "disable printing of toplevel state" K.diag
wenzelm@9010
   996
    (Scan.succeed (Toplevel.no_timing o IsarCmd.disable_pr));
wenzelm@5832
   997
wenzelm@24868
   998
val _ =
wenzelm@7222
   999
  OuterSyntax.improper_command "enable_pr" "enable printing of toplevel state" K.diag
wenzelm@9010
  1000
    (Scan.succeed (Toplevel.no_timing o IsarCmd.enable_pr));
wenzelm@7222
  1001
wenzelm@24868
  1002
val _ =
wenzelm@6723
  1003
  OuterSyntax.improper_command "commit" "commit current session to ML database" K.diag
wenzelm@26490
  1004
    (P.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit));
wenzelm@5832
  1005
wenzelm@24868
  1006
val _ =
wenzelm@6723
  1007
  OuterSyntax.improper_command "quit" "quit Isabelle" K.control
wenzelm@9010
  1008
    (P.opt_unit >> (Toplevel.no_timing oo K IsarCmd.quit));
wenzelm@5832
  1009
wenzelm@24868
  1010
val _ =
wenzelm@6723
  1011
  OuterSyntax.improper_command "exit" "exit Isar loop" K.control
wenzelm@9010
  1012
    (Scan.succeed (Toplevel.no_timing o IsarCmd.exit));
wenzelm@5832
  1013
wenzelm@24868
  1014
val _ =
wenzelm@8678
  1015
  OuterSyntax.improper_command "welcome" "print welcome message" K.diag
wenzelm@9010
  1016
    (Scan.succeed (Toplevel.no_timing o IsarCmd.welcome));
wenzelm@7462
  1017
wenzelm@5832
  1018
end;
wenzelm@27614
  1019