src/Pure/Isar/method.ML
author wenzelm
Wed Jan 05 11:43:37 2000 +0100 (2000-01-05)
changeset 8093 d5eb246c94ec
parent 7664 c151ac595551
child 8153 9bdbcb71dc56
permissions -rw-r--r--
added thms_ctxt_args;
wenzelm@5824
     1
(*  Title:      Pure/Isar/method.ML
wenzelm@5824
     2
    ID:         $Id$
wenzelm@5824
     3
    Author:     Markus Wenzel, TU Muenchen
wenzelm@5824
     4
wenzelm@5824
     5
Proof methods.
wenzelm@5824
     6
*)
wenzelm@5824
     7
wenzelm@5824
     8
signature BASIC_METHOD =
wenzelm@5824
     9
sig
wenzelm@5824
    10
  val print_methods: theory -> unit
wenzelm@5824
    11
  val Method: bstring -> (Args.src -> Proof.context -> Proof.method) -> string -> unit
wenzelm@5824
    12
end;
wenzelm@5824
    13
wenzelm@5824
    14
signature METHOD =
wenzelm@5824
    15
sig
wenzelm@5824
    16
  include BASIC_METHOD
wenzelm@6091
    17
  val METHOD: (thm list -> tactic) -> Proof.method
wenzelm@5824
    18
  val METHOD0: tactic -> Proof.method
wenzelm@5824
    19
  val fail: Proof.method
wenzelm@5824
    20
  val succeed: Proof.method
wenzelm@7419
    21
  val insert_tac: thm list -> int -> tactic
wenzelm@7574
    22
  val insert: thm list -> Proof.method
wenzelm@7555
    23
  val insert_facts: Proof.method
wenzelm@7601
    24
  val unfold: thm list -> Proof.method
wenzelm@7419
    25
  val fold: thm list -> Proof.method
wenzelm@7419
    26
  val multi_resolve: thm list -> thm -> thm Seq.seq
wenzelm@7419
    27
  val multi_resolves: thm list -> thm list -> thm Seq.seq
wenzelm@6091
    28
  val rule_tac: thm list -> thm list -> int -> tactic
wenzelm@7130
    29
  val erule_tac: thm list -> thm list -> int -> tactic
wenzelm@6091
    30
  val rule: thm list -> Proof.method
wenzelm@7130
    31
  val erule: thm list -> Proof.method
wenzelm@7555
    32
  val assumption: Proof.context -> Proof.method
wenzelm@5916
    33
  exception METHOD_FAIL of (string * Position.T) * exn
wenzelm@7611
    34
  val help_methods: theory option -> unit
wenzelm@5824
    35
  val method: theory -> Args.src -> Proof.context -> Proof.method
wenzelm@5824
    36
  val add_methods: (bstring * (Args.src -> Proof.context -> Proof.method) * string) list
wenzelm@5824
    37
    -> theory -> theory
wenzelm@5884
    38
  val syntax: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) ->
wenzelm@5884
    39
    Proof.context -> Args.src -> Proof.context * 'a
wenzelm@7555
    40
  val ctxt_args: (Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method
wenzelm@5884
    41
  val no_args: Proof.method -> Args.src -> Proof.context -> Proof.method
wenzelm@7268
    42
  type modifier
wenzelm@7601
    43
  val sectioned_args: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) ->
wenzelm@7268
    44
    (Args.T list -> modifier * Args.T list) list ->
