src/HOL/Tools/meson.ML
author wenzelm
Tue Sep 05 21:06:01 2000 +0200 (2000-09-05)
changeset 9869 95dca9f991f2
parent 9840 9dfcb0224f8c
child 10821 dcb75538f542
permissions -rw-r--r--
improved meson setup;
wenzelm@9869
     1
(*  Title:      HOL/Tools/meson.ML
paulson@9840
     2
    ID:         $Id$
paulson@9840
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@9840
     4
    Copyright   1992  University of Cambridge
paulson@9840
     5
wenzelm@9869
     6
The MESON resolution proof procedure for HOL.
paulson@9840
     7
paulson@9840
     8
When making clauses, avoids using the rewriter -- instead uses RS recursively
paulson@9840
     9
paulson@9840
    10
NEED TO SORT LITERALS BY # OF VARS, USING ==>I/E.  ELIMINATES NEED FOR
paulson@9840
    11
FUNCTION nodups -- if done to goal clauses too!
paulson@9840
    12
*)
paulson@9840
    13
paulson@9840
    14
local
paulson@9840
    15
paulson@9840
    16
 (*Prove theorems using fast_tac*)
wenzelm@9869
    17
 fun prove_fun s =
paulson@9840
    18
     prove_goal (the_context ()) s
wenzelm@9869
    19
          (fn prems => [ cut_facts_tac prems 1, Fast_tac 1 ]);
paulson@9840
    20
paulson@9840
    21
 (**** Negation Normal Form ****)
paulson@9840
    22
paulson@9840
    23
 (*** de Morgan laws ***)
paulson@9840
    24
paulson@9840
    25
 val not_conjD = prove_fun "~(P&Q) ==> ~P | ~Q";
paulson@9840
    26
 val not_disjD = prove_fun "~(P|Q) ==> ~P & ~Q";
paulson@9840
    27
 val not_notD = prove_fun "~~P ==> P";
paulson@9840
    28
 val not_allD = prove_fun  "~(ALL x. P(x)) ==> EX x. ~P(x)";
paulson@9840
    29
 val not_exD = prove_fun   "~(EX x. P(x)) ==> ALL x. ~P(x)";
paulson@9840
    30
paulson@9840
    31
paulson@9840
    32
 (*** Removal of --> and <-> (positive and negative occurrences) ***)
paulson@9840
    33
paulson@9840
    34
 val imp_to_disjD = prove_fun "P-->Q ==> ~P | Q";
paulson@9840
    35
 val not_impD = prove_fun   "~(P-->Q) ==> P & ~Q";
paulson@9840
    36
paulson@9840
    37
 val iff_to_disjD = prove_fun "P=Q ==> (~P | Q) & (~Q | P)";
paulson@9840
    38
paulson@9840
    39
 (*Much more efficient than (P & ~Q) | (Q & ~P) for computing CNF*)
paulson@9840
    40
 val not_iffD = prove_fun "~(P=Q) ==> (P | Q) & (~P | ~Q)";
paulson@9840
    41
paulson@9840
    42
paulson@9840
    43
 (**** Pulling out the existential quantifiers ****)
paulson@9840
    44
paulson@9840
    45
 (*** Conjunction ***)
paulson@9840
    46
paulson@9840
    47
 val conj_exD1 = prove_fun "(EX x. P(x)) & Q ==> EX x. P(x) & Q";
paulson@9840
    48
 val conj_exD2 = prove_fun "P & (EX x. Q(x)) ==> EX x. P & Q(x)";
paulson@9840
    49
paulson@9840
    50
 (*** Disjunction ***)
paulson@9840
    51
paulson@9840
    52
 (*DO NOT USE with forall-Skolemization: makes fewer schematic variables!!
paulson@9840
    53
   With ex-Skolemization, makes fewer Skolem constants*)
paulson@9840
    54
 val disj_exD = prove_fun "(EX x. P(x)) | (EX x. Q(x)) ==> EX x. P(x) | Q(x)";
paulson@9840
    55
paulson@9840
    56
 val disj_exD1 = prove_fun "(EX x. P(x)) | Q ==> EX x. P(x) | Q";
paulson@9840
    57
 val disj_exD2 = prove_fun "P | (EX x. Q(x)) ==> EX x. P | Q(x)";
paulson@9840
    58
paulson@9840
    59
paulson@9840
    60
paulson@9840
    61
 (***** Generating clauses for the Meson Proof Procedure *****)
paulson@9840
    62
paulson@9840
    63
 (*** Disjunctions ***)
paulson@9840
    64
paulson@9840
    65
 val disj_assoc = prove_fun "(P|Q)|R ==> P|(Q|R)";
paulson@9840
    66
paulson@9840
    67
 val disj_comm = prove_fun "P|Q ==> Q|P";
paulson@9840
    68
paulson@9840
    69
 val disj_FalseD1 = prove_fun "False|P ==> P";
paulson@9840
    70
 val disj_FalseD2 = prove_fun "P|False ==> P";
paulson@9840
    71
paulson@9840
    72
paulson@9840
    73
 (**** Operators for forward proof ****)
paulson@9840
    74
paulson@9840
    75
 (*raises exception if no rules apply -- unlike RL*)
paulson@9840
    76
 fun tryres (th, rl::rls) = (th RS rl handle THM _ => tryres(th,rls))
paulson@9840
    77
   | tryres (th, []) = raise THM("tryres", 0, [th]);
paulson@9840
    78
paulson@9840
    79
 val prop_of = #prop o rep_thm;
paulson@9840
    80
paulson@9840
    81
 (*Permits forward proof from rules that discharge assumptions*)
paulson@9840
    82
 fun forward_res nf st =
paulson@9840
    83
   case Seq.pull (ALLGOALS (METAHYPS (fn [prem] => rtac (nf prem) 1)) st)
paulson@9840
    84
   of Some(th,_) => th
paulson@9840
    85
    | None => raise THM("forward_res", 0, [st]);
paulson@9840
    86
paulson@9840
    87
paulson@9840
    88
 (*Are any of the constants in "bs" present in the term?*)
wenzelm@9869
    89
 fun has_consts bs =
paulson@9840
    90
   let fun has (Const(a,_)) = a mem bs
wenzelm@9869
    91
         | has (f$u) = has f orelse has u
wenzelm@9869
    92
         | has (Abs(_,_,t)) = has t
wenzelm@9869
    93
         | has _ = false
paulson@9840
    94
   in  has  end;
paulson@9840
    95
paulson@9840
    96
paulson@9840
    97
 (**** Clause handling ****)
paulson@9840
    98
paulson@9840
    99
 fun literals (Const("Trueprop",_) $ P) = literals P
paulson@9840
   100
   | literals (Const("op |",_) $ P $ Q) = literals P @ literals Q
paulson@9840
   101
   | literals (Const("Not",_) $ P) = [(false,P)]
paulson@9840
   102
   | literals P = [(true,P)];
paulson@9840
   103
paulson@9840
   104
 (*number of literals in a term*)
paulson@9840
   105
 val nliterals = length o literals;
paulson@9840
   106
paulson@9840
   107
 (*to detect, and remove, tautologous clauses*)
paulson@9840
   108
 fun taut_lits [] = false
paulson@9840
   109
   | taut_lits ((flg,t)::ts) = (not flg,t) mem ts orelse taut_lits ts;
paulson@9840
   110
paulson@9840
   111
 (*Include False as a literal: an occurrence of ~False is a tautology*)
wenzelm@9869
   112
 fun is_taut th = taut_lits ((true, HOLogic.false_const) ::
wenzelm@9869
   113
                             literals (prop_of th));
paulson@9840
   114
paulson@9840
   115
 (*Generation of unique names -- maxidx cannot be relied upon to increase!
paulson@9840
   116
   Cannot rely on "variant", since variables might coincide when literals
wenzelm@9869
   117
   are joined to make a clause...
paulson@9840
   118
   19 chooses "U" as the first variable name*)
paulson@9840
   119
 val name_ref = ref 19;
paulson@9840
   120
paulson@9840
   121
 (*Replaces universally quantified variables by FREE variables -- because
paulson@9840
   122
   assumptions may not contain scheme variables.  Later, call "generalize". *)
paulson@9840
   123
 fun freeze_spec th =
paulson@9840
   124
   let val sth = th RS spec
paulson@9840
   125
       val newname = (name_ref := !name_ref + 1;
wenzelm@9869
   126
                      radixstring(26, "A", !name_ref))
paulson@9840
   127
   in  read_instantiate [("x", newname)] sth  end;
paulson@9840
   128
paulson@9840
   129
 fun resop nf [prem] = resolve_tac (nf prem) 1;
paulson@9840
   130
paulson@9840
   131
 (*Conjunctive normal form, detecting tautologies early.
paulson@9840
   132
   Strips universal quantifiers and breaks up conjunctions. *)