wenzelm@5884
    45
    ('a -> Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method
wenzelm@7601
    46
  val bang_sectioned_args:
wenzelm@7601
    47
    (Args.T list -> modifier * Args.T list) list ->
wenzelm@7555
    48
    (thm list -> Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method
wenzelm@7601
    49
  val only_sectioned_args:
wenzelm@7601
    50
    (Args.T list -> modifier * Args.T list) list ->
wenzelm@5884
    51
    (Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method
wenzelm@8093
    52
  val thms_ctxt_args: (thm list -> Proof.context -> Proof.method)
wenzelm@8093
    53
    -> Args.src -> Proof.context -> Proof.method
wenzelm@6091
    54
  val thms_args: (thm list -> Proof.method) -> Args.src -> Proof.context -> Proof.method
wenzelm@5824
    55
  datatype text =
wenzelm@5824
    56
    Basic of (Proof.context -> Proof.method) |
wenzelm@5824
    57
    Source of Args.src |
wenzelm@5824
    58
    Then of text list |
wenzelm@5824
    59
    Orelse of text list |
wenzelm@5824
    60
    Try of text |
wenzelm@5824
    61
    Repeat1 of text
wenzelm@5824
    62
  val refine: text -> Proof.state -> Proof.state Seq.seq
wenzelm@7506
    63
  val refine_no_facts: text -> Proof.state -> Proof.state Seq.seq
wenzelm@5824
    64
  val proof: text option -> Proof.state -> Proof.state Seq.seq
wenzelm@6981
    65
  val local_qed: text option
wenzelm@6981
    66
    -> ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
wenzelm@6736
    67
    -> Proof.state -> Proof.state Seq.seq
wenzelm@6981
    68
  val local_terminal_proof: text * text option
wenzelm@6981
    69
    -> ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
wenzelm@6736
    70
    -> Proof.state -> Proof.state Seq.seq
wenzelm@6981
    71
  val local_immediate_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
wenzelm@6981
    72
    -> Proof.state -> Proof.state Seq.seq
wenzelm@6981
    73
  val local_default_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
wenzelm@6736
    74
    -> Proof.state -> Proof.state Seq.seq
wenzelm@6951
    75
  val global_qed: text option -> Proof.state -> theory * {kind: string, name: string, thm: thm}
wenzelm@6934
    76
  val global_terminal_proof: text * text option
wenzelm@6934
    77
    -> Proof.state -> theory * {kind: string, name: string, thm: thm}
wenzelm@6532
    78
  val global_immediate_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
wenzelm@6532
    79
  val global_default_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
wenzelm@5824
    80
  val setup: (theory -> theory) list
wenzelm@5824
    81
end;
wenzelm@5824
    82
wenzelm@5824
    83
structure Method: METHOD =
wenzelm@5824
    84
struct
wenzelm@5824
    85
wenzelm@5824
    86
wenzelm@5824
    87
(** proof methods **)
wenzelm@5824
    88
wenzelm@5824
    89
(* method from tactic *)
wenzelm@5824
    90
wenzelm@6849
    91
val METHOD = Proof.method;
wenzelm@5824
    92
fun METHOD0 tac = METHOD (fn [] => tac | _ => error "Method may not be used with facts");
wenzelm@5824
    93
wenzelm@5824
    94
wenzelm@5824
    95
(* primitive *)
wenzelm@5824
    96
wenzelm@5824
    97
val fail = METHOD (K no_tac);
wenzelm@5824
    98
val succeed = METHOD (K all_tac);
wenzelm@5824
    99
wenzelm@5824
   100
wenzelm@7419
   101
(* insert *)
wenzelm@7419
   102
wenzelm@7419
   103
local
wenzelm@5824
   104
wenzelm@6981
   105
fun cut_rule_tac raw_rule =
wenzelm@6981
   106
  let
wenzelm@6981
   107
    val rule = Drule.forall_intr_vars raw_rule;
wenzelm@6981
   108
    val revcut_rl = Drule.incr_indexes_wrt [] [] [] [rule] Drule.revcut_rl;
wenzelm@7555
   109
  in Tactic.rtac (rule COMP revcut_rl) end;
wenzelm@6981
   110
wenzelm@7419
   111
in
wenzelm@5824
   112
wenzelm@7419
   113
fun insert_tac [] i = all_tac
wenzelm@7419
   114
  | insert_tac facts i = EVERY (map (fn th => cut_rule_tac th i) facts);
wenzelm@6981
   115
wenzelm@7555
   116
val insert_facts = METHOD (ALLGOALS o insert_tac);
wenzelm@7664
   117
fun insert thms = METHOD (fn _ => ALLGOALS (insert_tac thms));
wenzelm@7419
   118
wenzelm@7419
   119
end;
wenzelm@5824
   120
wenzelm@5824
   121
wenzelm@7601
   122
(* unfold / fold definitions *)
wenzelm@6532
   123
wenzelm@7601
   124
fun unfold thms = METHOD (fn facts => ALLGOALS (insert_tac facts) THEN rewrite_goals_tac thms);
wenzelm@7555
   125
fun fold thms = METHOD (fn facts => ALLGOALS (insert_tac facts) THEN fold_goals_tac thms);
wenzelm@6532
   126
wenzelm@6532
   127
wenzelm@7419
   128
(* multi_resolve *)
wenzelm@7419
   129
wenzelm@7419
   130
local
wenzelm@7419
   131
wenzelm@7419
   132
fun res th i rule =
wenzelm@7419
   133
  Thm.biresolution false [(false, th)] i rule handle THM _ => Seq.empty;
wenzelm@7419
   134
wenzelm@7419
   135
fun multi_res _ [] rule = Seq.single rule
wenzelm@7419
   136
  | multi_res i (th :: ths) rule = Seq.flat (Seq.map (res th i) (multi_res (i + 1) ths rule));
wenzelm@7419
   137
wenzelm@7419
   138
in
wenzelm@7419
   139
wenzelm@7419
   140
val multi_resolve = multi_res 1;
wenzelm@7419
   141
fun multi_resolves facts rules = Seq.flat (Seq.map (multi_resolve facts) (Seq.of_list rules));
wenzelm@7419
   142
wenzelm@7419
   143
end;
wenzelm@7419
   144
wenzelm@7419
   145
wenzelm@5824
   146
(* rule *)
wenzelm@5824
   147
wenzelm@7419
   148
local
wenzelm@5824
   149
wenzelm@7130
   150
fun gen_rule_tac tac rules [] = tac rules
wenzelm@7130
   151
  | gen_rule_tac tac erules facts =
wenzelm@5824
   152
      let
wenzelm@7419
   153
        val rules = multi_resolves facts erules;
wenzelm@7130
   154
        fun tactic i state = Seq.flat (Seq.map (fn rule => tac [rule] i state) rules);
wenzelm@7130
   155
      in tactic end;
wenzelm@7130
   156
wenzelm@7419
   157
in
wenzelm@7419
   158
wenzelm@7130
   159
val rule_tac = gen_rule_tac Tactic.resolve_tac;
wenzelm@7130
   160
val erule_tac = gen_rule_tac Tactic.eresolve_tac;
wenzelm@5824
   161
wenzelm@5824
   162
fun rule rules = METHOD (FIRSTGOAL o rule_tac rules);
wenzelm@7130
   163
fun erule rules = METHOD (FIRSTGOAL o erule_tac rules);
wenzelm@5824
   164
wenzelm@7419
   165
end;
wenzelm@7419
   166
wenzelm@7419
   167
wenzelm@7555
   168
(* assumption / finish *)
wenzelm@7555
   169
wenzelm@7555
   170
fun assm_tac ctxt =
wenzelm@7555
   171
  assume_tac APPEND' resolve_tac (filter Thm.no_prems (ProofContext.prems_of ctxt));
wenzelm@7419
   172
wenzelm@7555
   173
fun assumption_tac ctxt [] = assm_tac ctxt
wenzelm@7555
   174
  | assumption_tac _ [fact] = resolve_tac [fact]
wenzelm@7555
   175
  | assumption_tac _ _ = K no_tac;
wenzelm@7419
   176
wenzelm@7555
   177
fun assumption ctxt = METHOD (FIRSTGOAL o assumption_tac ctxt);
wenzelm@7555
   178
fun finish ctxt = METHOD (K (FILTER Thm.no_prems (ALLGOALS (assm_tac ctxt))));
wenzelm@7419
   179
wenzelm@7419
   180
wenzelm@5824
   181
wenzelm@5824
   182
(** methods theory data **)
wenzelm@5824
   183
wenzelm@5824
   184
(* data kind 'Isar/methods' *)
wenzelm@5824
   185
wenzelm@5824
   186
structure MethodsDataArgs =
wenzelm@5824
   187
struct
wenzelm@5824
   188
  val name = "Isar/methods";
wenzelm@5824
   189
  type T =
wenzelm@5824
   190
    {space: NameSpace.T,
wenzelm@5824
   191
     meths: (((Args.src -> Proof.context -> Proof.method) * string) * stamp) Symtab.table};
wenzelm@5824
   192
wenzelm@5824
   193
  val empty = {space = NameSpace.empty, meths = Symtab.empty};
wenzelm@6546
   194
  val copy = I;
wenzelm@5824
   195
  val prep_ext = I;
wenzelm@5824
   196
  fun merge ({space = space1, meths = meths1}, {space = space2, meths = meths2}) =
wenzelm@5824
   197
    {space = NameSpace.merge (space1, space2),
wenzelm@5824
   198
      meths = Symtab.merge eq_snd (meths1, meths2) handle Symtab.DUPS dups =>
wenzelm@5824
   199
        error ("Attempt to merge different versions of methods " ^ commas_quote dups)};
wenzelm@5824
   200
wenzelm@7367
   201
  fun print_meths verbose {space, meths} =
wenzelm@5824
   202
    let
wenzelm@5824
   203
      fun prt_meth (name, ((_, comment), _)) = Pretty.block
wenzelm@6849
   204
        [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment];
wenzelm@5824
   205
    in
wenzelm@7367
   206
      if not verbose then ()
wenzelm@7367
   207
      else Pretty.writeln (Display.pretty_name_space ("method name space", space));
wenzelm@6849
   208
      Pretty.writeln (Pretty.big_list "methods:"
wenzelm@6849
   209
        (map prt_meth (NameSpace.cond_extern_table space meths)))
wenzelm@5824
   210
    end;
wenzelm@7367
   211
wenzelm@7367
   212
  fun print _ = print_meths true;
wenzelm@5824
   213
end;
wenzelm@5824
   214
wenzelm@5824
   215
structure MethodsData = TheoryDataFun(MethodsDataArgs);
wenzelm@5824
   216
val print_methods = MethodsData.print;
wenzelm@7611
   217
wenzelm@7611
   218
fun help_methods None = writeln "methods: (unkown theory context)"
wenzelm@7611
   219
  | help_methods (Some thy) = MethodsDataArgs.print_meths false (MethodsData.get thy);
wenzelm@5824
   220
wenzelm@5824
   221
wenzelm@5824
   222
(* get methods *)
wenzelm@5824
   223
wenzelm@5916
   224
exception METHOD_FAIL of (string * Position.T) * exn;
wenzelm@5916
   225
wenzelm@5824
   226
fun method thy =
wenzelm@5824
   227
  let
wenzelm@5824
   228
    val {space, meths} = MethodsData.get thy;
wenzelm@5824
   229
wenzelm@5884
   230
    fun meth src =
wenzelm@5884
   231
      let
wenzelm@5884
   232
        val ((raw_name, _), pos) = Args.dest_src src;
wenzelm@5884
   233
        val name = NameSpace.intern space raw_name;
wenzelm@5884
   234
      in
wenzelm@5824
   235
        (case Symtab.lookup (meths, name) of
wenzelm@5824
   236
          None => error ("Unknown proof method: " ^ quote name ^ Position.str_of pos)
wenzelm@5916
   237
        | Some ((mth, _), _) => transform_failure (curry METHOD_FAIL (name, pos)) (mth src))
wenzelm@5824
   238
      end;
wenzelm@5824
   239
  in meth end;
wenzelm@5824
   240
wenzelm@5824
   241
wenzelm@5824
   242
(* add_methods *)
wenzelm@5824
   243
wenzelm@5824
   244
fun add_methods raw_meths thy =
wenzelm@5824
   245
  let
wenzelm@5824
   246
    val full = Sign.full_name (Theory.sign_of thy);
wenzelm@5824
   247
    val new_meths =
wenzelm@5824
   248
      map (fn (name, f, comment) => (full name, ((f, comment), stamp ()))) raw_meths;
wenzelm@5824
   249
wenzelm@5824
   250
    val {space, meths} = MethodsData.get thy;
wenzelm@5824
   251
    val space' = NameSpace.extend (space, map fst new_meths);
wenzelm@5824
   252
    val meths' = Symtab.extend (meths, new_meths) handle Symtab.DUPS dups =>
wenzelm@5824
   253
      error ("Duplicate declaration of method(s) " ^ commas_quote dups);
wenzelm@5824
   254
  in
wenzelm@5824
   255
    thy |> MethodsData.put {space = space', meths = meths'}
wenzelm@5824
   256
  end;
wenzelm@5824
   257
wenzelm@5824
   258
(*implicit version*)
wenzelm@5824
   259
fun Method name meth cmt = Context.>> (add_methods [(name, meth, cmt)]);
wenzelm@5824
   260
wenzelm@5824
   261
wenzelm@5884
   262
wenzelm@5884
   263
(** method syntax **)
wenzelm@5824
   264
wenzelm@5884
   265
(* basic *)
wenzelm@5884
   266
wenzelm@5884
   267
fun syntax (scan: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list))) =
wenzelm@5884
   268
  Args.syntax "method" scan;
wenzelm@5824
   269
wenzelm@7555
   270
fun ctxt_args (f: Proof.context -> Proof.method) src ctxt =
wenzelm@7555
   271
  #2 (syntax (Scan.succeed (f ctxt)) ctxt src);
wenzelm@7555
   272
wenzelm@7555
   273
fun no_args m = ctxt_args (K m);
wenzelm@5884
   274
wenzelm@5884
   275
wenzelm@5884
   276
(* sections *)
wenzelm@5824
   277
wenzelm@7268
   278
type modifier = (Proof.context -> Proof.context) * Proof.context attribute;
wenzelm@7268
   279
wenzelm@7268
   280
local
wenzelm@7268
   281
wenzelm@5884
   282
fun sect ss = Scan.first (map (fn s => Scan.lift (s --| Args.$$$ ":")) ss);
wenzelm@5884
   283
fun thms ss = Scan.unless (sect ss) Attrib.local_thms;
wenzelm@5884
   284
fun thmss ss = Scan.repeat (thms ss) >> flat;
wenzelm@5884
   285
wenzelm@7268
   286
fun apply (f, att) (ctxt, ths) = Thm.applys_attributes ((f ctxt, ths), [att]);
wenzelm@5824
   287
wenzelm@7268
   288
fun section ss = (sect ss -- thmss ss) :-- (fn (m, ths) => Scan.depend (fn ctxt =>
wenzelm@7268
   289
  Scan.succeed (apply m (ctxt, ths)))) >> #2;
wenzelm@5884
   290
wenzelm@7601
   291
fun sectioned args ss = args -- Scan.repeat (section ss);
wenzelm@5884
   292
wenzelm@7268
   293
in
wenzelm@5824
   294
wenzelm@5884
   295
fun sectioned_args args ss f src ctxt =
wenzelm@5921
   296
  let val (ctxt', (x, _)) = syntax (sectioned args ss) ctxt src
wenzelm@5921
   297
  in f x ctxt' end;
wenzelm@5884
   298
wenzelm@7601
   299
fun bang_sectioned_args ss f = sectioned_args Args.bang_facts ss f;
wenzelm@7601
   300
fun only_sectioned_args ss f = sectioned_args (Scan.succeed ()) ss (fn () => f);
wenzelm@7268
   301
wenzelm@8093
   302
fun thms_ctxt_args f = sectioned_args (thmss []) [] f;
wenzelm@8093
   303
fun thms_args f = thms_ctxt_args (K o f);
wenzelm@5824
   304
wenzelm@7268
   305
end;
wenzelm@7268
   306
wenzelm@5824
   307
wenzelm@5824
   308
wenzelm@5824
   309
(** method text **)
wenzelm@5824
   310
wenzelm@5824
   311
(* datatype text *)
wenzelm@5824
   312
wenzelm@5824
   313
datatype text =
wenzelm@5824
   314
  Basic of (Proof.context -> Proof.method) |
wenzelm@5824
   315
  Source of Args.src |
wenzelm@5824
   316
  Then of text list |
wenzelm@5824
   317
  Orelse of text list |
wenzelm@5824
   318
  Try of text |
wenzelm@5824
   319
  Repeat1 of text;
wenzelm@5824
   320
wenzelm@5824
   321
wenzelm@5824
   322
(* refine *)
wenzelm@5824
   323
wenzelm@5824
   324
fun refine text state =
wenzelm@5824
   325
  let
wenzelm@5824
   326
    val thy = Proof.theory_of state;
wenzelm@5824
   327
wenzelm@5824
   328
    fun eval (Basic mth) = Proof.refine mth
wenzelm@5824
   329
      | eval (Source src) = Proof.refine (method thy src)
wenzelm@5824
   330
      | eval (Then txts) = Seq.EVERY (map eval txts)
wenzelm@5824
   331
      | eval (Orelse txts) = Seq.FIRST (map eval txts)
wenzelm@5824
   332
      | eval (Try txt) = Seq.TRY (eval txt)
wenzelm@5824
   333
      | eval (Repeat1 txt) = Seq.REPEAT1 (eval txt);
wenzelm@5824
   334
  in eval text state end;
wenzelm@5824
   335
wenzelm@7506
   336
fun refine_no_facts text state =
wenzelm@7506
   337
  state
wenzelm@7506
   338
  |> Proof.goal_facts (K [])
wenzelm@7506
   339
  |> refine text;
wenzelm@6404
   340
wenzelm@5824
   341
wenzelm@6404
   342
(* structured proof steps *)
wenzelm@5824
   343
wenzelm@7506
   344
val default_text = Source (Args.src (("default", []), Position.none));
wenzelm@7555
   345
wenzelm@7555
   346
fun finish_text None = Basic finish
wenzelm@7555
   347
  | finish_text (Some txt) = Then [txt, Basic finish];
wenzelm@6872
   348
wenzelm@5824
   349
fun proof opt_text state =
wenzelm@5824
   350
  state
wenzelm@5824
   351
  |> Proof.assert_backward
wenzelm@6404
   352
  |> refine (if_none opt_text default_text)
wenzelm@5824
   353
  |> Seq.map Proof.enter_forward;
wenzelm@5824
   354
wenzelm@7439
   355
fun local_qed opt_text = Proof.local_qed (refine (finish_text opt_text));
wenzelm@6934
   356
fun local_terminal_proof (text, opt_text) pr = Seq.THEN (proof (Some text), local_qed opt_text pr);
wenzelm@7555
   357
val local_immediate_proof = local_terminal_proof (Basic assumption, None);
wenzelm@6934
   358
val local_default_proof = local_terminal_proof (default_text, None);
wenzelm@5824
   359
wenzelm@6872
   360
wenzelm@7439
   361
fun global_qeds opt_text = Proof.global_qed (refine (finish_text opt_text));
wenzelm@5824
   362
wenzelm@6951
   363
fun global_qed opt_text state =
wenzelm@6872
   364
  state
wenzelm@6951
   365
  |> global_qeds opt_text
wenzelm@6872
   366
  |> Proof.check_result "Failed to finish proof" state
wenzelm@6872
   367
  |> Seq.hd;
wenzelm@6872
   368
wenzelm@6934
   369
fun global_terminal_proof (text, opt_text) state =
wenzelm@6872
   370
  state
wenzelm@6872
   371
  |> proof (Some text)
wenzelm@6872
   372
  |> Proof.check_result "Terminal proof method failed" state
wenzelm@6951
   373
  |> (Seq.flat o Seq.map (global_qeds opt_text))
wenzelm@6872
   374
  |> Proof.check_result "Failed to finish proof (after successful terminal method)" state
wenzelm@6872
   375
  |> Seq.hd;
wenzelm@6872
   376
wenzelm@7555
   377
val global_immediate_proof = global_terminal_proof (Basic assumption, None);
wenzelm@6934
   378
val global_default_proof = global_terminal_proof (default_text, None);
wenzelm@5824
   379
wenzelm@5824
   380
wenzelm@5824
   381
wenzelm@5824
   382
(** theory setup **)
wenzelm@5824
   383
wenzelm@5824
   384
(* pure_methods *)
wenzelm@5824
   385
wenzelm@5824
   386
val pure_methods =
wenzelm@5824
   387
 [("fail", no_args fail, "force failure"),
wenzelm@5824
   388
  ("succeed", no_args succeed, "succeed"),
wenzelm@7574
   389
  ("-", no_args insert_facts, "do nothing, inserting current facts only"),
wenzelm@7664
   390
  ("insert", thms_args insert, "insert theorems, ignoring facts (improper!)"),
wenzelm@7601
   391
  ("unfold", thms_args unfold, "unfold definitions"),
wenzelm@7601
   392
  ("fold", thms_args fold, "fold definitions"),
wenzelm@7130
   393
  ("rule", thms_args rule, "apply some rule"),
wenzelm@7419
   394
  ("erule", thms_args erule, "apply some erule (improper!)"),
wenzelm@7555
   395
  ("assumption", ctxt_args assumption, "proof by assumption, preferring facts")];
wenzelm@5824
   396
wenzelm@5824
   397
wenzelm@5824
   398
(* setup *)
wenzelm@5824
   399
wenzelm@5824
   400
val setup = [MethodsData.init, add_methods pure_methods];
wenzelm@5824
   401
wenzelm@5824
   402
wenzelm@5824
   403
end;
wenzelm@5824
   404
wenzelm@5824
   405
wenzelm@5824
   406
structure BasicMethod: BASIC_METHOD = Method;
wenzelm@5824
   407
open BasicMethod;