wenzelm@9869
   133
 fun cnf_aux seen (th,ths) =
paulson@9840
   134
   if taut_lits (literals(prop_of th) @ seen)  then ths
paulson@9840
   135
   else if not (has_consts ["All","op &"] (prop_of th))  then th::ths
paulson@9840
   136
   else (*conjunction?*)
wenzelm@9869
   137
         cnf_aux seen (th RS conjunct1,
wenzelm@9869
   138
                       cnf_aux seen (th RS conjunct2, ths))
paulson@9840
   139
   handle THM _ => (*universal quant?*)
wenzelm@9869
   140
         cnf_aux  seen (freeze_spec th,  ths)
paulson@9840
   141
   handle THM _ => (*disjunction?*)
wenzelm@9869
   142
     let val tac =
wenzelm@9869
   143
         (METAHYPS (resop (cnf_nil seen)) 1) THEN
wenzelm@9869
   144
         (fn st' => st' |>
wenzelm@9869
   145
                 METAHYPS (resop (cnf_nil (literals (concl_of st') @ seen))) 1)
paulson@9840
   146
     in  Seq.list_of (tac (th RS disj_forward)) @ ths  end
paulson@9840
   147
 and cnf_nil seen th = cnf_aux seen (th,[]);
paulson@9840
   148
paulson@9840
   149
 (*Top-level call to cnf -- it's safe to reset name_ref*)
wenzelm@9869
   150
 fun cnf (th,ths) =
paulson@9840
   151
    (name_ref := 19;  cnf (th RS conjunct1, cnf (th RS conjunct2, ths))
paulson@9840
   152
     handle THM _ => (*not a conjunction*) cnf_aux [] (th, ths));
paulson@9840
   153
paulson@9840
   154
 (**** Removal of duplicate literals ****)
paulson@9840
   155
paulson@9840
   156
 (*Forward proof, passing extra assumptions as theorems to the tactic*)
paulson@9840
   157
 fun forward_res2 nf hyps st =
paulson@9840
   158
   case Seq.pull
wenzelm@9869
   159
         (REPEAT
wenzelm@9869
   160
          (METAHYPS (fn major::minors => rtac (nf (minors@hyps) major) 1) 1)
wenzelm@9869
   161
          st)
paulson@9840
   162
   of Some(th,_) => th
paulson@9840
   163
    | None => raise THM("forward_res2", 0, [st]);
paulson@9840
   164
paulson@9840
   165
 (*Remove duplicates in P|Q by assuming ~P in Q
paulson@9840
   166
   rls (initially []) accumulates assumptions of the form P==>False*)
paulson@9840
   167
 fun nodups_aux rls th = nodups_aux rls (th RS disj_assoc)
paulson@9840
   168
     handle THM _ => tryres(th,rls)
paulson@9840
   169
     handle THM _ => tryres(forward_res2 nodups_aux rls (th RS disj_forward2),
wenzelm@9869
   170
                            [disj_FalseD1, disj_FalseD2, asm_rl])
paulson@9840
   171
     handle THM _ => th;
paulson@9840
   172
paulson@9840
   173
 (*Remove duplicate literals, if there are any*)
paulson@9840
   174
 fun nodups th =
paulson@9840
   175
     if null(findrep(literals(prop_of th))) then th
paulson@9840
   176
     else nodups_aux [] th;
paulson@9840
   177
paulson@9840
   178
paulson@9840
   179
 (**** Generation of contrapositives ****)
paulson@9840
   180
paulson@9840
   181
 (*Associate disjuctions to right -- make leftmost disjunct a LITERAL*)
paulson@9840
   182
 fun assoc_right th = assoc_right (th RS disj_assoc)
wenzelm@9869
   183
         handle THM _ => th;
paulson@9840
   184
paulson@9840
   185
 (*Must check for negative literal first!*)
paulson@9840
   186
 val clause_rules = [disj_assoc, make_neg_rule, make_pos_rule];
paulson@9840
   187
paulson@9840
   188
 (*For Plaisted's postive refinement.  [currently unused] *)
paulson@9840
   189
 val refined_clause_rules = [disj_assoc, make_refined_neg_rule, make_pos_rule];
paulson@9840
   190
paulson@9840
   191
 (*Create a goal or support clause, conclusing False*)
paulson@9840
   192
 fun make_goal th =   (*Must check for negative literal first!*)
wenzelm@9869
   193
     make_goal (tryres(th, clause_rules))
paulson@9840
   194
   handle THM _ => tryres(th, [make_neg_goal, make_pos_goal]);
paulson@9840
   195
paulson@9840
   196
 (*Sort clauses by number of literals*)
paulson@9840
   197
 fun fewerlits(th1,th2) = nliterals(prop_of th1) < nliterals(prop_of th2);
paulson@9840
   198
paulson@9840
   199
 (*TAUTOLOGY CHECK SHOULD NOT BE NECESSARY!*)
paulson@9840
   200
 fun sort_clauses ths = sort (make_ord fewerlits) (filter (not o is_taut) ths);
paulson@9840
   201
paulson@9840
   202
 (*Convert all suitable free variables to schematic variables*)
paulson@9840
   203
 fun generalize th = forall_elim_vars 0 (forall_intr_frees th);
paulson@9840
   204
paulson@9840
   205
 (*Create a meta-level Horn clause*)
wenzelm@9869
   206
 fun make_horn crules th = make_horn crules (tryres(th,crules))
wenzelm@9869
   207
                           handle THM _ => th;
paulson@9840
   208
paulson@9840
   209
 (*Generate Horn clauses for all contrapositives of a clause*)
wenzelm@9869
   210
 fun add_contras crules (th,hcs) =
paulson@9840
   211
   let fun rots (0,th) = hcs
wenzelm@9869
   212
         | rots (k,th) = zero_var_indexes (make_horn crules th) ::
wenzelm@9869
   213
                         rots(k-1, assoc_right (th RS disj_comm))
paulson@9840
   214
   in case nliterals(prop_of th) of
wenzelm@9869
   215
         1 => th::hcs
paulson@9840
   216
       | n => rots(n, assoc_right th)
paulson@9840
   217
   end;
paulson@9840
   218
paulson@9840
   219
 (*Use "theorem naming" to label the clauses*)
wenzelm@9869
   220
 fun name_thms label =
paulson@9840
   221
     let fun name1 (th, (k,ths)) =
wenzelm@9869
   222
           (k-1, Thm.name_thm (label ^ string_of_int k, th) :: ths)
paulson@9840
   223
paulson@9840
   224
     in  fn ths => #2 (foldr name1 (ths, (length ths, [])))  end;
paulson@9840
   225
paulson@9840
   226
 (*Find an all-negative support clause*)
paulson@9840
   227
 fun is_negative th = forall (not o #1) (literals (prop_of th));
paulson@9840
   228
paulson@9840
   229
 val neg_clauses = filter is_negative;
paulson@9840
   230
paulson@9840
   231
paulson@9840
   232
 (***** MESON PROOF PROCEDURE *****)
paulson@9840
   233
paulson@9840
   234
 fun rhyps (Const("==>",_) $ (Const("Trueprop",_) $ A) $ phi,
wenzelm@9869
   235
            As) = rhyps(phi, A::As)
paulson@9840
   236
   | rhyps (_, As) = As;
paulson@9840
   237
paulson@9840
   238
 (** Detecting repeated assumptions in a subgoal **)
paulson@9840
   239
paulson@9840
   240
 (*The stringtree detects repeated assumptions.*)
paulson@9840
   241
 fun ins_term (net,t) = Net.insert_term((t,t), net, op aconv);
paulson@9840
   242
paulson@9840
   243
 (*detects repetitions in a list of terms*)
paulson@9840
   244
 fun has_reps [] = false
paulson@9840
   245
   | has_reps [_] = false
paulson@9840
   246
   | has_reps [t,u] = (t aconv u)
paulson@9840
   247
   | has_reps ts = (foldl ins_term (Net.empty, ts);  false)
wenzelm@9869
   248
                   handle INSERT => true;
paulson@9840
   249
paulson@9840
   250
 (*Like TRYALL eq_assume_tac, but avoids expensive THEN calls*)
paulson@9840
   251
 fun TRYALL_eq_assume_tac 0 st = Seq.single st
wenzelm@9869
   252
   | TRYALL_eq_assume_tac i st =
wenzelm@9869
   253
        TRYALL_eq_assume_tac (i-1) (eq_assumption i st)
wenzelm@9869
   254
        handle THM _ => TRYALL_eq_assume_tac (i-1) st;
paulson@9840
   255
paulson@9840
   256
 (*Loop checking: FAIL if trying to prove the same thing twice
paulson@9840
   257
   -- if *ANY* subgoal has repeated literals*)
wenzelm@9869
   258
 fun check_tac st =
paulson@9840
   259
   if exists (fn prem => has_reps (rhyps(prem,[]))) (prems_of st)
paulson@9840
   260
   then  Seq.empty  else  Seq.single st;
paulson@9840
   261
paulson@9840
   262
paulson@9840
   263
 (* net_resolve_tac actually made it slower... *)
wenzelm@9869
   264
 fun prolog_step_tac horns i =
paulson@9840
   265
     (assume_tac i APPEND resolve_tac horns i) THEN check_tac THEN
paulson@9840
   266
     TRYALL eq_assume_tac;
paulson@9840
   267
paulson@9840
   268
paulson@9840
   269
in
paulson@9840
   270
paulson@9840
   271
paulson@9840
   272
(*Sums the sizes of the subgoals, ignoring hypotheses (ancestors)*)
paulson@9840
   273
local fun addconcl(prem,sz) = size_of_term(Logic.strip_assums_concl prem) + sz
paulson@9840
   274
in
paulson@9840
   275
fun size_of_subgoals st = foldr addconcl (prems_of st, 0)
paulson@9840
   276
end;
paulson@9840
   277
paulson@9840
   278
(*Negation Normal Form*)
paulson@9840
   279
val nnf_rls = [imp_to_disjD, iff_to_disjD, not_conjD, not_disjD,
wenzelm@9869
   280
               not_impD, not_iffD, not_allD, not_exD, not_notD];
paulson@9840
   281
fun make_nnf th = make_nnf (tryres(th, nnf_rls))
wenzelm@9869
   282
    handle THM _ =>
wenzelm@9869
   283
        forward_res make_nnf
wenzelm@9869
   284
           (tryres(th, [conj_forward,disj_forward,all_forward,ex_forward]))
paulson@9840
   285
    handle THM _ => th;
paulson@9840
   286
paulson@9840
   287
(*Pull existential quantifiers (Skolemization)*)
wenzelm@9869
   288
fun skolemize th =
paulson@9840
   289
  if not (has_consts ["Ex"] (prop_of th)) then th
paulson@9840
   290
  else skolemize (tryres(th, [choice, conj_exD1, conj_exD2,
wenzelm@9869
   291
                              disj_exD, disj_exD1, disj_exD2]))
wenzelm@9869
   292
    handle THM _ =>
wenzelm@9869
   293
        skolemize (forward_res skolemize
wenzelm@9869
   294
                   (tryres (th, [conj_forward, disj_forward, all_forward])))
paulson@9840
   295
    handle THM _ => forward_res skolemize (th RS ex_forward);
paulson@9840
   296
paulson@9840
   297
paulson@9840
   298
(*Make clauses from a list of theorems, previously Skolemized and put into nnf.
paulson@9840
   299
  The resulting clauses are HOL disjunctions.*)
wenzelm@9869
   300
fun make_clauses ths =
paulson@9840
   301
    sort_clauses (map (generalize o nodups) (foldr cnf (ths,[])));
paulson@9840
   302
paulson@9840
   303
(*Convert a list of clauses to (contrapositive) Horn clauses*)
wenzelm@9869
   304
fun make_horns ths =
paulson@9840
   305
    name_thms "Horn#"
paulson@9840
   306
      (gen_distinct eq_thm (foldr (add_contras clause_rules) (ths,[])));
paulson@9840
   307
paulson@9840
   308
(*Could simply use nprems_of, which would count remaining subgoals -- no
paulson@9840
   309
  discrimination as to their size!  With BEST_FIRST, fails for problem 41.*)
paulson@9840
   310
wenzelm@9869
   311
fun best_prolog_tac sizef horns =
paulson@9840
   312
    BEST_FIRST (has_fewer_prems 1, sizef) (prolog_step_tac horns 1);
paulson@9840
   313
wenzelm@9869
   314
fun depth_prolog_tac horns =
paulson@9840
   315
    DEPTH_FIRST (has_fewer_prems 1) (prolog_step_tac horns 1);
paulson@9840
   316
paulson@9840
   317
(*Return all negative clauses, as possible goal clauses*)
paulson@9840
   318
fun gocls cls = name_thms "Goal#" (map make_goal (neg_clauses cls));
paulson@9840
   319
paulson@9840
   320
wenzelm@9869
   321
fun skolemize_tac prems =
paulson@9840
   322
    cut_facts_tac (map (skolemize o make_nnf) prems)  THEN'
paulson@9840
   323
    REPEAT o (etac exE);
paulson@9840
   324
paulson@9840
   325
(*Shell of all meson-tactics.  Supplies cltac with clauses: HOL disjunctions*)
paulson@9840
   326
fun MESON cltac = SELECT_GOAL
paulson@9840
   327
 (EVERY1 [rtac ccontr,
paulson@9840
   328
          METAHYPS (fn negs =>
paulson@9840
   329
                    EVERY1 [skolemize_tac negs,
paulson@9840
   330
                            METAHYPS (cltac o make_clauses)])]);
paulson@9840
   331
paulson@9840
   332
(** Best-first search versions **)
paulson@9840
   333
wenzelm@9869
   334
fun best_meson_tac sizef =
wenzelm@9869
   335
  MESON (fn cls =>
paulson@9840
   336
         THEN_BEST_FIRST (resolve_tac (gocls cls) 1)
paulson@9840
   337
                         (has_fewer_prems 1, sizef)
paulson@9840
   338
                         (prolog_step_tac (make_horns cls) 1));
paulson@9840
   339
paulson@9840
   340
(*First, breaks the goal into independent units*)
paulson@9840
   341
val safe_best_meson_tac =
wenzelm@9869
   342
     SELECT_GOAL (TRY Safe_tac THEN
paulson@9840
   343
                  TRYALL (best_meson_tac size_of_subgoals));
paulson@9840
   344
paulson@9840
   345
(** Depth-first search version **)
paulson@9840
   346
paulson@9840
   347
val depth_meson_tac =
wenzelm@9869
   348
     MESON (fn cls => EVERY [resolve_tac (gocls cls) 1,
paulson@9840
   349
                             depth_prolog_tac (make_horns cls)]);
paulson@9840
   350
paulson@9840
   351
paulson@9840
   352
paulson@9840
   353
(** Iterative deepening version **)
paulson@9840
   354
paulson@9840
   355
(*This version does only one inference per call;
paulson@9840
   356
  having only one eq_assume_tac speeds it up!*)
wenzelm@9869
   357
fun prolog_step_tac' horns =
paulson@9840
   358
    let val (horn0s, hornps) = (*0 subgoals vs 1 or more*)
paulson@9840
   359
            take_prefix Thm.no_prems horns
paulson@9840
   360
        val nrtac = net_resolve_tac horns
paulson@9840
   361
    in  fn i => eq_assume_tac i ORELSE
paulson@9840
   362
                match_tac horn0s i ORELSE  (*no backtracking if unit MATCHES*)
paulson@9840
   363
                ((assume_tac i APPEND nrtac i) THEN check_tac)
paulson@9840
   364
    end;
paulson@9840
   365
wenzelm@9869
   366
fun iter_deepen_prolog_tac horns =
paulson@9840
   367
    ITER_DEEPEN (has_fewer_prems 1) (prolog_step_tac' horns);
paulson@9840
   368
wenzelm@9869
   369
val iter_deepen_meson_tac =
wenzelm@9869
   370
  MESON (fn cls =>
paulson@9840
   371
         (THEN_ITER_DEEPEN (resolve_tac (gocls cls) 1)
paulson@9840
   372
                           (has_fewer_prems 1)
paulson@9840
   373
                           (prolog_step_tac' (make_horns cls))));
paulson@9840
   374
wenzelm@9869
   375
fun meson_claset_tac cs =
wenzelm@9869
   376
  SELECT_GOAL (TRY (safe_tac cs) THEN TRYALL iter_deepen_meson_tac);
wenzelm@9869
   377
wenzelm@9869
   378
val meson_tac = CLASET' meson_claset_tac;
wenzelm@9869
   379
wenzelm@9869
   380
wenzelm@9869
   381
(* proof method setup *)
wenzelm@9869
   382
wenzelm@9869
   383
local
wenzelm@9869
   384
wenzelm@9869
   385
fun meson_meth ctxt =
wenzelm@9869
   386
  Method.SIMPLE_METHOD' HEADGOAL (CHANGED o meson_claset_tac (Classical.get_local_claset ctxt));
wenzelm@9869
   387
wenzelm@9869
   388
in
wenzelm@9869
   389
wenzelm@9869
   390
val meson_setup =
wenzelm@9869
   391
 [Method.add_methods
wenzelm@9869
   392
  [("meson", Method.ctxt_args meson_meth, "The MESON resolution proof procedure")]];
paulson@9840
   393
paulson@9840
   394
end;
wenzelm@9869
   395
wenzelm@9869
   396
end;