proper context for resolve_tac, eresolve_tac, dresolve_tac, forward_tac etc.;
authorwenzelm
Tue Feb 10 14:48:26 2015 +0100 (2015-02-10)
changeset 5949850b60f501b05
parent 59497 0c5cd369a643
child 59499 14095f771781
proper context for resolve_tac, eresolve_tac, dresolve_tac, forward_tac etc.;
occasionally clarified use of context;
NEWS
src/CCL/CCL.thy
src/CCL/Term.thy
src/CCL/Type.thy
src/CCL/Wfd.thy
src/CTT/Arith.thy
src/CTT/CTT.thy
src/CTT/ex/Elimination.thy
src/CTT/ex/Synthesis.thy
src/CTT/ex/Typechecking.thy
src/CTT/rew.ML
src/Cube/Example.thy
src/Doc/Implementation/Isar.thy
src/Doc/Implementation/Tactic.thy
src/Doc/Isar_Ref/Generic.thy
src/Doc/Isar_Ref/ML_Tactic.thy
src/Doc/Tutorial/Protocol/Event.thy
src/Doc/Tutorial/Protocol/Message.thy
src/Doc/Tutorial/Protocol/Public.thy
src/FOL/IFOL.thy
src/FOL/ex/Miniscope.thy
src/FOL/ex/Prolog.thy
src/FOL/intprover.ML
src/FOL/simpdata.ML
src/FOLP/FOLP.thy
src/FOLP/IFOLP.thy
src/FOLP/classical.ML
src/FOLP/intprover.ML
src/FOLP/simp.ML
src/HOL/Auth/Event.thy
src/HOL/Auth/Message.thy
src/HOL/Auth/OtwayReesBella.thy
src/HOL/Auth/Public.thy
src/HOL/Auth/Shared.thy
src/HOL/Auth/Smartcard/ShoupRubin.thy
src/HOL/Auth/Smartcard/ShoupRubinBella.thy
src/HOL/Auth/Smartcard/Smartcard.thy
src/HOL/Bali/AxExample.thy
src/HOL/Bali/AxSem.thy
src/HOL/Bali/Basis.thy
src/HOL/Bali/Eval.thy
src/HOL/Bali/Evaln.thy
src/HOL/Bali/WellType.thy
src/HOL/Datatype_Examples/Stream_Processor.thy
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Decision_Procs/approximation.ML
src/HOL/Fun.thy
src/HOL/HOL.thy
src/HOL/HOLCF/IOA/NTP/Impl.thy
src/HOL/HOLCF/Tools/Domain/domain_constructors.ML
src/HOL/HOLCF/Tools/Domain/domain_induction.ML
src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML
src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML
src/HOL/HOLCF/Tools/cont_proc.ML
src/HOL/IMPP/Hoare.thy
src/HOL/IMPP/Natural.thy
src/HOL/IOA/Solve.thy
src/HOL/Library/Countable.thy
src/HOL/Library/Old_SMT/old_z3_proof_methods.ML
src/HOL/Library/Old_SMT/old_z3_proof_reconstruction.ML
src/HOL/Library/bnf_lfp_countable.ML
src/HOL/MicroJava/J/Example.thy
src/HOL/MicroJava/J/JTypeSafe.thy
src/HOL/NSA/transfer.ML
src/HOL/NanoJava/Equivalence.thy
src/HOL/Nominal/nominal_atoms.ML
src/HOL/Nominal/nominal_datatype.ML
src/HOL/Nominal/nominal_inductive.ML
src/HOL/Nominal/nominal_inductive2.ML
src/HOL/Old_Number_Theory/Chinese.thy
src/HOL/Old_Number_Theory/IntPrimes.thy
src/HOL/Old_Number_Theory/WilsonBij.thy
src/HOL/Old_Number_Theory/WilsonRuss.thy
src/HOL/Probability/measurable.ML
src/HOL/Product_Type.thy
src/HOL/Prolog/prolog.ML
src/HOL/SET_Protocol/Event_SET.thy
src/HOL/SET_Protocol/Message_SET.thy
src/HOL/SET_Protocol/Public_SET.thy
src/HOL/SPARK/Tools/spark_vcs.ML
src/HOL/Set.thy
src/HOL/Statespace/state_space.ML
src/HOL/TLA/Action.thy
src/HOL/TLA/Memory/MemoryImplementation.thy
src/HOL/TLA/TLA.thy
src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML
src/HOL/TPTP/TPTP_Proof_Reconstruction.thy
src/HOL/TPTP/atp_problem_import.ML
src/HOL/TPTP/sledgehammer_tactics.ML
src/HOL/Tools/BNF/bnf_comp_tactics.ML
src/HOL/Tools/BNF/bnf_def_tactics.ML
src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML
src/HOL/Tools/BNF/bnf_fp_n2m_tactics.ML
src/HOL/Tools/BNF/bnf_gfp.ML
src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML
src/HOL/Tools/BNF/bnf_gfp_tactics.ML
src/HOL/Tools/BNF/bnf_lfp.ML
src/HOL/Tools/BNF/bnf_lfp_size.ML
src/HOL/Tools/BNF/bnf_lfp_tactics.ML
src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML
src/HOL/Tools/Ctr_Sugar/ctr_sugar_tactics.ML
src/HOL/Tools/Function/function_common.ML
src/HOL/Tools/Function/function_core.ML
src/HOL/Tools/Function/function_elims.ML
src/HOL/Tools/Function/function_lib.ML
src/HOL/Tools/Function/measure_functions.ML
src/HOL/Tools/Function/mutual.ML
src/HOL/Tools/Function/partial_function.ML
src/HOL/Tools/Function/scnp_reconstruct.ML
src/HOL/Tools/Lifting/lifting_def.ML
src/HOL/Tools/Lifting/lifting_setup.ML
src/HOL/Tools/Lifting/lifting_term.ML
src/HOL/Tools/Meson/meson.ML
src/HOL/Tools/Meson/meson_clausify.ML
src/HOL/Tools/Metis/metis_reconstruct.ML
src/HOL/Tools/Metis/metis_tactic.ML
src/HOL/Tools/Old_Datatype/old_datatype.ML
src/HOL/Tools/Old_Datatype/old_datatype_aux.ML
src/HOL/Tools/Old_Datatype/old_primrec.ML
src/HOL/Tools/Old_Datatype/old_rep_datatype.ML
src/HOL/Tools/Old_Datatype/old_size.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML
src/HOL/Tools/Quickcheck/exhaustive_generators.ML
src/HOL/Tools/Quickcheck/narrowing_generators.ML
src/HOL/Tools/Quickcheck/quickcheck_common.ML
src/HOL/Tools/Quickcheck/random_generators.ML
src/HOL/Tools/Quotient/quotient_tacs.ML
src/HOL/Tools/SMT/z3_replay.ML
src/HOL/Tools/SMT/z3_replay_methods.ML
src/HOL/Tools/TFL/post.ML
src/HOL/Tools/Transfer/transfer.ML
src/HOL/Tools/Transfer/transfer_bnf.ML
src/HOL/Tools/cnf.ML
src/HOL/Tools/code_evaluation.ML
src/HOL/Tools/coinduction.ML
src/HOL/Tools/datatype_realizer.ML
src/HOL/Tools/inductive.ML
src/HOL/Tools/inductive_realizer.ML
src/HOL/Tools/inductive_set.ML
src/HOL/Tools/lin_arith.ML
src/HOL/Tools/record.ML
src/HOL/Tools/sat.ML
src/HOL/Tools/set_comprehension_pointfree.ML
src/HOL/Tools/simpdata.ML
src/HOL/Typerep.thy
src/HOL/UNITY/Simple/NSP_Bad.thy
src/HOL/UNITY/UNITY_tactics.ML
src/HOL/Word/Word.thy
src/HOL/Word/WordBitwise.thy
src/LCF/LCF.thy
src/Provers/Arith/cancel_numerals.ML
src/Provers/Arith/combine_numerals.ML
src/Provers/Arith/fast_lin_arith.ML
src/Provers/blast.ML
src/Provers/classical.ML
src/Provers/hypsubst.ML
src/Provers/order.ML
src/Provers/quantifier1.ML
src/Provers/quasi.ML
src/Provers/splitter.ML
src/Provers/trancl.ML
src/Provers/typedsimp.ML
src/Pure/Isar/class.ML
src/Pure/Isar/class_declaration.ML
src/Pure/Isar/element.ML
src/Pure/Isar/local_defs.ML
src/Pure/Isar/locale.ML
src/Pure/Isar/method.ML
src/Pure/Isar/proof.ML
src/Pure/Tools/find_theorems.ML
src/Pure/Tools/rule_insts.ML
src/Pure/goal.ML
src/Pure/raw_simplifier.ML
src/Pure/simplifier.ML
src/Pure/skip_proof.ML
src/Pure/tactic.ML
src/Sequents/LK.thy
src/Sequents/modal.ML
src/Sequents/prover.ML
src/Sequents/simpdata.ML
src/Tools/case_product.ML
src/Tools/coherent.ML
src/Tools/eqsubst.ML
src/Tools/induct.ML
src/ZF/Datatype_ZF.thy
src/ZF/OrdQuant.thy
src/ZF/Tools/datatype_package.ML
src/ZF/Tools/inductive_package.ML
src/ZF/Tools/primrec_package.ML
src/ZF/Tools/typechk.ML
src/ZF/UNITY/Constrains.thy
src/ZF/arith_data.ML
src/ZF/pair.thy
     1.1 --- a/NEWS	Tue Feb 10 14:29:36 2015 +0100
     1.2 +++ b/NEWS	Tue Feb 10 14:48:26 2015 +0100
     1.3 @@ -248,8 +248,8 @@
     1.4  Input.source (with formal position information).
     1.5  
     1.6  * Proper context for various elementary tactics: assume_tac,
     1.7 -match_tac, compose_tac, Splitter.split_tac etc.  Minor
     1.8 -INCOMPATIBILITY.
     1.9 +resolve_tac, eresolve_tac, dresolve_tac, forward_tac, match_tac,
    1.10 +compose_tac, Splitter.split_tac etc. INCOMPATIBILITY.
    1.11  
    1.12  * Tactical PARALLEL_ALLGOALS is the most common way to refer to
    1.13  PARALLEL_GOALS.
     2.1 --- a/src/CCL/CCL.thy	Tue Feb 10 14:29:36 2015 +0100
     2.2 +++ b/src/CCL/CCL.thy	Tue Feb 10 14:48:26 2015 +0100
     2.3 @@ -205,7 +205,7 @@
     2.4        val inj_lemmas = maps mk_inj_lemmas rews
     2.5      in
     2.6        CHANGED (REPEAT (ares_tac [@{thm iffI}, @{thm allI}, @{thm conjI}] i ORELSE
     2.7 -        eresolve_tac inj_lemmas i ORELSE
     2.8 +        eresolve_tac ctxt inj_lemmas i ORELSE
     2.9          asm_simp_tac (ctxt addsimps rews) i))
    2.10      end;
    2.11  *}
    2.12 @@ -267,7 +267,7 @@
    2.13    let
    2.14      fun mk_raw_dstnct_thm rls s =
    2.15        Goal.prove_global @{theory} [] [] (Syntax.read_prop_global @{theory} s)
    2.16 -        (fn _ => rtac @{thm notI} 1 THEN eresolve_tac rls 1)
    2.17 +        (fn {context = ctxt, ...} => rtac @{thm notI} 1 THEN eresolve_tac ctxt rls 1)
    2.18    in map (mk_raw_dstnct_thm caseB_lemmas)
    2.19      (mk_dstnct_rls @{theory} ["bot","true","false","pair","lambda"]) end
    2.20  
     3.1 --- a/src/CCL/Term.thy	Tue Feb 10 14:29:36 2015 +0100
     3.2 +++ b/src/CCL/Term.thy	Tue Feb 10 14:48:26 2015 +0100
     3.3 @@ -203,7 +203,7 @@
     3.4  method_setup beta_rl = {*
     3.5    Scan.succeed (fn ctxt =>
     3.6      SIMPLE_METHOD' (CHANGED o
     3.7 -      simp_tac (ctxt addsimps @{thms rawBs} setloop (fn _ => stac @{thm letrecB}))))
     3.8 +      simp_tac (ctxt addsimps @{thms rawBs} setloop (fn _ => stac ctxt @{thm letrecB}))))
     3.9  *}
    3.10  
    3.11  lemma ifBtrue: "if true then t else u = t"
     4.1 --- a/src/CCL/Type.thy	Tue Feb 10 14:29:36 2015 +0100
     4.2 +++ b/src/CCL/Type.thy	Tue Feb 10 14:48:26 2015 +0100
     4.3 @@ -126,8 +126,8 @@
     4.4  ML {*
     4.5  fun mk_ncanT_tac top_crls crls =
     4.6    SUBPROOF (fn {context = ctxt, prems = major :: prems, ...} =>
     4.7 -    resolve_tac ([major] RL top_crls) 1 THEN
     4.8 -    REPEAT_SOME (eresolve_tac (crls @ [@{thm exE}, @{thm bexE}, @{thm conjE}, @{thm disjE}])) THEN
     4.9 +    resolve_tac ctxt ([major] RL top_crls) 1 THEN
    4.10 +    REPEAT_SOME (eresolve_tac ctxt (crls @ [@{thm exE}, @{thm bexE}, @{thm conjE}, @{thm disjE}])) THEN
    4.11      ALLGOALS (asm_simp_tac ctxt) THEN
    4.12      ALLGOALS (ares_tac (prems RL [@{thm lem}]) ORELSE' etac @{thm bspec}) THEN
    4.13      safe_tac (ctxt addSIs prems))
    4.14 @@ -436,7 +436,7 @@
    4.15  fun POgen_tac ctxt (rla, rlb) i =
    4.16    SELECT_GOAL (safe_tac ctxt) i THEN
    4.17    rtac (rlb RS (rla RS @{thm ssubst_pair})) i THEN
    4.18 -  (REPEAT (resolve_tac
    4.19 +  (REPEAT (resolve_tac ctxt
    4.20        (@{thms POgenIs} @ [@{thm PO_refl} RS (@{thm POgen_mono} RS @{thm ci3_AI})] @
    4.21          (@{thms POgenIs} RL [@{thm POgen_mono} RS @{thm ci3_AgenI}]) @
    4.22          [@{thm POgen_mono} RS @{thm ci3_RI}]) i))
    4.23 @@ -467,8 +467,8 @@
    4.24    unfolding data_defs by (genIs EQgenXH EQgen_mono)+
    4.25  
    4.26  ML {*
    4.27 -fun EQgen_raw_tac i =
    4.28 -  (REPEAT (resolve_tac (@{thms EQgenIs} @
    4.29 +fun EQgen_raw_tac ctxt i =
    4.30 +  (REPEAT (resolve_tac ctxt (@{thms EQgenIs} @
    4.31          [@{thm EQ_refl} RS (@{thm EQgen_mono} RS @{thm ci3_AI})] @
    4.32          (@{thms EQgenIs} RL [@{thm EQgen_mono} RS @{thm ci3_AgenI}]) @
    4.33          [@{thm EQgen_mono} RS @{thm ci3_RI}]) i))
    4.34 @@ -480,9 +480,9 @@
    4.35  fun EQgen_tac ctxt rews i =
    4.36   SELECT_GOAL
    4.37     (TRY (safe_tac ctxt) THEN
    4.38 -    resolve_tac ((rews @ [@{thm refl}]) RL ((rews @ [@{thm refl}]) RL [@{thm ssubst_pair}])) i THEN
    4.39 +    resolve_tac ctxt ((rews @ [@{thm refl}]) RL ((rews @ [@{thm refl}]) RL [@{thm ssubst_pair}])) i THEN
    4.40      ALLGOALS (simp_tac ctxt) THEN
    4.41 -    ALLGOALS EQgen_raw_tac) i
    4.42 +    ALLGOALS (EQgen_raw_tac ctxt)) i
    4.43  *}
    4.44  
    4.45  method_setup EQgen = {*
     5.1 --- a/src/CCL/Wfd.thy	Tue Feb 10 14:29:36 2015 +0100
     5.2 +++ b/src/CCL/Wfd.thy	Tue Feb 10 14:48:26 2015 +0100
     5.3 @@ -448,7 +448,7 @@
     5.4  fun rcall_tac ctxt i =
     5.5    let fun tac ps rl i = res_inst_tac ctxt ps rl i THEN atac i
     5.6    in IHinst tac @{thms rcallTs} i end
     5.7 -  THEN eresolve_tac @{thms rcall_lemmas} i
     5.8 +  THEN eresolve_tac ctxt @{thms rcall_lemmas} i
     5.9  
    5.10  fun raw_step_tac ctxt prems i =
    5.11    ares_tac (prems@type_rls) i ORELSE
    5.12 @@ -467,7 +467,7 @@
    5.13  fun clean_ccs_tac ctxt =
    5.14    let fun tac ps rl i = eres_inst_tac ctxt ps rl i THEN atac i in
    5.15      TRY (REPEAT_FIRST (IHinst tac @{thms hyprcallTs} ORELSE'
    5.16 -      eresolve_tac ([asm_rl, @{thm SubtypeE}] @ @{thms rmIHs}) ORELSE'
    5.17 +      eresolve_tac ctxt ([asm_rl, @{thm SubtypeE}] @ @{thms rmIHs}) ORELSE'
    5.18        hyp_subst_tac ctxt))
    5.19    end
    5.20  
    5.21 @@ -498,7 +498,7 @@
    5.22  fun eval_tac ths =
    5.23    Subgoal.FOCUS_PREMS (fn {context = ctxt, prems, ...} =>
    5.24      let val eval_rules = Named_Theorems.get ctxt @{named_theorems eval}
    5.25 -    in DEPTH_SOLVE_1 (resolve_tac (ths @ prems @ rev eval_rules) 1) end)
    5.26 +    in DEPTH_SOLVE_1 (resolve_tac ctxt (ths @ prems @ rev eval_rules) 1) end)
    5.27  *}
    5.28  
    5.29  method_setup eval = {*
    5.30 @@ -521,7 +521,7 @@
    5.31    apply (unfold let_def)
    5.32    apply (rule 1 [THEN canonical])
    5.33    apply (tactic {*
    5.34 -    REPEAT (DEPTH_SOLVE_1 (resolve_tac (@{thms assms} @ @{thms eval_rls}) 1 ORELSE
    5.35 +    REPEAT (DEPTH_SOLVE_1 (resolve_tac @{context} (@{thms assms} @ @{thms eval_rls}) 1 ORELSE
    5.36        etac @{thm substitute} 1)) *})
    5.37    done
    5.38  
     6.1 --- a/src/CTT/Arith.thy	Tue Feb 10 14:29:36 2015 +0100
     6.2 +++ b/src/CTT/Arith.thy	Tue Feb 10 14:48:26 2015 +0100
     6.3 @@ -177,7 +177,7 @@
     6.4    (Arith_simp.norm_tac ctxt (congr_rls, prems))
     6.5  
     6.6  fun hyp_arith_rew_tac ctxt prems = make_rew_tac ctxt
     6.7 -  (Arith_simp.cond_norm_tac ctxt (prove_cond_tac, congr_rls, prems))
     6.8 +  (Arith_simp.cond_norm_tac ctxt (prove_cond_tac ctxt, congr_rls, prems))
     6.9  
    6.10  end
    6.11  *}
     7.1 --- a/src/CTT/CTT.thy	Tue Feb 10 14:29:36 2015 +0100
     7.2 +++ b/src/CTT/CTT.thy	Tue Feb 10 14:48:26 2015 +0100
     7.3 @@ -453,13 +453,13 @@
     7.4  
     7.5  fun safestep_tac ctxt thms i =
     7.6      form_tac ctxt ORELSE
     7.7 -    resolve_tac thms i  ORELSE
     7.8 -    biresolve_tac safe0_brls i  ORELSE  mp_tac ctxt i  ORELSE
     7.9 -    DETERM (biresolve_tac safep_brls i)
    7.10 +    resolve_tac ctxt thms i  ORELSE
    7.11 +    biresolve_tac ctxt safe0_brls i  ORELSE  mp_tac ctxt i  ORELSE
    7.12 +    DETERM (biresolve_tac ctxt safep_brls i)
    7.13  
    7.14  fun safe_tac ctxt thms i = DEPTH_SOLVE_1 (safestep_tac ctxt thms i)
    7.15  
    7.16 -fun step_tac ctxt thms = safestep_tac ctxt thms  ORELSE'  biresolve_tac unsafe_brls
    7.17 +fun step_tac ctxt thms = safestep_tac ctxt thms  ORELSE'  biresolve_tac ctxt unsafe_brls
    7.18  
    7.19  (*Fails unless it solves the goal!*)
    7.20  fun pc_tac ctxt thms = DEPTH_SOLVE_1 o (step_tac ctxt thms)
     8.1 --- a/src/CTT/ex/Elimination.thy	Tue Feb 10 14:29:36 2015 +0100
     8.2 +++ b/src/CTT/ex/Elimination.thy	Tue Feb 10 14:48:26 2015 +0100
     8.3 @@ -182,7 +182,7 @@
     8.4      and "\<And>z. z:A*B \<Longrightarrow> C(z) type"
     8.5    shows "?a : (SUM z:A*B. C(z)) --> (SUM u:A. SUM v:B. C(<u,v>))"
     8.6  apply (rule intr_rls)
     8.7 -apply (tactic {* biresolve_tac safe_brls 2 *})
     8.8 +apply (tactic {* biresolve_tac @{context} safe_brls 2 *})
     8.9  (*Now must convert assumption C(z) into antecedent C(<kd,ke>) *)
    8.10  apply (rule_tac [2] a = "y" in ProdE)
    8.11  apply (typechk assms)
     9.1 --- a/src/CTT/ex/Synthesis.thy	Tue Feb 10 14:29:36 2015 +0100
     9.2 +++ b/src/CTT/ex/Synthesis.thy	Tue Feb 10 14:48:26 2015 +0100
     9.3 @@ -92,12 +92,12 @@
     9.4                  *  (PROD y:N. Eq(N, plus`succ(y)`x, succ(plus`y`x)))"
     9.5  apply intr
     9.6  apply eqintr
     9.7 -apply (tactic "resolve_tac [TSimp.split_eqn] 3")
     9.8 +apply (tactic "resolve_tac @{context} [TSimp.split_eqn] 3")
     9.9  apply (tactic "SELECT_GOAL (rew_tac @{context} []) 4")
    9.10 -apply (tactic "resolve_tac [TSimp.split_eqn] 3")
    9.11 +apply (tactic "resolve_tac @{context} [TSimp.split_eqn] 3")
    9.12  apply (tactic "SELECT_GOAL (rew_tac @{context} []) 4")
    9.13  apply (rule_tac [3] p = "y" in NC_succ)
    9.14 -  (**  by (resolve_tac comp_rls 3);  caused excessive branching  **)
    9.15 +  (**  by (resolve_tac @{context} comp_rls 3);  caused excessive branching  **)
    9.16  apply rew
    9.17  done
    9.18  
    10.1 --- a/src/CTT/ex/Typechecking.thy	Tue Feb 10 14:29:36 2015 +0100
    10.2 +++ b/src/CTT/ex/Typechecking.thy	Tue Feb 10 14:48:26 2015 +0100
    10.3 @@ -66,7 +66,8 @@
    10.4  
    10.5  (*Proofs involving arbitrary types.
    10.6    For concreteness, every type variable left over is forced to be N*)
    10.7 -method_setup N = {* Scan.succeed (fn _ => SIMPLE_METHOD (TRYALL (resolve_tac @{thms NF}))) *}
    10.8 +method_setup N =
    10.9 +  {* Scan.succeed (fn ctxt => SIMPLE_METHOD (TRYALL (resolve_tac ctxt @{thms NF}))) *}
   10.10  
   10.11  schematic_lemma "lam w. <w,w> : ?A"
   10.12  apply typechk
    11.1 --- a/src/CTT/rew.ML	Tue Feb 10 14:29:36 2015 +0100
    11.2 +++ b/src/CTT/rew.ML	Tue Feb 10 14:48:26 2015 +0100
    11.3 @@ -11,7 +11,7 @@
    11.4    | peEs n = @{thm EqE} :: map (curry (op RS) @{thm ProdE}) (peEs (n-1));
    11.5  
    11.6  (*Tactic used for proving conditions for the cond_rls*)
    11.7 -val prove_cond_tac = eresolve_tac (peEs 5);
    11.8 +fun prove_cond_tac ctxt = eresolve_tac ctxt (peEs 5);
    11.9  
   11.10  
   11.11  structure TSimp_data: TSIMP_DATA =
   11.12 @@ -32,11 +32,11 @@
   11.13  
   11.14  (*Make a rewriting tactic from a normalization tactic*)
   11.15  fun make_rew_tac ctxt ntac =
   11.16 -    TRY (eqintr_tac ctxt)  THEN  TRYALL (resolve_tac [TSimp.split_eqn])  THEN  
   11.17 +    TRY (eqintr_tac ctxt)  THEN  TRYALL (resolve_tac ctxt [TSimp.split_eqn])  THEN  
   11.18      ntac;
   11.19  
   11.20  fun rew_tac ctxt thms = make_rew_tac ctxt
   11.21      (TSimp.norm_tac ctxt (standard_congr_rls, thms));
   11.22  
   11.23  fun hyp_rew_tac ctxt thms = make_rew_tac ctxt
   11.24 -    (TSimp.cond_norm_tac ctxt (prove_cond_tac, standard_congr_rls, thms));
   11.25 +    (TSimp.cond_norm_tac ctxt (prove_cond_tac ctxt, standard_congr_rls, thms));
    12.1 --- a/src/Cube/Example.thy	Tue Feb 10 14:29:36 2015 +0100
    12.2 +++ b/src/Cube/Example.thy	Tue Feb 10 14:48:26 2015 +0100
    12.3 @@ -18,9 +18,9 @@
    12.4      (DEPTH_SOLVE_1 (HEADGOAL (ares_tac (facts @ thms)))))))\<close>
    12.5  
    12.6  method_setup strip_asms =
    12.7 -  \<open>Attrib.thms >> (fn thms => K (METHOD (fn facts =>
    12.8 -    REPEAT (resolve_tac [@{thm strip_b}, @{thm strip_s}] 1 THEN
    12.9 -    DEPTH_SOLVE_1 (ares_tac (facts @ thms) 1)))))\<close>
   12.10 +  \<open>Attrib.thms >> (fn thms => fn ctxt => METHOD (fn facts =>
   12.11 +    REPEAT (resolve_tac ctxt [@{thm strip_b}, @{thm strip_s}] 1 THEN
   12.12 +    DEPTH_SOLVE_1 (ares_tac (facts @ thms) 1))))\<close>
   12.13  
   12.14  
   12.15  subsection \<open>Simple types\<close>
    13.1 --- a/src/Doc/Implementation/Isar.thy	Tue Feb 10 14:29:36 2015 +0100
    13.2 +++ b/src/Doc/Implementation/Isar.thy	Tue Feb 10 14:48:26 2015 +0100
    13.3 @@ -366,8 +366,8 @@
    13.4  
    13.5    have "A \<and> B"
    13.6      apply (tactic \<open>rtac @{thm conjI} 1\<close>)
    13.7 -    using a apply (tactic \<open>resolve_tac facts 1\<close>)
    13.8 -    using b apply (tactic \<open>resolve_tac facts 1\<close>)
    13.9 +    using a apply (tactic \<open>resolve_tac @{context} facts 1\<close>)
   13.10 +    using b apply (tactic \<open>resolve_tac @{context} facts 1\<close>)
   13.11      done
   13.12  
   13.13    have "A \<and> B"
    14.1 --- a/src/Doc/Implementation/Tactic.thy	Tue Feb 10 14:29:36 2015 +0100
    14.2 +++ b/src/Doc/Implementation/Tactic.thy	Tue Feb 10 14:48:26 2015 +0100
    14.3 @@ -277,11 +277,11 @@
    14.4  
    14.5  text %mlref \<open>
    14.6    \begin{mldecls}
    14.7 -  @{index_ML resolve_tac: "thm list -> int -> tactic"} \\
    14.8 -  @{index_ML eresolve_tac: "thm list -> int -> tactic"} \\
    14.9 -  @{index_ML dresolve_tac: "thm list -> int -> tactic"} \\
   14.10 -  @{index_ML forward_tac: "thm list -> int -> tactic"} \\
   14.11 -  @{index_ML biresolve_tac: "(bool * thm) list -> int -> tactic"} \\[1ex]
   14.12 +  @{index_ML resolve_tac: "Proof.context -> thm list -> int -> tactic"} \\
   14.13 +  @{index_ML eresolve_tac: "Proof.context -> thm list -> int -> tactic"} \\
   14.14 +  @{index_ML dresolve_tac: "Proof.context -> thm list -> int -> tactic"} \\
   14.15 +  @{index_ML forward_tac: "Proof.context -> thm list -> int -> tactic"} \\
   14.16 +  @{index_ML biresolve_tac: "Proof.context -> (bool * thm) list -> int -> tactic"} \\[1ex]
   14.17    @{index_ML assume_tac: "Proof.context -> int -> tactic"} \\
   14.18    @{index_ML eq_assume_tac: "int -> tactic"} \\[1ex]
   14.19    @{index_ML match_tac: "Proof.context -> thm list -> int -> tactic"} \\
   14.20 @@ -292,20 +292,20 @@
   14.21  
   14.22    \begin{description}
   14.23  
   14.24 -  \item @{ML resolve_tac}~@{text "thms i"} refines the goal state
   14.25 +  \item @{ML resolve_tac}~@{text "ctxt thms i"} refines the goal state
   14.26    using the given theorems, which should normally be introduction
   14.27    rules.  The tactic resolves a rule's conclusion with subgoal @{text
   14.28    i}, replacing it by the corresponding versions of the rule's
   14.29    premises.
   14.30  
   14.31 -  \item @{ML eresolve_tac}~@{text "thms i"} performs elim-resolution
   14.32 +  \item @{ML eresolve_tac}~@{text "ctxt thms i"} performs elim-resolution
   14.33    with the given theorems, which are normally be elimination rules.
   14.34  
   14.35 -  Note that @{ML "eresolve_tac [asm_rl]"} is equivalent to @{ML
   14.36 -  assume_tac}, which facilitates mixing of assumption steps with
   14.37 +  Note that @{ML_text "eresolve_tac ctxt [asm_rl]"} is equivalent to @{ML_text
   14.38 +  "assume_tac ctxt"}, which facilitates mixing of assumption steps with
   14.39    genuine eliminations.
   14.40  
   14.41 -  \item @{ML dresolve_tac}~@{text "thms i"} performs
   14.42 +  \item @{ML dresolve_tac}~@{text "ctxt thms i"} performs
   14.43    destruct-resolution with the given theorems, which should normally
   14.44    be destruction rules.  This replaces an assumption by the result of
   14.45    applying one of the rules.
   14.46 @@ -314,7 +314,7 @@
   14.47    selected assumption is not deleted.  It applies a rule to an
   14.48    assumption, adding the result as a new assumption.
   14.49  
   14.50 -  \item @{ML biresolve_tac}~@{text "brls i"} refines the proof state
   14.51 +  \item @{ML biresolve_tac}~@{text "ctxt brls i"} refines the proof state
   14.52    by resolution or elim-resolution on each rule, as indicated by its
   14.53    flag.  It affects subgoal @{text "i"} of the proof state.
   14.54  
    15.1 --- a/src/Doc/Isar_Ref/Generic.thy	Tue Feb 10 14:29:36 2015 +0100
    15.2 +++ b/src/Doc/Isar_Ref/Generic.thy	Tue Feb 10 14:48:26 2015 +0100
    15.3 @@ -1054,7 +1054,7 @@
    15.4  ML \<open>
    15.5    fun subgoaler_tac ctxt =
    15.6      assume_tac ctxt ORELSE'
    15.7 -    resolve_tac (Simplifier.prems_of ctxt) ORELSE'
    15.8 +    resolve_tac ctxt (Simplifier.prems_of ctxt) ORELSE'
    15.9      asm_simp_tac ctxt
   15.10  \<close>
   15.11  
    16.1 --- a/src/Doc/Isar_Ref/ML_Tactic.thy	Tue Feb 10 14:29:36 2015 +0100
    16.2 +++ b/src/Doc/Isar_Ref/ML_Tactic.thy	Tue Feb 10 14:48:26 2015 +0100
    16.3 @@ -62,11 +62,11 @@
    16.4    \medskip
    16.5    \begin{tabular}{lll}
    16.6      @{ML rtac}~@{text "a 1"} & & @{text "rule a"} \\
    16.7 -    @{ML resolve_tac}~@{text "[a\<^sub>1, \<dots>] 1"} & & @{text "rule a\<^sub>1 \<dots>"} \\
    16.8 +    @{ML resolve_tac}~@{text "ctxt [a\<^sub>1, \<dots>] 1"} & & @{text "rule a\<^sub>1 \<dots>"} \\
    16.9      @{ML res_inst_tac}~@{text "ctxt [(x\<^sub>1, t\<^sub>1), \<dots>] a 1"} & &
   16.10      @{text "rule_tac x\<^sub>1 = t\<^sub>1 \<AND> \<dots> \<IN> a"} \\[0.5ex]
   16.11      @{ML rtac}~@{text "a i"} & & @{text "rule_tac [i] a"} \\
   16.12 -    @{ML resolve_tac}~@{text "[a\<^sub>1, \<dots>] i"} & & @{text "rule_tac [i] a\<^sub>1 \<dots>"} \\
   16.13 +    @{ML resolve_tac}~@{text "ctxt [a\<^sub>1, \<dots>] i"} & & @{text "rule_tac [i] a\<^sub>1 \<dots>"} \\
   16.14      @{ML res_inst_tac}~@{text "ctxt [(x\<^sub>1, t\<^sub>1), \<dots>] a i"} & &
   16.15      @{text "rule_tac [i] x\<^sub>1 = t\<^sub>1 \<AND> \<dots> \<IN> a"} \\
   16.16    \end{tabular}
    17.1 --- a/src/Doc/Tutorial/Protocol/Event.thy	Tue Feb 10 14:29:36 2015 +0100
    17.2 +++ b/src/Doc/Tutorial/Protocol/Event.thy	Tue Feb 10 14:48:26 2015 +0100
    17.3 @@ -262,7 +262,7 @@
    17.4  {*
    17.5  fun analz_mono_contra_tac ctxt =
    17.6    rtac @{thm analz_impI} THEN' 
    17.7 -  REPEAT1 o (dresolve_tac @{thms analz_mono_contra})
    17.8 +  REPEAT1 o (dresolve_tac ctxt @{thms analz_mono_contra})
    17.9    THEN' mp_tac ctxt
   17.10  *}
   17.11  
   17.12 @@ -333,7 +333,7 @@
   17.13  fun synth_analz_mono_contra_tac ctxt = 
   17.14    rtac @{thm syan_impI} THEN'
   17.15    REPEAT1 o 
   17.16 -    (dresolve_tac 
   17.17 +    (dresolve_tac ctxt
   17.18       [@{thm knows_Spy_subset_knows_Spy_Says} RS @{thm synth_analz_mono} RS @{thm contra_subsetD},
   17.19        @{thm knows_Spy_subset_knows_Spy_Notes} RS @{thm synth_analz_mono} RS @{thm contra_subsetD},
   17.20        @{thm knows_Spy_subset_knows_Spy_Gets} RS @{thm synth_analz_mono} RS @{thm contra_subsetD}])
    18.1 --- a/src/Doc/Tutorial/Protocol/Message.thy	Tue Feb 10 14:29:36 2015 +0100
    18.2 +++ b/src/Doc/Tutorial/Protocol/Message.thy	Tue Feb 10 14:48:26 2015 +0100
    18.3 @@ -837,13 +837,13 @@
    18.4  *)
    18.5  fun impOfSubs th = th RSN (2, @{thm rev_subsetD})
    18.6  
    18.7 -val Fake_insert_tac = 
    18.8 -    dresolve_tac [impOfSubs Fake_analz_insert,
    18.9 +fun Fake_insert_tac ctxt =
   18.10 +    dresolve_tac ctxt [impOfSubs Fake_analz_insert,
   18.11                    impOfSubs Fake_parts_insert] THEN'
   18.12 -    eresolve_tac [asm_rl, @{thm synth.Inj}];
   18.13 +    eresolve_tac ctxt [asm_rl, @{thm synth.Inj}];
   18.14  
   18.15  fun Fake_insert_simp_tac ctxt i = 
   18.16 -  REPEAT (Fake_insert_tac i) THEN asm_full_simp_tac ctxt i;
   18.17 +  REPEAT (Fake_insert_tac ctxt i) THEN asm_full_simp_tac ctxt i;
   18.18  
   18.19  fun atomic_spy_analz_tac ctxt =
   18.20    SELECT_GOAL
   18.21 @@ -859,7 +859,7 @@
   18.22             (res_inst_tac ctxt [(("x", 1), "X")] (insert_commute RS ssubst) 1),
   18.23         (*...allowing further simplifications*)
   18.24         simp_tac ctxt 1,
   18.25 -       REPEAT (FIRSTGOAL (resolve_tac [allI,impI,notI,conjI,iffI])),
   18.26 +       REPEAT (FIRSTGOAL (resolve_tac ctxt [allI,impI,notI,conjI,iffI])),
   18.27         DEPTH_SOLVE (atomic_spy_analz_tac ctxt 1)]) i);
   18.28  *}
   18.29  
    19.1 --- a/src/Doc/Tutorial/Protocol/Public.thy	Tue Feb 10 14:29:36 2015 +0100
    19.2 +++ b/src/Doc/Tutorial/Protocol/Public.thy	Tue Feb 10 14:48:26 2015 +0100
    19.3 @@ -162,7 +162,7 @@
    19.4      (ALLGOALS (simp_tac (ctxt delsimps [used_Says]))
    19.5       THEN
    19.6       REPEAT_FIRST (eq_assume_tac ORELSE' 
    19.7 -                   resolve_tac [refl, conjI, @{thm Nonce_supply}]));
    19.8 +                   resolve_tac ctxt [refl, conjI, @{thm Nonce_supply}]));
    19.9  *}
   19.10  
   19.11  method_setup possibility = {* Scan.succeed (SIMPLE_METHOD o possibility_tac) *}
    20.1 --- a/src/FOL/IFOL.thy	Tue Feb 10 14:29:36 2015 +0100
    20.2 +++ b/src/FOL/IFOL.thy	Tue Feb 10 14:48:26 2015 +0100
    20.3 @@ -208,8 +208,8 @@
    20.4  
    20.5  (*Finds P-->Q and P in the assumptions, replaces implication by Q *)
    20.6  ML {*
    20.7 -  fun mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  atac i
    20.8 -  fun eq_mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  eq_assume_tac i
    20.9 +  fun mp_tac i = eresolve0_tac [@{thm notE}, @{thm impE}] i  THEN  atac i
   20.10 +  fun eq_mp_tac i = eresolve0_tac [@{thm notE}, @{thm impE}] i  THEN  eq_assume_tac i
   20.11  *}
   20.12  
   20.13  
   20.14 @@ -305,8 +305,8 @@
   20.15  (*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
   20.16  ML {*
   20.17    fun iff_tac prems i =
   20.18 -    resolve_tac (prems RL @{thms iffE}) i THEN
   20.19 -    REPEAT1 (eresolve_tac [@{thm asm_rl}, @{thm mp}] i)
   20.20 +    resolve0_tac (prems RL @{thms iffE}) i THEN
   20.21 +    REPEAT1 (eresolve0_tac [@{thm asm_rl}, @{thm mp}] i)
   20.22  *}
   20.23  
   20.24  lemma conj_cong:
    21.1 --- a/src/FOL/ex/Miniscope.thy	Tue Feb 10 14:29:36 2015 +0100
    21.2 +++ b/src/FOL/ex/Miniscope.thy	Tue Feb 10 14:48:26 2015 +0100
    21.3 @@ -65,7 +65,8 @@
    21.4  
    21.5  ML {*
    21.6  val mini_ss = simpset_of (@{context} addsimps @{thms mini_simps});
    21.7 -fun mini_tac ctxt = resolve_tac @{thms ccontr} THEN' asm_full_simp_tac (put_simpset mini_ss ctxt);
    21.8 +fun mini_tac ctxt =
    21.9 +  resolve_tac ctxt @{thms ccontr} THEN' asm_full_simp_tac (put_simpset mini_ss ctxt);
   21.10  *}
   21.11  
   21.12  end
    22.1 --- a/src/FOL/ex/Prolog.thy	Tue Feb 10 14:29:36 2015 +0100
    22.2 +++ b/src/FOL/ex/Prolog.thy	Tue Feb 10 14:48:26 2015 +0100
    22.3 @@ -63,26 +63,29 @@
    22.4  
    22.5  (*backtracking version*)
    22.6  ML {*
    22.7 -val prolog_tac = DEPTH_FIRST (has_fewer_prems 1) (resolve_tac (@{thms rules}) 1)
    22.8 +fun prolog_tac ctxt =
    22.9 +  DEPTH_FIRST (has_fewer_prems 1) (resolve_tac ctxt @{thms rules} 1)
   22.10  *}
   22.11  
   22.12  schematic_lemma "rev(?x, a:b:c:Nil)"
   22.13 -apply (tactic prolog_tac)
   22.14 +apply (tactic \<open>prolog_tac @{context}\<close>)
   22.15  done
   22.16  
   22.17  schematic_lemma "rev(a:?x:c:?y:Nil, d:?z:b:?u)"
   22.18 -apply (tactic prolog_tac)
   22.19 +apply (tactic \<open>prolog_tac @{context}\<close>)
   22.20  done
   22.21  
   22.22  (*rev([a..p], ?w) requires 153 inferences *)
   22.23  schematic_lemma "rev(a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:Nil, ?w)"
   22.24 -apply (tactic {* DEPTH_SOLVE (resolve_tac ([@{thm refl}, @{thm conjI}] @ @{thms rules}) 1) *})
   22.25 +apply (tactic {*
   22.26 +  DEPTH_SOLVE (resolve_tac @{context} ([@{thm refl}, @{thm conjI}] @ @{thms rules}) 1) *})
   22.27  done
   22.28  
   22.29  (*?x has 16, ?y has 32;  rev(?y,?w) requires 561 (rather large) inferences
   22.30    total inferences = 2 + 1 + 17 + 561 = 581*)
   22.31  schematic_lemma "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:Nil = ?x & app(?x,?x,?y) & rev(?y,?w)"
   22.32 -apply (tactic {* DEPTH_SOLVE (resolve_tac ([@{thm refl}, @{thm conjI}] @ @{thms rules}) 1) *})
   22.33 +apply (tactic {*
   22.34 +  DEPTH_SOLVE (resolve_tac @{context} ([@{thm refl}, @{thm conjI}] @ @{thms rules}) 1) *})
   22.35  done
   22.36  
   22.37  end
    23.1 --- a/src/FOL/intprover.ML	Tue Feb 10 14:29:36 2015 +0100
    23.2 +++ b/src/FOL/intprover.ML	Tue Feb 10 14:48:26 2015 +0100
    23.3 @@ -76,12 +76,14 @@
    23.4  (*These steps could instantiate variables and are therefore unsafe.*)
    23.5  fun inst_step_tac ctxt =
    23.6    assume_tac ctxt APPEND' mp_tac APPEND' 
    23.7 -  biresolve_tac (safe0_brls @ safep_brls);
    23.8 +  biresolve_tac ctxt (safe0_brls @ safep_brls);
    23.9  
   23.10  (*One safe or unsafe step. *)
   23.11 -fun step_tac ctxt i = FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac haz_brls i];
   23.12 +fun step_tac ctxt i =
   23.13 +  FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac ctxt haz_brls i];
   23.14  
   23.15 -fun step_dup_tac ctxt i = FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac haz_dup_brls i];
   23.16 +fun step_dup_tac ctxt i =
   23.17 +  FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac ctxt haz_dup_brls i];
   23.18  
   23.19  (*Dumb but fast*)
   23.20  fun fast_tac ctxt = SELECT_GOAL (DEPTH_SOLVE (step_tac ctxt 1));
    24.1 --- a/src/FOL/simpdata.ML	Tue Feb 10 14:29:36 2015 +0100
    24.2 +++ b/src/FOL/simpdata.ML	Tue Feb 10 14:48:26 2015 +0100
    24.3 @@ -23,7 +23,7 @@
    24.4  (*Replace premises x=y, X<->Y by X==Y*)
    24.5  fun mk_meta_prems ctxt =
    24.6      rule_by_tactic ctxt
    24.7 -      (REPEAT_FIRST (resolve_tac [@{thm meta_eq_to_obj_eq}, @{thm def_imp_iff}]));
    24.8 +      (REPEAT_FIRST (resolve_tac ctxt [@{thm meta_eq_to_obj_eq}, @{thm def_imp_iff}]));
    24.9  
   24.10  (*Congruence rules for = or <-> (instead of ==)*)
   24.11  fun mk_meta_cong ctxt rl =
   24.12 @@ -107,9 +107,9 @@
   24.13  val triv_rls = [@{thm TrueI}, @{thm refl}, reflexive_thm, @{thm iff_refl}, @{thm notFalseI}];
   24.14  
   24.15  fun unsafe_solver ctxt =
   24.16 -  FIRST' [resolve_tac (triv_rls @ Simplifier.prems_of ctxt),
   24.17 +  FIRST' [resolve_tac ctxt (triv_rls @ Simplifier.prems_of ctxt),
   24.18      assume_tac ctxt,
   24.19 -    eresolve_tac @{thms FalseE}];
   24.20 +    eresolve_tac ctxt @{thms FalseE}];
   24.21  
   24.22  (*No premature instantiation of variables during simplification*)
   24.23  fun safe_solver ctxt =
    25.1 --- a/src/FOLP/FOLP.thy	Tue Feb 10 14:29:36 2015 +0100
    25.2 +++ b/src/FOLP/FOLP.thy	Tue Feb 10 14:48:26 2015 +0100
    25.3 @@ -57,7 +57,7 @@
    25.4    shows "?p : R"
    25.5    apply (rule excluded_middle [THEN disjE])
    25.6     apply (tactic {* DEPTH_SOLVE (atac 1 ORELSE
    25.7 -       resolve_tac [@{thm r1}, @{thm r2}, @{thm major} RS @{thm mp}] 1) *})
    25.8 +       resolve_tac @{context} [@{thm r1}, @{thm r2}, @{thm major} RS @{thm mp}] 1) *})
    25.9    done
   25.10  
   25.11  (*Double negation law*)
   25.12 @@ -81,8 +81,8 @@
   25.13    apply (unfold iff_def)
   25.14    apply (rule conjE)
   25.15    apply (tactic {* DEPTH_SOLVE_1 (etac @{thm impCE} 1 ORELSE
   25.16 -      eresolve_tac [@{thm notE}, @{thm impE}] 1 THEN atac 1 ORELSE atac 1 ORELSE
   25.17 -      resolve_tac [@{thm r1}, @{thm r2}] 1) *})+
   25.18 +      eresolve_tac @{context} [@{thm notE}, @{thm impE}] 1 THEN atac 1 ORELSE atac 1 ORELSE
   25.19 +      resolve_tac @{context} [@{thm r1}, @{thm r2}] 1) *})+
   25.20    done
   25.21  
   25.22  
    26.1 --- a/src/FOLP/IFOLP.thy	Tue Feb 10 14:29:36 2015 +0100
    26.2 +++ b/src/FOLP/IFOLP.thy	Tue Feb 10 14:48:26 2015 +0100
    26.3 @@ -273,13 +273,13 @@
    26.4  (*Finds P-->Q and P in the assumptions, replaces implication by Q *)
    26.5  ML {*
    26.6    fun mp_tac ctxt i =
    26.7 -    eresolve_tac [@{thm notE}, make_elim @{thm mp}] i  THEN  assume_tac ctxt i
    26.8 +    eresolve_tac ctxt [@{thm notE}, make_elim @{thm mp}] i  THEN  assume_tac ctxt i
    26.9  *}
   26.10  
   26.11  (*Like mp_tac but instantiates no variables*)
   26.12  ML {*
   26.13    fun int_uniq_mp_tac ctxt i =
   26.14 -    eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  uniq_assume_tac ctxt i
   26.15 +    eresolve_tac ctxt [@{thm notE}, @{thm impE}] i  THEN  uniq_assume_tac ctxt i
   26.16  *}
   26.17  
   26.18  
   26.19 @@ -361,8 +361,8 @@
   26.20  (*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
   26.21  ML {*
   26.22  fun iff_tac prems i =
   26.23 -    resolve_tac (prems RL [@{thm iffE}]) i THEN
   26.24 -    REPEAT1 (eresolve_tac [asm_rl, @{thm mp}] i)
   26.25 +    resolve0_tac (prems RL [@{thm iffE}]) i THEN
   26.26 +    REPEAT1 (eresolve0_tac [asm_rl, @{thm mp}] i)
   26.27  *}
   26.28  
   26.29  schematic_lemma conj_cong:
   26.30 @@ -503,17 +503,20 @@
   26.31  
   26.32  schematic_lemma pred1_cong: "p:a=a' ==> ?p:P(a) <-> P(a')"
   26.33    apply (rule iffI)
   26.34 -   apply (tactic {* DEPTH_SOLVE (atac 1 ORELSE eresolve_tac [@{thm subst}, @{thm ssubst}] 1) *})
   26.35 +   apply (tactic {*
   26.36 +     DEPTH_SOLVE (atac 1 ORELSE eresolve_tac @{context} [@{thm subst}, @{thm ssubst}] 1) *})
   26.37    done
   26.38  
   26.39  schematic_lemma pred2_cong: "[| p:a=a';  q:b=b' |] ==> ?p:P(a,b) <-> P(a',b')"
   26.40    apply (rule iffI)
   26.41 -   apply (tactic {* DEPTH_SOLVE (atac 1 ORELSE eresolve_tac [@{thm subst}, @{thm ssubst}] 1) *})
   26.42 +   apply (tactic {*
   26.43 +     DEPTH_SOLVE (atac 1 ORELSE eresolve_tac @{context} [@{thm subst}, @{thm ssubst}] 1) *})
   26.44    done
   26.45  
   26.46  schematic_lemma pred3_cong: "[| p:a=a';  q:b=b';  r:c=c' |] ==> ?p:P(a,b,c) <-> P(a',b',c')"
   26.47    apply (rule iffI)
   26.48 -   apply (tactic {* DEPTH_SOLVE (atac 1 ORELSE eresolve_tac [@{thm subst}, @{thm ssubst}] 1) *})
   26.49 +   apply (tactic {*
   26.50 +     DEPTH_SOLVE (atac 1 ORELSE eresolve_tac @{context} [@{thm subst}, @{thm ssubst}] 1) *})
   26.51    done
   26.52  
   26.53  lemmas pred_congs = pred1_cong pred2_cong pred3_cong
   26.54 @@ -541,7 +544,7 @@
   26.55      and minor: "!!x y.[| x:P-->S; y:Q-->S |] ==> q(x,y):R"
   26.56    shows "?p:R"
   26.57    apply (tactic {* DEPTH_SOLVE (atac 1 ORELSE
   26.58 -      resolve_tac [@{thm disjI1}, @{thm disjI2}, @{thm impI},
   26.59 +      resolve_tac @{context} [@{thm disjI1}, @{thm disjI2}, @{thm impI},
   26.60          @{thm major} RS @{thm mp}, @{thm minor}] 1) *})
   26.61    done
   26.62  
    27.1 --- a/src/FOLP/classical.ML	Tue Feb 10 14:29:36 2015 +0100
    27.2 +++ b/src/FOLP/classical.ML	Tue Feb 10 14:48:26 2015 +0100
    27.3 @@ -73,7 +73,7 @@
    27.4  fun contr_tac ctxt = etac not_elim THEN'  assume_tac ctxt;
    27.5  
    27.6  (*Finds P-->Q and P in the assumptions, replaces implication by Q *)
    27.7 -fun mp_tac ctxt i = eresolve_tac ([not_elim,imp_elim]) i  THEN  assume_tac ctxt i;
    27.8 +fun mp_tac ctxt i = eresolve_tac ctxt ([not_elim,imp_elim]) i  THEN  assume_tac ctxt i;
    27.9  
   27.10  (*Like mp_tac but instantiates no variables*)
   27.11  fun uniq_mp_tac ctxt i = ematch_tac ctxt ([not_elim,imp_elim]) i  THEN  uniq_assume_tac ctxt i;
   27.12 @@ -151,9 +151,9 @@
   27.13  fun safe_step_tac ctxt (CS{safe0_brls,safep_brls,...}) = 
   27.14    FIRST' [uniq_assume_tac ctxt,
   27.15            uniq_mp_tac ctxt,
   27.16 -          biresolve_tac safe0_brls,
   27.17 +          biresolve_tac ctxt safe0_brls,
   27.18            FIRST' hyp_subst_tacs,
   27.19 -          biresolve_tac safep_brls] ;
   27.20 +          biresolve_tac ctxt safep_brls] ;
   27.21  
   27.22  (*Repeatedly attack subgoals using safe inferences*)
   27.23  fun safe_tac ctxt cs = DETERM (REPEAT_FIRST (safe_step_tac ctxt cs));
   27.24 @@ -165,7 +165,7 @@
   27.25  fun step_tac ctxt (cs as (CS{haz_brls,...})) i = 
   27.26    FIRST [safe_tac ctxt cs,
   27.27           inst_step_tac ctxt i,
   27.28 -         biresolve_tac haz_brls i];
   27.29 +         biresolve_tac ctxt haz_brls i];
   27.30  
   27.31  (*** The following tactics all fail unless they solve one goal ***)
   27.32  
   27.33 @@ -179,7 +179,7 @@
   27.34  (*Using a "safe" rule to instantiate variables is unsafe.  This tactic
   27.35    allows backtracking from "safe" rules to "unsafe" rules here.*)
   27.36  fun slow_step_tac ctxt (cs as (CS{haz_brls,...})) i = 
   27.37 -    safe_tac ctxt cs ORELSE (assume_tac ctxt i APPEND biresolve_tac haz_brls i);
   27.38 +    safe_tac ctxt cs ORELSE (assume_tac ctxt i APPEND biresolve_tac ctxt haz_brls i);
   27.39  
   27.40  end; 
   27.41  end;
    28.1 --- a/src/FOLP/intprover.ML	Tue Feb 10 14:29:36 2015 +0100
    28.2 +++ b/src/FOLP/intprover.ML	Tue Feb 10 14:48:26 2015 +0100
    28.3 @@ -54,9 +54,9 @@
    28.4  (*Attack subgoals using safe inferences*)
    28.5  fun safe_step_tac ctxt = FIRST' [uniq_assume_tac ctxt,
    28.6                              int_uniq_mp_tac ctxt,
    28.7 -                            biresolve_tac safe0_brls,
    28.8 +                            biresolve_tac ctxt safe0_brls,
    28.9                              hyp_subst_tac,
   28.10 -                            biresolve_tac safep_brls] ;
   28.11 +                            biresolve_tac ctxt safep_brls] ;
   28.12  
   28.13  (*Repeatedly attack subgoals using safe inferences*)
   28.14  fun safe_tac ctxt = DETERM (REPEAT_FIRST (safe_step_tac ctxt));
   28.15 @@ -65,7 +65,7 @@
   28.16  fun inst_step_tac ctxt = assume_tac ctxt APPEND' mp_tac ctxt;
   28.17  
   28.18  (*One safe or unsafe step. *)
   28.19 -fun step_tac ctxt i = FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac haz_brls i];
   28.20 +fun step_tac ctxt i = FIRST [safe_tac ctxt, inst_step_tac ctxt i, biresolve_tac ctxt haz_brls i];
   28.21  
   28.22  (*Dumb but fast*)
   28.23  fun fast_tac ctxt = SELECT_GOAL (DEPTH_SOLVE (step_tac ctxt 1));
    29.1 --- a/src/FOLP/simp.ML	Tue Feb 10 14:29:36 2015 +0100
    29.2 +++ b/src/FOLP/simp.ML	Tue Feb 10 14:48:26 2015 +0100
    29.3 @@ -75,12 +75,12 @@
    29.4    rewrite rules are not ordered.*)
    29.5  fun net_tac net =
    29.6    SUBGOAL(fn (prem,i) =>
    29.7 -          resolve_tac (Net.unify_term net (Logic.strip_assums_concl prem)) i);
    29.8 +          resolve0_tac (Net.unify_term net (Logic.strip_assums_concl prem)) i);
    29.9  
   29.10  (*match subgoal i against possible theorems indexed by lhs in the net*)
   29.11  fun lhs_net_tac net =
   29.12    SUBGOAL(fn (prem,i) =>
   29.13 -          biresolve_tac (Net.unify_term net
   29.14 +          biresolve0_tac (Net.unify_term net
   29.15                         (lhs_of (Logic.strip_assums_concl prem))) i);
   29.16  
   29.17  fun nth_subgoal i thm = nth (prems_of thm) (i - 1);
   29.18 @@ -119,7 +119,7 @@
   29.19  fun lhs_is_NORM(thm,i) = case lhs_of_eq i thm of
   29.20          Const(s,_)$_ => member (op =) norms s | _ => false;
   29.21  
   29.22 -val refl_tac = resolve_tac refl_thms;
   29.23 +val refl_tac = resolve0_tac refl_thms;
   29.24  
   29.25  fun find_res thms thm =
   29.26      let fun find [] = error "Check Simp_Data"
   29.27 @@ -138,7 +138,7 @@
   29.28          SOME(thm',_) => thm'
   29.29        | NONE => raise THM("Simplifier: could not continue", 0, [thm]);
   29.30  
   29.31 -fun res1(thm,thms,i) = one_result(resolve_tac thms i,thm);
   29.32 +fun res1(thm,thms,i) = one_result(resolve0_tac thms i,thm);
   29.33  
   29.34  
   29.35  (**** Adding "NORM" tags ****)
   29.36 @@ -204,10 +204,10 @@
   29.37      fun norm_step_tac st = st |>
   29.38           (case head_of(rhs_of_eq 1 st) of
   29.39              Var(ixn,_) => if member (op =) hvs ixn then refl1_tac
   29.40 -                          else resolve_tac normI_thms 1 ORELSE refl1_tac
   29.41 -          | Const _ => resolve_tac normI_thms 1 ORELSE
   29.42 -                       resolve_tac congs 1 ORELSE refl1_tac
   29.43 -          | Free _ => resolve_tac congs 1 ORELSE refl1_tac
   29.44 +                          else resolve0_tac normI_thms 1 ORELSE refl1_tac
   29.45 +          | Const _ => resolve0_tac normI_thms 1 ORELSE
   29.46 +                       resolve0_tac congs 1 ORELSE refl1_tac
   29.47 +          | Free _ => resolve0_tac congs 1 ORELSE refl1_tac
   29.48            | _ => refl1_tac)
   29.49      val add_norm_tac = DEPTH_FIRST (has_fewer_prems nops) norm_step_tac
   29.50      val SOME(thm'',_) = Seq.pull(add_norm_tac thm')
    30.1 --- a/src/HOL/Auth/Event.thy	Tue Feb 10 14:29:36 2015 +0100
    30.2 +++ b/src/HOL/Auth/Event.thy	Tue Feb 10 14:48:26 2015 +0100
    30.3 @@ -272,7 +272,7 @@
    30.4  {*
    30.5  fun analz_mono_contra_tac ctxt = 
    30.6    rtac @{thm analz_impI} THEN' 
    30.7 -  REPEAT1 o (dresolve_tac @{thms analz_mono_contra})
    30.8 +  REPEAT1 o (dresolve_tac ctxt @{thms analz_mono_contra})
    30.9    THEN' (mp_tac ctxt)
   30.10  *}
   30.11  
   30.12 @@ -289,7 +289,7 @@
   30.13  fun synth_analz_mono_contra_tac ctxt = 
   30.14    rtac @{thm syan_impI} THEN'
   30.15    REPEAT1 o 
   30.16 -    (dresolve_tac 
   30.17 +    (dresolve_tac ctxt
   30.18       [@{thm knows_Spy_subset_knows_Spy_Says} RS @{thm synth_analz_mono} RS @{thm contra_subsetD},
   30.19        @{thm knows_Spy_subset_knows_Spy_Notes} RS @{thm synth_analz_mono} RS @{thm contra_subsetD},
   30.20        @{thm knows_Spy_subset_knows_Spy_Gets} RS @{thm synth_analz_mono} RS @{thm contra_subsetD}])
    31.1 --- a/src/HOL/Auth/Message.thy	Tue Feb 10 14:29:36 2015 +0100
    31.2 +++ b/src/HOL/Auth/Message.thy	Tue Feb 10 14:48:26 2015 +0100
    31.3 @@ -845,13 +845,13 @@
    31.4  (*Apply rules to break down assumptions of the form
    31.5    Y \<in> parts(insert X H)  and  Y \<in> analz(insert X H)
    31.6  *)
    31.7 -val Fake_insert_tac = 
    31.8 -    dresolve_tac [impOfSubs @{thm Fake_analz_insert},
    31.9 +fun Fake_insert_tac ctxt = 
   31.10 +    dresolve_tac ctxt [impOfSubs @{thm Fake_analz_insert},
   31.11                    impOfSubs @{thm Fake_parts_insert}] THEN'
   31.12 -    eresolve_tac [asm_rl, @{thm synth.Inj}];
   31.13 +    eresolve_tac ctxt [asm_rl, @{thm synth.Inj}];
   31.14  
   31.15  fun Fake_insert_simp_tac ctxt i = 
   31.16 -  REPEAT (Fake_insert_tac i) THEN asm_full_simp_tac ctxt i;
   31.17 +  REPEAT (Fake_insert_tac ctxt i) THEN asm_full_simp_tac ctxt i;
   31.18  
   31.19  fun atomic_spy_analz_tac ctxt =
   31.20    SELECT_GOAL
   31.21 @@ -869,7 +869,7 @@
   31.22             (res_inst_tac ctxt [(("x", 1), "X")] (insert_commute RS ssubst) 1),
   31.23         (*...allowing further simplifications*)
   31.24         simp_tac ctxt 1,
   31.25 -       REPEAT (FIRSTGOAL (resolve_tac [allI,impI,notI,conjI,iffI])),
   31.26 +       REPEAT (FIRSTGOAL (resolve_tac ctxt [allI,impI,notI,conjI,iffI])),
   31.27         DEPTH_SOLVE (atomic_spy_analz_tac ctxt 1)]) i);
   31.28  *}
   31.29  
    32.1 --- a/src/HOL/Auth/OtwayReesBella.thy	Tue Feb 10 14:29:36 2015 +0100
    32.2 +++ b/src/HOL/Auth/OtwayReesBella.thy	Tue Feb 10 14:48:26 2015 +0100
    32.3 @@ -126,14 +126,14 @@
    32.4  
    32.5  ML
    32.6  {*
    32.7 -fun parts_explicit_tac i = 
    32.8 -    forward_tac [@{thm Oops_parts_knows_Spy}] (i+7) THEN
    32.9 -    forward_tac [@{thm OR4_parts_knows_Spy}]  (i+6) THEN
   32.10 -    forward_tac [@{thm OR2_parts_knows_Spy}]  (i+4)
   32.11 +fun parts_explicit_tac ctxt i =
   32.12 +    forward_tac ctxt [@{thm Oops_parts_knows_Spy}] (i+7) THEN
   32.13 +    forward_tac ctxt [@{thm OR4_parts_knows_Spy}]  (i+6) THEN
   32.14 +    forward_tac ctxt [@{thm OR2_parts_knows_Spy}]  (i+4)
   32.15  *}
   32.16   
   32.17  method_setup parts_explicit = {*
   32.18 -    Scan.succeed (K (SIMPLE_METHOD' parts_explicit_tac)) *}
   32.19 +    Scan.succeed (SIMPLE_METHOD' o parts_explicit_tac) *}
   32.20    "to explicitly state that some message components belong to parts knows Spy"
   32.21  
   32.22  
   32.23 @@ -249,7 +249,7 @@
   32.24  method_setup analz_freshCryptK = {*
   32.25      Scan.succeed (fn ctxt =>
   32.26       (SIMPLE_METHOD
   32.27 -      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
   32.28 +      (EVERY [REPEAT_FIRST (resolve_tac ctxt [allI, ballI, impI]),
   32.29            REPEAT_FIRST (rtac @{thm analz_image_freshCryptK_lemma}),
   32.30            ALLGOALS (asm_simp_tac
   32.31              (put_simpset OtwayReesBella.analz_image_freshK_ss ctxt))]))) *}
   32.32 @@ -259,7 +259,7 @@
   32.33  method_setup disentangle = {*
   32.34      Scan.succeed
   32.35       (fn ctxt => SIMPLE_METHOD
   32.36 -      (REPEAT_FIRST (eresolve_tac [asm_rl, conjE, disjE] 
   32.37 +      (REPEAT_FIRST (eresolve_tac ctxt [asm_rl, conjE, disjE] 
   32.38                     ORELSE' hyp_subst_tac ctxt))) *}
   32.39    "for eliminating conjunctions, disjunctions and the like"
   32.40  
    33.1 --- a/src/HOL/Auth/Public.thy	Tue Feb 10 14:29:36 2015 +0100
    33.2 +++ b/src/HOL/Auth/Public.thy	Tue Feb 10 14:48:26 2015 +0100
    33.3 @@ -417,7 +417,7 @@
    33.4      (ALLGOALS (simp_tac (ctxt setSolver safe_solver delsimps [@{thm used_Says}]))
    33.5       THEN
    33.6       REPEAT_FIRST (eq_assume_tac ORELSE' 
    33.7 -                   resolve_tac [refl, conjI, @{thm Nonce_supply}]))
    33.8 +                   resolve_tac ctxt [refl, conjI, @{thm Nonce_supply}]))
    33.9  
   33.10  (*For harder protocols (such as Recur) where we have to set up some
   33.11    nonces and keys initially*)
   33.12 @@ -425,7 +425,7 @@
   33.13      REPEAT 
   33.14      (ALLGOALS (asm_simp_tac (ctxt setSolver safe_solver))
   33.15       THEN
   33.16 -     REPEAT_FIRST (resolve_tac [refl, conjI]))
   33.17 +     REPEAT_FIRST (resolve_tac ctxt [refl, conjI]))
   33.18  
   33.19  end
   33.20  *}
   33.21 @@ -433,7 +433,7 @@
   33.22  method_setup analz_freshK = {*
   33.23      Scan.succeed (fn ctxt =>
   33.24       (SIMPLE_METHOD
   33.25 -      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
   33.26 +      (EVERY [REPEAT_FIRST (resolve_tac ctxt [allI, ballI, impI]),
   33.27            REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
   33.28            ALLGOALS (asm_simp_tac (put_simpset Public.analz_image_freshK_ss ctxt))]))) *}
   33.29      "for proving the Session Key Compromise theorem"
    34.1 --- a/src/HOL/Auth/Shared.thy	Tue Feb 10 14:29:36 2015 +0100
    34.2 +++ b/src/HOL/Auth/Shared.thy	Tue Feb 10 14:48:26 2015 +0100
    34.3 @@ -205,7 +205,7 @@
    34.4            setSolver safe_solver))
    34.5       THEN
    34.6       REPEAT_FIRST (eq_assume_tac ORELSE' 
    34.7 -                   resolve_tac [refl, conjI, @{thm Nonce_supply}])))
    34.8 +                   resolve_tac ctxt [refl, conjI, @{thm Nonce_supply}])))
    34.9  
   34.10  (*For harder protocols (such as Recur) where we have to set up some
   34.11    nonces and keys initially*)
   34.12 @@ -213,7 +213,7 @@
   34.13      REPEAT 
   34.14      (ALLGOALS (asm_simp_tac (ctxt setSolver safe_solver))
   34.15       THEN
   34.16 -     REPEAT_FIRST (resolve_tac [refl, conjI]))
   34.17 +     REPEAT_FIRST (resolve_tac ctxt [refl, conjI]))
   34.18  
   34.19  
   34.20  val analz_image_freshK_ss =
   34.21 @@ -237,7 +237,7 @@
   34.22  method_setup analz_freshK = {*
   34.23      Scan.succeed (fn ctxt =>
   34.24       (SIMPLE_METHOD
   34.25 -      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
   34.26 +      (EVERY [REPEAT_FIRST (resolve_tac ctxt [allI, ballI, impI]),
   34.27            REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
   34.28            ALLGOALS (asm_simp_tac (put_simpset Shared.analz_image_freshK_ss ctxt))]))) *}
   34.29      "for proving the Session Key Compromise theorem"
    35.1 --- a/src/HOL/Auth/Smartcard/ShoupRubin.thy	Tue Feb 10 14:29:36 2015 +0100
    35.2 +++ b/src/HOL/Auth/Smartcard/ShoupRubin.thy	Tue Feb 10 14:48:26 2015 +0100
    35.3 @@ -736,32 +736,32 @@
    35.4  structure ShoupRubin =
    35.5  struct
    35.6  
    35.7 -val prepare_tac = 
    35.8 - (*SR8*)   forward_tac [@{thm Outpts_B_Card_form_7}] 14 THEN
    35.9 -           eresolve_tac [exE] 15 THEN eresolve_tac [exE] 15 THEN 
   35.10 - (*SR9*)   forward_tac [@{thm Outpts_A_Card_form_4}] 16 THEN 
   35.11 - (*SR11*)  forward_tac [@{thm Outpts_A_Card_form_10}] 21 THEN
   35.12 -           eresolve_tac [exE] 22 THEN eresolve_tac [exE] 22
   35.13 +fun prepare_tac ctxt = 
   35.14 + (*SR8*)   forward_tac ctxt [@{thm Outpts_B_Card_form_7}] 14 THEN
   35.15 +           eresolve_tac ctxt [exE] 15 THEN eresolve_tac ctxt [exE] 15 THEN 
   35.16 + (*SR9*)   forward_tac ctxt [@{thm Outpts_A_Card_form_4}] 16 THEN 
   35.17 + (*SR11*)  forward_tac ctxt [@{thm Outpts_A_Card_form_10}] 21 THEN
   35.18 +           eresolve_tac ctxt [exE] 22 THEN eresolve_tac ctxt [exE] 22
   35.19  
   35.20  fun parts_prepare_tac ctxt = 
   35.21 -           prepare_tac THEN
   35.22 - (*SR9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 18 THEN 
   35.23 - (*SR9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 19 THEN 
   35.24 - (*Oops1*) dresolve_tac [@{thm Outpts_B_Card_form_7}] 25    THEN               
   35.25 - (*Oops2*) dresolve_tac [@{thm Outpts_A_Card_form_10}] 27 THEN                
   35.26 +           prepare_tac ctxt THEN
   35.27 + (*SR9*)   dresolve_tac ctxt [@{thm Gets_imp_knows_Spy_parts_Snd}] 18 THEN 
   35.28 + (*SR9*)   dresolve_tac ctxt [@{thm Gets_imp_knows_Spy_parts_Snd}] 19 THEN 
   35.29 + (*Oops1*) dresolve_tac ctxt [@{thm Outpts_B_Card_form_7}] 25    THEN               
   35.30 + (*Oops2*) dresolve_tac ctxt [@{thm Outpts_A_Card_form_10}] 27 THEN                
   35.31   (*Base*)  (force_tac ctxt) 1
   35.32  
   35.33  fun analz_prepare_tac ctxt =
   35.34 -         prepare_tac THEN
   35.35 +         prepare_tac ctxt THEN
   35.36           dtac @{thm Gets_imp_knows_Spy_analz_Snd} 18 THEN 
   35.37   (*SR9*) dtac @{thm Gets_imp_knows_Spy_analz_Snd} 19 THEN 
   35.38 -         REPEAT_FIRST (eresolve_tac [asm_rl, conjE] ORELSE' hyp_subst_tac ctxt)
   35.39 +         REPEAT_FIRST (eresolve_tac ctxt [asm_rl, conjE] ORELSE' hyp_subst_tac ctxt)
   35.40  
   35.41  end
   35.42  *}
   35.43  
   35.44  method_setup prepare = {*
   35.45 -    Scan.succeed (K (SIMPLE_METHOD ShoupRubin.prepare_tac)) *}
   35.46 +    Scan.succeed (SIMPLE_METHOD o ShoupRubin.prepare_tac) *}
   35.47    "to launch a few simple facts that will help the simplifier"
   35.48  
   35.49  method_setup parts_prepare = {*
   35.50 @@ -817,7 +817,7 @@
   35.51      Scan.succeed (fn ctxt =>
   35.52       (SIMPLE_METHOD
   35.53        (EVERY [REPEAT_FIRST
   35.54 -       (resolve_tac [allI, ballI, impI]),
   35.55 +       (resolve_tac ctxt [allI, ballI, impI]),
   35.56          REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
   35.57          ALLGOALS (asm_simp_tac (put_simpset Smartcard.analz_image_freshK_ss ctxt
   35.58            addsimps [@{thm knows_Spy_Inputs_secureM_sr_Spy},
    36.1 --- a/src/HOL/Auth/Smartcard/ShoupRubinBella.thy	Tue Feb 10 14:29:36 2015 +0100
    36.2 +++ b/src/HOL/Auth/Smartcard/ShoupRubinBella.thy	Tue Feb 10 14:48:26 2015 +0100
    36.3 @@ -747,24 +747,24 @@
    36.4  struct
    36.5  
    36.6  fun prepare_tac ctxt = 
    36.7 - (*SR_U8*)   forward_tac [@{thm Outpts_B_Card_form_7}] 14 THEN
    36.8 + (*SR_U8*)   forward_tac ctxt [@{thm Outpts_B_Card_form_7}] 14 THEN
    36.9   (*SR_U8*)   clarify_tac ctxt 15 THEN
   36.10 - (*SR_U9*)   forward_tac [@{thm Outpts_A_Card_form_4}] 16 THEN 
   36.11 - (*SR_U11*)  forward_tac [@{thm Outpts_A_Card_form_10}] 21 
   36.12 + (*SR_U9*)   forward_tac ctxt [@{thm Outpts_A_Card_form_4}] 16 THEN 
   36.13 + (*SR_U11*)  forward_tac ctxt [@{thm Outpts_A_Card_form_10}] 21 
   36.14  
   36.15  fun parts_prepare_tac ctxt = 
   36.16             prepare_tac ctxt THEN
   36.17 - (*SR_U9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 18 THEN 
   36.18 - (*SR_U9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 19 THEN 
   36.19 - (*Oops1*) dresolve_tac [@{thm Outpts_B_Card_form_7}] 25    THEN               
   36.20 - (*Oops2*) dresolve_tac [@{thm Outpts_A_Card_form_10}] 27 THEN                
   36.21 + (*SR_U9*)   dresolve_tac ctxt [@{thm Gets_imp_knows_Spy_parts_Snd}] 18 THEN 
   36.22 + (*SR_U9*)   dresolve_tac ctxt [@{thm Gets_imp_knows_Spy_parts_Snd}] 19 THEN 
   36.23 + (*Oops1*) dresolve_tac ctxt [@{thm Outpts_B_Card_form_7}] 25    THEN               
   36.24 + (*Oops2*) dresolve_tac ctxt [@{thm Outpts_A_Card_form_10}] 27 THEN                
   36.25   (*Base*)  (force_tac ctxt) 1
   36.26  
   36.27  fun analz_prepare_tac ctxt = 
   36.28           prepare_tac ctxt THEN
   36.29           dtac (@{thm Gets_imp_knows_Spy_analz_Snd}) 18 THEN 
   36.30   (*SR_U9*) dtac (@{thm Gets_imp_knows_Spy_analz_Snd}) 19 THEN 
   36.31 -         REPEAT_FIRST (eresolve_tac [asm_rl, conjE] ORELSE' hyp_subst_tac ctxt)
   36.32 +         REPEAT_FIRST (eresolve_tac ctxt [asm_rl, conjE] ORELSE' hyp_subst_tac ctxt)
   36.33  
   36.34  end
   36.35  *}
   36.36 @@ -826,7 +826,7 @@
   36.37  method_setup sc_analz_freshK = {*
   36.38      Scan.succeed (fn ctxt =>
   36.39       (SIMPLE_METHOD
   36.40 -      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
   36.41 +      (EVERY [REPEAT_FIRST (resolve_tac ctxt [allI, ballI, impI]),
   36.42            REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
   36.43            ALLGOALS (asm_simp_tac (put_simpset Smartcard.analz_image_freshK_ss ctxt
   36.44                addsimps [@{thm knows_Spy_Inputs_secureM_srb_Spy},
    37.1 --- a/src/HOL/Auth/Smartcard/Smartcard.thy	Tue Feb 10 14:29:36 2015 +0100
    37.2 +++ b/src/HOL/Auth/Smartcard/Smartcard.thy	Tue Feb 10 14:48:26 2015 +0100
    37.3 @@ -374,7 +374,7 @@
    37.4        setSolver safe_solver))
    37.5       THEN
    37.6       REPEAT_FIRST (eq_assume_tac ORELSE' 
    37.7 -                   resolve_tac [refl, conjI, @{thm Nonce_supply}])))
    37.8 +                   resolve_tac ctxt [refl, conjI, @{thm Nonce_supply}])))
    37.9  
   37.10  (*For harder protocols (such as Recur) where we have to set up some
   37.11    nonces and keys initially*)
   37.12 @@ -382,7 +382,7 @@
   37.13      REPEAT 
   37.14      (ALLGOALS (asm_simp_tac (ctxt setSolver safe_solver))
   37.15       THEN
   37.16 -     REPEAT_FIRST (resolve_tac [refl, conjI]))
   37.17 +     REPEAT_FIRST (resolve_tac ctxt [refl, conjI]))
   37.18  
   37.19  val analz_image_freshK_ss = 
   37.20    simpset_of
   37.21 @@ -403,7 +403,7 @@
   37.22  method_setup analz_freshK = {*
   37.23      Scan.succeed (fn ctxt =>
   37.24       (SIMPLE_METHOD
   37.25 -      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
   37.26 +      (EVERY [REPEAT_FIRST (resolve_tac ctxt [allI, ballI, impI]),
   37.27            REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
   37.28            ALLGOALS (asm_simp_tac (put_simpset Smartcard.analz_image_freshK_ss ctxt))]))) *}
   37.29      "for proving the Session Key Compromise theorem"
    38.1 --- a/src/HOL/Bali/AxExample.thy	Tue Feb 10 14:29:36 2015 +0100
    38.2 +++ b/src/HOL/Bali/AxExample.thy	Tue Feb 10 14:48:26 2015 +0100
    38.3 @@ -46,9 +46,9 @@
    38.4      SOME i => Rule_Insts.instantiate_tac ctxt [((s, i), t)] xs st
    38.5    | NONE => Seq.empty);
    38.6  
    38.7 -val ax_tac =
    38.8 +fun ax_tac ctxt =
    38.9    REPEAT o rtac allI THEN'
   38.10 -  resolve_tac (@{thm ax_Skip} :: @{thm ax_StatRef} :: @{thm ax_MethdN} :: @{thm ax_Alloc} ::
   38.11 +  resolve_tac ctxt (@{thm ax_Skip} :: @{thm ax_StatRef} :: @{thm ax_MethdN} :: @{thm ax_Alloc} ::
   38.12      @{thm ax_Alloc_Arr} :: @{thm ax_SXAlloc_Normal} :: @{thms ax_derivs.intros(8-)});
   38.13  *}
   38.14  
   38.15 @@ -58,11 +58,11 @@
   38.16    .test [Class Base]. 
   38.17    {\<lambda>Y s Z. abrupt s = Some (Xcpt (Std IndOutBound))}"
   38.18  apply (unfold test_def arr_viewed_from_def)
   38.19 -apply (tactic "ax_tac 1" (*;;*))
   38.20 +apply (tactic "ax_tac @{context} 1" (*;;*))
   38.21  defer (* We begin with the last assertion, to synthesise the intermediate
   38.22           assertions, like in the fashion of the weakest
   38.23           precondition. *)
   38.24 -apply  (tactic "ax_tac 1" (* Try *))
   38.25 +apply  (tactic "ax_tac @{context} 1" (* Try *))
   38.26  defer
   38.27  apply    (tactic {* inst1_tac @{context} "Q" 
   38.28                   "\<lambda>Y s Z. arr_inv (snd s) \<and> tprg,s\<turnstile>catch SXcpt NullPointer" [] *})
   38.29 @@ -74,26 +74,26 @@
   38.30  apply   (rule_tac Q' = "(\<lambda>Y s Z. ?Q Y s Z)\<leftarrow>=False\<down>=\<diamondsuit>" in conseq2)
   38.31  prefer 2
   38.32  apply    simp
   38.33 -apply   (tactic "ax_tac 1" (* While *))
   38.34 +apply   (tactic "ax_tac @{context} 1" (* While *))
   38.35  prefer 2
   38.36  apply    (rule ax_impossible [THEN conseq1], clarsimp)
   38.37  apply   (rule_tac P' = "Normal ?P" in conseq1)
   38.38  prefer 2
   38.39  apply    clarsimp
   38.40 -apply   (tactic "ax_tac 1")
   38.41 -apply   (tactic "ax_tac 1" (* AVar *))
   38.42 +apply   (tactic "ax_tac @{context} 1")
   38.43 +apply   (tactic "ax_tac @{context} 1" (* AVar *))
   38.44  prefer 2
   38.45  apply    (rule ax_subst_Val_allI)
   38.46  apply    (tactic {* inst1_tac @{context} "P'" "\<lambda>a. Normal (PP a\<leftarrow>x)" ["PP", "x"] *})
   38.47  apply    (simp del: avar_def2 peek_and_def2)
   38.48 -apply    (tactic "ax_tac 1")
   38.49 -apply   (tactic "ax_tac 1")
   38.50 +apply    (tactic "ax_tac @{context} 1")
   38.51 +apply   (tactic "ax_tac @{context} 1")
   38.52        (* just for clarification: *)
   38.53  apply   (rule_tac Q' = "Normal (\<lambda>Var:(v, f) u ua. fst (snd (avar tprg (Intg 2) v u)) = Some (Xcpt (Std IndOutBound)))" in conseq2)
   38.54  prefer 2
   38.55  apply    (clarsimp simp add: split_beta)
   38.56 -apply   (tactic "ax_tac 1" (* FVar *))
   38.57 -apply    (tactic "ax_tac 2" (* StatRef *))
   38.58 +apply   (tactic "ax_tac @{context} 1" (* FVar *))
   38.59 +apply    (tactic "ax_tac @{context} 2" (* StatRef *))
   38.60  apply   (rule ax_derivs.Done [THEN conseq1])
   38.61  apply   (clarsimp simp add: arr_inv_def inited_def in_bounds_def)
   38.62  defer
   38.63 @@ -101,20 +101,20 @@
   38.64  apply  (rule_tac Q' = "(\<lambda>Y (x, s) Z. x = Some (Xcpt (Std NullPointer)) \<and> arr_inv s) \<and>. heap_free two" in conseq2)
   38.65  prefer 2
   38.66  apply   (simp add: arr_inv_new_obj)
   38.67 -apply  (tactic "ax_tac 1") 
   38.68 +apply  (tactic "ax_tac @{context} 1") 
   38.69  apply  (rule_tac C = "Ext" in ax_Call_known_DynT)
   38.70  apply     (unfold DynT_prop_def)
   38.71  apply     (simp (no_asm))
   38.72  apply    (intro strip)
   38.73  apply    (rule_tac P' = "Normal ?P" in conseq1)
   38.74 -apply     (tactic "ax_tac 1" (* Methd *))
   38.75 +apply     (tactic "ax_tac @{context} 1" (* Methd *))
   38.76  apply     (rule ax_thin [OF _ empty_subsetI])
   38.77  apply     (simp (no_asm) add: body_def2)
   38.78 -apply     (tactic "ax_tac 1" (* Body *))
   38.79 +apply     (tactic "ax_tac @{context} 1" (* Body *))
   38.80  (* apply       (rule_tac [2] ax_derivs.Abrupt) *)
   38.81  defer
   38.82  apply      (simp (no_asm))
   38.83 -apply      (tactic "ax_tac 1") (* Comp *)
   38.84 +apply      (tactic "ax_tac @{context} 1") (* Comp *)
   38.85              (* The first statement in the  composition 
   38.86                   ((Ext)z).vee = 1; Return Null 
   38.87                  will throw an exception (since z is null). So we can handle
   38.88 @@ -122,7 +122,7 @@
   38.89  apply       (rule_tac [2] ax_derivs.Abrupt)
   38.90               
   38.91  apply      (rule ax_derivs.Expr) (* Expr *)
   38.92 -apply      (tactic "ax_tac 1") (* Ass *)
   38.93 +apply      (tactic "ax_tac @{context} 1") (* Ass *)
   38.94  prefer 2
   38.95  apply       (rule ax_subst_Var_allI)
   38.96  apply       (tactic {* inst1_tac @{context} "P'" "\<lambda>a vs l vf. PP a vs l vf\<leftarrow>x \<and>. p" ["PP", "x", "p"] *})
   38.97 @@ -130,9 +130,9 @@
   38.98  apply       (tactic {* simp_tac (@{context} delloop "split_all_tac" delsimps [@{thm peek_and_def2}, @{thm heap_def2}, @{thm subst_res_def2}, @{thm normal_def2}]) 1 *})
   38.99  apply       (rule ax_derivs.Abrupt)
  38.100  apply      (simp (no_asm))
  38.101 -apply      (tactic "ax_tac 1" (* FVar *))
  38.102 -apply       (tactic "ax_tac 2", tactic "ax_tac 2", tactic "ax_tac 2")
  38.103 -apply      (tactic "ax_tac 1")
  38.104 +apply      (tactic "ax_tac @{context} 1" (* FVar *))
  38.105 +apply       (tactic "ax_tac @{context} 2", tactic "ax_tac @{context} 2", tactic "ax_tac @{context} 2")
  38.106 +apply      (tactic "ax_tac @{context} 1")
  38.107  apply     (tactic {* inst1_tac @{context} "R" "\<lambda>a'. Normal ((\<lambda>Vals:vs (x, s) Z. arr_inv s \<and> inited Ext (globs s) \<and> a' \<noteq> Null \<and> vs = [Null]) \<and>. heap_free two)" [] *})
  38.108  apply     fastforce
  38.109  prefer 4
  38.110 @@ -140,15 +140,15 @@
  38.111  apply   (rule ax_subst_Val_allI)
  38.112  apply   (tactic {* inst1_tac @{context} "P'" "\<lambda>a. Normal (PP a\<leftarrow>x)" ["PP", "x"] *})
  38.113  apply   (simp (no_asm) del: peek_and_def2 heap_free_def2 normal_def2 o_apply)
  38.114 -apply   (tactic "ax_tac 1")
  38.115 +apply   (tactic "ax_tac @{context} 1")
  38.116  prefer 2
  38.117  apply   (rule ax_subst_Val_allI)
  38.118  apply    (tactic {* inst1_tac @{context} "P'" "\<lambda>aa v. Normal (QQ aa v\<leftarrow>y)" ["QQ", "y"] *})
  38.119  apply    (simp del: peek_and_def2 heap_free_def2 normal_def2)
  38.120 -apply    (tactic "ax_tac 1")
  38.121 -apply   (tactic "ax_tac 1")
  38.122 -apply  (tactic "ax_tac 1")
  38.123 -apply  (tactic "ax_tac 1")
  38.124 +apply    (tactic "ax_tac @{context} 1")
  38.125 +apply   (tactic "ax_tac @{context} 1")
  38.126 +apply  (tactic "ax_tac @{context} 1")
  38.127 +apply  (tactic "ax_tac @{context} 1")
  38.128  (* end method call *)
  38.129  apply (simp (no_asm))
  38.130      (* just for clarification: *)
  38.131 @@ -158,14 +158,14 @@
  38.132    in conseq2)
  38.133  prefer 2
  38.134  apply  clarsimp
  38.135 -apply (tactic "ax_tac 1")
  38.136 -apply (tactic "ax_tac 1")
  38.137 +apply (tactic "ax_tac @{context} 1")
  38.138 +apply (tactic "ax_tac @{context} 1")
  38.139  defer
  38.140  apply  (rule ax_subst_Var_allI)
  38.141  apply  (tactic {* inst1_tac @{context} "P'" "\<lambda>vf. Normal (PP vf \<and>. p)" ["PP", "p"] *})
  38.142  apply  (simp (no_asm) del: split_paired_All peek_and_def2 initd_def2 heap_free_def2 normal_def2)
  38.143 -apply  (tactic "ax_tac 1" (* NewC *))
  38.144 -apply  (tactic "ax_tac 1" (* ax_Alloc *))
  38.145 +apply  (tactic "ax_tac @{context} 1" (* NewC *))
  38.146 +apply  (tactic "ax_tac @{context} 1" (* ax_Alloc *))
  38.147       (* just for clarification: *)
  38.148  apply  (rule_tac Q' = "Normal ((\<lambda>Y s Z. arr_inv (store s) \<and> vf=lvar (VName e) (store s)) \<and>. heap_free three \<and>. initd Ext)" in conseq2)
  38.149  prefer 2
  38.150 @@ -187,19 +187,19 @@
  38.151  apply    (rule allI)
  38.152  apply    (rule_tac P' = "Normal ?P" in conseq1)
  38.153  apply     (tactic {* simp_tac (@{context} delloop "split_all_tac") 1 *})
  38.154 -apply     (tactic "ax_tac 1")
  38.155 -apply     (tactic "ax_tac 1")
  38.156 +apply     (tactic "ax_tac @{context} 1")
  38.157 +apply     (tactic "ax_tac @{context} 1")
  38.158  apply     (rule_tac [2] ax_subst_Var_allI)
  38.159  apply      (tactic {* inst1_tac @{context} "P'" "\<lambda>vf l vfa. Normal (P vf l vfa)" ["P"] *})
  38.160  apply     (tactic {* simp_tac (@{context} delloop "split_all_tac" delsimps [@{thm split_paired_All}, @{thm peek_and_def2}, @{thm heap_free_def2}, @{thm initd_def2}, @{thm normal_def2}, @{thm supd_lupd}]) 2 *})
  38.161 -apply      (tactic "ax_tac 2" (* NewA *))
  38.162 -apply       (tactic "ax_tac 3" (* ax_Alloc_Arr *))
  38.163 -apply       (tactic "ax_tac 3")
  38.164 +apply      (tactic "ax_tac @{context} 2" (* NewA *))
  38.165 +apply       (tactic "ax_tac @{context} 3" (* ax_Alloc_Arr *))
  38.166 +apply       (tactic "ax_tac @{context} 3")
  38.167  apply      (tactic {* inst1_tac @{context} "P" "\<lambda>vf l vfa. Normal (P vf l vfa\<leftarrow>\<diamondsuit>)" ["P"] *})
  38.168  apply      (tactic {* simp_tac (@{context} delloop "split_all_tac") 2 *})
  38.169 -apply      (tactic "ax_tac 2")
  38.170 -apply     (tactic "ax_tac 1" (* FVar *))
  38.171 -apply      (tactic "ax_tac 2" (* StatRef *))
  38.172 +apply      (tactic "ax_tac @{context} 2")
  38.173 +apply     (tactic "ax_tac @{context} 1" (* FVar *))
  38.174 +apply      (tactic "ax_tac @{context} 2" (* StatRef *))
  38.175  apply     (rule ax_derivs.Done [THEN conseq1])
  38.176  apply     (tactic {* inst1_tac @{context} "Q" "\<lambda>vf. Normal ((\<lambda>Y s Z. vf=lvar (VName e) (snd s)) \<and>. heap_free four \<and>. initd Base \<and>. initd Ext)" [] *})
  38.177  apply     (clarsimp split del: split_if)
  38.178 @@ -217,7 +217,7 @@
  38.179  apply  clarsimp
  38.180       (* end init *)
  38.181  apply (rule conseq1)
  38.182 -apply (tactic "ax_tac 1")
  38.183 +apply (tactic "ax_tac @{context} 1")
  38.184  apply clarsimp
  38.185  done
  38.186  
  38.187 @@ -234,36 +234,36 @@
  38.188          (Expr (Ass (LVar i) (Acc (LVar j))))). {Q}"
  38.189  apply (rule_tac P' = "Q" and Q' = "Q\<leftarrow>=False\<down>=\<diamondsuit>" in conseq12)
  38.190  apply  safe
  38.191 -apply  (tactic "ax_tac 1" (* Loop *))
  38.192 +apply  (tactic "ax_tac @{context} 1" (* Loop *))
  38.193  apply   (rule ax_Normal_cases)
  38.194  prefer 2
  38.195  apply    (rule ax_derivs.Abrupt [THEN conseq1], clarsimp simp add: Let_def)
  38.196  apply   (rule conseq1)
  38.197 -apply    (tactic "ax_tac 1")
  38.198 +apply    (tactic "ax_tac @{context} 1")
  38.199  apply   clarsimp
  38.200  prefer 2
  38.201  apply  clarsimp
  38.202 -apply (tactic "ax_tac 1" (* If *))
  38.203 +apply (tactic "ax_tac @{context} 1" (* If *))
  38.204  apply  (tactic 
  38.205    {* inst1_tac @{context} "P'" "Normal (\<lambda>s.. (\<lambda>Y s Z. True)\<down>=Val (the (locals s i)))" [] *})
  38.206 -apply  (tactic "ax_tac 1")
  38.207 +apply  (tactic "ax_tac @{context} 1")
  38.208  apply  (rule conseq1)
  38.209 -apply   (tactic "ax_tac 1")
  38.210 +apply   (tactic "ax_tac @{context} 1")
  38.211  apply  clarsimp
  38.212  apply (rule allI)
  38.213  apply (rule ax_escape)
  38.214  apply auto
  38.215  apply  (rule conseq1)
  38.216 -apply   (tactic "ax_tac 1" (* Throw *))
  38.217 -apply   (tactic "ax_tac 1")
  38.218 -apply   (tactic "ax_tac 1")
  38.219 +apply   (tactic "ax_tac @{context} 1" (* Throw *))
  38.220 +apply   (tactic "ax_tac @{context} 1")
  38.221 +apply   (tactic "ax_tac @{context} 1")
  38.222  apply  clarsimp
  38.223  apply (rule_tac Q' = "Normal (\<lambda>Y s Z. True)" in conseq2)
  38.224  prefer 2
  38.225  apply  clarsimp
  38.226  apply (rule conseq1)
  38.227 -apply  (tactic "ax_tac 1")
  38.228 -apply  (tactic "ax_tac 1")
  38.229 +apply  (tactic "ax_tac @{context} 1")
  38.230 +apply  (tactic "ax_tac @{context} 1")
  38.231  prefer 2
  38.232  apply   (rule ax_subst_Var_allI)
  38.233  apply   (tactic {* inst1_tac @{context} "P'" "\<lambda>b Y ba Z vf. \<lambda>Y (x,s) Z. x=None \<and> snd vf = snd (lvar i s)" [] *})
  38.234 @@ -271,11 +271,11 @@
  38.235  apply   (rule_tac P' = "Normal ?P" in conseq1)
  38.236  prefer 2
  38.237  apply    clarsimp
  38.238 -apply   (tactic "ax_tac 1")
  38.239 +apply   (tactic "ax_tac @{context} 1")
  38.240  apply   (rule conseq1)
  38.241 -apply    (tactic "ax_tac 1")
  38.242 +apply    (tactic "ax_tac @{context} 1")
  38.243  apply   clarsimp
  38.244 -apply  (tactic "ax_tac 1")
  38.245 +apply  (tactic "ax_tac @{context} 1")
  38.246  apply clarsimp
  38.247  done
  38.248  
    39.1 --- a/src/HOL/Bali/AxSem.thy	Tue Feb 10 14:29:36 2015 +0100
    39.2 +++ b/src/HOL/Bali/AxSem.thy	Tue Feb 10 14:48:26 2015 +0100
    39.3 @@ -672,7 +672,7 @@
    39.4  (* 37 subgoals *)
    39.5  prefer 18 (* Methd *)
    39.6  apply (rule ax_derivs.Methd, drule spec, erule mp, fast) 
    39.7 -apply (tactic {* TRYALL (resolve_tac ((funpow 5 tl) @{thms ax_derivs.intros})) *})
    39.8 +apply (tactic {* TRYALL (resolve_tac @{context} ((funpow 5 tl) @{thms ax_derivs.intros})) *})
    39.9  apply auto
   39.10  done
   39.11  
   39.12 @@ -691,7 +691,7 @@
   39.13   "G,(A::'a triple set)|\<turnstile>(ts'::'a triple set) \<Longrightarrow> !ts. ts \<subseteq> ts' \<longrightarrow> G,A|\<turnstile>ts"
   39.14  apply (erule ax_derivs.induct)
   39.15  (*42 subgoals*)
   39.16 -apply       (tactic "ALLGOALS strip_tac")
   39.17 +apply       (tactic "ALLGOALS (strip_tac @{context})")
   39.18  apply       (tactic {* ALLGOALS(REPEAT o (EVERY'[dtac @{thm subset_singletonD},
   39.19           etac disjE, fast_tac (@{context} addSIs @{thms ax_derivs.empty})]))*})
   39.20  apply       (tactic "TRYALL (hyp_subst_tac @{context})")
   39.21 @@ -703,7 +703,7 @@
   39.22  apply   (fast intro: ax_derivs.weaken)
   39.23  apply  (rule ax_derivs.conseq, clarify, tactic "smp_tac @{context} 3 1", blast(* unused *))
   39.24  (*37 subgoals*)
   39.25 -apply (tactic {* TRYALL (resolve_tac ((funpow 5 tl) @{thms ax_derivs.intros}) 
   39.26 +apply (tactic {* TRYALL (resolve_tac @{context} ((funpow 5 tl) @{thms ax_derivs.intros})
   39.27                     THEN_ALL_NEW fast_tac @{context}) *})
   39.28  (*1 subgoal*)
   39.29  apply (clarsimp simp add: subset_mtriples_iff)
    40.1 --- a/src/HOL/Bali/Basis.thy	Tue Feb 10 14:29:36 2015 +0100
    40.2 +++ b/src/HOL/Bali/Basis.thy	Tue Feb 10 14:48:26 2015 +0100
    40.3 @@ -9,7 +9,7 @@
    40.4  
    40.5  subsubsection "misc"
    40.6  
    40.7 -ML {* fun strip_tac i = REPEAT (resolve_tac [impI, allI] i) *}
    40.8 +ML {* fun strip_tac ctxt i = REPEAT (resolve_tac ctxt [impI, allI] i) *}
    40.9  
   40.10  declare split_if_asm  [split] option.split [split] option.split_asm [split]
   40.11  setup {* map_theory_simpset (fn ctxt => ctxt addloop ("split_all_tac", split_all_tac)) *}
    41.1 --- a/src/HOL/Bali/Eval.thy	Tue Feb 10 14:29:36 2015 +0100
    41.2 +++ b/src/HOL/Bali/Eval.thy	Tue Feb 10 14:48:26 2015 +0100
    41.3 @@ -1163,7 +1163,7 @@
    41.4    "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w, s') \<Longrightarrow> (\<forall>w' s''. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w', s'') \<longrightarrow> w' = w \<and> s'' = s')"
    41.5  apply (erule eval_induct)
    41.6  apply (tactic {* ALLGOALS (EVERY'
    41.7 -      [strip_tac, rotate_tac ~1, eresolve_tac @{thms eval_elim_cases}]) *})
    41.8 +      [strip_tac @{context}, rotate_tac ~1, eresolve_tac @{context} @{thms eval_elim_cases}]) *})
    41.9  (* 31 subgoals *)
   41.10  prefer 28 (* Try *) 
   41.11  apply (simp (no_asm_use) only: split add: split_if_asm)
    42.1 --- a/src/HOL/Bali/Evaln.thy	Tue Feb 10 14:29:36 2015 +0100
    42.2 +++ b/src/HOL/Bali/Evaln.thy	Tue Feb 10 14:48:26 2015 +0100
    42.3 @@ -448,9 +448,9 @@
    42.4  lemma evaln_nonstrict [rule_format (no_asm), elim]: 
    42.5    "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (w, s') \<Longrightarrow> \<forall>m. n\<le>m \<longrightarrow> G\<turnstile>s \<midarrow>t\<succ>\<midarrow>m\<rightarrow> (w, s')"
    42.6  apply (erule evaln.induct)
    42.7 -apply (tactic {* ALLGOALS (EVERY'[strip_tac, TRY o etac @{thm Suc_le_D_lemma},
    42.8 +apply (tactic {* ALLGOALS (EVERY' [strip_tac @{context}, TRY o etac @{thm Suc_le_D_lemma},
    42.9    REPEAT o smp_tac @{context} 1, 
   42.10 -  resolve_tac @{thms evaln.intros} THEN_ALL_NEW TRY o atac]) *})
   42.11 +  resolve_tac @{context} @{thms evaln.intros} THEN_ALL_NEW TRY o atac]) *})
   42.12  (* 3 subgoals *)
   42.13  apply (auto split del: split_if)
   42.14  done
    43.1 --- a/src/HOL/Bali/WellType.thy	Tue Feb 10 14:29:36 2015 +0100
    43.2 +++ b/src/HOL/Bali/WellType.thy	Tue Feb 10 14:48:26 2015 +0100
    43.3 @@ -665,7 +665,7 @@
    43.4      thin_tac @{context} "?E,dt\<Turnstile>e2\<Colon>-?T2"] i
    43.5    else thin_tac @{context} "All ?P" i) *})
    43.6  (*apply (safe del: disjE elim!: wt_elim_cases)*)
    43.7 -apply (tactic {*ALLGOALS (eresolve_tac @{thms wt_elim_cases})*})
    43.8 +apply (tactic {*ALLGOALS (eresolve_tac @{context} @{thms wt_elim_cases})*})
    43.9  apply (simp_all (no_asm_use) split del: split_if_asm)
   43.10  apply (erule_tac [12] V = "All ?P" in thin_rl) (* Call *)
   43.11  apply (blast del: equalityCE dest: sym [THEN trans])+
    44.1 --- a/src/HOL/Datatype_Examples/Stream_Processor.thy	Tue Feb 10 14:29:36 2015 +0100
    44.2 +++ b/src/HOL/Datatype_Examples/Stream_Processor.thy	Tue Feb 10 14:48:26 2015 +0100
    44.3 @@ -136,7 +136,7 @@
    44.4        BNF_Util.CONJ_WRAP' (K (rtac @{thm subset_UNIV})) ks, rtac @{thm relcomppI}, atac,
    44.5        rtac @{thm conversepI}, rtac @{thm GrpI}, rtac refl, rtac CollectI,
    44.6        BNF_Util.CONJ_WRAP' (K (rtac @{thm subset_UNIV})) ks,
    44.7 -      REPEAT_DETERM o eresolve_tac @{thms relcomppE conversepE GrpE},
    44.8 +      REPEAT_DETERM o eresolve_tac @{context} @{thms relcomppE conversepE GrpE},
    44.9        hyp_subst_tac @{context}, atac])
   44.10    end
   44.11  *})
    45.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Tue Feb 10 14:29:36 2015 +0100
    45.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Tue Feb 10 14:48:26 2015 +0100
    45.3 @@ -3699,7 +3699,7 @@
    45.4                        etac @{thm meta_eqE},
    45.5                        rtac @{thm impI}] i)
    45.6        THEN Subgoal.FOCUS (fn {prems, ...} => reorder_bounds_tac prems i) ctxt i
    45.7 -      THEN DETERM (TRY (filter_prems_tac (K false) i))
    45.8 +      THEN DETERM (TRY (filter_prems_tac ctxt (K false) i))
    45.9        THEN DETERM (Reification.tac ctxt form_equations NONE i)
   45.10        THEN rewrite_interpret_form_tac ctxt prec splitting taylor i
   45.11        THEN gen_eval_tac (approximation_conv ctxt) ctxt i))
    46.1 --- a/src/HOL/Decision_Procs/approximation.ML	Tue Feb 10 14:29:36 2015 +0100
    46.2 +++ b/src/HOL/Decision_Procs/approximation.ML	Tue Feb 10 14:48:26 2015 +0100
    46.3 @@ -100,7 +100,7 @@
    46.4  fun prepare_form ctxt term = apply_tactic ctxt term (
    46.5      REPEAT (FIRST' [etac @{thm intervalE}, etac @{thm meta_eqE}, rtac @{thm impI}] 1)
    46.6      THEN Subgoal.FOCUS (fn {prems, ...} => reorder_bounds_tac prems 1) ctxt 1
    46.7 -    THEN DETERM (TRY (filter_prems_tac (K false) 1)))
    46.8 +    THEN DETERM (TRY (filter_prems_tac ctxt (K false) 1)))
    46.9  
   46.10  fun reify_form ctxt term = apply_tactic ctxt term
   46.11     (Reification.tac ctxt form_equations NONE 1)
    47.1 --- a/src/HOL/Fun.thy	Tue Feb 10 14:29:36 2015 +0100
    47.2 +++ b/src/HOL/Fun.thy	Tue Feb 10 14:48:26 2015 +0100
    47.3 @@ -839,8 +839,8 @@
    47.4        | (T, SOME rhs) =>
    47.5            SOME (Goal.prove ctxt [] [] (Logic.mk_equals (t, rhs))
    47.6              (fn _ =>
    47.7 -              resolve_tac [eq_reflection] 1 THEN
    47.8 -              resolve_tac @{thms ext} 1 THEN
    47.9 +              resolve_tac ctxt [eq_reflection] 1 THEN
   47.10 +              resolve_tac ctxt @{thms ext} 1 THEN
   47.11                simp_tac (put_simpset ss ctxt) 1))
   47.12      end
   47.13  in proc end
    48.1 --- a/src/HOL/HOL.thy	Tue Feb 10 14:29:36 2015 +0100
    48.2 +++ b/src/HOL/HOL.thy	Tue Feb 10 14:48:26 2015 +0100
    48.3 @@ -905,7 +905,7 @@
    48.4  apply (rule ex1E [OF major])
    48.5  apply (rule prem)
    48.6  apply (tactic {* ares_tac @{thms allI} 1 *})+
    48.7 -apply (tactic {* eresolve_tac [Classical.dup_elim NONE @{thm allE}] 1 *})
    48.8 +apply (tactic {* eresolve_tac @{context} [Classical.dup_elim NONE @{thm allE}] 1 *})
    48.9  apply iprover
   48.10  done
   48.11  
   48.12 @@ -1822,7 +1822,7 @@
   48.13  proof
   48.14    assume "PROP ?ofclass"
   48.15    show "PROP ?equal"
   48.16 -    by (tactic {* ALLGOALS (resolve_tac [Thm.unconstrainT @{thm eq_equal}]) *})
   48.17 +    by (tactic {* ALLGOALS (resolve_tac @{context} [Thm.unconstrainT @{thm eq_equal}]) *})
   48.18        (fact `PROP ?ofclass`)
   48.19  next
   48.20    assume "PROP ?equal"
   48.21 @@ -1923,7 +1923,7 @@
   48.22        let val conv = Code_Runtime.dynamic_holds_conv ctxt
   48.23        in
   48.24          CONVERSION (Conv.params_conv ~1 (K (Conv.concl_conv ~1 conv)) ctxt) THEN'
   48.25 -        resolve_tac [TrueI]
   48.26 +        resolve_tac ctxt [TrueI]
   48.27        end
   48.28    in
   48.29      Scan.succeed (SIMPLE_METHOD' o eval_tac)
   48.30 @@ -1935,7 +1935,7 @@
   48.31      SIMPLE_METHOD'
   48.32        (CHANGED_PROP o
   48.33          (CONVERSION (Nbe.dynamic_conv ctxt)
   48.34 -          THEN_ALL_NEW (TRY o resolve_tac [TrueI]))))
   48.35 +          THEN_ALL_NEW (TRY o resolve_tac ctxt [TrueI]))))
   48.36  *} "solve goal by normalization"
   48.37  
   48.38  
   48.39 @@ -1975,7 +1975,7 @@
   48.40      val filter_right = filter (not o wrong_prem o HOLogic.dest_Trueprop o hd o Thm.prems_of);
   48.41    in
   48.42      fun smp i = funpow i (fn m => filter_right ([spec] RL m)) ([mp]);
   48.43 -    fun smp_tac ctxt j = EVERY'[dresolve_tac (smp j), assume_tac ctxt];
   48.44 +    fun smp_tac ctxt j = EVERY' [dresolve_tac ctxt (smp j), assume_tac ctxt];
   48.45    end;
   48.46  
   48.47    local
    49.1 --- a/src/HOL/HOLCF/IOA/NTP/Impl.thy	Tue Feb 10 14:29:36 2015 +0100
    49.2 +++ b/src/HOL/HOLCF/IOA/NTP/Impl.thy	Tue Feb 10 14:48:26 2015 +0100
    49.3 @@ -208,19 +208,19 @@
    49.4    txt {* 10 - 7 *}
    49.5    apply (tactic "EVERY1 [tac2,tac2,tac2,tac2]")
    49.6    txt {* 6 *}
    49.7 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv1_def}]
    49.8 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
    49.9                                 (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1 *})
   49.10  
   49.11    txt {* 6 - 5 *}
   49.12    apply (tactic "EVERY1 [tac2,tac2]")
   49.13  
   49.14    txt {* 4 *}
   49.15 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.16 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.17                                  (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1 *})
   49.18    apply (tactic "tac2 1")
   49.19  
   49.20    txt {* 3 *}
   49.21 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.22 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.23      (@{thm raw_inv1} RS @{thm invariantE})] 1 *})
   49.24  
   49.25    apply (tactic "tac2 1")
   49.26 @@ -230,7 +230,7 @@
   49.27  
   49.28    txt {* 2 *}
   49.29    apply (tactic "tac2 1")
   49.30 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.31 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.32                                 (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1 *})
   49.33    apply (intro strip)
   49.34    apply (erule conjE)+
   49.35 @@ -238,7 +238,7 @@
   49.36  
   49.37    txt {* 1 *}
   49.38    apply (tactic "tac2 1")
   49.39 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.40 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
   49.41                                 (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct2] 1 *})
   49.42    apply (intro strip)
   49.43    apply (erule conjE)+
   49.44 @@ -287,13 +287,13 @@
   49.45    apply (intro strip, (erule conjE)+)
   49.46    apply (rule imp_disjL [THEN iffD1])
   49.47    apply (rule impI)
   49.48 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.49 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.50      (@{thm raw_inv2} RS @{thm invariantE})] 1 *})
   49.51    apply simp
   49.52    apply (erule conjE)+
   49.53    apply (rule_tac j = "count (ssent (sen s)) (~sbit (sen s))" and
   49.54      k = "count (rsent (rec s)) (sbit (sen s))" in le_trans)
   49.55 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm inv1_def}]
   49.56 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm inv1_def}]
   49.57                                  (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct2] 1 *})
   49.58    apply (simp add: hdr_sum_def Multiset.count_def)
   49.59    apply (rule add_le_mono)
   49.60 @@ -308,7 +308,7 @@
   49.61    apply (intro strip, (erule conjE)+)
   49.62    apply (rule imp_disjL [THEN iffD1])
   49.63    apply (rule impI)
   49.64 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.65 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.66      (@{thm raw_inv2} RS @{thm invariantE})] 1 *})
   49.67    apply simp
   49.68    done
   49.69 @@ -334,7 +334,7 @@
   49.70    txt {* 2 b *}
   49.71  
   49.72    apply (intro strip, (erule conjE)+)
   49.73 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.74 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.75                                 (@{thm raw_inv2} RS @{thm invariantE})] 1 *})
   49.76    apply simp
   49.77  
   49.78 @@ -342,9 +342,9 @@
   49.79    apply (tactic "tac4 1")
   49.80    apply (intro strip, (erule conjE)+)
   49.81    apply (rule ccontr)
   49.82 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.83 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
   49.84                                 (@{thm raw_inv2} RS @{thm invariantE})] 1 *})
   49.85 -  apply (tactic {* forward_tac [rewrite_rule @{context} [@{thm Impl.inv3_def}]
   49.86 +  apply (tactic {* forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv3_def}]
   49.87                                 (@{thm raw_inv3} RS @{thm invariantE})] 1 *})
   49.88    apply simp
   49.89    apply (rename_tac m, erule_tac x = "m" in allE)
    50.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_constructors.ML	Tue Feb 10 14:29:36 2015 +0100
    50.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_constructors.ML	Tue Feb 10 14:48:26 2015 +0100
    50.3 @@ -244,9 +244,9 @@
    50.4        let
    50.5          val rules = @{thms compact_sinl compact_sinr compact_spair
    50.6                             compact_up compact_ONE}
    50.7 -        val tacs =
    50.8 +        fun tacs ctxt =
    50.9            [rtac (iso_locale RS @{thm iso.compact_abs}) 1,
   50.10 -           REPEAT (resolve_tac rules 1 ORELSE atac 1)]
   50.11 +           REPEAT (resolve_tac ctxt rules 1 ORELSE atac 1)]
   50.12          fun con_compact (con, args) =
   50.13            let
   50.14              val vs = vars_of args
   50.15 @@ -255,7 +255,7 @@
   50.16              val assms = map (mk_trp o mk_compact) vs
   50.17              val goal = Logic.list_implies (assms, concl)
   50.18            in
   50.19 -            prove thy con_betas goal (K tacs)
   50.20 +            prove thy con_betas goal (tacs o #context)
   50.21            end
   50.22        in
   50.23          map con_compact spec'
   50.24 @@ -500,8 +500,8 @@
   50.25          val defs = case_beta :: map mk_meta_eq [rep_strict, @{thm cfcomp2}]
   50.26          val goal = mk_trp (mk_strict case_app)
   50.27          val rules = @{thms sscase1 ssplit1 strictify1 one_case1}
   50.28 -        val tacs = [resolve_tac rules 1]
   50.29 -      in prove thy defs goal (K tacs) end
   50.30 +        fun tacs ctxt = [resolve_tac ctxt rules 1]
   50.31 +      in prove thy defs goal (tacs o #context) end
   50.32  
   50.33      (* prove rewrites for case combinator *)
   50.34      local
    51.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_induction.ML	Tue Feb 10 14:29:36 2015 +0100
    51.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_induction.ML	Tue Feb 10 14:48:26 2015 +0100
    51.3 @@ -180,7 +180,7 @@
    51.4              TRY (safe_tac (put_claset HOL_cs ctxt))]
    51.5            fun con_tac _ = 
    51.6              asm_simp_tac (put_simpset take_ss ctxt) 1 THEN
    51.7 -            (resolve_tac prems' THEN_ALL_NEW etac spec) 1
    51.8 +            (resolve_tac ctxt prems' THEN_ALL_NEW etac spec) 1
    51.9            fun cases_tacs (cons, exhaust) =
   51.10              res_inst_tac ctxt [(("y", 0), "x")] exhaust 1 ::
   51.11              asm_simp_tac (put_simpset take_ss ctxt addsimps prems) 1 ::
   51.12 @@ -201,8 +201,8 @@
   51.13          let
   51.14            fun finite_tac (take_induct, fin_ind) =
   51.15                rtac take_induct 1 THEN
   51.16 -              (if is_finite then all_tac else resolve_tac prems 1) THEN
   51.17 -              (rtac fin_ind THEN_ALL_NEW solve_tac prems) 1
   51.18 +              (if is_finite then all_tac else resolve_tac ctxt prems 1) THEN
   51.19 +              (rtac fin_ind THEN_ALL_NEW solve_tac ctxt prems) 1
   51.20            val fin_inds = Project_Rule.projections ctxt finite_ind
   51.21          in
   51.22            TRY (safe_tac (put_claset HOL_cs ctxt)) THEN
    52.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML	Tue Feb 10 14:29:36 2015 +0100
    52.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML	Tue Feb 10 14:48:26 2015 +0100
    52.3 @@ -311,11 +311,11 @@
    52.4           EVERY
    52.5            [rewrite_goals_tac ctxt map_apply_thms,
    52.6             rtac (map_cont_thm RS @{thm cont_fix_ind}) 1,
    52.7 -           REPEAT (resolve_tac adm_rules 1),
    52.8 +           REPEAT (resolve_tac ctxt adm_rules 1),
    52.9             simp_tac (put_simpset HOL_basic_ss ctxt addsimps bottom_rules) 1,
   52.10             simp_tac (put_simpset HOL_basic_ss ctxt addsimps tuple_rules) 1,
   52.11             REPEAT (etac @{thm conjE} 1),
   52.12 -           REPEAT (resolve_tac (deflation_rules @ prems) 1 ORELSE atac 1)])
   52.13 +           REPEAT (resolve_tac ctxt (deflation_rules @ prems) 1 ORELSE atac 1)])
   52.14        end
   52.15      fun conjuncts [] _ = []
   52.16        | conjuncts (n::[]) thm = [(n, thm)]
   52.17 @@ -516,7 +516,7 @@
   52.18            Named_Theorems.get (Proof_Context.init_global thy) @{named_theorems domain_defl_simps}
   52.19          fun tac ctxt =
   52.20            rewrite_goals_tac ctxt (map mk_meta_eq (rev DEFL_simps))
   52.21 -          THEN TRY (resolve_tac defl_unfold_thms 1)
   52.22 +          THEN TRY (resolve_tac ctxt defl_unfold_thms 1)
   52.23        in
   52.24          Goal.prove_global thy [] [] goal (tac o #context)
   52.25        end
   52.26 @@ -625,12 +625,12 @@
   52.27            [rewrite_goals_tac ctxt (defl_apply_thms @ map_apply_thms),
   52.28             rtac (@{thm cont_parallel_fix_ind}
   52.29               OF [defl_cont_thm, map_cont_thm]) 1,
   52.30 -           REPEAT (resolve_tac adm_rules 1),
   52.31 +           REPEAT (resolve_tac ctxt adm_rules 1),
   52.32             simp_tac (put_simpset HOL_basic_ss ctxt addsimps bottom_rules) 1,
   52.33             simp_tac (put_simpset HOL_basic_ss ctxt addsimps tuple_rules) 1,
   52.34             simp_tac (put_simpset HOL_basic_ss ctxt addsimps map_ID_simps) 1,
   52.35             REPEAT (etac @{thm conjE} 1),
   52.36 -           REPEAT (resolve_tac (isodefl_rules @ prems) 1 ORELSE atac 1)])
   52.37 +           REPEAT (resolve_tac ctxt (isodefl_rules @ prems) 1 ORELSE atac 1)])
   52.38        end
   52.39      val isodefl_binds = map (Binding.prefix_name "isodefl_") dbinds
   52.40      fun conjuncts [] _ = []
   52.41 @@ -654,13 +654,13 @@
   52.42          fun is_cpo T = Sign.of_sort thy (T, @{sort cpo})
   52.43          val lhs = list_ccomb (map_const, map mk_ID (filter is_cpo Ts))
   52.44          val goal = mk_eqs (lhs, mk_ID lhsT)
   52.45 -        val tac = EVERY
   52.46 +        fun tac ctxt = EVERY
   52.47            [rtac @{thm isodefl_DEFL_imp_ID} 1,
   52.48 -           stac DEFL_thm 1,
   52.49 +           stac ctxt DEFL_thm 1,
   52.50             rtac isodefl_thm 1,
   52.51 -           REPEAT (resolve_tac @{thms isodefl_ID_DEFL isodefl_LIFTDEFL} 1)]
   52.52 +           REPEAT (resolve_tac ctxt @{thms isodefl_ID_DEFL isodefl_LIFTDEFL} 1)]
   52.53        in
   52.54 -        Goal.prove_global thy [] [] goal (K tac)
   52.55 +        Goal.prove_global thy [] [] goal (tac o #context)
   52.56        end
   52.57      val map_ID_binds = map (Binding.suffix_name "_map_ID") dbinds
   52.58      val map_ID_thms =
    53.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML	Tue Feb 10 14:29:36 2015 +0100
    53.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML	Tue Feb 10 14:48:26 2015 +0100
    53.3 @@ -324,7 +324,7 @@
    53.4             simp_tac (put_simpset HOL_basic_ss ctxt addsimps bottom_rules) 1,
    53.5             asm_simp_tac (put_simpset HOL_basic_ss ctxt addsimps take_Suc_thms) 1,
    53.6             REPEAT (etac @{thm conjE} 1
    53.7 -                   ORELSE resolve_tac deflation_rules 1
    53.8 +                   ORELSE resolve_tac ctxt deflation_rules 1
    53.9                     ORELSE atac 1)])
   53.10        end
   53.11      fun conjuncts [] _ = []
   53.12 @@ -462,9 +462,9 @@
   53.13              EVERY [
   53.14              rewrite_goals_tac ctxt finite_defs,
   53.15              rtac @{thm lub_ID_finite} 1,
   53.16 -            resolve_tac chain_take_thms 1,
   53.17 -            resolve_tac lub_take_thms 1,
   53.18 -            resolve_tac decisive_thms 1]
   53.19 +            resolve_tac ctxt chain_take_thms 1,
   53.20 +            resolve_tac ctxt lub_take_thms 1,
   53.21 +            resolve_tac ctxt decisive_thms 1]
   53.22        in
   53.23          Goal.prove_global thy [] [] goal (tac o #context)
   53.24        end
    54.1 --- a/src/HOL/HOLCF/Tools/cont_proc.ML	Tue Feb 10 14:29:36 2015 +0100
    54.2 +++ b/src/HOL/HOLCF/Tools/cont_proc.ML	Tue Feb 10 14:48:26 2015 +0100
    54.3 @@ -7,7 +7,7 @@
    54.4    val is_lcf_term: term -> bool
    54.5    val cont_thms: term -> thm list
    54.6    val all_cont_thms: term -> thm list
    54.7 -  val cont_tac: int -> tactic
    54.8 +  val cont_tac: Proof.context -> int -> tactic
    54.9    val cont_proc: theory -> simproc
   54.10    val setup: theory -> theory
   54.11  end
   54.12 @@ -95,7 +95,7 @@
   54.13    conditional rewrite rule with the unsolved subgoals as premises.
   54.14  *)
   54.15  
   54.16 -val cont_tac =
   54.17 +fun cont_tac ctxt =
   54.18    let
   54.19      val rules = [cont_K, cont_I, cont_R, cont_A, cont_L]
   54.20    
   54.21 @@ -110,7 +110,7 @@
   54.22        in
   54.23          if is_lcf_term f'
   54.24          then new_cont_tac f'
   54.25 -        else REPEAT_ALL_NEW (resolve_tac rules)
   54.26 +        else REPEAT_ALL_NEW (resolve_tac ctxt rules)
   54.27        end
   54.28        | cont_tac_of_term _ = K no_tac
   54.29    in
   54.30 @@ -123,7 +123,7 @@
   54.31      let
   54.32        val thy = Proof_Context.theory_of ctxt
   54.33        val tr = instantiate' [] [SOME (cterm_of thy t)] @{thm Eq_TrueI}
   54.34 -    in Option.map fst (Seq.pull (cont_tac 1 tr)) end
   54.35 +    in Option.map fst (Seq.pull (cont_tac ctxt 1 tr)) end
   54.36  in
   54.37    fun cont_proc thy =
   54.38      Simplifier.simproc_global thy "cont_proc" ["cont f"] solve_cont
    55.1 --- a/src/HOL/IMPP/Hoare.thy	Tue Feb 10 14:29:36 2015 +0100
    55.2 +++ b/src/HOL/IMPP/Hoare.thy	Tue Feb 10 14:48:26 2015 +0100
    55.3 @@ -218,7 +218,7 @@
    55.4  apply           (rule hoare_derivs.conseq, intro strip, tactic "smp_tac @{context} 2 1", clarify, tactic "smp_tac @{context} 1 1",rule exI, rule exI, erule (1) conjI)
    55.5  prefer 7
    55.6  apply          (rule_tac hoare_derivs.Body, drule_tac spec, erule_tac mp, fast)
    55.7 -apply         (tactic {* ALLGOALS (resolve_tac ((funpow 5 tl) @{thms hoare_derivs.intros}) THEN_ALL_NEW (fast_tac @{context})) *})
    55.8 +apply         (tactic {* ALLGOALS (resolve_tac @{context} ((funpow 5 tl) @{thms hoare_derivs.intros}) THEN_ALL_NEW (fast_tac @{context})) *})
    55.9  done
   55.10  
   55.11  lemma weak_Body: "G|-{P}. the (body pn) .{Q} ==> G|-{P}. BODY pn .{Q}"
   55.12 @@ -278,7 +278,7 @@
   55.13  
   55.14  lemma hoare_sound: "G||-ts ==> G||=ts"
   55.15  apply (erule hoare_derivs.induct)
   55.16 -apply              (tactic {* TRYALL (eresolve_tac [@{thm Loop_sound_lemma}, @{thm Body_sound_lemma}] THEN_ALL_NEW atac) *})
   55.17 +apply              (tactic {* TRYALL (eresolve_tac @{context} [@{thm Loop_sound_lemma}, @{thm Body_sound_lemma}] THEN_ALL_NEW atac) *})
   55.18  apply            (unfold hoare_valids_def)
   55.19  apply            blast
   55.20  apply           blast
    56.1 --- a/src/HOL/IMPP/Natural.thy	Tue Feb 10 14:29:36 2015 +0100
    56.2 +++ b/src/HOL/IMPP/Natural.thy	Tue Feb 10 14:48:26 2015 +0100
    56.3 @@ -112,7 +112,7 @@
    56.4  
    56.5  lemma evaln_evalc: "<c,s> -n-> t ==> <c,s> -c-> t"
    56.6  apply (erule evaln.induct)
    56.7 -apply (tactic {* ALLGOALS (resolve_tac @{thms evalc.intros} THEN_ALL_NEW atac) *})
    56.8 +apply (tactic {* ALLGOALS (resolve_tac @{context} @{thms evalc.intros} THEN_ALL_NEW atac) *})
    56.9  done
   56.10  
   56.11  lemma Suc_le_D_lemma: "[| Suc n <= m'; (!!m. n <= m ==> P (Suc m)) |] ==> P m'"
   56.12 @@ -140,8 +140,9 @@
   56.13  apply (erule evalc.induct)
   56.14  apply (tactic {* ALLGOALS (REPEAT o etac exE) *})
   56.15  apply (tactic {* TRYALL (EVERY' [dtac @{thm evaln_max2}, assume_tac @{context},
   56.16 -  REPEAT o eresolve_tac [exE, conjE]]) *})
   56.17 -apply (tactic {* ALLGOALS (rtac exI THEN' resolve_tac @{thms evaln.intros} THEN_ALL_NEW atac) *})
   56.18 +  REPEAT o eresolve_tac @{context} [exE, conjE]]) *})
   56.19 +apply (tactic
   56.20 +  {* ALLGOALS (rtac exI THEN' resolve_tac @{context} @{thms evaln.intros} THEN_ALL_NEW atac) *})
   56.21  done
   56.22  
   56.23  lemma eval_eq: "<c,s> -c-> t = (? n. <c,s> -n-> t)"
    57.1 --- a/src/HOL/IOA/Solve.thy	Tue Feb 10 14:29:36 2015 +0100
    57.2 +++ b/src/HOL/IOA/Solve.thy	Tue Feb 10 14:48:26 2015 +0100
    57.3 @@ -145,7 +145,7 @@
    57.4    apply force
    57.5    apply (simp (no_asm) add: conj_disj_distribR cong add: conj_cong split add: split_if)
    57.6    apply (tactic {*
    57.7 -    REPEAT((resolve_tac [conjI,impI] 1 ORELSE etac conjE 1) THEN
    57.8 +    REPEAT((resolve_tac @{context} [conjI, impI] 1 ORELSE etac conjE 1) THEN
    57.9        asm_full_simp_tac(@{context} addsimps [@{thm comp1_reachable}, @{thm comp2_reachable}]) 1) *})
   57.10    done
   57.11  
    58.1 --- a/src/HOL/Library/Countable.thy	Tue Feb 10 14:29:36 2015 +0100
    58.2 +++ b/src/HOL/Library/Countable.thy	Tue Feb 10 14:48:26 2015 +0100
    58.3 @@ -190,7 +190,7 @@
    58.4            [rtac @{thm countable_datatype} i,
    58.5             rtac typedef_thm i,
    58.6             etac induct_thm' i,
    58.7 -           REPEAT (resolve_tac rules i ORELSE atac i)]) 1
    58.8 +           REPEAT (resolve_tac ctxt rules i ORELSE atac i)]) 1
    58.9        end)
   58.10  *}
   58.11  
    59.1 --- a/src/HOL/Library/Old_SMT/old_z3_proof_methods.ML	Tue Feb 10 14:29:36 2015 +0100
    59.2 +++ b/src/HOL/Library/Old_SMT/old_z3_proof_methods.ML	Tue Feb 10 14:48:26 2015 +0100
    59.3 @@ -72,7 +72,7 @@
    59.4    in
    59.5      Goal.init (mk_inj_prop ctxt' (Thm.dest_arg ct))
    59.6      |> apply (rtac @{thm injI})
    59.7 -    |> apply (Tactic.solve_tac [rule, rule RS @{thm sym}])
    59.8 +    |> apply (Tactic.solve_tac ctxt' [rule, rule RS @{thm sym}])
    59.9      |> Goal.norm_result ctxt' o Goal.finish ctxt'
   59.10      |> singleton (Variable.export ctxt' ctxt)
   59.11    end
    60.1 --- a/src/HOL/Library/Old_SMT/old_z3_proof_reconstruction.ML	Tue Feb 10 14:29:36 2015 +0100
    60.2 +++ b/src/HOL/Library/Old_SMT/old_z3_proof_reconstruction.ML	Tue Feb 10 14:48:26 2015 +0100
    60.3 @@ -636,10 +636,10 @@
    60.4  fun skolemize vars =
    60.5    apfst Thm oo close vars (yield_singleton Assumption.add_assumes)
    60.6  
    60.7 -fun discharge_sk_tac i st = (
    60.8 +fun discharge_sk_tac ctxt i st = (
    60.9    rtac @{thm trans} i
   60.10 -  THEN resolve_tac sk_rules i
   60.11 -  THEN (rtac @{thm refl} ORELSE' discharge_sk_tac) (i+1)
   60.12 +  THEN resolve_tac ctxt sk_rules i
   60.13 +  THEN (rtac @{thm refl} ORELSE' discharge_sk_tac ctxt) (i+1)
   60.14    THEN rtac @{thm refl} i) st
   60.15  
   60.16  end
   60.17 @@ -847,13 +847,13 @@
   60.18    fun make_discharge_rules rules = rules @ [@{thm allI}, @{thm refl},
   60.19      @{thm reflexive}, Old_Z3_Proof_Literals.true_thm]
   60.20  
   60.21 -  fun discharge_assms_tac rules =
   60.22 -    REPEAT (HEADGOAL (resolve_tac rules ORELSE' SOLVED' discharge_sk_tac))
   60.23 +  fun discharge_assms_tac ctxt rules =
   60.24 +    REPEAT (HEADGOAL (resolve_tac ctxt rules ORELSE' SOLVED' (discharge_sk_tac ctxt)))
   60.25      
   60.26    fun discharge_assms ctxt rules thm =
   60.27      if Thm.nprems_of thm = 0 then Goal.norm_result ctxt thm
   60.28      else
   60.29 -      (case Seq.pull (discharge_assms_tac rules thm) of
   60.30 +      (case Seq.pull (discharge_assms_tac ctxt rules thm) of
   60.31          SOME (thm', _) => Goal.norm_result ctxt thm'
   60.32        | NONE => raise THM ("failed to discharge premise", 1, [thm]))
   60.33  
    61.1 --- a/src/HOL/Library/bnf_lfp_countable.ML	Tue Feb 10 14:29:36 2015 +0100
    61.2 +++ b/src/HOL/Library/bnf_lfp_countable.ML	Tue Feb 10 14:48:26 2015 +0100
    61.3 @@ -25,7 +25,7 @@
    61.4  
    61.5  fun nchotomy_tac nchotomy =
    61.6    HEADGOAL (rtac (nchotomy RS @{thm all_reg[rotated]}) THEN'
    61.7 -    REPEAT_ALL_NEW (resolve_tac [allI, impI] ORELSE' eresolve_tac [exE, disjE]));
    61.8 +    REPEAT_ALL_NEW (resolve0_tac [allI, impI] ORELSE' eresolve0_tac [exE, disjE]));
    61.9  
   61.10  fun meta_spec_mp_tac 0 = K all_tac
   61.11    | meta_spec_mp_tac depth =
   61.12 @@ -43,7 +43,7 @@
   61.13    HEADGOAL (asm_full_simp_tac
   61.14        (ss_only (injects @ recs @ map_congs' @ same_ctr_simps) ctxt) THEN_MAYBE'
   61.15      TRY o REPEAT_ALL_NEW (rtac conjI) THEN_ALL_NEW
   61.16 -    REPEAT_ALL_NEW (eresolve_tac (conjE :: inj_map_strongs')) THEN_ALL_NEW
   61.17 +    REPEAT_ALL_NEW (eresolve_tac ctxt (conjE :: inj_map_strongs')) THEN_ALL_NEW
   61.18      (atac ORELSE' use_induction_hypothesis_tac));
   61.19  
   61.20  fun distinct_ctrs_tac ctxt recs =
   61.21 @@ -64,7 +64,7 @@
   61.22  
   61.23  fun endgame_tac ctxt encode_injectives =
   61.24    unfold_thms_tac ctxt @{thms inj_on_def ball_UNIV} THEN
   61.25 -  ALLGOALS (rtac exI THEN' rtac allI THEN' resolve_tac encode_injectives);
   61.26 +  ALLGOALS (rtac exI THEN' rtac allI THEN' resolve_tac ctxt encode_injectives);
   61.27  
   61.28  fun encode_sumN n k t =
   61.29    Balanced_Tree.access {init = t,
   61.30 @@ -188,6 +188,6 @@
   61.31    end;
   61.32  
   61.33  fun countable_datatype_tac ctxt =
   61.34 -  TRY (Class.intro_classes_tac []) THEN core_countable_datatype_tac ctxt;
   61.35 +  TRY (Class.intro_classes_tac ctxt []) THEN core_countable_datatype_tac ctxt;
   61.36  
   61.37  end;
    62.1 --- a/src/HOL/MicroJava/J/Example.thy	Tue Feb 10 14:29:36 2015 +0100
    62.2 +++ b/src/HOL/MicroJava/J/Example.thy	Tue Feb 10 14:48:26 2015 +0100
    62.3 @@ -372,34 +372,34 @@
    62.4  apply (auto simp add: appl_methds_foo_Base)
    62.5  done
    62.6  
    62.7 -ML {* val t = resolve_tac @{thms ty_expr_ty_exprs_wt_stmt.intros} 1 *}
    62.8 +lemmas t = ty_expr_ty_exprs_wt_stmt.intros
    62.9  schematic_lemma wt_test: "(tprg, empty(e\<mapsto>Class Base))\<turnstile>  
   62.10    Expr(e::=NewC Ext);; Expr({Base}LAcc e..foo({?pTs'}[Lit Null]))\<surd>"
   62.11 -apply (tactic t) -- ";;"
   62.12 -apply  (tactic t) -- "Expr"
   62.13 -apply  (tactic t) -- "LAss"
   62.14 +apply (rule ty_expr_ty_exprs_wt_stmt.intros) -- ";;"
   62.15 +apply  (rule t) -- "Expr"
   62.16 +apply  (rule t) -- "LAss"
   62.17  apply    simp -- {* @{text "e \<noteq> This"} *}
   62.18 -apply    (tactic t) -- "LAcc"
   62.19 +apply    (rule t) -- "LAcc"
   62.20  apply     (simp (no_asm))
   62.21  apply    (simp (no_asm))
   62.22 -apply   (tactic t) -- "NewC"
   62.23 +apply   (rule t) -- "NewC"
   62.24  apply   (simp (no_asm))
   62.25  apply  (simp (no_asm))
   62.26 -apply (tactic t) -- "Expr"
   62.27 -apply (tactic t) -- "Call"
   62.28 -apply   (tactic t) -- "LAcc"
   62.29 +apply (rule t) -- "Expr"
   62.30 +apply (rule t) -- "Call"
   62.31 +apply   (rule t) -- "LAcc"
   62.32  apply    (simp (no_asm))
   62.33  apply   (simp (no_asm))
   62.34 -apply  (tactic t) -- "Cons"
   62.35 -apply   (tactic t) -- "Lit"
   62.36 +apply  (rule t) -- "Cons"
   62.37 +apply   (rule t) -- "Lit"
   62.38  apply   (simp (no_asm))
   62.39 -apply  (tactic t) -- "Nil"
   62.40 +apply  (rule t) -- "Nil"
   62.41  apply (simp (no_asm))
   62.42  apply (rule max_spec_foo_Base)
   62.43  done
   62.44  
   62.45 -ML {* val e = resolve_tac (@{thm NewCI} :: @{thms eval_evals_exec.intros}) 1 *}
   62.46  
   62.47 +lemmas e = NewCI eval_evals_exec.intros
   62.48  declare split_if [split del]
   62.49  declare init_vars_def [simp] c_hupd_def [simp] cast_ok_def [simp]
   62.50  schematic_lemma exec_test: 
   62.51 @@ -407,37 +407,37 @@
   62.52    tprg\<turnstile>s0 -test-> ?s"
   62.53  apply (unfold test_def)
   62.54  -- "?s = s3 "
   62.55 -apply (tactic e) -- ";;"
   62.56 -apply  (tactic e) -- "Expr"
   62.57 -apply  (tactic e) -- "LAss"
   62.58 -apply   (tactic e) -- "NewC"
   62.59 +apply (rule e) -- ";;"
   62.60 +apply  (rule e) -- "Expr"
   62.61 +apply  (rule e) -- "LAss"
   62.62 +apply   (rule e) -- "NewC"
   62.63  apply    force
   62.64  apply   force
   62.65  apply  (simp (no_asm))
   62.66  apply (erule thin_rl)
   62.67 -apply (tactic e) -- "Expr"
   62.68 -apply (tactic e) -- "Call"
   62.69 -apply       (tactic e) -- "LAcc"
   62.70 +apply (rule e) -- "Expr"
   62.71 +apply (rule e) -- "Call"
   62.72 +apply       (rule e) -- "LAcc"
   62.73  apply      force
   62.74 -apply     (tactic e) -- "Cons"
   62.75 -apply      (tactic e) -- "Lit"
   62.76 -apply     (tactic e) -- "Nil"
   62.77 +apply     (rule e) -- "Cons"
   62.78 +apply      (rule e) -- "Lit"
   62.79 +apply     (rule e) -- "Nil"
   62.80  apply    (simp (no_asm))
   62.81  apply   (force simp add: foo_Ext_def)
   62.82  apply  (simp (no_asm))
   62.83 -apply  (tactic e) -- "Expr"
   62.84 -apply  (tactic e) -- "FAss"
   62.85 -apply       (tactic e) -- "Cast"
   62.86 -apply        (tactic e) -- "LAcc"
   62.87 +apply  (rule e) -- "Expr"
   62.88 +apply  (rule e) -- "FAss"
   62.89 +apply       (rule e) -- "Cast"
   62.90 +apply        (rule e) -- "LAcc"
   62.91  apply       (simp (no_asm))
   62.92  apply      (simp (no_asm))
   62.93  apply     (simp (no_asm))
   62.94 -apply     (tactic e) -- "XcptE"
   62.95 +apply     (rule e) -- "XcptE"
   62.96  apply    (simp (no_asm))
   62.97  apply   (rule surjective_pairing [symmetric, THEN[2]trans], subst Pair_eq, force)
   62.98  apply  (simp (no_asm))
   62.99  apply (simp (no_asm))
  62.100 -apply (tactic e) -- "XcptE"
  62.101 +apply (rule e) -- "XcptE"
  62.102  done
  62.103  
  62.104  end
    63.1 --- a/src/HOL/MicroJava/J/JTypeSafe.thy	Tue Feb 10 14:29:36 2015 +0100
    63.2 +++ b/src/HOL/MicroJava/J/JTypeSafe.thy	Tue Feb 10 14:48:26 2015 +0100
    63.3 @@ -199,8 +199,8 @@
    63.4  
    63.5  -- "several simplifications, XcptE, XcptEs, XcptS, Skip, Nil??"
    63.6  apply( simp_all)
    63.7 -apply( tactic "ALLGOALS (REPEAT o resolve_tac [impI, allI])")
    63.8 -apply( tactic {* ALLGOALS (eresolve_tac [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}]
    63.9 +apply( tactic "ALLGOALS (REPEAT o resolve_tac @{context} [impI, allI])")
   63.10 +apply( tactic {* ALLGOALS (eresolve_tac @{context} [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}]
   63.11    THEN_ALL_NEW (full_simp_tac (put_simpset (simpset_of @{theory_context Conform}) @{context}))) *})
   63.12  apply(tactic "ALLGOALS (EVERY' [REPEAT o (etac conjE), REPEAT o hyp_subst_tac @{context}])")
   63.13  
   63.14 @@ -240,7 +240,7 @@
   63.15  apply( fast elim: conforms_localD [THEN lconfD])
   63.16  
   63.17  -- "for FAss"
   63.18 -apply( tactic {* EVERY'[eresolve_tac [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}] 
   63.19 +apply( tactic {* EVERY'[eresolve_tac @{context} [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}] 
   63.20         THEN_ALL_NEW (full_simp_tac @{context}), REPEAT o (etac conjE), hyp_subst_tac @{context}] 3*})
   63.21  
   63.22  -- "for if"
   63.23 @@ -276,7 +276,7 @@
   63.24  
   63.25  -- "7 LAss"
   63.26  apply (fold fun_upd_def)
   63.27 -apply( tactic {* (eresolve_tac [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}] 
   63.28 +apply( tactic {* (eresolve_tac @{context} [@{thm ty_expr.cases}, @{thm ty_exprs.cases}, @{thm wt_stmt.cases}]
   63.29                   THEN_ALL_NEW (full_simp_tac @{context})) 1 *})
   63.30  apply (intro strip)
   63.31  apply (case_tac E)
    64.1 --- a/src/HOL/NSA/transfer.ML	Tue Feb 10 14:29:36 2015 +0100
    64.2 +++ b/src/HOL/NSA/transfer.ML	Tue Feb 10 14:48:26 2015 +0100
    64.3 @@ -63,8 +63,8 @@
    64.4        rewrite_goals_tac ctxt (ths' @ refolds' @ unfolds') THEN
    64.5        ALLGOALS (Object_Logic.full_atomize_tac ctxt) THEN
    64.6        match_tac ctxt [transitive_thm] 1 THEN
    64.7 -      resolve_tac [@{thm transfer_start}] 1 THEN
    64.8 -      REPEAT_ALL_NEW (resolve_tac intros) 1 THEN
    64.9 +      resolve_tac ctxt [@{thm transfer_start}] 1 THEN
   64.10 +      REPEAT_ALL_NEW (resolve_tac ctxt intros) 1 THEN
   64.11        match_tac ctxt [reflexive_thm] 1
   64.12    in Goal.prove ctxt [] [] (Logic.mk_equals (t,u)) (K tac) end
   64.13  
    65.1 --- a/src/HOL/NanoJava/Equivalence.thy	Tue Feb 10 14:29:36 2015 +0100
    65.2 +++ b/src/HOL/NanoJava/Equivalence.thy	Tue Feb 10 14:48:26 2015 +0100
    65.3 @@ -104,7 +104,7 @@
    65.4  apply (tactic "split_all_tac @{context} 1", rename_tac P e Q)
    65.5  apply (rule hoare_ehoare.induct)
    65.6  (*18*)
    65.7 -apply (tactic {* ALLGOALS (REPEAT o dresolve_tac [@{thm all_conjunct2}, @{thm all3_conjunct2}]) *})
    65.8 +apply (tactic {* ALLGOALS (REPEAT o dresolve_tac @{context} [@{thm all_conjunct2}, @{thm all3_conjunct2}]) *})
    65.9  apply (tactic {* ALLGOALS (REPEAT o thin_tac @{context} "hoare ?x ?y") *})
   65.10  apply (tactic {* ALLGOALS (REPEAT o thin_tac @{context} "ehoare ?x ?y") *})
   65.11  apply (simp_all only: cnvalid1_eq cenvalid_def2)
    66.1 --- a/src/HOL/Nominal/nominal_atoms.ML	Tue Feb 10 14:29:36 2015 +0100
    66.2 +++ b/src/HOL/Nominal/nominal_atoms.ML	Tue Feb 10 14:48:26 2015 +0100
    66.3 @@ -503,20 +503,20 @@
    66.4             val cls_name = Sign.full_bname thy' ("pt_"^ak_name);
    66.5             val at_inst  = Global_Theory.get_thm thy' ("at_" ^ ak_name' ^ "_inst");
    66.6  
    66.7 -           val proof1 = EVERY [Class.intro_classes_tac [],
    66.8 +           fun proof1 ctxt = EVERY [Class.intro_classes_tac ctxt [],
    66.9                                   rtac ((at_inst RS at_pt_inst) RS pt1) 1,
   66.10                                   rtac ((at_inst RS at_pt_inst) RS pt2) 1,
   66.11                                   rtac ((at_inst RS at_pt_inst) RS pt3) 1,
   66.12                                   atac 1];
   66.13             fun proof2 ctxt =
   66.14 -             Class.intro_classes_tac [] THEN
   66.15 +             Class.intro_classes_tac ctxt [] THEN
   66.16               REPEAT (asm_simp_tac
   66.17                (put_simpset HOL_basic_ss ctxt addsimps
   66.18                  maps (Global_Theory.get_thms thy') [ak_name ^ "_prm_" ^ ak_name' ^ "_def"]) 1);
   66.19           in
   66.20             thy'
   66.21             |> Axclass.prove_arity (qu_name,[],[cls_name])
   66.22 -              (fn ctxt => if ak_name = ak_name' then proof1 else proof2 ctxt)
   66.23 +              (fn ctxt => if ak_name = ak_name' then proof1 ctxt else proof2 ctxt)
   66.24           end) ak_names thy) ak_names thy12d;
   66.25  
   66.26       (* show that                       *)
   66.27 @@ -536,7 +536,7 @@
   66.28            val pt_inst  = Global_Theory.get_thm thy ("pt_"^ak_name^"_inst");
   66.29  
   66.30            fun pt_proof thm ctxt =
   66.31 -              EVERY [Class.intro_classes_tac [],
   66.32 +              EVERY [Class.intro_classes_tac ctxt [],
   66.33                       rtac (thm RS pt1) 1, rtac (thm RS pt2) 1, rtac (thm RS pt3) 1, atac 1];
   66.34  
   66.35            val pt_thm_fun   = at_thm RS (pt_inst RS (pt_inst RS pt_fun_inst));
   66.36 @@ -582,13 +582,13 @@
   66.37                 (if ak_name = ak_name'
   66.38                  then
   66.39                    let val at_thm = Global_Theory.get_thm thy' ("at_"^ak_name^"_inst");
   66.40 -                  in  EVERY [Class.intro_classes_tac [],
   66.41 +                  in  EVERY [Class.intro_classes_tac ctxt [],
   66.42                               rtac ((at_thm RS fs_at_inst) RS fs1) 1] end
   66.43                  else
   66.44                    let val dj_inst = Global_Theory.get_thm thy' ("dj_"^ak_name'^"_"^ak_name);
   66.45                        val simp_s =
   66.46                          put_simpset HOL_basic_ss ctxt addsimps [dj_inst RS dj_supp, finite_emptyI];
   66.47 -                  in EVERY [Class.intro_classes_tac [], asm_simp_tac simp_s 1] end)
   66.48 +                  in EVERY [Class.intro_classes_tac ctxt [], asm_simp_tac simp_s 1] end)
   66.49          in
   66.50           Axclass.prove_arity (qu_name,[],[qu_class]) proof thy'
   66.51          end) ak_names thy) ak_names thy18;
   66.52 @@ -605,7 +605,7 @@
   66.53          let
   66.54            val cls_name = Sign.full_bname thy ("fs_"^ak_name);
   66.55            val fs_inst  = Global_Theory.get_thm thy ("fs_"^ak_name^"_inst");
   66.56 -          fun fs_proof thm ctxt = EVERY [Class.intro_classes_tac [], rtac (thm RS fs1) 1];
   66.57 +          fun fs_proof thm ctxt = EVERY [Class.intro_classes_tac ctxt [], rtac (thm RS fs1) 1];
   66.58  
   66.59            val fs_thm_unit  = fs_unit_inst;
   66.60            val fs_thm_prod  = fs_inst RS (fs_inst RS fs_prod_inst);
   66.61 @@ -651,7 +651,7 @@
   66.62                      val pt_inst  = Global_Theory.get_thm thy'' ("pt_"^ak_name''^"_inst");
   66.63                      val at_inst  = Global_Theory.get_thm thy'' ("at_"^ak_name''^"_inst");
   66.64                    in
   66.65 -                   EVERY [Class.intro_classes_tac [],
   66.66 +                   EVERY [Class.intro_classes_tac ctxt [],
   66.67                            rtac (at_inst RS (pt_inst RS pt_perm_compose)) 1]
   66.68                    end)
   66.69                  else
   66.70 @@ -663,7 +663,7 @@
   66.71                                             [ak_name' ^"_prm_"^ak_name^"_def",
   66.72                                              ak_name''^"_prm_"^ak_name^"_def"]));
   66.73                    in
   66.74 -                    EVERY [Class.intro_classes_tac [], simp_tac simp_s 1]
   66.75 +                    EVERY [Class.intro_classes_tac ctxt [], simp_tac simp_s 1]
   66.76                    end))
   66.77                in
   66.78                  Axclass.prove_arity (name,[],[cls_name]) proof thy''
   66.79 @@ -686,7 +686,7 @@
   66.80              val pt_inst  = Global_Theory.get_thm thy' ("pt_"^ak_name^"_inst");
   66.81              val at_inst  = Global_Theory.get_thm thy' ("at_"^ak_name^"_inst");
   66.82  
   66.83 -            fun cp_proof thm ctxt = EVERY [Class.intro_classes_tac [],rtac (thm RS cp1) 1];
   66.84 +            fun cp_proof thm ctxt = EVERY [Class.intro_classes_tac ctxt [], rtac (thm RS cp1) 1];
   66.85            
   66.86              val cp_thm_unit = cp_unit_inst;
   66.87              val cp_thm_prod = cp_inst RS (cp_inst RS cp_prod_inst);
   66.88 @@ -717,7 +717,7 @@
   66.89               let
   66.90                 val qu_class = Sign.full_bname thy ("pt_"^ak_name);
   66.91                 fun proof ctxt =
   66.92 -                Class.intro_classes_tac [] THEN
   66.93 +                Class.intro_classes_tac ctxt [] THEN
   66.94                  REPEAT (asm_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [Simpdata.mk_eq defn]) 1);
   66.95               in 
   66.96                 Axclass.prove_arity (discrete_ty, [], [qu_class]) proof thy
   66.97 @@ -729,7 +729,7 @@
   66.98                 val qu_class = Sign.full_bname thy ("fs_"^ak_name);
   66.99                 val supp_def = Simpdata.mk_eq @{thm "Nominal.supp_def"};
  66.100                 fun proof ctxt =
  66.101 -                Class.intro_classes_tac [] THEN
  66.102 +                Class.intro_classes_tac ctxt [] THEN
  66.103                  asm_simp_tac (put_simpset HOL_ss ctxt
  66.104                    addsimps [supp_def, Collect_const, finite_emptyI, Simpdata.mk_eq defn]) 1;
  66.105               in 
  66.106 @@ -742,7 +742,7 @@
  66.107                 val qu_class = Sign.full_bname thy ("cp_"^ak_name^"_"^ak_name');
  66.108                 val supp_def = Simpdata.mk_eq @{thm "Nominal.supp_def"};
  66.109                 fun proof ctxt =
  66.110 -                Class.intro_classes_tac [] THEN
  66.111 +                Class.intro_classes_tac ctxt [] THEN
  66.112                  asm_simp_tac (put_simpset HOL_ss ctxt addsimps [Simpdata.mk_eq defn]) 1;
  66.113               in
  66.114                 Axclass.prove_arity (discrete_ty, [], [qu_class]) proof thy
    67.1 --- a/src/HOL/Nominal/nominal_datatype.ML	Tue Feb 10 14:29:36 2015 +0100
    67.2 +++ b/src/HOL/Nominal/nominal_datatype.ML	Tue Feb 10 14:48:26 2015 +0100
    67.3 @@ -427,7 +427,8 @@
    67.4        in
    67.5          fold (fn (s, tvs) => fn thy => Axclass.prove_arity
    67.6              (s, map (inter_sort thy sort o snd) tvs, [cp_class])
    67.7 -            (fn _ => Class.intro_classes_tac [] THEN ALLGOALS (resolve_tac thms)) thy)
    67.8 +            (fn ctxt' =>
    67.9 +              Class.intro_classes_tac ctxt' [] THEN ALLGOALS (resolve_tac ctxt' thms)) thy)
   67.10            (full_new_type_names' ~~ tyvars) thy
   67.11        end;
   67.12  
   67.13 @@ -439,10 +440,10 @@
   67.14            fold (fn (s, tvs) => fn thy => Axclass.prove_arity
   67.15                (s, map (inter_sort thy [pt_name] o snd) tvs, [pt_name])
   67.16                (fn ctxt => EVERY
   67.17 -                [Class.intro_classes_tac [],
   67.18 -                 resolve_tac perm_empty_thms 1,
   67.19 -                 resolve_tac perm_append_thms 1,
   67.20 -                 resolve_tac perm_eq_thms 1, assume_tac ctxt 1]) thy)
   67.21 +                [Class.intro_classes_tac ctxt [],
   67.22 +                 resolve_tac ctxt perm_empty_thms 1,
   67.23 +                 resolve_tac ctxt perm_append_thms 1,
   67.24 +                 resolve_tac ctxt perm_eq_thms 1, assume_tac ctxt 1]) thy)
   67.25              (full_new_type_names' ~~ tyvars) thy
   67.26          end) atoms |>
   67.27        Global_Theory.add_thmss
   67.28 @@ -562,7 +563,7 @@
   67.29             [Old_Datatype_Aux.ind_tac rep_induct [] 1,
   67.30              ALLGOALS (simp_tac (ctxt addsimps
   67.31                (Thm.symmetric perm_fun_def :: abs_perm))),
   67.32 -            ALLGOALS (resolve_tac rep_intrs THEN_ALL_NEW assume_tac ctxt)])),
   67.33 +            ALLGOALS (resolve_tac ctxt rep_intrs THEN_ALL_NEW assume_tac ctxt)])),
   67.34          length new_type_names));
   67.35  
   67.36      val perm_closed_thmss = map mk_perm_closed atoms;
   67.37 @@ -578,9 +579,9 @@
   67.38              (name, map (fn (v, _) => (v, dummyS)) tvs, mx)  (* FIXME keep constraints!? *)
   67.39              (Const (@{const_name Collect}, (U --> HOLogic.boolT) --> HOLogic.mk_setT U) $
   67.40                 Const (cname, U --> HOLogic.boolT)) NONE
   67.41 -            (fn _ => rtac exI 1 THEN rtac CollectI 1 THEN
   67.42 +            (fn ctxt => rtac exI 1 THEN rtac CollectI 1 THEN
   67.43                QUIET_BREADTH_FIRST (has_fewer_prems 1)
   67.44 -              (resolve_tac rep_intrs 1)) thy |> (fn ((_, r), thy) =>
   67.45 +              (resolve_tac ctxt rep_intrs 1)) thy |> (fn ((_, r), thy) =>
   67.46          let
   67.47            val permT = mk_permT
   67.48              (TFree (singleton (Name.variant_list (map fst tvs)) "'a", @{sort type}));
   67.49 @@ -619,7 +620,7 @@
   67.50            in Axclass.prove_arity
   67.51              (Sign.intern_type thy name,
   67.52                map (inter_sort thy sort o snd) tvs, [pt_class])
   67.53 -            (fn ctxt => EVERY [Class.intro_classes_tac [],
   67.54 +            (fn ctxt => EVERY [Class.intro_classes_tac ctxt [],
   67.55                rewrite_goals_tac ctxt [perm_def],
   67.56                asm_full_simp_tac (ctxt addsimps [Rep_inverse]) 1,
   67.57                asm_full_simp_tac (ctxt addsimps
   67.58 @@ -648,7 +649,7 @@
   67.59            Axclass.prove_arity
   67.60              (Sign.intern_type thy name,
   67.61                map (inter_sort thy sort o snd) tvs, [cp_class])
   67.62 -            (fn ctxt => EVERY [Class.intro_classes_tac [],
   67.63 +            (fn ctxt => EVERY [Class.intro_classes_tac ctxt [],
   67.64                rewrite_goals_tac ctxt [perm_def],
   67.65                asm_full_simp_tac (ctxt addsimps
   67.66                  ((Rep RS perm_closed1 RS Abs_inverse) ::
   67.67 @@ -801,11 +802,11 @@
   67.68          val inj_thms = map (fn r => r RS iffD1) abs_inject_thms;
   67.69          val rewrites = constr_defs @ map mk_meta_eq Rep_inverse_thms
   67.70        in Goal.prove_global_future thy8 [] [] eqn (fn {context = ctxt, ...} => EVERY
   67.71 -        [resolve_tac inj_thms 1,
   67.72 +        [resolve_tac ctxt inj_thms 1,
   67.73           rewrite_goals_tac ctxt rewrites,
   67.74           rtac refl 3,
   67.75 -         resolve_tac rep_intrs 2,
   67.76 -         REPEAT (resolve_tac Rep_thms 1)])
   67.77 +         resolve_tac ctxt rep_intrs 2,
   67.78 +         REPEAT (resolve_tac ctxt Rep_thms 1)])
   67.79        end;
   67.80  
   67.81      val constr_rep_thmss = map (map prove_constr_rep_thm) constr_rep_eqns;
   67.82 @@ -1041,7 +1042,7 @@
   67.83              REPEAT (EVERY
   67.84                [TRY (rtac conjI 1),
   67.85                 full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps Rep_inverse_thms) 1,
   67.86 -               etac mp 1, resolve_tac Rep_thms 1])]);
   67.87 +               etac mp 1, resolve_tac ctxt Rep_thms 1])]);
   67.88  
   67.89      val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of indrule_lemma)));
   67.90      val frees = if length Ps = 1 then [Free ("P", snd (dest_Var (hd Ps)))] else
   67.91 @@ -1058,7 +1059,7 @@
   67.92          [rtac indrule_lemma' 1,
   67.93           (Old_Datatype_Aux.ind_tac rep_induct [] THEN_ALL_NEW Object_Logic.atomize_prems_tac ctxt) 1,
   67.94           EVERY (map (fn (prem, r) => (EVERY
   67.95 -           [REPEAT (eresolve_tac Abs_inverse_thms' 1),
   67.96 +           [REPEAT (eresolve_tac ctxt Abs_inverse_thms' 1),
   67.97              simp_tac (put_simpset HOL_basic_ss ctxt addsimps [Thm.symmetric r]) 1,
   67.98              DEPTH_SOLVE_1 (ares_tac [prem] 1 ORELSE etac allE 1)]))
   67.99                  (prems ~~ constr_defs))]);
  67.100 @@ -1116,7 +1117,7 @@
  67.101            val sort = Sign.minimize_sort thy (Sign.certify_sort thy (class :: pt_cp_sort));
  67.102          in fold (fn Type (s, Ts) => Axclass.prove_arity
  67.103            (s, map (inter_sort thy sort o snd o dest_TFree) Ts, [class])
  67.104 -          (fn _ => Class.intro_classes_tac [] THEN resolve_tac ths 1)) newTs thy
  67.105 +          (fn ctxt => Class.intro_classes_tac ctxt [] THEN resolve_tac ctxt ths 1)) newTs thy
  67.106          end) (atoms ~~ finite_supp_thms);
  67.107  
  67.108      (**** strong induction theorem ****)
  67.109 @@ -1243,7 +1244,7 @@
  67.110                fresh_const T (fastype_of p) $
  67.111                  Bound 0 $ p)))
  67.112            (fn _ => EVERY
  67.113 -            [resolve_tac exists_fresh' 1,
  67.114 +            [resolve_tac ctxt exists_fresh' 1,
  67.115               simp_tac (put_simpset HOL_ss ctxt addsimps (supp_prod :: finite_Un :: fs_atoms @
  67.116                 fin_set_supp @ ths)) 1]);
  67.117          val (([(_, cx)], ths), ctxt') = Obtain.result
  67.118 @@ -1354,22 +1355,22 @@
  67.119                         val th = Goal.prove context3 [] [] concl' (fn _ => EVERY
  67.120                           [simp_tac (ind_ss6 addsimps rename_eq) 1,
  67.121                            cut_facts_tac iprems 1,
  67.122 -                          (resolve_tac prems THEN_ALL_NEW
  67.123 +                          (resolve_tac context2 prems THEN_ALL_NEW
  67.124                              SUBGOAL (fn (t, i) => case Logic.strip_assums_concl t of
  67.125                                  _ $ (Const (@{const_name Nominal.fresh}, _) $ _ $ _) =>
  67.126                                    simp_tac ind_ss1' i
  67.127                                | _ $ (Const (@{const_name Not}, _) $ _) =>
  67.128 -                                  resolve_tac freshs2' i
  67.129 +                                  resolve_tac context2 freshs2' i
  67.130                                | _ => asm_simp_tac (put_simpset HOL_basic_ss context3 addsimps
  67.131                                    pt2_atoms addsimprocs [perm_simproc]) i)) 1])
  67.132                         val final = Proof_Context.export context3 context2 [th]
  67.133                       in
  67.134 -                       resolve_tac final 1
  67.135 +                       resolve_tac context2 final 1
  67.136                       end) context1 1) (constrs ~~ constrs')) (descr'' ~~ ndescr)))
  67.137        in
  67.138          EVERY
  67.139            [cut_facts_tac [th] 1,
  67.140 -           REPEAT (eresolve_tac [conjE, @{thm allE_Nil}] 1),
  67.141 +           REPEAT (eresolve_tac context [conjE, @{thm allE_Nil}] 1),
  67.142             REPEAT (etac allE 1),
  67.143             REPEAT (TRY (rtac conjI 1) THEN asm_full_simp_tac ind_ss5 1)]
  67.144        end);
  67.145 @@ -1390,8 +1391,8 @@
  67.146        (augment_sort thy9 fs_cp_sort ind_concl)
  67.147        (fn {prems, context = ctxt} => EVERY
  67.148           [rtac induct_aux' 1,
  67.149 -          REPEAT (resolve_tac fs_atoms 1),
  67.150 -          REPEAT ((resolve_tac prems THEN_ALL_NEW
  67.151 +          REPEAT (resolve_tac ctxt fs_atoms 1),
  67.152 +          REPEAT ((resolve_tac ctxt prems THEN_ALL_NEW
  67.153              (etac @{thm meta_spec} ORELSE'
  67.154                full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [fresh_def]))) 1)])
  67.155  
  67.156 @@ -1538,7 +1539,7 @@
  67.157                   (simp_tac (put_simpset HOL_basic_ss ctxt
  67.158                      addsimps flat perm_simps'
  67.159                      addsimprocs [NominalPermeq.perm_simproc_app]) 1 THEN
  67.160 -                  (resolve_tac rec_intrs THEN_ALL_NEW
  67.161 +                  (resolve_tac ctxt rec_intrs THEN_ALL_NEW
  67.162                     asm_simp_tac (put_simpset HOL_ss ctxt addsimps (fresh_bij @ perm_bij))) 1))))
  67.163          val ths' = map (fn ((P, Q), th) =>
  67.164            Goal.prove_global_future thy11 [] []
  67.165 @@ -1630,7 +1631,7 @@
  67.166                        supports_fresh) 1,
  67.167                      simp_tac (put_simpset HOL_basic_ss context addsimps
  67.168                        [supports_def, Thm.symmetric fresh_def, fresh_prod]) 1,
  67.169 -                    REPEAT_DETERM (resolve_tac [allI, impI] 1),
  67.170 +                    REPEAT_DETERM (resolve_tac context [allI, impI] 1),
  67.171                      REPEAT_DETERM (etac conjE 1),
  67.172                      rtac unique 1,
  67.173                      SUBPROOF (fn {prems = prems', params = [(_, a), (_, b)], ...} => EVERY
  67.174 @@ -1683,8 +1684,8 @@
  67.175                fresh_const T (fastype_of p) $ Bound 0 $ p)))
  67.176            (fn _ => EVERY
  67.177              [cut_facts_tac ths 1,
  67.178 -             REPEAT_DETERM (dresolve_tac (the (AList.lookup op = rec_fin_supp T)) 1),
  67.179 -             resolve_tac exists_fresh' 1,
  67.180 +             REPEAT_DETERM (dresolve_tac ctxt (the (AList.lookup op = rec_fin_supp T)) 1),
  67.181 +             resolve_tac ctxt exists_fresh' 1,
  67.182               asm_simp_tac (put_simpset HOL_ss ctxt addsimps (supp_prod :: finite_Un :: fs_atoms)) 1]);
  67.183          val (([(_, cx)], ths), ctxt') = Obtain.result
  67.184            (fn _ => EVERY
  67.185 @@ -1723,7 +1724,7 @@
  67.186                             rec_sets ~~ rec_preds)))))
  67.187                 (fn {context = ctxt, ...} =>
  67.188                    rtac rec_induct 1 THEN
  67.189 -                  REPEAT ((resolve_tac P_ind_ths THEN_ALL_NEW assume_tac ctxt) 1))));
  67.190 +                  REPEAT ((resolve_tac ctxt P_ind_ths THEN_ALL_NEW assume_tac ctxt) 1))));
  67.191             val rec_fin_supp_thms' = map
  67.192               (fn (ths, (T, fin_ths)) => (T, map (curry op MRS fin_ths) ths))
  67.193               (rec_fin_supp_thms ~~ finite_thss);
  67.194 @@ -1735,9 +1736,9 @@
  67.195                  (finite_thss ~~ finite_ctxt_ths) @
  67.196              maps (fn ((_, idxss), elim) => maps (fn idxs =>
  67.197                [full_simp_tac (put_simpset HOL_ss context addsimps [Thm.symmetric fresh_def, supp_prod, Un_iff]) 1,
  67.198 -               REPEAT_DETERM (eresolve_tac @{thms conjE ex1E} 1),
  67.199 +               REPEAT_DETERM (eresolve_tac context @{thms conjE ex1E} 1),
  67.200                 rtac @{thm ex1I} 1,
  67.201 -               (resolve_tac rec_intrs THEN_ALL_NEW atac) 1,
  67.202 +               (resolve_tac context rec_intrs THEN_ALL_NEW atac) 1,
  67.203                 rotate_tac ~1 1,
  67.204                 ((DETERM o etac elim) THEN_ALL_NEW full_simp_tac
  67.205                    (put_simpset HOL_ss context addsimps flat distinct_thms)) 1] @
  67.206 @@ -1907,7 +1908,7 @@
  67.207                                      map (fn th => rtac th 1)
  67.208                                        (snd (nth finite_thss l)) @
  67.209                                      [rtac rec_prem 1, rtac ih 1,
  67.210 -                                     REPEAT_DETERM (resolve_tac fresh_prems 1)]))
  67.211 +                                     REPEAT_DETERM (resolve_tac context fresh_prems 1)]))
  67.212                              end) atoms
  67.213                          end) (rec_prems1 ~~ ihs);
  67.214  
  67.215 @@ -1917,13 +1918,13 @@
  67.216                        Goal.prove context'' [] []
  67.217                          (HOLogic.mk_Trueprop (fresh_const aT rT $ a $ rhs'))
  67.218                          (fn _ => EVERY
  67.219 -                           [resolve_tac fcbs 1,
  67.220 -                            REPEAT_DETERM (resolve_tac
  67.221 +                           [resolve_tac context'' fcbs 1,
  67.222 +                            REPEAT_DETERM (resolve_tac context''
  67.223                                (fresh_prems @ rec_freshs) 1),
  67.224 -                            REPEAT_DETERM (resolve_tac (maps snd rec_fin_supp_thms') 1
  67.225 -                              THEN resolve_tac rec_prems 1),
  67.226 -                            resolve_tac P_ind_ths 1,
  67.227 -                            REPEAT_DETERM (resolve_tac (P_ths @ rec_prems) 1)]);
  67.228 +                            REPEAT_DETERM (resolve_tac context'' (maps snd rec_fin_supp_thms') 1
  67.229 +                              THEN resolve_tac context'' rec_prems 1),
  67.230 +                            resolve_tac context'' P_ind_ths 1,
  67.231 +                            REPEAT_DETERM (resolve_tac context'' (P_ths @ rec_prems) 1)]);
  67.232  
  67.233                      val fresh_results'' = map prove_fresh_result boundsl;
  67.234  
  67.235 @@ -1956,7 +1957,7 @@
  67.236                          (HOLogic.mk_Trueprop (fresh_const aT rT $ a $ t))
  67.237                          (fn _ => EVERY
  67.238                            [cut_facts_tac recs 1,
  67.239 -                           REPEAT_DETERM (dresolve_tac
  67.240 +                           REPEAT_DETERM (dresolve_tac context''
  67.241                               (the (AList.lookup op = rec_fin_supp_thms' aT)) 1),
  67.242                             NominalPermeq.fresh_guess_tac
  67.243                               (put_simpset HOL_ss context'' addsimps (freshs2 @
  67.244 @@ -1986,7 +1987,7 @@
  67.245                      val final' = Proof_Context.export context'' context' [final];
  67.246                      val _ = warning "finished!"
  67.247                    in
  67.248 -                    resolve_tac final' 1
  67.249 +                    resolve_tac context' final' 1
  67.250                    end) context 1])) idxss) (ndescr ~~ rec_elims))
  67.251           end));
  67.252  
  67.253 @@ -2025,8 +2026,8 @@
  67.254          val concl' = subst_atomic_types (rec_result_Ts' ~~ rec_result_Ts) concl;
  67.255          val prems' = flat finite_premss @ finite_ctxt_prems @
  67.256            rec_prems @ rec_prems' @ map (subst_atomic ps) prems;
  67.257 -        fun solve rules prems = resolve_tac rules THEN_ALL_NEW
  67.258 -          (resolve_tac prems THEN_ALL_NEW atac)
  67.259 +        fun solve ctxt rules prems = resolve_tac ctxt rules THEN_ALL_NEW
  67.260 +          (resolve_tac ctxt prems THEN_ALL_NEW atac)
  67.261        in
  67.262          Goal.prove_global_future thy12 []
  67.263            (map (augment_sort thy12 fs_cp_sort) prems')
  67.264 @@ -2034,9 +2035,9 @@
  67.265            (fn {context = ctxt, prems} => EVERY
  67.266              [rewrite_goals_tac ctxt reccomb_defs,
  67.267               rtac @{thm the1_equality} 1,
  67.268 -             solve rec_unique_thms prems 1,
  67.269 -             resolve_tac rec_intrs 1,
  67.270 -             REPEAT (solve (prems @ rec_total_thms) prems 1)])
  67.271 +             solve ctxt rec_unique_thms prems 1,
  67.272 +             resolve_tac ctxt rec_intrs 1,
  67.273 +             REPEAT (solve ctxt (prems @ rec_total_thms) prems 1)])
  67.274        end) (rec_eq_prems ~~
  67.275          Old_Datatype_Prop.make_primrecs reccomb_names descr' thy12);
  67.276  
    68.1 --- a/src/HOL/Nominal/nominal_inductive.ML	Tue Feb 10 14:29:36 2015 +0100
    68.2 +++ b/src/HOL/Nominal/nominal_inductive.ML	Tue Feb 10 14:48:26 2015 +0100
    68.3 @@ -130,7 +130,7 @@
    68.4      fun prove t =
    68.5        Goal.prove ctxt [] [] t (fn _ =>
    68.6          EVERY [cut_facts_tac [th] 1, etac rev_mp 1,
    68.7 -          REPEAT_DETERM (FIRSTGOAL (resolve_tac monos)),
    68.8 +          REPEAT_DETERM (FIRSTGOAL (resolve_tac ctxt monos)),
    68.9            REPEAT_DETERM (rtac impI 1 THEN (atac 1 ORELSE tac))])
   68.10    in Option.map prove (map_term f prop (the_default prop opt)) end;
   68.11  
   68.12 @@ -296,8 +296,8 @@
   68.13                NominalDatatype.fresh_const T (fastype_of p) $
   68.14                  Bound 0 $ p)))
   68.15            (fn _ => EVERY
   68.16 -            [resolve_tac exists_fresh' 1,
   68.17 -             resolve_tac fs_atoms 1]);
   68.18 +            [resolve_tac ctxt exists_fresh' 1,
   68.19 +             resolve_tac ctxt fs_atoms 1]);
   68.20          val (([(_, cx)], ths), ctxt') = Obtain.result
   68.21            (fn ctxt' => EVERY
   68.22              [etac exE 1,
   68.23 @@ -388,17 +388,17 @@
   68.24                         (simp_tac (put_simpset HOL_basic_ss ctxt''
   68.25                            addsimps [inductive_forall_def']
   68.26                            addsimprocs [NominalDatatype.perm_simproc]) 1 THEN
   68.27 -                        resolve_tac gprems2 1)]));
   68.28 +                        resolve_tac ctxt'' gprems2 1)]));
   68.29                   val final = Goal.prove ctxt'' [] [] (term_of concl)
   68.30                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (put_simpset HOL_ss ctxt''
   68.31                       addsimps vc_compat_ths'' @ freshs2' @
   68.32                         perm_fresh_fresh @ fresh_atm) 1);
   68.33                   val final' = Proof_Context.export ctxt'' ctxt' [final];
   68.34 -               in resolve_tac final' 1 end) context 1])
   68.35 +               in resolve_tac ctxt' final' 1 end) context 1])
   68.36                   (prems ~~ thss ~~ ihyps ~~ prems'')))
   68.37          in
   68.38            cut_facts_tac [th] 1 THEN REPEAT (etac conjE 1) THEN
   68.39 -          REPEAT (REPEAT (resolve_tac [conjI, impI] 1) THEN
   68.40 +          REPEAT (REPEAT (resolve_tac ctxt [conjI, impI] 1) THEN
   68.41              etac impE 1 THEN atac 1 THEN REPEAT (etac @{thm allE_Nil} 1) THEN
   68.42              asm_full_simp_tac ctxt 1)
   68.43          end) |> singleton (Proof_Context.export ctxt' ctxt);
   68.44 @@ -532,10 +532,10 @@
   68.45                           in
   68.46                             simp_tac case_simpset 1 THEN
   68.47                             REPEAT_DETERM (TRY (rtac conjI 1) THEN
   68.48 -                             resolve_tac case_hyps' 1)
   68.49 +                             resolve_tac ctxt4 case_hyps' 1)
   68.50                           end) ctxt4 1)
   68.51                    val final = Proof_Context.export ctxt3 ctxt2 [th]
   68.52 -                in resolve_tac final 1 end) ctxt1 1)
   68.53 +                in resolve_tac ctxt2 final 1 end) ctxt1 1)
   68.54                    (thss ~~ hyps ~~ prems))) |>
   68.55                    singleton (Proof_Context.export ctxt' ctxt))
   68.56  
   68.57 @@ -634,7 +634,7 @@
   68.58              val intr' = Drule.cterm_instantiate (map (cterm_of thy) vs ~~
   68.59                 map (cterm_of thy o NominalDatatype.mk_perm [] pi o term_of o #2) params)
   68.60                 intr
   68.61 -          in (rtac intr' THEN_ALL_NEW (TRY o resolve_tac prems'')) 1
   68.62 +          in (rtac intr' THEN_ALL_NEW (TRY o resolve_tac ctxt'' prems'')) 1
   68.63            end) ctxt' 1 st
   68.64        in
   68.65          case (Seq.pull res handle THM (s, _, _) => eqvt_err s) of
    69.1 --- a/src/HOL/Nominal/nominal_inductive2.ML	Tue Feb 10 14:29:36 2015 +0100
    69.2 +++ b/src/HOL/Nominal/nominal_inductive2.ML	Tue Feb 10 14:48:26 2015 +0100
    69.3 @@ -135,7 +135,7 @@
    69.4      fun prove t =
    69.5        Goal.prove ctxt [] [] t (fn _ =>
    69.6          EVERY [cut_facts_tac [th] 1, etac rev_mp 1,
    69.7 -          REPEAT_DETERM (FIRSTGOAL (resolve_tac monos)),
    69.8 +          REPEAT_DETERM (FIRSTGOAL (resolve_tac ctxt monos)),
    69.9            REPEAT_DETERM (rtac impI 1 THEN (atac 1 ORELSE tac))])
   69.10    in Option.map prove (map_term f prop (the_default prop opt)) end;
   69.11  
   69.12 @@ -424,17 +424,17 @@
   69.13                         (simp_tac (put_simpset HOL_basic_ss ctxt''
   69.14                            addsimps [inductive_forall_def']
   69.15                            addsimprocs [NominalDatatype.perm_simproc]) 1 THEN
   69.16 -                        resolve_tac gprems2 1)]));
   69.17 +                        resolve_tac ctxt'' gprems2 1)]));
   69.18                   val final = Goal.prove ctxt'' [] [] (term_of concl)
   69.19                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (put_simpset HOL_ss ctxt''
   69.20                       addsimps vc_compat_ths1' @ fresh_ths1 @
   69.21                         perm_freshs_freshs') 1);
   69.22                   val final' = Proof_Context.export ctxt'' ctxt' [final];
   69.23 -               in resolve_tac final' 1 end) context 1])
   69.24 +               in resolve_tac ctxt' final' 1 end) context 1])
   69.25                   (prems ~~ thss ~~ vc_compat' ~~ ihyps ~~ prems'')))
   69.26          in
   69.27            cut_facts_tac [th] 1 THEN REPEAT (etac conjE 1) THEN
   69.28 -          REPEAT (REPEAT (resolve_tac [conjI, impI] 1) THEN
   69.29 +          REPEAT (REPEAT (resolve_tac ctxt' [conjI, impI] 1) THEN
   69.30              etac impE 1 THEN atac 1 THEN REPEAT (etac @{thm allE_Nil} 1) THEN
   69.31              asm_full_simp_tac ctxt 1)
   69.32          end) |>
    70.1 --- a/src/HOL/Old_Number_Theory/Chinese.thy	Tue Feb 10 14:29:36 2015 +0100
    70.2 +++ b/src/HOL/Old_Number_Theory/Chinese.thy	Tue Feb 10 14:48:26 2015 +0100
    70.3 @@ -166,11 +166,11 @@
    70.4    "0 < n ==> i \<le> n ==> m_cond n mf ==> km_cond n kf mf
    70.5      ==> \<exists>!x. 0 \<le> x \<and> x < mf i \<and> [kf i * mhf mf n i * x = bf i] (mod mf i)"
    70.6    apply (rule zcong_lineq_unique)
    70.7 -   apply (tactic {* stac @{thm zgcd_zmult_cancel} 2 *})
    70.8 +   apply (tactic {* stac @{context} @{thm zgcd_zmult_cancel} 2 *})
    70.9      apply (unfold m_cond_def km_cond_def mhf_def)
   70.10      apply (simp_all (no_asm_simp))
   70.11    apply safe
   70.12 -    apply (tactic {* stac @{thm zgcd_zmult_cancel} 3 *})
   70.13 +    apply (tactic {* stac @{context} @{thm zgcd_zmult_cancel} 3 *})
   70.14       apply (rule_tac [!] funprod_zgcd)
   70.15       apply safe
   70.16       apply simp_all
   70.17 @@ -228,12 +228,12 @@
   70.18    apply (rule_tac x = "x_sol n kf bf mf mod funprod mf 0 n" in exI)
   70.19    apply (unfold lincong_sol_def)
   70.20    apply safe
   70.21 -    apply (tactic {* stac @{thm zcong_zmod} 3 *})
   70.22 -    apply (tactic {* stac @{thm mod_mult_eq} 3 *})
   70.23 -    apply (tactic {* stac @{thm mod_mod_cancel} 3 *})
   70.24 -      apply (tactic {* stac @{thm x_sol_lin} 4 *})
   70.25 -        apply (tactic {* stac (@{thm mod_mult_eq} RS sym) 6 *})
   70.26 -        apply (tactic {* stac (@{thm zcong_zmod} RS sym) 6 *})
   70.27 +    apply (tactic {* stac @{context} @{thm zcong_zmod} 3 *})
   70.28 +    apply (tactic {* stac @{context} @{thm mod_mult_eq} 3 *})
   70.29 +    apply (tactic {* stac @{context} @{thm mod_mod_cancel} 3 *})
   70.30 +      apply (tactic {* stac @{context} @{thm x_sol_lin} 4 *})
   70.31 +        apply (tactic {* stac @{context} (@{thm mod_mult_eq} RS sym) 6 *})
   70.32 +        apply (tactic {* stac @{context} (@{thm zcong_zmod} RS sym) 6 *})
   70.33          apply (subgoal_tac [6]
   70.34            "0 \<le> xilin_sol i n kf bf mf \<and> xilin_sol i n kf bf mf < mf i
   70.35            \<and> [kf i * mhf mf n i * xilin_sol i n kf bf mf = bf i] (mod mf i)")
    71.1 --- a/src/HOL/Old_Number_Theory/IntPrimes.thy	Tue Feb 10 14:29:36 2015 +0100
    71.2 +++ b/src/HOL/Old_Number_Theory/IntPrimes.thy	Tue Feb 10 14:48:26 2015 +0100
    71.3 @@ -399,7 +399,7 @@
    71.4      zgcd a n = 1 ==> \<exists>!x. 0 \<le> x \<and> x < n \<and> [a * x = b] (mod n)"
    71.5    apply auto
    71.6     apply (rule_tac [2] zcong_zless_imp_eq)
    71.7 -       apply (tactic {* stac (@{thm zcong_cancel2} RS sym) 6 *})
    71.8 +       apply (tactic {* stac @{context} (@{thm zcong_cancel2} RS sym) 6 *})
    71.9           apply (rule_tac [8] zcong_trans)
   71.10            apply (simp_all (no_asm_simp))
   71.11     prefer 2
    72.1 --- a/src/HOL/Old_Number_Theory/WilsonBij.thy	Tue Feb 10 14:29:36 2015 +0100
    72.2 +++ b/src/HOL/Old_Number_Theory/WilsonBij.thy	Tue Feb 10 14:48:26 2015 +0100
    72.3 @@ -139,9 +139,9 @@
    72.4    apply (unfold inj_on_def)
    72.5    apply auto
    72.6    apply (rule zcong_zless_imp_eq)
    72.7 -      apply (tactic {* stac (@{thm zcong_cancel} RS sym) 5 *})
    72.8 +      apply (tactic {* stac @{context} (@{thm zcong_cancel} RS sym) 5 *})
    72.9          apply (rule_tac [7] zcong_trans)
   72.10 -         apply (tactic {* stac @{thm zcong_sym} 8 *})
   72.11 +         apply (tactic {* stac @{context} @{thm zcong_sym} 8 *})
   72.12           apply (erule_tac [7] inv_is_inv)
   72.13            apply (tactic "asm_simp_tac @{context} 9")
   72.14            apply (erule_tac [9] inv_is_inv)
   72.15 @@ -192,15 +192,15 @@
   72.16    apply (unfold reciR_def uniqP_def)
   72.17    apply auto
   72.18     apply (rule zcong_zless_imp_eq)
   72.19 -       apply (tactic {* stac (@{thm zcong_cancel2} RS sym) 5 *})
   72.20 +       apply (tactic {* stac @{context} (@{thm zcong_cancel2} RS sym) 5 *})
   72.21           apply (rule_tac [7] zcong_trans)
   72.22 -          apply (tactic {* stac @{thm zcong_sym} 8 *})
   72.23 +          apply (tactic {* stac @{context} @{thm zcong_sym} 8 *})
   72.24            apply (rule_tac [6] zless_zprime_imp_zrelprime)
   72.25              apply auto
   72.26    apply (rule zcong_zless_imp_eq)
   72.27 -      apply (tactic {* stac (@{thm zcong_cancel} RS sym) 5 *})
   72.28 +      apply (tactic {* stac @{context} (@{thm zcong_cancel} RS sym) 5 *})
   72.29          apply (rule_tac [7] zcong_trans)
   72.30 -         apply (tactic {* stac @{thm zcong_sym} 8 *})
   72.31 +         apply (tactic {* stac @{context} @{thm zcong_sym} 8 *})
   72.32           apply (rule_tac [6] zless_zprime_imp_zrelprime)
   72.33             apply auto
   72.34    done
    73.1 --- a/src/HOL/Old_Number_Theory/WilsonRuss.thy	Tue Feb 10 14:29:36 2015 +0100
    73.2 +++ b/src/HOL/Old_Number_Theory/WilsonRuss.thy	Tue Feb 10 14:48:26 2015 +0100
    73.3 @@ -252,7 +252,7 @@
    73.4     apply (subst wset.simps)
    73.5     apply (auto, unfold Let_def, auto)
    73.6    apply (subst setprod.insert)
    73.7 -    apply (tactic {* stac @{thm setprod.insert} 3 *})
    73.8 +    apply (tactic {* stac @{context} @{thm setprod.insert} 3 *})
    73.9        apply (subgoal_tac [5]
   73.10          "zcong (a * inv p a * (\<Prod>x\<in>wset (a - 1) p. x)) (1 * 1) p")
   73.11         prefer 5
    74.1 --- a/src/HOL/Probability/measurable.ML	Tue Feb 10 14:29:36 2015 +0100
    74.2 +++ b/src/HOL/Probability/measurable.ML	Tue Feb 10 14:48:26 2015 +0100
    74.3 @@ -208,9 +208,9 @@
    74.4      fun r_tac msg =
    74.5        if Config.get ctxt debug
    74.6        then FIRST' o
    74.7 -        map (fn thm => resolve_tac [thm]
    74.8 +        map (fn thm => resolve_tac ctxt [thm]
    74.9            THEN' K (debug_tac ctxt (debug_fact (msg ^ " resolved using") thm) all_tac))
   74.10 -      else resolve_tac
   74.11 +      else resolve_tac ctxt
   74.12  
   74.13      val elem_congI = @{lemma "A = B \<Longrightarrow> x \<in> B \<Longrightarrow> x \<in> A" by simp}
   74.14  
   74.15 @@ -249,7 +249,8 @@
   74.16            val f = dest_measurable_fun (HOLogic.dest_Trueprop t)
   74.17            fun cert f = map (Option.map (f (Proof_Context.theory_of ctxt)))
   74.18            fun inst (ts, Ts) =
   74.19 -            Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts) @{thm measurable_compose_countable}
   74.20 +            Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts)
   74.21 +              @{thm measurable_compose_countable}
   74.22          in r_tac "split countable" (cnt_prefixes ctxt f |> map inst) i end
   74.23          handle TERM _ => no_tac) 1)
   74.24  
    75.1 --- a/src/HOL/Product_Type.thy	Tue Feb 10 14:29:36 2015 +0100
    75.2 +++ b/src/HOL/Product_Type.thy	Tue Feb 10 14:48:26 2015 +0100
    75.3 @@ -1327,10 +1327,10 @@
    75.4                        SOME (Goal.prove ctxt [] []
    75.5                          (Const (@{const_name Pure.eq}, T --> T --> propT) $ S $ S')
    75.6                          (K (EVERY
    75.7 -                          [resolve_tac [eq_reflection] 1,
    75.8 -                           resolve_tac @{thms subset_antisym} 1,
    75.9 -                           resolve_tac [subsetI] 1, dresolve_tac [CollectD] 1, simp,
   75.10 -                           resolve_tac [subsetI] 1, resolve_tac [CollectI] 1, simp])))
   75.11 +                          [resolve_tac ctxt [eq_reflection] 1,
   75.12 +                           resolve_tac ctxt @{thms subset_antisym} 1,
   75.13 +                           resolve_tac ctxt [subsetI] 1, dresolve_tac ctxt [CollectD] 1, simp,
   75.14 +                           resolve_tac ctxt [subsetI] 1, resolve_tac ctxt [CollectI] 1, simp])))
   75.15                      end
   75.16                    else NONE)
   75.17            | _ => NONE)
    76.1 --- a/src/HOL/Prolog/prolog.ML	Tue Feb 10 14:29:36 2015 +0100
    76.2 +++ b/src/HOL/Prolog/prolog.ML	Tue Feb 10 14:48:26 2015 +0100
    76.3 @@ -119,8 +119,8 @@
    76.4                    asm_full_simp_tac (put_simpset atomize_ss ctxt) THEN'    (* atomize the asms *)
    76.5                    (REPEAT_DETERM o (etac conjE))        (* split the asms *)
    76.6                  ])
    76.7 -        ORELSE' resolve_tac [disjI1,disjI2]     (* "P ==> P | Q","Q ==> P | Q"*)
    76.8 -        ORELSE' ((resolve_tac proga APPEND' hyp_resolve_tac)
    76.9 +        ORELSE' resolve_tac ctxt [disjI1,disjI2]     (* "P ==> P | Q","Q ==> P | Q"*)
   76.10 +        ORELSE' ((resolve_tac ctxt proga APPEND' hyp_resolve_tac)
   76.11                   THEN' (fn _ => check_HOHH_tac2))
   76.12  end;
   76.13  
    77.1 --- a/src/HOL/SET_Protocol/Event_SET.thy	Tue Feb 10 14:29:36 2015 +0100
    77.2 +++ b/src/HOL/SET_Protocol/Event_SET.thy	Tue Feb 10 14:48:26 2015 +0100
    77.3 @@ -184,7 +184,7 @@
    77.4  {*
    77.5  fun analz_mono_contra_tac ctxt = 
    77.6    rtac @{thm analz_impI} THEN' 
    77.7 -  REPEAT1 o (dresolve_tac @{thms analz_mono_contra})
    77.8 +  REPEAT1 o (dresolve_tac ctxt @{thms analz_mono_contra})
    77.9    THEN' mp_tac ctxt
   77.10  *}
   77.11  
    78.1 --- a/src/HOL/SET_Protocol/Message_SET.thy	Tue Feb 10 14:29:36 2015 +0100
    78.2 +++ b/src/HOL/SET_Protocol/Message_SET.thy	Tue Feb 10 14:48:26 2015 +0100
    78.3 @@ -850,13 +850,13 @@
    78.4  (*Apply rules to break down assumptions of the form
    78.5    Y \<in> parts(insert X H)  and  Y \<in> analz(insert X H)
    78.6  *)
    78.7 -val Fake_insert_tac =
    78.8 -    dresolve_tac [impOfSubs @{thm Fake_analz_insert},
    78.9 +fun Fake_insert_tac ctxt =
   78.10 +    dresolve_tac ctxt [impOfSubs @{thm Fake_analz_insert},
   78.11                    impOfSubs @{thm Fake_parts_insert}] THEN'
   78.12 -    eresolve_tac [asm_rl, @{thm synth.Inj}];
   78.13 +    eresolve_tac ctxt [asm_rl, @{thm synth.Inj}];
   78.14  
   78.15  fun Fake_insert_simp_tac ctxt i =
   78.16 -  REPEAT (Fake_insert_tac i) THEN asm_full_simp_tac ctxt i;
   78.17 +  REPEAT (Fake_insert_tac ctxt i) THEN asm_full_simp_tac ctxt i;
   78.18  
   78.19  fun atomic_spy_analz_tac ctxt =
   78.20    SELECT_GOAL
   78.21 @@ -874,7 +874,7 @@
   78.22             (res_inst_tac ctxt [(("x", 1), "X")] (insert_commute RS ssubst) 1),
   78.23         (*...allowing further simplifications*)
   78.24         simp_tac ctxt 1,
   78.25 -       REPEAT (FIRSTGOAL (resolve_tac [allI,impI,notI,conjI,iffI])),
   78.26 +       REPEAT (FIRSTGOAL (resolve_tac ctxt [allI,impI,notI,conjI,iffI])),
   78.27         DEPTH_SOLVE (atomic_spy_analz_tac ctxt 1)]) i);
   78.28  *}
   78.29  (*>*)
    79.1 --- a/src/HOL/SET_Protocol/Public_SET.thy	Tue Feb 10 14:29:36 2015 +0100
    79.2 +++ b/src/HOL/SET_Protocol/Public_SET.thy	Tue Feb 10 14:48:26 2015 +0100
    79.3 @@ -347,7 +347,7 @@
    79.4      (ALLGOALS (simp_tac (ctxt delsimps [@{thm used_Says}, @{thm used_Notes}]))
    79.5       THEN
    79.6       REPEAT_FIRST (eq_assume_tac ORELSE' 
    79.7 -                   resolve_tac [refl, conjI, @{thm Nonce_supply}]))
    79.8 +                   resolve_tac ctxt [refl, conjI, @{thm Nonce_supply}]))
    79.9  
   79.10  (*For harder protocols (such as SET_CR!), where we have to set up some
   79.11    nonces and keys initially*)
   79.12 @@ -355,7 +355,7 @@
   79.13      REPEAT 
   79.14      (ALLGOALS (asm_simp_tac (ctxt setSolver safe_solver))
   79.15       THEN
   79.16 -     REPEAT_FIRST (resolve_tac [refl, conjI]))
   79.17 +     REPEAT_FIRST (resolve_tac ctxt [refl, conjI]))
   79.18  *}
   79.19  
   79.20  method_setup possibility = {*
    80.1 --- a/src/HOL/SPARK/Tools/spark_vcs.ML	Tue Feb 10 14:29:36 2015 +0100
    80.2 +++ b/src/HOL/SPARK/Tools/spark_vcs.ML	Tue Feb 10 14:48:26 2015 +0100
    80.3 @@ -242,12 +242,12 @@
    80.4             delsimps @{thms atLeastLessThan_iff}) 1);
    80.5  
    80.6      val lthy' =
    80.7 -      Class.prove_instantiation_instance (fn _ =>
    80.8 -        Class.intro_classes_tac [] THEN
    80.9 +      Class.prove_instantiation_instance (fn ctxt =>
   80.10 +        Class.intro_classes_tac ctxt [] THEN
   80.11          rtac finite_UNIV 1 THEN
   80.12          rtac range_pos 1 THEN
   80.13 -        simp_tac (put_simpset HOL_basic_ss lthy addsimps [def3]) 1 THEN
   80.14 -        simp_tac (put_simpset HOL_basic_ss lthy addsimps [def2]) 1) lthy;
   80.15 +        simp_tac (put_simpset HOL_basic_ss ctxt addsimps [def3]) 1 THEN
   80.16 +        simp_tac (put_simpset HOL_basic_ss ctxt addsimps [def2]) 1) lthy;
   80.17  
   80.18      val (pos_eqs, val_eqs) = split_list (map_index (fn (i, c) =>
   80.19        let
    81.1 --- a/src/HOL/Set.thy	Tue Feb 10 14:29:36 2015 +0100
    81.2 +++ b/src/HOL/Set.thy	Tue Feb 10 14:48:26 2015 +0100
    81.3 @@ -70,11 +70,11 @@
    81.4  
    81.5  simproc_setup defined_Collect ("{x. P x & Q x}") = {*
    81.6    fn _ => Quantifier1.rearrange_Collect
    81.7 -    (fn _ =>
    81.8 -      resolve_tac @{thms Collect_cong} 1 THEN
    81.9 -      resolve_tac @{thms iffI} 1 THEN
   81.10 +    (fn ctxt =>
   81.11 +      resolve_tac ctxt @{thms Collect_cong} 1 THEN
   81.12 +      resolve_tac ctxt @{thms iffI} 1 THEN
   81.13        ALLGOALS
   81.14 -        (EVERY' [REPEAT_DETERM o eresolve_tac @{thms conjE},
   81.15 +        (EVERY' [REPEAT_DETERM o eresolve_tac ctxt @{thms conjE},
   81.16            DEPTH_SOLVE_1 o ares_tac @{thms conjI}]))
   81.17  *}
   81.18  
   81.19 @@ -359,14 +359,14 @@
   81.20    fn _ => Quantifier1.rearrange_bex
   81.21      (fn ctxt =>
   81.22        unfold_tac ctxt @{thms Bex_def} THEN
   81.23 -      Quantifier1.prove_one_point_ex_tac)
   81.24 +      Quantifier1.prove_one_point_ex_tac ctxt)
   81.25  *}
   81.26  
   81.27  simproc_setup defined_All ("ALL x:A. P x --> Q x") = {*
   81.28    fn _ => Quantifier1.rearrange_ball
   81.29      (fn ctxt =>
   81.30        unfold_tac ctxt @{thms Ball_def} THEN
   81.31 -      Quantifier1.prove_one_point_all_tac)
   81.32 +      Quantifier1.prove_one_point_all_tac ctxt)
   81.33  *}
   81.34  
   81.35  lemma ballI [intro!]: "(!!x. x:A ==> P x) ==> ALL x:A. P x"
   81.36 @@ -383,7 +383,7 @@
   81.37  
   81.38  setup {*
   81.39    map_theory_claset (fn ctxt =>
   81.40 -    ctxt addbefore ("bspec", fn ctxt' => dresolve_tac @{thms bspec} THEN' assume_tac ctxt'))
   81.41 +    ctxt addbefore ("bspec", fn ctxt' => dresolve_tac ctxt' @{thms bspec} THEN' assume_tac ctxt'))
   81.42  *}
   81.43  
   81.44  ML {*
    82.1 --- a/src/HOL/Statespace/state_space.ML	Tue Feb 10 14:29:36 2015 +0100
    82.2 +++ b/src/HOL/Statespace/state_space.ML	Tue Feb 10 14:48:26 2015 +0100
    82.3 @@ -354,7 +354,7 @@
    82.4          val expr = ([(suffix valuetypesN name,
    82.5                       (prefix, Expression.Positional (map SOME pars)))],[]);
    82.6        in
    82.7 -        prove_interpretation_in (ALLGOALS o solve_tac o Assumption.all_prems_of)
    82.8 +        prove_interpretation_in (fn ctxt => ALLGOALS (solve_tac ctxt (Assumption.all_prems_of ctxt)))
    82.9            (suffix valuetypesN name, expr) thy
   82.10        end;
   82.11  
    83.1 --- a/src/HOL/TLA/Action.thy	Tue Feb 10 14:29:36 2015 +0100
    83.2 +++ b/src/HOL/TLA/Action.thy	Tue Feb 10 14:48:26 2015 +0100
    83.3 @@ -263,9 +263,9 @@
    83.4  *)
    83.5  fun action_simp_tac ctxt intros elims =
    83.6      asm_full_simp_tac
    83.7 -         (ctxt setloop (fn _ => (resolve_tac ((map (action_use ctxt) intros)
    83.8 +         (ctxt setloop (fn _ => (resolve_tac ctxt ((map (action_use ctxt) intros)
    83.9                                      @ [refl,impI,conjI,@{thm actionI},@{thm intI},allI]))
   83.10 -                      ORELSE' (eresolve_tac ((map (action_use ctxt) elims)
   83.11 +                      ORELSE' (eresolve_tac ctxt ((map (action_use ctxt) elims)
   83.12                                               @ [conjE,disjE,exE]))));
   83.13  *}
   83.14  
    84.1 --- a/src/HOL/TLA/Memory/MemoryImplementation.thy	Tue Feb 10 14:29:36 2015 +0100
    84.2 +++ b/src/HOL/TLA/Memory/MemoryImplementation.thy	Tue Feb 10 14:48:26 2015 +0100
    84.3 @@ -800,7 +800,7 @@
    84.4     (TRY (rtac @{thm actionI} 1) THEN
    84.5      Induct_Tacs.case_tac ctxt "(s,t) |= unchanged (e p, c p, r p, m p, rmhist!p)" 1 THEN
    84.6      rewrite_goals_tac ctxt @{thms action_rews} THEN
    84.7 -    forward_tac [temp_use ctxt @{thm Step1_4_7}] 1 THEN
    84.8 +    forward_tac ctxt [temp_use ctxt @{thm Step1_4_7}] 1 THEN
    84.9      asm_full_simp_tac ctxt 1);
   84.10  *}
   84.11  
    85.1 --- a/src/HOL/TLA/TLA.thy	Tue Feb 10 14:29:36 2015 +0100
    85.2 +++ b/src/HOL/TLA/TLA.thy	Tue Feb 10 14:48:26 2015 +0100
    85.3 @@ -697,7 +697,8 @@
    85.4  
    85.5  (* A tactic that "boxes" all fairness conditions. Apply more_temp_simps to "unbox". *)
    85.6  ML {*
    85.7 -val box_fair_tac = SELECT_GOAL (REPEAT (dresolve_tac [@{thm BoxWFI}, @{thm BoxSFI}] 1))
    85.8 +fun box_fair_tac ctxt =
    85.9 +  SELECT_GOAL (REPEAT (dresolve_tac ctxt [@{thm BoxWFI}, @{thm BoxSFI}] 1))
   85.10  *}
   85.11  
   85.12  
    86.1 --- a/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML	Tue Feb 10 14:29:36 2015 +0100
    86.2 +++ b/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML	Tue Feb 10 14:48:26 2015 +0100
    86.3 @@ -623,7 +623,7 @@
    86.4  
    86.5  (*Prove subgoals of form A ==> B1 | ... | A | ... | Bn*)
    86.6  val clause_breaker =
    86.7 -  (REPEAT o (resolve_tac [@{thm "disjI1"}, @{thm "disjI2"}, @{thm "conjI"}]))
    86.8 +  (REPEAT o (resolve0_tac [@{thm "disjI1"}, @{thm "disjI2"}, @{thm "conjI"}]))
    86.9    THEN'  atac
   86.10  
   86.11  (*
    87.1 --- a/src/HOL/TPTP/TPTP_Proof_Reconstruction.thy	Tue Feb 10 14:29:36 2015 +0100
    87.2 +++ b/src/HOL/TPTP/TPTP_Proof_Reconstruction.thy	Tue Feb 10 14:48:26 2015 +0100
    87.3 @@ -474,7 +474,7 @@
    87.4        THEN' (REPEAT_DETERM o etac @{thm conjE})
    87.5        THEN' (TRY o (expander_animal ctxt))
    87.6    in
    87.7 -    default_tac ORELSE' resolve_tac @{thms flip}
    87.8 +    default_tac ORELSE' resolve_tac ctxt @{thms flip}
    87.9    end
   87.10  *}
   87.11  
   87.12 @@ -1154,7 +1154,7 @@
   87.13        ASAP
   87.14          (rtac @{thm disjI1} APPEND' rtac @{thm disjI2})
   87.15          (FIRST' (map closure
   87.16 -                  [dresolve_tac @{thms dec_commut_eq},
   87.17 +                  [dresolve_tac ctxt @{thms dec_commut_eq},
   87.18                     dtac @{thm dec_commut_disj},
   87.19                     elim_tac]))
   87.20    in
   87.21 @@ -1527,7 +1527,7 @@
   87.22  
   87.23      val ex_free =
   87.24        if loop_can_feature [Existential_Free] feats andalso consts_diff = [] then
   87.25 -        eresolve_tac @{thms polar_exE}
   87.26 +        eresolve_tac ctxt @{thms polar_exE}
   87.27        else K no_tac
   87.28    in
   87.29      ex_var APPEND' ex_free
   87.30 @@ -1613,8 +1613,8 @@
   87.31              | Not_neg => trace_tac' "mark: not_neg" (dtac @{thm leo2_rules(10)})
   87.32              | Or_pos => trace_tac' "mark: or_pos" (dtac @{thm leo2_rules(5)}) (*could add (6) for negated conjunction*)
   87.33              | Or_neg => trace_tac' "mark: or_neg" (dtac @{thm leo2_rules(7)})
   87.34 -            | Equal_pos => trace_tac' "mark: equal_pos" (dresolve_tac (@{thms eq_pos_bool} @ [@{thm leo2_rules(3)}, @{thm eq_pos_func}]))
   87.35 -            | Equal_neg => trace_tac' "mark: equal_neg" (dresolve_tac [@{thm eq_neg_bool}, @{thm leo2_rules(4)}])
   87.36 +            | Equal_pos => trace_tac' "mark: equal_pos" (dresolve_tac ctxt (@{thms eq_pos_bool} @ [@{thm leo2_rules(3)}, @{thm eq_pos_func}]))
   87.37 +            | Equal_neg => trace_tac' "mark: equal_neg" (dresolve_tac ctxt [@{thm eq_neg_bool}, @{thm leo2_rules(4)}])
   87.38              | Donkey_Cong => trace_tac' "mark: donkey_cong" (simper_animal ctxt THEN' ex_expander_tac ctxt)
   87.39  
   87.40              | Extuni_Bool2 => trace_tac' "mark: extuni_bool2" (dtac @{thm extuni_bool2})
   87.41 @@ -1624,7 +1624,7 @@
   87.42              | Extuni_Dec => trace_tac' "mark: extuni_dec_tac" (extuni_dec_tac ctxt)
   87.43              | Extuni_FlexRigid => trace_tac' "mark: extuni_flex_rigid" (atac ORELSE' asm_full_simp_tac ctxt)
   87.44              | Extuni_Func => trace_tac' "mark: extuni_func" (dtac @{thm extuni_func})
   87.45 -            | Polarity_switch => trace_tac' "mark: polarity_switch" (eresolve_tac @{thms polarity_switch})
   87.46 +            | Polarity_switch => trace_tac' "mark: polarity_switch" (eresolve_tac ctxt @{thms polarity_switch})
   87.47              | Forall_special_pos => trace_tac' "mark: dorall_special_pos" extcnf_forall_special_pos_tac
   87.48  
   87.49          val core_tac =
   87.50 @@ -1804,7 +1804,7 @@
   87.51                    member (op =)  (Term.add_frees hyp_lit_body []) (hd hyp_lit_prefix) then
   87.52                    no_tac st
   87.53                  else
   87.54 -                  dresolve_tac @{thms drop_redundant_literal_qtfr} i st
   87.55 +                  dresolve_tac ctxt @{thms drop_redundant_literal_qtfr} i st
   87.56                end
   87.57            end
   87.58       end
    88.1 --- a/src/HOL/TPTP/atp_problem_import.ML	Tue Feb 10 14:29:36 2015 +0100
    88.2 +++ b/src/HOL/TPTP/atp_problem_import.ML	Tue Feb 10 14:48:26 2015 +0100
    88.3 @@ -178,7 +178,7 @@
    88.4          val (outcome, _) =
    88.5            Nitpick.pick_nits_in_term state params Nitpick.Normal i n step subst [] [] conj
    88.6        in
    88.7 -        if outcome = "none" then ALLGOALS Skip_Proof.cheat_tac th else Seq.empty
    88.8 +        if outcome = "none" then ALLGOALS (Skip_Proof.cheat_tac ctxt) th else Seq.empty
    88.9        end
   88.10    end
   88.11  
    89.1 --- a/src/HOL/TPTP/sledgehammer_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    89.2 +++ b/src/HOL/TPTP/sledgehammer_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    89.3 @@ -70,7 +70,7 @@
    89.4         ("minimize", "false")]
    89.5      val xs = run_prover override_params fact_override chained i i ctxt th
    89.6    in
    89.7 -    if is_some xs then ALLGOALS Skip_Proof.cheat_tac th else Seq.empty
    89.8 +    if is_some xs then ALLGOALS (Skip_Proof.cheat_tac ctxt) th else Seq.empty
    89.9    end
   89.10  
   89.11  end;
    90.1 --- a/src/HOL/Tools/BNF/bnf_comp_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    90.2 +++ b/src/HOL/Tools/BNF/bnf_comp_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    90.3 @@ -171,11 +171,11 @@
    90.4    unfold_thms_tac ctxt [collect_set_map] THEN
    90.5    unfold_thms_tac ctxt comp_wit_thms THEN
    90.6    REPEAT_DETERM ((atac ORELSE'
    90.7 -    REPEAT_DETERM o eresolve_tac @{thms UnionE UnE} THEN'
    90.8 -    etac imageE THEN' TRY o dresolve_tac Gwit_thms THEN'
    90.9 +    REPEAT_DETERM o eresolve_tac ctxt @{thms UnionE UnE} THEN'
   90.10 +    etac imageE THEN' TRY o dresolve_tac ctxt Gwit_thms THEN'
   90.11      (etac FalseE ORELSE'
   90.12      hyp_subst_tac ctxt THEN'
   90.13 -    dresolve_tac Fwit_thms THEN'
   90.14 +    dresolve_tac ctxt Fwit_thms THEN'
   90.15      (etac FalseE ORELSE' atac))) 1);
   90.16  
   90.17  
   90.18 @@ -231,7 +231,7 @@
   90.19  fun mk_simple_rel_OO_Grp_tac rel_OO_Grp in_alt_thm =
   90.20    rtac (trans OF [rel_OO_Grp, in_alt_thm RS @{thm OO_Grp_cong} RS sym]) 1;
   90.21  
   90.22 -fun mk_simple_wit_tac wit_thms = ALLGOALS (atac ORELSE' eresolve_tac (@{thm emptyE} :: wit_thms));
   90.23 +fun mk_simple_wit_tac wit_thms = ALLGOALS (atac ORELSE' eresolve0_tac (@{thm emptyE} :: wit_thms));
   90.24  
   90.25  val csum_thms =
   90.26    @{thms csum_cong1 csum_cong2 csum_cong  csum_dup[OF natLeq_cinfinite natLeq_Card_order]};
   90.27 @@ -247,7 +247,7 @@
   90.28    unfold_thms_tac ctxt simplified_set_simps THEN rtac refl 1;
   90.29  
   90.30  val bd_ordIso_natLeq_tac =
   90.31 -  HEADGOAL (REPEAT_DETERM o resolve_tac
   90.32 +  HEADGOAL (REPEAT_DETERM o resolve0_tac
   90.33      (@{thm ordIso_refl[OF natLeq_Card_order]} :: csum_thms @ cprod_thms));
   90.34  
   90.35  end;
    91.1 --- a/src/HOL/Tools/BNF/bnf_def_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    91.2 +++ b/src/HOL/Tools/BNF/bnf_def_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    91.3 @@ -58,7 +58,7 @@
    91.4  fun mk_in_mono_tac n = if n = 0 then rtac subset_UNIV 1
    91.5    else (rtac subsetI THEN'
    91.6    rtac CollectI) 1 THEN
    91.7 -  REPEAT_DETERM (eresolve_tac [CollectE, conjE] 1) THEN
    91.8 +  REPEAT_DETERM (eresolve0_tac [CollectE, conjE] 1) THEN
    91.9    REPEAT_DETERM_N (n - 1)
   91.10      ((rtac conjI THEN' etac subset_trans THEN' atac) 1) THEN
   91.11    (etac subset_trans THEN' atac) 1;
   91.12 @@ -102,21 +102,21 @@
   91.13      else
   91.14        EVERY' [rel_OO_Grps_tac, rtac @{thm antisym}, rtac @{thm predicate2I},
   91.15          REPEAT_DETERM o
   91.16 -          eresolve_tac [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.17 +          eresolve_tac ctxt [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.18          hyp_subst_tac ctxt, rtac @{thm GrpI}, rtac trans, rtac map_comp, rtac map_cong0,
   91.19          REPEAT_DETERM_N n o EVERY' [rtac @{thm Collect_split_Grp_eqD}, etac @{thm set_mp}, atac],
   91.20          rtac CollectI,
   91.21          CONJ_WRAP' (fn thm => EVERY' [rtac (thm RS ord_eq_le_trans),
   91.22            rtac @{thm image_subsetI}, rtac @{thm Collect_split_Grp_inD}, etac @{thm set_mp}, atac])
   91.23          set_maps,
   91.24 -        rtac @{thm predicate2I}, REPEAT_DETERM o eresolve_tac [@{thm GrpE}, exE, conjE],
   91.25 +        rtac @{thm predicate2I}, REPEAT_DETERM o eresolve_tac ctxt [@{thm GrpE}, exE, conjE],
   91.26          hyp_subst_tac ctxt,
   91.27          rtac @{thm relcomppI}, rtac @{thm conversepI},
   91.28          EVERY' (map2 (fn convol => fn map_id0 =>
   91.29            EVERY' [rtac @{thm GrpI},
   91.30              rtac (@{thm box_equals} OF [map_cong0, map_comp RS sym, map_id0]),
   91.31              REPEAT_DETERM_N n o rtac (convol RS fun_cong),
   91.32 -            REPEAT_DETERM o eresolve_tac [CollectE, conjE],
   91.33 +            REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE],
   91.34              rtac CollectI,
   91.35              CONJ_WRAP' (fn thm =>
   91.36                EVERY' [rtac ord_eq_le_trans, rtac thm, rtac @{thm image_subsetI},
   91.37 @@ -145,11 +145,11 @@
   91.38        Goal.conjunction_tac 1 THEN
   91.39        unfold_thms_tac ctxt [rel_compp, rel_conversep, rel_Grp, @{thm vimage2p_Grp}] THEN
   91.40        TRYALL (EVERY' [rtac iffI, rtac @{thm relcomppI}, rtac @{thm GrpI},
   91.41 -        resolve_tac [map_id, refl], rtac CollectI,
   91.42 +        resolve_tac ctxt [map_id, refl], rtac CollectI,
   91.43          CONJ_WRAP' (K (rtac @{thm subset_UNIV})) ks, rtac @{thm relcomppI}, atac,
   91.44 -        rtac @{thm conversepI}, rtac @{thm GrpI}, resolve_tac [map_id, refl], rtac CollectI,
   91.45 +        rtac @{thm conversepI}, rtac @{thm GrpI}, resolve_tac ctxt [map_id, refl], rtac CollectI,
   91.46          CONJ_WRAP' (K (rtac @{thm subset_UNIV})) ks,
   91.47 -        REPEAT_DETERM o eresolve_tac @{thms relcomppE conversepE GrpE},
   91.48 +        REPEAT_DETERM o eresolve_tac ctxt @{thms relcomppE conversepE GrpE},
   91.49          dtac (trans OF [sym, map_id]), hyp_subst_tac ctxt, atac])
   91.50      end;
   91.51  
   91.52 @@ -175,7 +175,7 @@
   91.53      else
   91.54        EVERY' [rel_OO_Grps_tac, rtac @{thm predicate2I},
   91.55          REPEAT_DETERM o
   91.56 -          eresolve_tac [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.57 +          eresolve_tac ctxt [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.58          hyp_subst_tac ctxt, rtac @{thm conversepI}, rtac @{thm relcomppI}, rtac @{thm conversepI},
   91.59          EVERY' (map (fn thm => EVERY' [rtac @{thm GrpI}, rtac sym, rtac trans,
   91.60            rtac map_cong0, REPEAT_DETERM_N n o rtac thm,
   91.61 @@ -204,7 +204,7 @@
   91.62      else
   91.63        EVERY' [rel_OO_Grps_tac, rtac @{thm predicate2I},
   91.64          REPEAT_DETERM o
   91.65 -          eresolve_tac [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.66 +          eresolve_tac ctxt [CollectE, exE, conjE, @{thm GrpE}, @{thm relcomppE}, @{thm conversepE}],
   91.67          hyp_subst_tac ctxt,
   91.68          rtac @{thm relcomppI}, rtac @{thm relcomppI}, rtac @{thm conversepI}, rtac @{thm GrpI},
   91.69          rtac trans, rtac map_comp, rtac sym, rtac map_cong0,
   91.70 @@ -229,7 +229,7 @@
   91.71    if null set_maps then atac 1
   91.72    else
   91.73      unfold_tac ctxt [in_rel] THEN
   91.74 -    REPEAT_DETERM (eresolve_tac [exE, CollectE, conjE] 1) THEN
   91.75 +    REPEAT_DETERM (eresolve_tac ctxt [exE, CollectE, conjE] 1) THEN
   91.76      hyp_subst_tac ctxt 1 THEN
   91.77      EVERY' [rtac exI, rtac @{thm conjI[OF CollectI conjI[OF refl refl]]},
   91.78        CONJ_WRAP' (fn thm =>
   91.79 @@ -245,7 +245,7 @@
   91.80    in
   91.81      REPEAT_DETERM (HEADGOAL (rtac rel_funI)) THEN
   91.82      (HEADGOAL (hyp_subst_tac ctxt THEN' rtac refl) ORELSE
   91.83 -     REPEAT_DETERM (HEADGOAL (eresolve_tac (Tactic.make_elim (in_rel RS iffD1) ::
   91.84 +     REPEAT_DETERM (HEADGOAL (eresolve_tac ctxt (Tactic.make_elim (in_rel RS iffD1) ::
   91.85         @{thms exE conjE CollectE}))) THEN
   91.86       HEADGOAL (hyp_subst_tac ctxt) THEN unfold_thms_tac ctxt rel_map THEN HEADGOAL (rtac iffI) THEN
   91.87       last_tac iffD1 THEN last_tac iffD2)
   91.88 @@ -264,7 +264,7 @@
   91.89      unfold_thms_tac ctxt @{thms rel_fun_iff_leq_vimage2p} THEN
   91.90      HEADGOAL (EVERY' [rtac @{thm order_trans}, rtac rel_mono, REPEAT_DETERM_N n o atac,
   91.91        rtac @{thm predicate2I}, dtac (in_rel RS iffD1),
   91.92 -      REPEAT_DETERM o eresolve_tac [exE, CollectE, conjE], hyp_subst_tac ctxt,
   91.93 +      REPEAT_DETERM o eresolve_tac ctxt [exE, CollectE, conjE], hyp_subst_tac ctxt,
   91.94        rtac @{thm vimage2pI}, rtac (in_rel RS iffD2), rtac exI, rtac conjI, in_tac,
   91.95        rtac conjI,
   91.96        EVERY' (map (fn convol =>
   91.97 @@ -311,7 +311,7 @@
   91.98        unfold_thms_tac ctxt @{thms cprod_def Field_card_of} THEN
   91.99        EVERY' [rtac (Drule.rotate_prems 1 ctrans), rtac surj_imp_ordLeq_inst, rtac subsetI,
  91.100          Method.insert_tac inserts, REPEAT_DETERM o dtac meta_spec,
  91.101 -        REPEAT_DETERM o eresolve_tac [exE, Tactic.make_elim conjunct1], etac CollectE,
  91.102 +        REPEAT_DETERM o eresolve_tac ctxt [exE, Tactic.make_elim conjunct1], etac CollectE,
  91.103          if live = 1 then K all_tac
  91.104          else REPEAT_DETERM_N (live - 2) o (etac conjE THEN' rotate_tac ~1) THEN' etac conjE,
  91.105          rtac (Drule.rotate_prems 1 @{thm image_eqI}), rtac @{thm SigmaI}, rtac @{thm UNIV_I},
  91.106 @@ -325,7 +325,7 @@
  91.107          REPEAT_DETERM_N live o rtac (@{thm prod.case} RS trans),
  91.108          rtac refl,
  91.109          rtac @{thm surj_imp_ordLeq}, rtac subsetI, rtac (Drule.rotate_prems 1 @{thm image_eqI}),
  91.110 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac CollectI,
  91.111 +        REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], rtac CollectI,
  91.112          CONJ_WRAP' (fn thm =>
  91.113            rtac (thm RS ord_eq_le_trans) THEN' etac @{thm subset_trans[OF image_mono Un_upper1]})
  91.114          set_maps,
  91.115 @@ -341,12 +341,12 @@
  91.116  fun mk_set_transfer_tac ctxt in_rel set_maps =
  91.117    Goal.conjunction_tac 1 THEN
  91.118    EVERY (map (fn set_map => HEADGOAL (rtac rel_funI) THEN
  91.119 -  REPEAT_DETERM (HEADGOAL (eresolve_tac (Tactic.make_elim (in_rel RS iffD1) ::
  91.120 +  REPEAT_DETERM (HEADGOAL (eresolve_tac ctxt (Tactic.make_elim (in_rel RS iffD1) ::
  91.121      @{thms exE conjE CollectE}))) THEN
  91.122    HEADGOAL (hyp_subst_tac ctxt THEN' rtac (@{thm iffD2[OF arg_cong2]} OF [set_map, set_map]) THEN'
  91.123      rtac @{thm rel_setI}) THEN
  91.124    REPEAT (HEADGOAL (etac imageE THEN' dtac @{thm set_mp} THEN' atac THEN'
  91.125 -    REPEAT_DETERM o (eresolve_tac @{thms CollectE case_prodE}) THEN' hyp_subst_tac ctxt THEN'
  91.126 +    REPEAT_DETERM o (eresolve_tac ctxt @{thms CollectE case_prodE}) THEN' hyp_subst_tac ctxt THEN'
  91.127      rtac bexI THEN' etac @{thm subst_Pair[OF _ refl]} THEN' etac imageI))) set_maps);
  91.128  
  91.129  end;
    92.1 --- a/src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    92.2 +++ b/src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    92.3 @@ -120,16 +120,16 @@
    92.4  
    92.5  fun mk_ctr_transfer_tac ctxt rel_intros rel_eqs =
    92.6    HEADGOAL Goal.conjunction_tac THEN
    92.7 -  ALLGOALS (REPEAT o (resolve_tac (rel_funI :: rel_intros) THEN'
    92.8 +  ALLGOALS (REPEAT o (resolve_tac ctxt (rel_funI :: rel_intros) THEN'
    92.9      TRY o (REPEAT_DETERM1 o (atac ORELSE'
   92.10        K (unfold_thms_tac ctxt rel_eqs) THEN' hyp_subst_tac ctxt THEN' rtac refl))));
   92.11  
   92.12 -fun mk_disc_transfer_tac rel_sel exhaust_disc distinct_disc=
   92.13 +fun mk_disc_transfer_tac rel_sel exhaust_disc distinct_disc =
   92.14    let
   92.15      fun last_disc_tac iffD =
   92.16        HEADGOAL (rtac (rotate_prems ~1 exhaust_disc) THEN' atac THEN'
   92.17        REPEAT_DETERM o (rotate_tac ~1 THEN' dtac (rotate_prems 1 iffD) THEN' atac THEN'
   92.18 -        rotate_tac ~1 THEN' etac (rotate_prems 1 notE) THEN' eresolve_tac distinct_disc));
   92.19 +        rotate_tac ~1 THEN' etac (rotate_prems 1 notE) THEN' eresolve0_tac distinct_disc));
   92.20    in
   92.21      HEADGOAL Goal.conjunction_tac THEN
   92.22      REPEAT_DETERM (HEADGOAL (rtac rel_funI THEN' dtac (rel_sel RS iffD1) THEN'
   92.23 @@ -169,7 +169,7 @@
   92.24        case_prod_map_prod id_bnf_def map_prod_simp map_sum_if_distrib_then map_sum_if_distrib_else
   92.25        if_distrib[THEN sym]};
   92.26    in
   92.27 -    HEADGOAL (subst_tac @{context} (SOME [1, 2]) [co_rec_def] THEN'
   92.28 +    HEADGOAL (subst_tac ctxt (SOME [1, 2]) [co_rec_def] THEN'
   92.29        rtac (xtor_co_rec_o_map RS trans) THEN'
   92.30        CONVERSION Thm.eta_long_conversion THEN'
   92.31        asm_simp_tac (ss_only (pre_map_defs @ distinct Thm.eq_thm_prop (map_ident0s @ abs_inverses) @
   92.32 @@ -208,11 +208,11 @@
   92.33               HEADGOAL (rtac @{thm vimage2p_rel_fun}) THEN
   92.34               unfold_thms_tac ctxt rel_eqs THEN
   92.35               EVERY (@{map 2} (fn n => fn xss =>
   92.36 -                 REPEAT_DETERM (HEADGOAL (resolve_tac
   92.37 +                 REPEAT_DETERM (HEADGOAL (resolve_tac ctxt
   92.38                     [mk_rel_funDN 2 case_sum_transfer_eq, mk_rel_funDN 2 case_sum_transfer])) THEN
   92.39                   HEADGOAL (select_prem_tac total_n (dtac asm_rl) (acc + n)) THEN
   92.40                   HEADGOAL (SELECT_GOAL (HEADGOAL
   92.41 -                   (REPEAT_DETERM o (atac ORELSE' resolve_tac
   92.42 +                   (REPEAT_DETERM o (atac ORELSE' resolve_tac ctxt
   92.43                         [mk_rel_funDN 1 case_prod_transfer_eq,
   92.44                          mk_rel_funDN 1 case_prod_transfer,
   92.45                          rel_funI]) THEN_ALL_NEW
   92.46 @@ -251,7 +251,7 @@
   92.47      val num_pgs = length pgs;
   92.48      fun prem_no_of x = 1 + find_index (curry (op =) x) pgs;
   92.49  
   92.50 -    val Inl_Inr_Pair_tac = REPEAT_DETERM o (resolve_tac
   92.51 +    val Inl_Inr_Pair_tac = REPEAT_DETERM o (resolve_tac ctxt
   92.52        [mk_rel_funDN 1 @{thm Inl_transfer},
   92.53         mk_rel_funDN 1 @{thm Inl_transfer[of "op =" "op =", unfolded sum.rel_eq]},
   92.54         mk_rel_funDN 1 @{thm Inr_transfer},
   92.55 @@ -314,8 +314,8 @@
   92.56    end;
   92.57  
   92.58  fun solve_prem_prem_tac ctxt =
   92.59 -  REPEAT o (eresolve_tac @{thms bexE rev_bexI} ORELSE' rtac @{thm rev_bexI[OF UNIV_I]} ORELSE'
   92.60 -    hyp_subst_tac ctxt ORELSE' resolve_tac @{thms disjI1 disjI2}) THEN'
   92.61 +  REPEAT o (eresolve_tac ctxt @{thms bexE rev_bexI} ORELSE' rtac @{thm rev_bexI[OF UNIV_I]} ORELSE'
   92.62 +    hyp_subst_tac ctxt ORELSE' resolve_tac ctxt @{thms disjI1 disjI2}) THEN'
   92.63    (rtac refl ORELSE' atac ORELSE' rtac @{thm singletonI});
   92.64  
   92.65  fun mk_induct_leverage_prem_prems_tac ctxt nn kks fp_abs_inverses abs_inverses set_maps
   92.66 @@ -361,7 +361,7 @@
   92.67    (atac ORELSE' REPEAT o etac conjE THEN'
   92.68       full_simp_tac (ss_only (no_refl discs @ rel_eqs @ more_simp_thms) ctxt) THEN'
   92.69       REPEAT o etac conjE THEN_MAYBE' REPEAT o hyp_subst_tac ctxt THEN'
   92.70 -     REPEAT o (resolve_tac [refl, conjI] ORELSE' atac));
   92.71 +     REPEAT o (resolve_tac ctxt [refl, conjI] ORELSE' atac));
   92.72  
   92.73  fun mk_coinduct_distinct_ctrs_tac ctxt discs discs' =
   92.74    let
   92.75 @@ -424,7 +424,7 @@
   92.76      map (fn thm => thm RS eqTrueI) rel_injects) THEN
   92.77    TRYALL (atac ORELSE' etac FalseE ORELSE'
   92.78      (REPEAT_DETERM o dtac @{thm meta_spec} THEN'
   92.79 -     TRY o filter_prems_tac
   92.80 +     TRY o filter_prems_tac ctxt
   92.81         (forall (curry (op <>) (HOLogic.mk_Trueprop @{term False})) o Logic.strip_imp_prems) THEN'
   92.82       REPEAT_DETERM o (dtac @{thm meta_mp} THEN' rtac refl) THEN' Goal.assume_rule_tac ctxt));
   92.83  
   92.84 @@ -454,7 +454,7 @@
   92.85        fn ctor_inject => fn rel_pre_list_def => fn Abs_inverse =>
   92.86          HEADGOAL (rtac exhaust THEN_ALL_NEW (rtac exhaust THEN_ALL_NEW
   92.87            (rtac (cterm_instantiate_pos (replicate 4 NONE @ [SOME cterm]) @{thm arg_cong2} RS iffD2)
   92.88 -            THEN' atac THEN' atac THEN' TRY o resolve_tac assms))) THEN
   92.89 +            THEN' atac THEN' atac THEN' TRY o resolve_tac ctxt assms))) THEN
   92.90          unfold_thms_tac ctxt (ctor_inject :: rel_pre_list_def :: ctor_defs @ nesting_rel_eqs @
   92.91            @{thms id_bnf_def vimage2p_def}) THEN
   92.92          TRYALL (hyp_subst_tac ctxt) THEN
   92.93 @@ -470,7 +470,7 @@
   92.94    unfold_thms_tac ctxt (sels @ rel_injects @ rel_eqs @
   92.95      @{thms simp_thms(6,7,8,11,12,15,16,21,22,24)} @ ((discs @ distincts) RL [eqTrueI, eqFalseI]) @
   92.96      (rel_injects RL [eqTrueI]) @ (rel_distincts RL [eqFalseI])) THEN
   92.97 -  TRYALL (resolve_tac [TrueI, refl]);
   92.98 +  TRYALL (resolve_tac ctxt [TrueI, refl]);
   92.99  
  92.100  fun mk_sel_transfer_tac ctxt n sel_defs case_transfer =
  92.101    TRYALL Goal.conjunction_tac THEN
  92.102 @@ -486,8 +486,8 @@
  92.103        @{thms not_True_eq_False not_False_eq_True}) THEN
  92.104      TRYALL (etac FalseE ORELSE' etac @{thm TrueE}) THEN
  92.105      unfold_thms_tac ctxt (sels @ sets) THEN
  92.106 -    ALLGOALS (REPEAT o (resolve_tac @{thms UnI1 UnI2 imageI} ORELSE'
  92.107 -        eresolve_tac @{thms UN_I UN_I[rotated] imageE} ORELSE'
  92.108 +    ALLGOALS (REPEAT o (resolve_tac ctxt @{thms UnI1 UnI2 imageI} ORELSE'
  92.109 +        eresolve_tac ctxt @{thms UN_I UN_I[rotated] imageE} ORELSE'
  92.110          hyp_subst_tac ctxt) THEN'
  92.111        (rtac @{thm singletonI} ORELSE' atac));
  92.112  
  92.113 @@ -495,16 +495,16 @@
  92.114    HEADGOAL (rtac (cterm_instantiate_pos [SOME ct] exhaust) THEN_ALL_NEW hyp_subst_tac ctxt) THEN
  92.115    unfold_thms_tac ctxt sets THEN
  92.116    REPEAT_DETERM (HEADGOAL
  92.117 -    (eresolve_tac @{thms FalseE emptyE singletonE UnE UN_E insertE} ORELSE'
  92.118 +    (eresolve_tac ctxt @{thms FalseE emptyE singletonE UnE UN_E insertE} ORELSE'
  92.119       hyp_subst_tac ctxt ORELSE'
  92.120 -     SELECT_GOAL (SOLVE (HEADGOAL (eresolve_tac assms THEN' REPEAT_DETERM o atac)))));
  92.121 +     SELECT_GOAL (SOLVE (HEADGOAL (eresolve_tac ctxt assms THEN' REPEAT_DETERM o atac)))));
  92.122  
  92.123  fun mk_set_intros_tac ctxt sets =
  92.124    TRYALL Goal.conjunction_tac THEN
  92.125    unfold_thms_tac ctxt sets THEN
  92.126    TRYALL (REPEAT o
  92.127 -    (resolve_tac @{thms UnI1 UnI2} ORELSE'
  92.128 -     eresolve_tac @{thms UN_I UN_I[rotated]}) THEN' (rtac @{thm singletonI} ORELSE' atac));
  92.129 +    (resolve_tac ctxt @{thms UnI1 UnI2} ORELSE'
  92.130 +     eresolve_tac ctxt @{thms UN_I UN_I[rotated]}) THEN' (rtac @{thm singletonI} ORELSE' atac));
  92.131  
  92.132  fun mk_set_induct0_tac ctxt cts assms dtor_set_inducts exhausts set_pre_defs ctor_defs dtor_ctors
  92.133      Abs_pre_inverses =
  92.134 @@ -518,15 +518,15 @@
  92.135      val exhausts' = map (fn thm => thm RS @{thm asm_rl[of "P x y" for P x y]}) exhausts
  92.136        |> map2 (fn ct => cterm_instantiate_pos [NONE, SOME ct]) cts;
  92.137    in
  92.138 -    ALLGOALS (resolve_tac dtor_set_inducts) THEN
  92.139 -    TRYALL (resolve_tac exhausts' THEN_ALL_NEW
  92.140 -      (resolve_tac (map (fn ct => refl RS
  92.141 +    ALLGOALS (resolve_tac ctxt dtor_set_inducts) THEN
  92.142 +    TRYALL (resolve_tac ctxt exhausts' THEN_ALL_NEW
  92.143 +      (resolve_tac ctxt (map (fn ct => refl RS
  92.144           cterm_instantiate_pos (replicate 4 NONE @ [SOME ct]) @{thm arg_cong2} RS iffD2) cts)
  92.145          THEN' atac THEN' hyp_subst_tac ctxt)) THEN
  92.146      unfold_thms_tac ctxt (Abs_pre_inverses @ dtor_ctors @ set_pre_defs @ ctor_defs @
  92.147        @{thms id_bnf_def o_apply sum_set_simps prod_set_simps UN_empty UN_insert Un_empty_left
  92.148          Un_empty_right empty_iff singleton_iff}) THEN
  92.149 -    REPEAT (HEADGOAL (hyp_subst_tac ctxt ORELSE' eresolve_tac @{thms UN_E UnE singletonE} ORELSE'
  92.150 +    REPEAT (HEADGOAL (hyp_subst_tac ctxt ORELSE' eresolve_tac ctxt @{thms UN_E UnE singletonE} ORELSE'
  92.151        assms_tac))
  92.152    end;
  92.153  
    93.1 --- a/src/HOL/Tools/BNF/bnf_fp_n2m_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    93.2 +++ b/src/HOL/Tools/BNF/bnf_fp_n2m_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    93.3 @@ -42,10 +42,10 @@
    93.4      unfold_thms_tac ctxt vimage2p_unfolds THEN
    93.5      HEADGOAL (CONJ_WRAP_GEN' (rtac @{thm context_conjI})
    93.6        (fn thm => rtac thm THEN_ALL_NEW (rotate_tac ~1 THEN'
    93.7 -         REPEAT_ALL_NEW (FIRST' [eresolve_tac C_IHs, eresolve_tac C_IH_monos,
    93.8 +         REPEAT_ALL_NEW (FIRST' [eresolve_tac ctxt C_IHs, eresolve_tac ctxt C_IH_monos,
    93.9             SELECT_GOAL (unfold_thms_tac ctxt nesting_rel_eqs) THEN' rtac @{thm order_refl},
   93.10 -           assume_tac ctxt, resolve_tac co_inducts,
   93.11 -           resolve_tac C_IH_monos THEN' REPEAT_ALL_NEW (eresolve_tac nesting_rel_monos)])))
   93.12 +           assume_tac ctxt, resolve_tac ctxt co_inducts,
   93.13 +           resolve_tac ctxt C_IH_monos THEN' REPEAT_ALL_NEW (eresolve_tac ctxt nesting_rel_monos)])))
   93.14      co_inducts)
   93.15    end;
   93.16  
    94.1 --- a/src/HOL/Tools/BNF/bnf_gfp.ML	Tue Feb 10 14:29:36 2015 +0100
    94.2 +++ b/src/HOL/Tools/BNF/bnf_gfp.ML	Tue Feb 10 14:48:26 2015 +0100
    94.3 @@ -440,7 +440,7 @@
    94.4            HOLogic.mk_Trueprop (mk_mor Bs ss B''s s''s (map2 (curry HOLogic.mk_comp) gs fs));
    94.5        in
    94.6          Goal.prove_sorry lthy [] [] (Logic.list_implies (prems, concl))
    94.7 -          (K (mk_mor_comp_tac mor_def mor_image'_thms morE_thms map_comp_id_thms))
    94.8 +          (K (mk_mor_comp_tac lthy mor_def mor_image'_thms morE_thms map_comp_id_thms))
    94.9          |> Thm.close_derivation
   94.10          |> singleton (Proof_Context.export names_lthy lthy)
   94.11        end;
    95.1 --- a/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    95.2 +++ b/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    95.3 @@ -52,7 +52,7 @@
    95.4  val exhaust_inst_as_projs_tac = PRIMITIVE oo exhaust_inst_as_projs;
    95.5  
    95.6  fun distinct_in_prems_tac distincts =
    95.7 -  eresolve_tac (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac;
    95.8 +  eresolve0_tac (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac;
    95.9  
   95.10  fun mk_primcorec_nchotomy_tac ctxt exhaust_discs =
   95.11    HEADGOAL (Method.insert_tac exhaust_discs THEN' clean_blast_tac ctxt);
   95.12 @@ -74,9 +74,9 @@
   95.13    SELECT_GOAL (unfold_thms_tac ctxt @{thms fst_conv snd_conv not_not not_False_eq_True
   95.14        not_True_eq_False de_Morgan_conj de_Morgan_disj} THEN
   95.15      SOLVE (HEADGOAL (REPEAT o (rtac refl ORELSE' atac ORELSE' etac conjE ORELSE'
   95.16 -    eresolve_tac falseEs ORELSE'
   95.17 -    resolve_tac @{thms TrueI conjI disjI1 disjI2} ORELSE'
   95.18 -    dresolve_tac discIs THEN' atac ORELSE'
   95.19 +    eresolve_tac ctxt falseEs ORELSE'
   95.20 +    resolve_tac ctxt @{thms TrueI conjI disjI1 disjI2} ORELSE'
   95.21 +    dresolve_tac ctxt discIs THEN' atac ORELSE'
   95.22      etac notE THEN' atac ORELSE'
   95.23      etac disjE))));
   95.24  
   95.25 @@ -121,21 +121,21 @@
   95.26              rtac FalseE THEN'
   95.27              (rotate_tac 1 THEN' dtac fun_disc' THEN' REPEAT_DETERM o atac ORELSE'
   95.28               cut_tac fun_disc') THEN'
   95.29 -            dresolve_tac distinct_discs THEN' etac notE THEN' atac)
   95.30 +            dresolve_tac ctxt distinct_discs THEN' etac notE THEN' atac)
   95.31        fun_discss) THEN'
   95.32      (etac FalseE ORELSE'
   95.33 -     resolve_tac (map (unfold_thms ctxt [atomize_conjL]) fun_discs) THEN_MAYBE' atac));
   95.34 +     resolve_tac ctxt (map (unfold_thms ctxt [atomize_conjL]) fun_discs) THEN_MAYBE' atac));
   95.35  
   95.36  fun mk_primcorec_sel_tac ctxt defs distincts splits split_asms mapsx map_ident0s map_comps fun_sel k
   95.37      m excludesss =
   95.38    prelude_tac ctxt defs (fun_sel RS trans) THEN
   95.39    cases_tac ctxt k m excludesss THEN
   95.40    HEADGOAL (REPEAT_DETERM o (rtac refl ORELSE'
   95.41 -    eresolve_tac falseEs ORELSE'
   95.42 -    resolve_tac split_connectI ORELSE'
   95.43 +    eresolve_tac ctxt falseEs ORELSE'
   95.44 +    resolve_tac ctxt split_connectI ORELSE'
   95.45      Splitter.split_asm_tac ctxt (split_if_asm :: split_asms) ORELSE'
   95.46      Splitter.split_tac ctxt (split_if :: splits) ORELSE'
   95.47 -    eresolve_tac (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac ORELSE'
   95.48 +    eresolve_tac ctxt (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac ORELSE'
   95.49      etac notE THEN' atac ORELSE'
   95.50      (CHANGED o SELECT_GOAL (unfold_thms_tac ctxt (@{thms fst_conv snd_conv id_def comp_def split_def
   95.51           sum.case sum.sel sum.distinct[THEN eq_False[THEN iffD2]]} @
   95.52 @@ -165,17 +165,17 @@
   95.53      val splits' =
   95.54        map (fn th => th RS iffD2) (@{thm split_if_eq2} :: map (inst_split_eq ctxt) splits);
   95.55    in
   95.56 -    HEADGOAL (REPEAT o (resolve_tac (splits' @ split_connectI))) THEN
   95.57 +    HEADGOAL (REPEAT o (resolve_tac ctxt (splits' @ split_connectI))) THEN
   95.58      prelude_tac ctxt [] (fun_ctr RS trans) THEN
   95.59      HEADGOAL ((REPEAT_DETERM_N m o mk_primcorec_assumption_tac ctxt discIs) THEN'
   95.60        SELECT_GOAL (SOLVE (HEADGOAL (REPEAT_DETERM o
   95.61        (rtac refl ORELSE' atac ORELSE'
   95.62 -       resolve_tac (@{thm Code.abort_def} :: split_connectI) ORELSE'
   95.63 +       resolve_tac ctxt (@{thm Code.abort_def} :: split_connectI) ORELSE'
   95.64         Splitter.split_tac ctxt (split_if :: splits) ORELSE'
   95.65         Splitter.split_asm_tac ctxt (split_if_asm :: split_asms) ORELSE'
   95.66         mk_primcorec_assumption_tac ctxt discIs ORELSE'
   95.67         distinct_in_prems_tac distincts ORELSE'
   95.68 -       (TRY o dresolve_tac discIs) THEN' etac notE THEN' atac)))))
   95.69 +       (TRY o dresolve_tac ctxt discIs) THEN' etac notE THEN' atac)))))
   95.70    end;
   95.71  
   95.72  fun rulify_nchotomy n = funpow (n - 1) (fn thm => thm RS @{thm Meson.make_pos_rule'});
   95.73 @@ -196,14 +196,14 @@
   95.74    in
   95.75      EVERY (map2 (raw_code_single_tac ctxt distincts discIs splits split_asms) ms' fun_ctrs') THEN
   95.76      IF_UNSOLVED (unfold_thms_tac ctxt @{thms Code.abort_def} THEN
   95.77 -      HEADGOAL (REPEAT_DETERM o resolve_tac (refl :: split_connectI)))
   95.78 +      HEADGOAL (REPEAT_DETERM o resolve_tac ctxt (refl :: split_connectI)))
   95.79    end;
   95.80  
   95.81  fun mk_primcorec_code_tac ctxt distincts splits raw =
   95.82    HEADGOAL (rtac raw ORELSE' rtac (raw RS trans) THEN'
   95.83      SELECT_GOAL (unfold_thms_tac ctxt unfold_lets) THEN' REPEAT_DETERM o
   95.84      (rtac refl ORELSE' atac ORELSE'
   95.85 -     resolve_tac split_connectI ORELSE'
   95.86 +     resolve_tac ctxt split_connectI ORELSE'
   95.87       Splitter.split_tac ctxt (split_if :: splits) ORELSE'
   95.88       distinct_in_prems_tac distincts ORELSE'
   95.89       rtac sym THEN' atac ORELSE'
    96.1 --- a/src/HOL/Tools/BNF/bnf_gfp_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    96.2 +++ b/src/HOL/Tools/BNF/bnf_gfp_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    96.3 @@ -56,7 +56,7 @@
    96.4      thm list -> thm list -> thm list list -> thm list list list -> thm list list list ->
    96.5      thm list list -> thm list -> thm list -> tactic
    96.6    val mk_mor_case_sum_tac: 'a list -> thm -> tactic
    96.7 -  val mk_mor_comp_tac: thm -> thm list -> thm list -> thm list -> tactic
    96.8 +  val mk_mor_comp_tac: Proof.context -> thm -> thm list -> thm list -> thm list -> tactic
    96.9    val mk_mor_elim_tac: thm -> tactic
   96.10    val mk_mor_col_tac: int -> int -> cterm option list -> int -> thm list -> thm list ->
   96.11      thm list -> thm list list -> thm list list -> tactic
   96.12 @@ -116,7 +116,7 @@
   96.13    dtac (coalg_def RS iffD1) 1 THEN
   96.14    REPEAT_DETERM (etac conjE 1) THEN
   96.15    EVERY' [dtac rev_bspec, atac] 1 THEN
   96.16 -  REPEAT_DETERM (eresolve_tac [CollectE, conjE] 1) THEN atac 1;
   96.17 +  REPEAT_DETERM (eresolve0_tac [CollectE, conjE] 1) THEN atac 1;
   96.18  
   96.19  fun mk_mor_elim_tac mor_def =
   96.20    (dtac (mor_def RS iffD1) THEN'
   96.21 @@ -133,12 +133,12 @@
   96.22    CONJ_WRAP' (fn thm =>
   96.23      (EVERY' [rtac ballI, rtac (thm RS trans), rtac sym, rtac (id_apply RS arg_cong)])) map_ids) 1;
   96.24  
   96.25 -fun mk_mor_comp_tac mor_def mor_images morEs map_comp_ids =
   96.26 +fun mk_mor_comp_tac ctxt mor_def mor_images morEs map_comp_ids =
   96.27    let
   96.28      fun fbetw_tac image = EVERY' [rtac ballI, rtac (o_apply RS @{thm ssubst_mem}), etac image,
   96.29        etac image, atac];
   96.30      fun mor_tac ((mor_image, morE), map_comp_id) =
   96.31 -      EVERY' [rtac ballI, stac o_apply, rtac trans, rtac (map_comp_id RS sym), rtac trans,
   96.32 +      EVERY' [rtac ballI, stac ctxt o_apply, rtac trans, rtac (map_comp_id RS sym), rtac trans,
   96.33          etac (morE RS arg_cong), atac, etac morE, etac mor_image, atac];
   96.34    in
   96.35      (rtac (mor_def RS iffD2) THEN' rtac conjI THEN'
   96.36 @@ -183,14 +183,14 @@
   96.37          if m = 0 then K all_tac
   96.38          else (rtac @{thm Un_least} THEN' Goal.assume_rule_tac ctxt),
   96.39          CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_least}))
   96.40 -          (K (EVERY' [rtac @{thm UN_least}, REPEAT_DETERM o eresolve_tac [allE, conjE],
   96.41 +          (K (EVERY' [rtac @{thm UN_least}, REPEAT_DETERM o eresolve_tac ctxt [allE, conjE],
   96.42              rtac subset_trans, atac, Goal.assume_rule_tac ctxt])) rec_0s])
   96.43        rec_Sucs] 1;
   96.44  
   96.45  fun mk_Jset_minimal_tac ctxt n col_minimal =
   96.46    (CONJ_WRAP' (K (EVERY' [rtac @{thm UN_least}, rtac rev_mp, rtac col_minimal,
   96.47      EVERY' (replicate ((n + 1) * n) (Goal.assume_rule_tac ctxt)), rtac impI,
   96.48 -    REPEAT_DETERM o eresolve_tac [allE, conjE], atac])) (1 upto n)) 1
   96.49 +    REPEAT_DETERM o eresolve_tac ctxt [allE, conjE], atac])) (1 upto n)) 1
   96.50  
   96.51  fun mk_mor_col_tac m n cts j rec_0s rec_Sucs morEs set_map0ss coalg_setss =
   96.52    EVERY' [rtac (Drule.instantiate' [] cts nat_induct),
   96.53 @@ -222,7 +222,7 @@
   96.54      fun mk_if_tac ((((i, map_comp0), map_cong0), set_map0s), in_rel) =
   96.55        EVERY' [rtac allI, rtac allI, rtac impI, dtac (mk_conjunctN n i),
   96.56          etac allE, etac allE, etac impE, atac, etac bexE,
   96.57 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE],
   96.58 +        REPEAT_DETERM o eresolve0_tac [CollectE, conjE],
   96.59          rtac (in_rel RS iffD2), rtac exI, rtac (Drule.rotate_prems 1 conjI),
   96.60          CONJ_WRAP' (fn thm => EVERY' [rtac trans, rtac trans, rtac map_comp0, rtac map_cong0,
   96.61            REPEAT_DETERM_N m o rtac thm, REPEAT_DETERM_N n o rtac (@{thm comp_id} RS fun_cong),
   96.62 @@ -242,7 +242,7 @@
   96.63        EVERY' [dtac (mk_conjunctN n i), rtac allI, rtac allI, rtac impI,
   96.64          etac allE, etac allE, etac impE, atac,
   96.65          dtac (in_rel RS @{thm iffD1}),
   96.66 -        REPEAT_DETERM o eresolve_tac ([CollectE, conjE, exE] @
   96.67 +        REPEAT_DETERM o eresolve0_tac ([CollectE, conjE, exE] @
   96.68            @{thms CollectE Collect_split_in_rel_leE}),
   96.69          rtac bexI, rtac conjI, rtac trans, rtac map_comp0, rtac trans, rtac map_cong0,
   96.70          REPEAT_DETERM_N m o rtac (@{thm id_comp} RS fun_cong),
   96.71 @@ -327,7 +327,7 @@
   96.72      val n = length lsbis_defs;
   96.73    in
   96.74      EVERY' [rtac (Thm.permute_prems 0 1 bis_cong), EVERY' (map rtac lsbis_defs),
   96.75 -      rtac bis_Union, rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE, exE],
   96.76 +      rtac bis_Union, rtac ballI, REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE, exE],
   96.77        hyp_subst_tac ctxt, etac bis_cong, EVERY' (map (rtac o mk_nth_conv n) (1 upto n))] 1
   96.78    end;
   96.79  
   96.80 @@ -357,7 +357,7 @@
   96.81      val n = length strT_defs;
   96.82      val ks = 1 upto n;
   96.83      fun coalg_tac (i, (active_sets, def)) =
   96.84 -      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE],
   96.85 +      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE],
   96.86          hyp_subst_tac ctxt, rtac (def RS trans RS @{thm ssubst_mem}), etac (arg_cong RS trans),
   96.87          rtac (mk_sum_caseN n i), rtac CollectI,
   96.88          REPEAT_DETERM_N m o EVERY' [rtac conjI, rtac subset_UNIV],
   96.89 @@ -370,7 +370,7 @@
   96.90              CONJ_WRAP' (fn i => EVERY' [rtac ballI, etac CollectE, dtac @{thm ShiftD},
   96.91                dtac bspec, etac thin_rl, atac, dtac (mk_conjunctN n i),
   96.92                dtac bspec, rtac CollectI, etac @{thm set_mp[OF equalityD1[OF Succ_Shift]]},
   96.93 -              REPEAT_DETERM o eresolve_tac [exE, conjE], rtac exI,
   96.94 +              REPEAT_DETERM o eresolve_tac ctxt [exE, conjE], rtac exI,
   96.95                rtac conjI, rtac (@{thm shift_def} RS fun_cong RS trans),
   96.96                rtac (@{thm append_Cons} RS sym RS arg_cong RS trans), atac,
   96.97                CONJ_WRAP' (K (EVERY' [etac trans, rtac @{thm Collect_cong},
   96.98 @@ -378,7 +378,7 @@
   96.99                  rtac (@{thm append_Cons} RS sym RS arg_cong)])) ks]) ks,
  96.100            dtac bspec, atac, dtac (mk_conjunctN n i), dtac bspec,
  96.101            etac @{thm set_mp[OF equalityD1]}, atac,
  96.102 -          REPEAT_DETERM o eresolve_tac [exE, conjE], rtac exI,
  96.103 +          REPEAT_DETERM o eresolve_tac ctxt [exE, conjE], rtac exI,
  96.104            rtac conjI, rtac (@{thm shift_def} RS fun_cong RS trans),
  96.105            etac (@{thm append_Nil} RS sym RS arg_cong RS trans),
  96.106            REPEAT_DETERM_N m o (rtac conjI THEN' atac),
  96.107 @@ -405,7 +405,7 @@
  96.108          EVERY' [rtac impI, dtac (Lev_Suc RS equalityD1 RS set_mp),
  96.109            CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE))
  96.110              (fn i =>
  96.111 -              EVERY' [REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], hyp_subst_tac ctxt,
  96.112 +              EVERY' [REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE], hyp_subst_tac ctxt,
  96.113                  rtac trans, rtac @{thm length_Cons}, rtac @{thm arg_cong[of _ _ Suc]},
  96.114                  REPEAT_DETERM o etac allE, dtac (mk_conjunctN n i), etac mp, atac]) ks])
  96.115        Lev_Sucs] 1
  96.116 @@ -467,7 +467,7 @@
  96.117          EVERY' [rtac impI, dtac (Lev_Suc RS equalityD1 RS set_mp),
  96.118            CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE))
  96.119              (fn (i, from_to_sbd) =>
  96.120 -              EVERY' [REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], hyp_subst_tac ctxt,
  96.121 +              EVERY' [REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE], hyp_subst_tac ctxt,
  96.122                  CONJ_WRAP' (fn i' => rtac impI THEN'
  96.123                    CONJ_WRAP' (fn i'' =>
  96.124                      EVERY' [rtac impI, rtac (Lev_Suc RS equalityD2 RS set_mp),
  96.125 @@ -502,7 +502,7 @@
  96.126                  dtac (Lev_Suc RS equalityD1 RS set_mp), dtac (mk_InN_inject n i),
  96.127                  hyp_subst_tac ctxt,
  96.128                  CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE))
  96.129 -                  (fn k => REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE] THEN'
  96.130 +                  (fn k => REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE] THEN'
  96.131                      dtac list_inject_iffD1 THEN' etac conjE THEN'
  96.132                      (if k = i'
  96.133                      then EVERY' [dtac (mk_InN_inject n k), hyp_subst_tac ctxt, etac imageI]
  96.134 @@ -517,12 +517,12 @@
  96.135          EVERY' [rtac impI, dtac (Lev_Suc RS equalityD1 RS set_mp),
  96.136            CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE))
  96.137              (fn (i, (from_to_sbd, to_sbd_inj)) =>
  96.138 -              REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE] THEN' hyp_subst_tac ctxt THEN'
  96.139 +              REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE] THEN' hyp_subst_tac ctxt THEN'
  96.140                CONJ_WRAP' (fn i' => rtac impI THEN'
  96.141                  dtac @{thm ssubst_mem[OF sym[OF append_Cons]]} THEN'
  96.142                  dtac (Lev_Suc RS equalityD1 RS set_mp) THEN'
  96.143                  CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE)) (fn k =>
  96.144 -                  REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE] THEN'
  96.145 +                  REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE] THEN'
  96.146                    dtac list_inject_iffD1 THEN' etac conjE THEN'
  96.147                    (if k = i
  96.148                    then EVERY' [dtac (mk_InN_inject n i),
  96.149 @@ -563,7 +563,7 @@
  96.150            CONJ_WRAP' (fn (i, (rv_last, (isNode_def, (set_map0s,
  96.151              (set_Levs, set_image_Levs))))) =>
  96.152              EVERY' [rtac ballI,
  96.153 -              REPEAT_DETERM o eresolve_tac [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.154 +              REPEAT_DETERM o eresolve_tac ctxt [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.155                rtac (rev_mp OF [rv_last, impI]), etac exE, rtac (isNode_def RS iffD2),
  96.156                rtac exI, rtac conjI,
  96.157                if n = 1 then rtac refl
  96.158 @@ -572,7 +572,7 @@
  96.159                  EVERY' [rtac (set_map0 RS trans), rtac equalityI, rtac @{thm image_subsetI},
  96.160                    rtac CollectI, rtac @{thm SuccI}, rtac @{thm UN_I}, rtac UNIV_I, etac set_Lev,
  96.161                    if n = 1 then rtac refl else atac, atac, rtac subsetI,
  96.162 -                  REPEAT_DETERM o eresolve_tac [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.163 +                  REPEAT_DETERM o eresolve_tac ctxt [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.164                    REPEAT_DETERM_N 4 o etac thin_rl,
  96.165                    rtac set_image_Lev,
  96.166                    atac, dtac length_Lev, hyp_subst_tac ctxt, dtac length_Lev',
  96.167 @@ -591,7 +591,7 @@
  96.168                rtac CollectI, rtac @{thm SuccI}, rtac @{thm UN_I}, rtac UNIV_I, rtac set_Lev,
  96.169                rtac (Lev_0 RS equalityD2 RS set_mp), rtac @{thm singletonI}, rtac rv_Nil,
  96.170                atac, rtac subsetI,
  96.171 -              REPEAT_DETERM o eresolve_tac [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.172 +              REPEAT_DETERM o eresolve_tac ctxt [CollectE, @{thm SuccE}, @{thm UN_E}],
  96.173                rtac set_image_Lev, rtac (Lev_0 RS equalityD2 RS set_mp),
  96.174                rtac @{thm singletonI}, dtac length_Lev',
  96.175                etac @{thm set_mp[OF equalityD1[OF arg_cong[OF
  96.176 @@ -612,11 +612,11 @@
  96.177            DETERM o EVERY' [rtac trans, rtac o_apply, rtac prod_injectI, rtac conjI,
  96.178              rtac trans, rtac @{thm Shift_def},
  96.179              rtac equalityI, rtac subsetI, etac thin_rl,
  96.180 -            REPEAT_DETERM o eresolve_tac [CollectE, @{thm UN_E}], dtac length_Lev', dtac asm_rl,
  96.181 +            REPEAT_DETERM o eresolve_tac ctxt [CollectE, @{thm UN_E}], dtac length_Lev', dtac asm_rl,
  96.182              etac thin_rl, dtac @{thm set_rev_mp[OF _ equalityD1]},
  96.183              rtac (@{thm length_Cons} RS arg_cong RS trans), rtac Lev_Suc,
  96.184              CONJ_WRAP_GEN' (etac (Thm.permute_prems 1 1 UnE)) (fn i'' =>
  96.185 -              EVERY' [REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE],
  96.186 +              EVERY' [REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE],
  96.187                  dtac list_inject_iffD1, etac conjE,
  96.188                  if i' = i'' then EVERY' [dtac (mk_InN_inject n i'),
  96.189                    dtac (Thm.permute_prems 0 2 (to_sbd_inj RS iffD1)),
  96.190 @@ -648,7 +648,7 @@
  96.191  
  96.192  fun mk_congruent_str_final_tac m lsbisE map_comp_id map_cong0 equiv_LSBISs =
  96.193    EVERY' [rtac @{thm congruentI}, dtac lsbisE,
  96.194 -    REPEAT_DETERM o eresolve_tac [CollectE, conjE, bexE], rtac (o_apply RS trans),
  96.195 +    REPEAT_DETERM o eresolve0_tac [CollectE, conjE, bexE], rtac (o_apply RS trans),
  96.196      etac (sym RS arg_cong RS trans), rtac (map_comp_id RS trans),
  96.197      rtac (map_cong0 RS trans), REPEAT_DETERM_N m o rtac refl,
  96.198      EVERY' (map (fn equiv_LSBIS =>
  96.199 @@ -818,8 +818,8 @@
  96.200      EVERY' ([rtac rev_mp, coinduct_tac] @
  96.201        maps (fn ((((((map_comp_trans, dtor_maps_trans), map_cong0), set_map0s), set_Jsets),
  96.202          set_Jset_Jsetss), in_rel) =>
  96.203 -        [REPEAT_DETERM o resolve_tac [allI, impI, in_rel RS iffD2],
  96.204 -         REPEAT_DETERM o eresolve_tac [exE, conjE], hyp_subst_tac ctxt, rtac exI,
  96.205 +        [REPEAT_DETERM o resolve_tac ctxt [allI, impI, in_rel RS iffD2],
  96.206 +         REPEAT_DETERM o eresolve_tac ctxt [exE, conjE], hyp_subst_tac ctxt, rtac exI,
  96.207           rtac (Drule.rotate_prems 1 conjI),
  96.208           rtac conjI, rtac map_comp_trans, rtac sym, rtac dtor_maps_trans, rtac map_cong0,
  96.209           REPEAT_DETERM_N m o (rtac o_apply_trans_sym THEN' rtac @{thm fst_conv}),
  96.210 @@ -910,17 +910,17 @@
  96.211    rel_Jrels le_rel_OOs) 1;
  96.212  
  96.213  fun mk_wit_tac ctxt n dtor_ctors dtor_set wit coind_wits =
  96.214 -  ALLGOALS (TRY o (eresolve_tac coind_wits THEN' rtac refl)) THEN
  96.215 +  ALLGOALS (TRY o (eresolve_tac ctxt coind_wits THEN' rtac refl)) THEN
  96.216    REPEAT_DETERM (atac 1 ORELSE
  96.217 -    EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac dtor_set,
  96.218 +    EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac ctxt dtor_set,
  96.219      K (unfold_thms_tac ctxt dtor_ctors),
  96.220      REPEAT_DETERM_N n o etac UnE,
  96.221      REPEAT_DETERM o
  96.222        (TRY o REPEAT_DETERM o etac UnE THEN' TRY o etac @{thm UN_E} THEN'
  96.223 -        (eresolve_tac wit ORELSE'
  96.224 -        (dresolve_tac wit THEN'
  96.225 +        (eresolve_tac ctxt wit ORELSE'
  96.226 +        (dresolve_tac ctxt wit THEN'
  96.227            (etac FalseE ORELSE'
  96.228 -          EVERY' [hyp_subst_tac ctxt, dtac set_rev_mp, rtac equalityD1, resolve_tac dtor_set,
  96.229 +          EVERY' [hyp_subst_tac ctxt, dtac set_rev_mp, rtac equalityD1, resolve_tac ctxt dtor_set,
  96.230              K (unfold_thms_tac ctxt dtor_ctors), REPEAT_DETERM_N n o etac UnE]))))] 1);
  96.231  
  96.232  fun mk_coind_wit_tac ctxt induct unfolds set_nats wits =
  96.233 @@ -928,7 +928,7 @@
  96.234    unfold_thms_tac ctxt (unfolds @ set_nats @ @{thms image_id id_apply}) THEN
  96.235    ALLGOALS (REPEAT_DETERM o etac imageE THEN' TRY o hyp_subst_tac ctxt) THEN
  96.236    ALLGOALS (TRY o
  96.237 -    FIRST' [rtac TrueI, rtac refl, etac (refl RSN (2, mp)), dresolve_tac wits THEN' etac FalseE]);
  96.238 +    FIRST' [rtac TrueI, rtac refl, etac (refl RSN (2, mp)), dresolve_tac ctxt wits THEN' etac FalseE]);
  96.239  
  96.240  fun mk_dtor_corec_transfer_tac ctxt n m dtor_corec_defs dtor_unfold_transfer pre_T_map_transfers
  96.241      dtor_rels =
  96.242 @@ -955,7 +955,7 @@
  96.243      val (passive_set_map0s, active_set_map0s) = chop m set_map0s;
  96.244      val in_Jrel = nth in_Jrels (i - 1);
  96.245      val if_tac =
  96.246 -      EVERY' [dtac (in_Jrel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE],
  96.247 +      EVERY' [dtac (in_Jrel RS iffD1), REPEAT_DETERM o eresolve_tac ctxt [exE, conjE, CollectE],
  96.248          rtac (in_rel RS iffD2), rtac exI, rtac conjI, rtac CollectI,
  96.249          EVERY' (map2 (fn set_map0 => fn set_incl =>
  96.250            EVERY' [rtac conjI, rtac ord_eq_le_trans, rtac set_map0,
  96.251 @@ -975,7 +975,7 @@
  96.252            rtac trans, rtac sym, rtac dtor_map, rtac (dtor_inject RS iffD2), atac])
  96.253          @{thms fst_conv snd_conv}];
  96.254      val only_if_tac =
  96.255 -      EVERY' [dtac (in_rel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE],
  96.256 +      EVERY' [dtac (in_rel RS iffD1), REPEAT_DETERM o eresolve_tac ctxt [exE, conjE, CollectE],
  96.257          rtac (in_Jrel RS iffD2), rtac exI, rtac conjI, rtac CollectI,
  96.258          CONJ_WRAP' (fn (dtor_set, passive_set_map0) =>
  96.259            EVERY' [rtac ord_eq_le_trans, rtac dtor_set, rtac @{thm Un_least},
  96.260 @@ -987,12 +987,12 @@
  96.261                  rtac active_set_map0, rtac (dtor_ctor RS sym RS arg_cong), rtac @{thm UN_least},
  96.262                  dtac set_rev_mp, etac @{thm image_mono}, etac imageE,
  96.263                  dtac @{thm ssubst_mem[OF pair_collapse]},
  96.264 -                REPEAT_DETERM o eresolve_tac (CollectE :: conjE ::
  96.265 +                REPEAT_DETERM o eresolve_tac ctxt (CollectE :: conjE ::
  96.266                    @{thms case_prodE iffD1[OF prod.inject, elim_format]}),
  96.267                  hyp_subst_tac ctxt,
  96.268                  dtac (in_Jrel RS iffD1),
  96.269                  dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE,
  96.270 -                REPEAT_DETERM o eresolve_tac [CollectE, conjE], atac])
  96.271 +                REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], atac])
  96.272              (rev (active_set_map0s ~~ in_Jrels))])
  96.273          (dtor_sets ~~ passive_set_map0s),
  96.274          rtac conjI,
  96.275 @@ -1001,7 +1001,7 @@
  96.276            rtac map_cong0, REPEAT_DETERM_N m o rtac @{thm fun_cong[OF comp_id]},
  96.277            EVERY' (map (fn in_Jrel => EVERY' [rtac trans, rtac o_apply, dtac set_rev_mp, atac,
  96.278              dtac @{thm ssubst_mem[OF pair_collapse]},
  96.279 -            REPEAT_DETERM o eresolve_tac (CollectE :: conjE ::
  96.280 +            REPEAT_DETERM o eresolve_tac ctxt (CollectE :: conjE ::
  96.281                @{thms case_prodE iffD1[OF prod.inject, elim_format]}),
  96.282              hyp_subst_tac ctxt, dtac (in_Jrel RS iffD1),
  96.283              dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE, atac]) in_Jrels),
  96.284 @@ -1020,10 +1020,10 @@
  96.285      EVERY' [rtac coinduct,
  96.286        EVERY' (@{map 8} (fn i => fn map_comp0 => fn map_cong => fn map_arg_cong => fn set_map0s =>
  96.287            fn dtor_unfold => fn dtor_map => fn in_rel =>
  96.288 -        EVERY' [REPEAT_DETERM o resolve_tac [allI, impI, in_rel RS iffD2],
  96.289 -          REPEAT_DETERM o eresolve_tac [exE, conjE],
  96.290 +        EVERY' [REPEAT_DETERM o resolve_tac ctxt [allI, impI, in_rel RS iffD2],
  96.291 +          REPEAT_DETERM o eresolve_tac ctxt [exE, conjE],
  96.292            select_prem_tac (length ks) (dtac @{thm spec2}) i, dtac mp, atac,
  96.293 -          REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  96.294 +          REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], hyp_subst_tac ctxt,
  96.295            rtac exI, rtac (Drule.rotate_prems 1 conjI), rtac conjI,
  96.296            rtac (map_comp0 RS trans), rtac (dtor_map RS trans RS sym),
  96.297            rtac (dtor_unfold RS map_arg_cong RS trans), rtac (trans OF [map_comp0, map_cong]),
  96.298 @@ -1051,20 +1051,20 @@
  96.299    in
  96.300      rtac set_induct 1 THEN
  96.301      EVERY' (@{map 3} (fn unfold => fn set_map0s => fn i =>
  96.302 -      EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  96.303 +      EVERY' [REPEAT_DETERM o resolve_tac ctxt [allI, impI], etac conjE,
  96.304          select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  96.305 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE, Collect_splitD_set_mp, set_rev_mp],
  96.306 +        REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE, Collect_splitD_set_mp, set_rev_mp],
  96.307          hyp_subst_tac ctxt,
  96.308          SELECT_GOAL (unfold_thms_tac ctxt ([unfold, nth set_map0s (j - 1)] @ split_id_unfolds)),
  96.309          rtac subset_refl])
  96.310      unfolds set_map0ss ks) 1 THEN
  96.311      EVERY' (@{map 3} (fn unfold => fn set_map0s => fn i =>
  96.312        EVERY' (map (fn set_map0 =>
  96.313 -        EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  96.314 +        EVERY' [REPEAT_DETERM o resolve_tac ctxt [allI, impI], etac conjE,
  96.315          select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  96.316 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  96.317 +        REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], hyp_subst_tac ctxt,
  96.318          SELECT_GOAL (unfold_thms_tac ctxt ([unfold, set_map0] @ split_id_unfolds)),
  96.319 -        etac imageE, hyp_subst_tac ctxt, REPEAT_DETERM o eresolve_tac [allE, mp],
  96.320 +        etac imageE, hyp_subst_tac ctxt, REPEAT_DETERM o eresolve_tac ctxt [allE, mp],
  96.321          rtac conjI, etac Collect_splitD_set_mp, atac, rtac (@{thm surjective_pairing} RS arg_cong)])
  96.322        (drop m set_map0s)))
  96.323      unfolds set_map0ss ks) 1
  96.324 @@ -1083,8 +1083,8 @@
  96.325            CONJ_WRAP' (fn helper_ind =>
  96.326              EVERY' [rtac (helper_ind RS rev_mp), REPEAT_DETERM_N n o atac,
  96.327                REPEAT_DETERM_N n o etac thin_rl, rtac impI,
  96.328 -              REPEAT_DETERM o resolve_tac [subsetI, CollectI, @{thm iffD2[OF split_beta]}],
  96.329 -              dtac bspec, atac, REPEAT_DETERM o eresolve_tac [allE, mp, conjE],
  96.330 +              REPEAT_DETERM o resolve_tac ctxt [subsetI, CollectI, @{thm iffD2[OF split_beta]}],
  96.331 +              dtac bspec, atac, REPEAT_DETERM o eresolve_tac ctxt [allE, mp, conjE],
  96.332                etac (refl RSN (2, conjI))])
  96.333            helper_inds,
  96.334          rtac conjI,
  96.335 @@ -1103,9 +1103,9 @@
  96.336        @{thms rel_fun_def_butlast all_conj_distrib[symmetric] imp_conjR[symmetric]} THEN
  96.337      unfold_thms_tac ctxt @{thms rel_fun_iff_geq_image2p} THEN
  96.338      HEADGOAL (EVERY'
  96.339 -      [REPEAT_DETERM o resolve_tac [allI, impI], rtac ctor_rel_coinduct,
  96.340 +      [REPEAT_DETERM o resolve_tac ctxt [allI, impI], rtac ctor_rel_coinduct,
  96.341        EVERY' (map (fn map_transfer => EVERY'
  96.342 -        [REPEAT_DETERM o resolve_tac [allI, impI], etac @{thm image2pE}, hyp_subst_tac ctxt,
  96.343 +        [REPEAT_DETERM o resolve_tac ctxt [allI, impI], etac @{thm image2pE}, hyp_subst_tac ctxt,
  96.344          SELECT_GOAL (unfold_thms_tac ctxt unfolds),
  96.345          rtac (funpow (m + n + 1) (fn thm => thm RS rel_funD) map_transfer),
  96.346          REPEAT_DETERM_N m o rtac @{thm id_transfer},
    97.1 --- a/src/HOL/Tools/BNF/bnf_lfp.ML	Tue Feb 10 14:29:36 2015 +0100
    97.2 +++ b/src/HOL/Tools/BNF/bnf_lfp.ML	Tue Feb 10 14:48:26 2015 +0100
    97.3 @@ -368,7 +368,7 @@
    97.4          val concl = HOLogic.mk_Trueprop (mk_mor Bs ss Bs_copy ss active_ids);
    97.5        in
    97.6          Goal.prove_sorry lthy [] [] (Logic.list_implies (prems, concl))
    97.7 -          (K (mk_mor_incl_tac mor_def map_ids))
    97.8 +          (fn {context = ctxt, ...} => mk_mor_incl_tac ctxt mor_def map_ids)
    97.9          |> Thm.close_derivation
   97.10          |> singleton (Proof_Context.export names_lthy lthy)
   97.11        end;
   97.12 @@ -860,7 +860,8 @@
   97.13        lthy
   97.14        |> @{fold_map 3} (fn b => fn mx => fn car_init =>
   97.15          typedef (b, params, mx) car_init NONE
   97.16 -          (fn _ => EVERY' [rtac iffD2, rtac @{thm ex_in_conv}, resolve_tac alg_not_empty_thms,
   97.17 +          (fn ctxt =>
   97.18 +            EVERY' [rtac iffD2, rtac @{thm ex_in_conv}, resolve_tac ctxt alg_not_empty_thms,
   97.19              rtac alg_init_thm] 1)) bs mixfixes car_inits
   97.20        |>> apsnd split_list o split_list;
   97.21  
   97.22 @@ -1024,7 +1025,8 @@
   97.23        in
   97.24          Goal.prove_sorry lthy [] []
   97.25            (HOLogic.mk_Trueprop (mk_mor UNIVs ctors active_UNIVs ss (map (mk_fold Ts ss) ks)))
   97.26 -          (K (mk_mor_fold_tac cT ct fold_defs init_ex_mor_thm mor_cong))
   97.27 +          (fn {context = ctxt, ...} =>
   97.28 +            mk_mor_fold_tac ctxt cT ct fold_defs init_ex_mor_thm mor_cong)
   97.29          |> Thm.close_derivation
   97.30          |> singleton (Proof_Context.export names_lthy lthy)
   97.31        end;
    98.1 --- a/src/HOL/Tools/BNF/bnf_lfp_size.ML	Tue Feb 10 14:29:36 2015 +0100
    98.2 +++ b/src/HOL/Tools/BNF/bnf_lfp_size.ML	Tue Feb 10 14:48:26 2015 +0100
    98.3 @@ -221,7 +221,7 @@
    98.4            (Class.instantiation (T_names, map dest_TFree As, [HOLogic.class_size])
    98.5             #> @{fold_map 3} define_overloaded_size overloaded_size_def_bs overloaded_size_consts
    98.6               overloaded_size_rhss
    98.7 -           ##> Class.prove_instantiation_instance (K (Class.intro_classes_tac []))
    98.8 +           ##> Class.prove_instantiation_instance (fn ctxt => Class.intro_classes_tac ctxt [])
    98.9             ##> Local_Theory.exit_global);
   98.10  
   98.11        val size_defs' =
    99.1 --- a/src/HOL/Tools/BNF/bnf_lfp_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
    99.2 +++ b/src/HOL/Tools/BNF/bnf_lfp_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
    99.3 @@ -56,8 +56,8 @@
    99.4    val mk_mor_comp_tac: thm -> thm list list -> thm list -> tactic
    99.5    val mk_mor_convol_tac: 'a list -> thm -> tactic
    99.6    val mk_mor_elim_tac: thm -> tactic
    99.7 -  val mk_mor_incl_tac: thm -> thm list -> tactic
    99.8 -  val mk_mor_fold_tac: ctyp -> cterm -> thm list -> thm -> thm -> tactic
    99.9 +  val mk_mor_incl_tac: Proof.context -> thm -> thm list -> tactic
   99.10 +  val mk_mor_fold_tac: Proof.context -> ctyp -> cterm -> thm list -> thm -> thm -> tactic
   99.11    val mk_mor_select_tac: thm -> thm -> thm -> thm -> thm -> thm -> thm list -> thm list list ->
   99.12      thm list -> tactic
   99.13    val mk_mor_str_tac: 'a list -> thm -> tactic
   99.14 @@ -96,9 +96,9 @@
   99.15  fun mk_alg_not_empty_tac ctxt alg_set alg_sets wits =
   99.16    (EVERY' [rtac notI, hyp_subst_tac ctxt, ftac alg_set] THEN'
   99.17    REPEAT_DETERM o FIRST'
   99.18 -    [EVERY' [rtac @{thm subset_emptyI}, eresolve_tac wits],
   99.19 -    EVERY' [rtac subsetI, rtac FalseE, eresolve_tac wits],
   99.20 -    EVERY' [rtac subsetI, dresolve_tac wits, hyp_subst_tac ctxt,
   99.21 +    [EVERY' [rtac @{thm subset_emptyI}, eresolve_tac ctxt wits],
   99.22 +    EVERY' [rtac subsetI, rtac FalseE, eresolve_tac ctxt wits],
   99.23 +    EVERY' [rtac subsetI, dresolve_tac ctxt wits, hyp_subst_tac ctxt,
   99.24        FIRST' (map (fn thm => rtac thm THEN' atac) alg_sets)]] THEN'
   99.25    etac @{thm emptyE}) 1;
   99.26  
   99.27 @@ -109,13 +109,13 @@
   99.28    etac bspec THEN'
   99.29    atac) 1;
   99.30  
   99.31 -fun mk_mor_incl_tac mor_def map_ids =
   99.32 +fun mk_mor_incl_tac ctxt mor_def map_ids =
   99.33    (rtac (mor_def RS iffD2) THEN'
   99.34    rtac conjI THEN'
   99.35    CONJ_WRAP' (K (EVERY' [rtac ballI, etac set_mp, etac (id_apply RS @{thm ssubst_mem})]))
   99.36      map_ids THEN'
   99.37    CONJ_WRAP' (fn thm =>
   99.38 -    (EVERY' [rtac ballI, rtac trans, rtac id_apply, stac thm, rtac refl])) map_ids) 1;
   99.39 +    (EVERY' [rtac ballI, rtac trans, rtac id_apply, stac ctxt thm, rtac refl])) map_ids) 1;
   99.40  
   99.41  fun mk_mor_comp_tac mor_def set_maps map_comp_ids =
   99.42    let
   99.43 @@ -124,7 +124,7 @@
   99.44      fun mor_tac (set_map, map_comp_id) =
   99.45        EVERY' [rtac ballI, rtac (o_apply RS trans), rtac trans,
   99.46          rtac trans, dtac rev_bspec, atac, etac arg_cong,
   99.47 -         REPEAT o eresolve_tac [CollectE, conjE], etac bspec, rtac CollectI] THEN'
   99.48 +         REPEAT o eresolve0_tac [CollectE, conjE], etac bspec, rtac CollectI] THEN'
   99.49        CONJ_WRAP' (fn thm =>
   99.50          FIRST' [rtac subset_UNIV,
   99.51            (EVERY' [rtac ord_eq_le_trans, rtac thm, rtac @{thm image_subsetI},
   99.52 @@ -170,14 +170,14 @@
   99.53          rtac equalityD1, etac @{thm bij_betw_imageE}];
   99.54      val alg_tac =
   99.55        CONJ_WRAP' (fn (set_maps, alg_set) =>
   99.56 -        EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac set_mp,
   99.57 +        EVERY' [rtac ballI, REPEAT_DETERM o eresolve0_tac [CollectE, conjE], rtac set_mp,
   99.58            rtac equalityD1, etac @{thm bij_betw_imageE[OF bij_betw_the_inv_into]},
   99.59            rtac imageI, etac alg_set, EVERY' (map set_tac (drop m set_maps))])
   99.60        (set_mapss ~~ alg_sets);
   99.61  
   99.62      val mor_tac = rtac conjI THEN' CONJ_WRAP' (K (etac @{thm bij_betwE})) alg_sets THEN'
   99.63        CONJ_WRAP' (fn (set_maps, alg_set) =>
   99.64 -        EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE],
   99.65 +        EVERY' [rtac ballI, REPEAT_DETERM o eresolve0_tac [CollectE, conjE],
   99.66            etac @{thm f_the_inv_into_f_bij_betw}, etac alg_set,
   99.67            EVERY' (map set_tac (drop m set_maps))])
   99.68        (set_mapss ~~ alg_sets);
   99.69 @@ -251,7 +251,7 @@
   99.70        rtac @{thm csum_absorb1}, rtac Asuc_Cinfinite, rtac @{thm ctwo_ordLeq_Cinfinite},
   99.71        rtac Asuc_Cinfinite, rtac bd_Card_order,
   99.72        rtac @{thm ordIso_imp_ordLeq}, rtac @{thm cexp_cprod_ordLeq},
   99.73 -      resolve_tac @{thms Card_order_csum Card_order_ctwo}, rtac suc_Cinfinite,
   99.74 +      resolve0_tac @{thms Card_order_csum Card_order_ctwo}, rtac suc_Cinfinite,
   99.75        rtac bd_Cnotzero, rtac @{thm cardSuc_ordLeq}, rtac bd_Card_order, rtac Asuc_Cinfinite];
   99.76    in
   99.77      (rtac induct THEN'
   99.78 @@ -269,7 +269,7 @@
   99.79  
   99.80      fun mk_minH_tac (min_alg, alg_set) = EVERY' [rtac ord_eq_le_trans, etac min_alg,
   99.81        rtac @{thm Un_least}, minG_tac, rtac @{thm image_subsetI},
   99.82 -      REPEAT_DETERM o eresolve_tac [CollectE, conjE], etac alg_set,
   99.83 +      REPEAT_DETERM o eresolve0_tac [CollectE, conjE], etac alg_set,
   99.84        REPEAT_DETERM o (etac subset_trans THEN' minG_tac)];
   99.85    in
   99.86      (rtac induct THEN'
   99.87 @@ -283,9 +283,9 @@
   99.88      val n = length min_algs;
   99.89      fun mk_cardSuc_UNION_tac set_bds (mono, def) = EVERY'
   99.90        [rtac bexE, rtac @{thm cardSuc_UNION_Cinfinite}, rtac bd_Cinfinite, rtac mono,
   99.91 -       etac (def RSN (2, @{thm subset_trans[OF _ equalityD1]})), resolve_tac set_bds];
   99.92 +       etac (def RSN (2, @{thm subset_trans[OF _ equalityD1]})), resolve0_tac set_bds];
   99.93      fun mk_conjunct_tac (set_bds, (min_alg, min_alg_def)) =
   99.94 -      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE],
   99.95 +      EVERY' [rtac ballI, REPEAT_DETERM o eresolve0_tac [CollectE, conjE],
   99.96          EVERY' (map (mk_cardSuc_UNION_tac set_bds) (min_alg_monos ~~ min_alg_defs)), rtac bexE,
   99.97          rtac bd_limit, REPEAT_DETERM_N (n - 1) o etac conjI, atac,
   99.98          rtac (min_alg_def RS @{thm set_mp[OF equalityD2]}),
   99.99 @@ -314,7 +314,8 @@
  99.100      REPEAT_DETERM o etac conjE, atac] 1;
  99.101  
  99.102  fun mk_alg_select_tac ctxt Abs_inverse =
  99.103 -  EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], hyp_subst_tac ctxt] 1 THEN
  99.104 +  EVERY' [rtac ballI,
  99.105 +    REPEAT_DETERM o eresolve_tac ctxt [CollectE, exE, conjE], hyp_subst_tac ctxt] 1 THEN
  99.106    unfold_thms_tac ctxt (Abs_inverse :: fst_snd_convs) THEN atac 1;
  99.107  
  99.108  fun mk_mor_select_tac mor_def mor_cong mor_comp mor_incl_min_alg alg_def alg_select alg_sets
  99.109 @@ -326,9 +327,9 @@
  99.110      val mor_tac =
  99.111        CONJ_WRAP' (fn thm => EVERY' [rtac ballI, rtac thm]) str_init_defs;
  99.112      fun alg_epi_tac ((alg_set, str_init_def), set_map) =
  99.113 -      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac CollectI,
  99.114 +      EVERY' [rtac ballI, REPEAT_DETERM o eresolve0_tac [CollectE, conjE], rtac CollectI,
  99.115          rtac ballI, ftac (alg_select RS bspec), rtac (str_init_def RS @{thm ssubst_mem}),
  99.116 -        etac alg_set, REPEAT_DETERM o EVERY' [rtac ord_eq_le_trans, resolve_tac set_map,
  99.117 +        etac alg_set, REPEAT_DETERM o EVERY' [rtac ord_eq_le_trans, resolve0_tac set_map,
  99.118            rtac subset_trans, etac @{thm image_mono}, rtac @{thm image_Collect_subsetI}, etac bspec,
  99.119            atac]];
  99.120    in
  99.121 @@ -344,7 +345,7 @@
  99.122    in
  99.123      EVERY' [Method.insert_tac (map (fn thm => thm RS @{thm ex_bij_betw}) card_of_min_algs),
  99.124        REPEAT_DETERM o etac exE, rtac rev_mp, rtac copy, REPEAT_DETERM_N n o atac,
  99.125 -      rtac impI, REPEAT_DETERM o eresolve_tac [exE, conjE], REPEAT_DETERM_N n o rtac exI,
  99.126 +      rtac impI, REPEAT_DETERM o eresolve0_tac [exE, conjE], REPEAT_DETERM_N n o rtac exI,
  99.127        rtac mor_comp, rtac mor_Rep, rtac mor_select, rtac CollectI, REPEAT_DETERM o rtac exI,
  99.128        rtac conjI, rtac refl, atac,
  99.129        SELECT_GOAL (unfold_thms_tac ctxt (Abs_inverse :: fst_snd_convs)),
  99.130 @@ -367,7 +368,7 @@
  99.131  
  99.132      fun mk_alg_tac (ct, (alg_set, (in_mono, (morE, map_cong0)))) =
  99.133        EVERY' [rtac ballI, rtac CollectI,
  99.134 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set),
  99.135 +        REPEAT_DETERM o eresolve0_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set),
  99.136          REPEAT_DETERM_N n o (etac subset_trans THEN' rtac @{thm Collect_restrict}),
  99.137          rtac trans, mor_tac morE in_mono,
  99.138          rtac trans, cong_tac ct map_cong0,
  99.139 @@ -386,7 +387,7 @@
  99.140      val n = length least_min_algs;
  99.141  
  99.142      fun mk_alg_tac alg_set = EVERY' [rtac ballI, rtac CollectI,
  99.143 -      REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set),
  99.144 +      REPEAT_DETERM o eresolve0_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set),
  99.145        REPEAT_DETERM_N n o (etac subset_trans THEN' rtac @{thm Collect_restrict}),
  99.146        rtac mp, etac bspec, rtac CollectI,
  99.147        REPEAT_DETERM_N m o (rtac conjI THEN' atac),
  99.148 @@ -417,15 +418,15 @@
  99.149    EVERY' [rtac conjI,
  99.150      CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) Abs_inverses,
  99.151      CONJ_WRAP' (fn (ct, thm) =>
  99.152 -      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE],
  99.153 +      EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE],
  99.154          rtac (thm RS (cterm_instantiate_pos [NONE, NONE, SOME ct] arg_cong) RS sym),
  99.155          EVERY' (map (fn Abs_inverse =>
  99.156            EVERY' [rtac (o_apply RS trans RS ballI), etac (set_mp RS Abs_inverse), atac])
  99.157          Abs_inverses)])
  99.158      (cts ~~ map2 mk_trans map_comp_ids map_congLs)] 1;;
  99.159  
  99.160 -fun mk_mor_fold_tac cT ct fold_defs ex_mor mor =
  99.161 -  (EVERY' (map stac fold_defs) THEN' EVERY' [rtac rev_mp, rtac ex_mor, rtac impI] THEN'
  99.162 +fun mk_mor_fold_tac ctxt cT ct fold_defs ex_mor mor =
  99.163 +  (EVERY' (map (stac ctxt) fold_defs) THEN' EVERY' [rtac rev_mp, rtac ex_mor, rtac impI] THEN'
  99.164    REPEAT_DETERM_N (length fold_defs) o etac exE THEN'
  99.165    rtac (Drule.instantiate' [SOME cT] [SOME ct] @{thm someI}) THEN' etac mor) 1;
  99.166  
  99.167 @@ -433,7 +434,7 @@
  99.168    let
  99.169      fun mk_unique type_def =
  99.170        EVERY' [rtac @{thm surj_fun_eq}, rtac (type_def RS @{thm type_definition.Abs_image}),
  99.171 -        rtac ballI, resolve_tac init_unique_mors,
  99.172 +        rtac ballI, resolve0_tac init_unique_mors,
  99.173          EVERY' (map (fn thm => atac ORELSE' rtac thm) Reps),
  99.174          rtac mor_comp, rtac mor_Abs, atac,
  99.175          rtac mor_comp, rtac mor_Abs, rtac mor_fold];
  99.176 @@ -472,7 +473,7 @@
  99.177      fun mk_closed_tac (k, (morE, set_maps)) =
  99.178        EVERY' [select_prem_tac n (dtac asm_rl) k, rtac ballI, rtac impI,
  99.179          rtac (mor_Abs RS morE RS arg_cong RS iffD2), atac,
  99.180 -        REPEAT_DETERM o eresolve_tac [CollectE, conjE], dtac @{thm meta_spec},
  99.181 +        REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], dtac @{thm meta_spec},
  99.182          EVERY' (@{map 3} mk_IH_tac Rep_invs Abs_invs (drop m set_maps)), atac];
  99.183  
  99.184      fun mk_induct_tac (Rep, Rep_inv) =
  99.185 @@ -498,7 +499,7 @@
  99.186    in
  99.187      EVERY' [rtac rev_mp, rtac (Drule.instantiate' cTs cts ctor_induct),
  99.188        EVERY' (map2 mk_inner_induct_tac weak_ctor_inducts ks), rtac impI,
  99.189 -      REPEAT_DETERM o eresolve_tac [conjE, allE],
  99.190 +      REPEAT_DETERM o eresolve_tac ctxt [conjE, allE],
  99.191        CONJ_WRAP' (K atac) ks] 1
  99.192    end;
  99.193  
  99.194 @@ -626,13 +627,13 @@
  99.195  
  99.196  fun mk_wit_tac ctxt n ctor_set wit =
  99.197    REPEAT_DETERM (atac 1 ORELSE
  99.198 -    EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac ctor_set,
  99.199 +    EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac ctxt ctor_set,
  99.200      REPEAT_DETERM o
  99.201        (TRY o REPEAT_DETERM o etac UnE THEN' TRY o etac @{thm UN_E} THEN'
  99.202 -        (eresolve_tac wit ORELSE'
  99.203 -        (dresolve_tac wit THEN'
  99.204 +        (eresolve_tac ctxt wit ORELSE'
  99.205 +        (dresolve_tac ctxt wit THEN'
  99.206            (etac FalseE ORELSE'
  99.207 -          EVERY' [hyp_subst_tac ctxt, dtac set_rev_mp, rtac equalityD1, resolve_tac ctor_set,
  99.208 +          EVERY' [hyp_subst_tac ctxt, dtac set_rev_mp, rtac equalityD1, resolve_tac ctxt ctor_set,
  99.209              REPEAT_DETERM_N n o etac UnE]))))] 1);
  99.210  
  99.211  fun mk_ctor_rel_tac ctxt in_Irels i in_rel map_comp0 map_cong0 ctor_map ctor_sets ctor_inject
  99.212 @@ -646,7 +647,7 @@
  99.213      val le_arg_cong_ctor_dtor = ctor_dtor RS arg_cong RS ord_eq_le_trans;
  99.214      val eq_arg_cong_ctor_dtor = ctor_dtor RS arg_cong RS trans;
  99.215      val if_tac =
  99.216 -      EVERY' [dtac (in_Irel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE],
  99.217 +      EVERY' [dtac (in_Irel RS iffD1), REPEAT_DETERM o eresolve_tac ctxt [exE, conjE, CollectE],
  99.218          rtac (in_rel RS iffD2), rtac exI, rtac conjI, rtac CollectI,
  99.219          EVERY' (map2 (fn set_map0 => fn ctor_set_incl =>
  99.220            EVERY' [rtac conjI, rtac ord_eq_le_trans, rtac set_map0,
  99.221 @@ -669,7 +670,7 @@
  99.222            etac eq_arg_cong_ctor_dtor])
  99.223          fst_snd_convs];
  99.224      val only_if_tac =
  99.225 -      EVERY' [dtac (in_rel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE],
  99.226 +      EVERY' [dtac (in_rel RS iffD1), REPEAT_DETERM o eresolve_tac ctxt [exE, conjE, CollectE],
  99.227          rtac (in_Irel RS iffD2), rtac exI, rtac conjI, rtac CollectI,
  99.228          CONJ_WRAP' (fn (ctor_set, passive_set_map0) =>
  99.229            EVERY' [rtac ord_eq_le_trans, rtac ctor_set, rtac @{thm Un_least},
  99.230 @@ -680,11 +681,11 @@
  99.231                  rtac @{thm SUP_cong[OF _ refl]}, rtac active_set_map0, rtac @{thm UN_least},
  99.232                  dtac set_rev_mp, etac @{thm image_mono}, etac imageE,
  99.233                  dtac @{thm ssubst_mem[OF pair_collapse]},
  99.234 -                REPEAT_DETERM o eresolve_tac (CollectE :: conjE ::
  99.235 +                REPEAT_DETERM o eresolve_tac ctxt (CollectE :: conjE ::
  99.236                    @{thms case_prodE iffD1[OF prod.inject, elim_format]}),
  99.237                  hyp_subst_tac ctxt,
  99.238                  dtac (in_Irel RS iffD1), dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE,
  99.239 -                REPEAT_DETERM o eresolve_tac [CollectE, conjE], atac])
  99.240 +                REPEAT_DETERM o eresolve_tac ctxt [CollectE, conjE], atac])
  99.241              (rev (active_set_map0s ~~ in_Irels))])
  99.242          (ctor_sets ~~ passive_set_map0s),
  99.243          rtac conjI,
  99.244 @@ -693,7 +694,7 @@
  99.245            REPEAT_DETERM_N m o rtac @{thm fun_cong[OF comp_id]},
  99.246            EVERY' (map (fn in_Irel => EVERY' [rtac trans, rtac o_apply, dtac set_rev_mp, atac,
  99.247              dtac @{thm ssubst_mem[OF pair_collapse]},
  99.248 -            REPEAT_DETERM o eresolve_tac (CollectE :: conjE ::
  99.249 +            REPEAT_DETERM o eresolve_tac ctxt (CollectE :: conjE ::
  99.250                @{thms case_prodE iffD1[OF prod.inject, elim_format]}),
  99.251              hyp_subst_tac ctxt,
  99.252              dtac (in_Irel RS iffD1), dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE, atac])
  99.253 @@ -743,9 +744,9 @@
  99.254        @{thms rel_fun_def_butlast all_conj_distrib[symmetric] imp_conjR[symmetric]} THEN
  99.255      unfold_thms_tac ctxt @{thms rel_fun_iff_leq_vimage2p} THEN
  99.256      HEADGOAL (EVERY'
  99.257 -      [REPEAT_DETERM o resolve_tac [allI, impI], rtac ctor_rel_induct,
  99.258 +      [REPEAT_DETERM o resolve_tac ctxt [allI, impI], rtac ctor_rel_induct,
  99.259        EVERY' (map (fn map_transfer => EVERY'
  99.260 -        [REPEAT_DETERM o resolve_tac [allI, impI, @{thm vimage2pI}],
  99.261 +        [REPEAT_DETERM o resolve_tac ctxt [allI, impI, @{thm vimage2pI}],
  99.262          SELECT_GOAL (unfold_thms_tac ctxt folds),
  99.263          etac @{thm predicate2D_vimage2p},
  99.264          rtac (funpow (m + n + 1) (fn thm => thm RS rel_funD) map_transfer),
   100.1 --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML	Tue Feb 10 14:29:36 2015 +0100
   100.2 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML	Tue Feb 10 14:48:26 2015 +0100
   100.3 @@ -93,7 +93,8 @@
   100.4          (def, lthy')
   100.5        end;
   100.6  
   100.7 -    fun tac ctxt thms = Class.intro_classes_tac [] THEN ALLGOALS (Proof_Context.fact_tac ctxt thms);
   100.8 +    fun tac ctxt thms =
   100.9 +      Class.intro_classes_tac ctxt [] THEN ALLGOALS (Proof_Context.fact_tac ctxt thms);
  100.10  
  100.11      val qualify =
  100.12        Binding.qualify true (Long_Name.base_name fcT_name) o Binding.qualify true eqN o Binding.name;
   101.1 --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
   101.2 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
   101.3 @@ -85,7 +85,7 @@
   101.4  
   101.5  fun mk_exhaust_sel_tac n exhaust_disc collapses =
   101.6    mk_exhaust_disc_or_sel_tac n exhaust_disc collapses ORELSE
   101.7 -  HEADGOAL (etac meta_mp THEN' resolve_tac collapses);
   101.8 +  HEADGOAL (etac meta_mp THEN' resolve0_tac collapses);
   101.9  
  101.10  fun mk_collapse_tac ctxt m discD sels =
  101.11    HEADGOAL (dtac discD THEN'
  101.12 @@ -101,7 +101,7 @@
  101.13      (hyp_subst_tac ctxt THEN'
  101.14       SELECT_GOAL (unfold_thms_tac ctxt (@{thms not_True_eq_False not_False_eq_True} @ cases @
  101.15         ((refl :: discs @ distincts) RL [eqTrueI, eqFalseI]))) THEN'
  101.16 -     resolve_tac @{thms TrueI True_not_False False_not_True}));
  101.17 +     resolve_tac ctxt @{thms TrueI True_not_False False_not_True}));
  101.18  
  101.19  fun mk_expand_tac ctxt n ms uexhaust_disc vexhaust_disc uncollapses distinct_discsss
  101.20      distinct_discsss' =
   102.1 --- a/src/HOL/Tools/Function/function_common.ML	Tue Feb 10 14:29:36 2015 +0100
   102.2 +++ b/src/HOL/Tools/Function/function_common.ML	Tue Feb 10 14:48:26 2015 +0100
   102.3 @@ -279,7 +279,8 @@
   102.4      preproc1)
   102.5  )
   102.6  
   102.7 -val termination_rule_tac = resolve_tac o #1 o Data.get o Context.Proof
   102.8 +fun termination_rule_tac ctxt = resolve_tac ctxt (#1 (Data.get (Context.Proof ctxt)))
   102.9 +
  102.10  val store_termination_rule = Data.map o @{apply 4(1)} o cons
  102.11  
  102.12  val get_functions = #2 o Data.get o Context.Proof
   103.1 --- a/src/HOL/Tools/Function/function_core.ML	Tue Feb 10 14:29:36 2015 +0100
   103.2 +++ b/src/HOL/Tools/Function/function_core.ML	Tue Feb 10 14:48:26 2015 +0100
   103.3 @@ -707,8 +707,8 @@
   103.4        |> cterm_of thy
   103.5    in
   103.6      Goal.init goal
   103.7 -    |> (SINGLE (resolve_tac [accI] 1)) |> the
   103.8 -    |> (SINGLE (eresolve_tac [Thm.forall_elim_vars 0 R_cases] 1))  |> the
   103.9 +    |> (SINGLE (resolve_tac ctxt [accI] 1)) |> the
  103.10 +    |> (SINGLE (eresolve_tac ctxt [Thm.forall_elim_vars 0 R_cases] 1))  |> the
  103.11      |> (SINGLE (auto_tac ctxt)) |> the
  103.12      |> Goal.conclude
  103.13      |> fold_rev forall_intr_rename (map fst oqs ~~ cqs)
   104.1 --- a/src/HOL/Tools/Function/function_elims.ML	Tue Feb 10 14:29:36 2015 +0100
   104.2 +++ b/src/HOL/Tools/Function/function_elims.ML	Tue Feb 10 14:48:26 2015 +0100
   104.3 @@ -60,8 +60,8 @@
   104.4  
   104.5  fun bool_subst_tac ctxt i =
   104.6    REPEAT (EqSubst.eqsubst_asm_tac ctxt [1] eq_bool i)
   104.7 -  THEN REPEAT (dresolve_tac boolD i)
   104.8 -  THEN REPEAT (eresolve_tac boolE i)
   104.9 +  THEN REPEAT (dresolve_tac ctxt boolD i)
  104.10 +  THEN REPEAT (eresolve_tac ctxt boolE i)
  104.11  
  104.12  fun mk_bool_elims ctxt elim =
  104.13    let
  104.14 @@ -69,7 +69,7 @@
  104.15      fun mk_bool_elim b =
  104.16        elim
  104.17        |> Thm.forall_elim b
  104.18 -      |> Tactic.rule_by_tactic ctxt (TRY (resolve_tac eq_boolI 1))
  104.19 +      |> Tactic.rule_by_tactic ctxt (TRY (resolve_tac ctxt eq_boolI 1))
  104.20        |> Tactic.rule_by_tactic ctxt tac;
  104.21    in
  104.22      map mk_bool_elim [@{cterm True}, @{cterm False}]
  104.23 @@ -125,7 +125,7 @@
  104.24          val asms_thms = map Thm.assume asms;
  104.25  
  104.26          fun prep_subgoal_tac i =
  104.27 -          REPEAT (eresolve_tac @{thms Pair_inject} i)
  104.28 +          REPEAT (eresolve_tac ctxt @{thms Pair_inject} i)
  104.29            THEN Method.insert_tac (case asms_thms of thm :: thms => (thm RS sym) :: thms) i
  104.30            THEN propagate_tac ctxt i
  104.31            THEN TRY ((EqSubst.eqsubst_asm_tac ctxt [1] psimps i) THEN assume_tac ctxt i)
   105.1 --- a/src/HOL/Tools/Function/function_lib.ML	Tue Feb 10 14:29:36 2015 +0100
   105.2 +++ b/src/HOL/Tools/Function/function_lib.ML	Tue Feb 10 14:48:26 2015 +0100
   105.3 @@ -113,7 +113,7 @@
   105.4              then mk (foldr1 mk (map (nth xs) is), Const (neu, ty))
   105.5              else mk (foldr1 mk (map (nth xs) is), foldr1 mk (map (nth xs) js)))))
   105.6       (K (rewrite_goals_tac ctxt ac
   105.7 -         THEN resolve_tac [Drule.reflexive_thm] 1))
   105.8 +         THEN resolve_tac ctxt [Drule.reflexive_thm] 1))
   105.9   end
  105.10  
  105.11  (* instance for unions *)
   106.1 --- a/src/HOL/Tools/Function/measure_functions.ML	Tue Feb 10 14:29:36 2015 +0100
   106.2 +++ b/src/HOL/Tools/Function/measure_functions.ML	Tue Feb 10 14:48:26 2015 +0100
   106.3 @@ -18,7 +18,7 @@
   106.4    Const (@{const_name is_measure}, fastype_of t --> HOLogic.boolT) $ t
   106.5  
   106.6  fun find_measures ctxt T =
   106.7 -  DEPTH_SOLVE (resolve_tac (rev (Named_Theorems.get ctxt @{named_theorems measure_function})) 1)
   106.8 +  DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems measure_function})) 1)
   106.9      (HOLogic.mk_Trueprop (mk_is_measure (Var (("f",0), T --> HOLogic.natT)))
  106.10       |> cterm_of (Proof_Context.theory_of ctxt) |> Goal.init)
  106.11    |> Seq.map (prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
   107.1 --- a/src/HOL/Tools/Function/mutual.ML	Tue Feb 10 14:29:36 2015 +0100
   107.2 +++ b/src/HOL/Tools/Function/mutual.ML	Tue Feb 10 14:48:26 2015 +0100
   107.3 @@ -267,8 +267,8 @@
   107.4        @{thms HOL.notE[OF Sum_Type.sum.distinct(1)] HOL.notE[OF Sum_Type.sum.distinct(2)]}
   107.5  
   107.6      fun prep_subgoal i =
   107.7 -      REPEAT (eresolve_tac @{thms Pair_inject Inl_inject[elim_format] Inr_inject[elim_format]} i)
   107.8 -      THEN REPEAT (Tactic.eresolve_tac sum_elims i)
   107.9 +      REPEAT (eresolve_tac ctxt @{thms Pair_inject Inl_inject[elim_format] Inr_inject[elim_format]} i)
  107.10 +      THEN REPEAT (eresolve_tac ctxt sum_elims i)
  107.11    in
  107.12      cases_rule
  107.13      |> Thm.forall_elim P
   108.1 --- a/src/HOL/Tools/Function/partial_function.ML	Tue Feb 10 14:29:36 2015 +0100
   108.2 +++ b/src/HOL/Tools/Function/partial_function.ML	Tue Feb 10 14:48:26 2015 +0100
   108.3 @@ -80,7 +80,7 @@
   108.4    | _ => NONE;
   108.5  
   108.6  (*split on case expressions*)
   108.7 -val split_cases_tac = Subgoal.FOCUS_PARAMS (fn {context=ctxt, ...} =>
   108.8 +val split_cases_tac = Subgoal.FOCUS_PARAMS (fn {context = ctxt, ...} =>
   108.9    SUBGOAL (fn (t, i) => case t of
  108.10      _ $ (_ $ Abs (_, _, body)) =>
  108.11        (case dest_case ctxt body of
  108.12 @@ -90,7 +90,7 @@
  108.13                if Term.is_open arg then no_tac
  108.14                else ((DETERM o strip_cases o Induct.cases_tac ctxt false [[SOME arg]] NONE [])
  108.15                  THEN_ALL_NEW (rewrite_with_asm_tac ctxt 0)
  108.16 -                THEN_ALL_NEW eresolve_tac @{thms thin_rl}
  108.17 +                THEN_ALL_NEW eresolve_tac ctxt @{thms thin_rl}
  108.18                  THEN_ALL_NEW (CONVERSION
  108.19                    (params_conv ~1 (fn ctxt' =>
  108.20                      arg_conv (arg_conv (abs_conv (K conv) ctxt'))) ctxt))) i
  108.21 @@ -101,7 +101,7 @@
  108.22  fun mono_tac ctxt =
  108.23    K (Local_Defs.unfold_tac ctxt [@{thm curry_def}])
  108.24    THEN' (TRY o REPEAT_ALL_NEW
  108.25 -   (resolve_tac (rev (Named_Theorems.get ctxt @{named_theorems partial_function_mono}))
  108.26 +   (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems partial_function_mono}))
  108.27       ORELSE' split_cases_tac ctxt));
  108.28  
  108.29  
  108.30 @@ -290,7 +290,7 @@
  108.31      val rec_rule = let open Conv in
  108.32        Goal.prove lthy' (map (fst o dest_Free) args) [] eqn (fn _ =>
  108.33          CONVERSION ((arg_conv o arg1_conv o head_conv o rewr_conv) (mk_meta_eq unfold)) 1
  108.34 -        THEN resolve_tac @{thms refl} 1) end;
  108.35 +        THEN resolve_tac lthy' @{thms refl} 1) end;
  108.36    in
  108.37      lthy'
  108.38      |> Local_Theory.note (eq_abinding, [rec_rule])
   109.1 --- a/src/HOL/Tools/Function/scnp_reconstruct.ML	Tue Feb 10 14:29:36 2015 +0100
   109.2 +++ b/src/HOL/Tools/Function/scnp_reconstruct.ML	Tue Feb 10 14:48:26 2015 +0100
   109.3 @@ -282,7 +282,7 @@
   109.4           THEN PRIMITIVE (instantiate' [] [SOME level_mapping])
   109.5           THEN unfold_tac ctxt @{thms rp_inv_image_def}
   109.6           THEN Local_Defs.unfold_tac ctxt @{thms split_conv fst_conv snd_conv}
   109.7 -         THEN REPEAT (SOMEGOAL (resolve_tac [@{thm Un_least}, @{thm empty_subsetI}]))
   109.8 +         THEN REPEAT (SOMEGOAL (resolve_tac ctxt [@{thm Un_least}, @{thm empty_subsetI}]))
   109.9           THEN EVERY (map (prove_lev true) sl)
  109.10           THEN EVERY (map (prove_lev false) (subtract (op =) sl (0 upto length cs - 1))))
  109.11      end
   110.1 --- a/src/HOL/Tools/Lifting/lifting_def.ML	Tue Feb 10 14:29:36 2015 +0100
   110.2 +++ b/src/HOL/Tools/Lifting/lifting_def.ML	Tue Feb 10 14:48:26 2015 +0100
   110.3 @@ -33,8 +33,8 @@
   110.4      val refl_rules = Lifting_Info.get_reflexivity_rules ctxt
   110.5      val transfer_rules = Transfer.get_transfer_raw ctxt
   110.6      
   110.7 -    fun main_tac i = (REPEAT_ALL_NEW (DETERM o resolve_tac refl_rules) THEN_ALL_NEW 
   110.8 -      (REPEAT_ALL_NEW (DETERM o resolve_tac transfer_rules))) i
   110.9 +    fun main_tac i = (REPEAT_ALL_NEW (DETERM o resolve_tac ctxt refl_rules) THEN_ALL_NEW 
  110.10 +      (REPEAT_ALL_NEW (DETERM o resolve_tac ctxt transfer_rules))) i
  110.11    in
  110.12      SOME (Goal.prove ctxt [] [] prop (K (main_tac 1)))
  110.13        handle ERROR _ => NONE
  110.14 @@ -545,7 +545,7 @@
  110.15          fun binop_conv2 cv1 cv2 = Conv.combination_conv (Conv.arg_conv cv1) cv2
  110.16          val eq_onp_assms_tac_rules = @{thm left_unique_OO} :: 
  110.17              eq_onp_assms_tac_fixed_rules @ (Transfer.get_transfer_raw lthy)
  110.18 -        val eq_onp_assms_tac = (TRY o REPEAT_ALL_NEW (resolve_tac eq_onp_assms_tac_rules) 
  110.19 +        val eq_onp_assms_tac = (TRY o REPEAT_ALL_NEW (resolve_tac lthy eq_onp_assms_tac_rules) 
  110.20            THEN_ALL_NEW (DETERM o Transfer.eq_tac lthy)) 1
  110.21          val relator_eq_onp_conv = Conv.bottom_conv
  110.22            (K (Conv.try_conv (assms_rewrs_conv eq_onp_assms_tac
   111.1 --- a/src/HOL/Tools/Lifting/lifting_setup.ML	Tue Feb 10 14:29:36 2015 +0100
   111.2 +++ b/src/HOL/Tools/Lifting/lifting_setup.ML	Tue Feb 10 14:48:26 2015 +0100
   111.3 @@ -310,7 +310,8 @@
   111.4            val init_goal = Goal.init (cterm_of thy fixed_goal)
   111.5            val rules = Transfer.get_transfer_raw ctxt
   111.6            val rules = constraint :: OO_rules @ rules
   111.7 -          val tac = K (Local_Defs.unfold_tac ctxt [pcr_def]) THEN' REPEAT_ALL_NEW (resolve_tac rules)
   111.8 +          val tac =
   111.9 +            K (Local_Defs.unfold_tac ctxt [pcr_def]) THEN' REPEAT_ALL_NEW (resolve_tac ctxt rules)
  111.10          in
  111.11            (singleton (Variable.export ctxt orig_ctxt) o Goal.conclude) (the (SINGLE (tac 1) init_goal))
  111.12          end
  111.13 @@ -414,7 +415,8 @@
  111.14      let
  111.15        val goal = thm |> prems_of |> hd
  111.16        val var = goal |> HOLogic.dest_Trueprop |> dest_comb |> snd |> dest_Var 
  111.17 -      val reduced_assm = reduce_goal [var] goal (TRY (REPEAT_ALL_NEW (resolve_tac rules) 1)) ctxt
  111.18 +      val reduced_assm =
  111.19 +        reduce_goal [var] goal (TRY (REPEAT_ALL_NEW (resolve_tac ctxt rules) 1)) ctxt
  111.20      in
  111.21        reduced_assm RS thm
  111.22      end
  111.23 @@ -424,7 +426,8 @@
  111.24        fun reduce_first_assm ctxt rules thm =
  111.25          let
  111.26            val goal = thm |> prems_of |> hd
  111.27 -          val reduced_assm = reduce_goal [] goal (TRY (REPEAT_ALL_NEW (resolve_tac rules) 1)) ctxt
  111.28 +          val reduced_assm =
  111.29 +            reduce_goal [] goal (TRY (REPEAT_ALL_NEW (resolve_tac ctxt rules) 1)) ctxt
  111.30          in
  111.31            reduced_assm RS thm
  111.32          end
   112.1 --- a/src/HOL/Tools/Lifting/lifting_term.ML	Tue Feb 10 14:29:36 2015 +0100
   112.2 +++ b/src/HOL/Tools/Lifting/lifting_term.ML	Tue Feb 10 14:48:26 2015 +0100
   112.3 @@ -473,7 +473,7 @@
   112.4        fun prove_extra_assms ctxt ctm distr_rule =
   112.5          let
   112.6            fun prove_assm assm = try (Goal.prove ctxt [] [] (term_of assm))
   112.7 -            (fn _ => SOLVED' (REPEAT_ALL_NEW (resolve_tac (Transfer.get_transfer_raw ctxt))) 1)
   112.8 +            (fn _ => SOLVED' (REPEAT_ALL_NEW (resolve_tac ctxt (Transfer.get_transfer_raw ctxt))) 1)
   112.9    
  112.10            fun is_POS_or_NEG ctm =
  112.11              case (head_of o term_of o Thm.dest_arg) ctm of
   113.1 --- a/src/HOL/Tools/Meson/meson.ML	Tue Feb 10 14:29:36 2015 +0100
   113.2 +++ b/src/HOL/Tools/Meson/meson.ML	Tue Feb 10 14:48:26 2015 +0100
   113.3 @@ -170,14 +170,14 @@
   113.4     property of the form "... c ... c ... c ..." will lead to a huge unification
   113.5     problem, due to the (spurious) choices between projection and imitation. The
   113.6     workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *)
   113.7 -fun quant_resolve_tac th i st =
   113.8 +fun quant_resolve_tac ctxt th i st =
   113.9    case (concl_of st, prop_of th) of
  113.10      (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) =>
  113.11      let
  113.12        val cc = cterm_of (theory_of_thm th) c
  113.13        val ct = Thm.dest_arg (cprop_of th)
  113.14 -    in resolve_tac [th] i (Drule.instantiate' [] [SOME (Thm.lambda cc ct)] st) end
  113.15 -  | _ => resolve_tac [th] i st
  113.16 +    in resolve_tac ctxt [th] i (Drule.instantiate' [] [SOME (Thm.lambda cc ct)] st) end
  113.17 +  | _ => resolve_tac ctxt [th] i st
  113.18  
  113.19  (*Permits forward proof from rules that discharge assumptions. The supplied proof state st,
  113.20    e.g. from conj_forward, should have the form
  113.21 @@ -185,7 +185,7 @@
  113.22    and the effect should be to instantiate ?P and ?Q with normalized versions of P' and Q'.*)
  113.23  fun forward_res ctxt nf st =
  113.24    let
  113.25 -    fun tacf [prem] = quant_resolve_tac (nf prem) 1
  113.26 +    fun tacf [prem] = quant_resolve_tac ctxt (nf prem) 1
  113.27        | tacf prems =
  113.28          error (cat_lines
  113.29            ("Bad proof state in forward_res, please inform lcp@cl.cam.ac.uk:" ::
  113.30 @@ -287,7 +287,7 @@
  113.31    case Seq.pull
  113.32          (REPEAT
  113.33           (Misc_Legacy.METAHYPS ctxt
  113.34 -           (fn major::minors => resolve_tac [nf (minors @ hyps) major] 1) 1)
  113.35 +           (fn major::minors => resolve_tac ctxt [nf (minors @ hyps) major] 1) 1)
  113.36           st)
  113.37    of SOME(th,_) => th
  113.38     | NONE => raise THM("forward_res2", 0, [st]);
  113.39 @@ -390,7 +390,7 @@
  113.40                  cnf_nil. The normal form is given to resolve_tac, instantiate a Boolean
  113.41                  variable created by resolution with disj_forward. Since (cnf_nil prem)
  113.42                  returns a LIST of theorems, we can backtrack to get all combinations.*)
  113.43 -              let val tac = Misc_Legacy.METAHYPS ctxt (fn [prem] => resolve_tac (cnf_nil prem) 1) 1
  113.44 +              let val tac = Misc_Legacy.METAHYPS ctxt (fn [prem] => resolve_tac ctxt (cnf_nil prem) 1) 1
  113.45                in  Seq.list_of ((tac THEN tac) (th RS disj_forward)) @ ths  end
  113.46            | _ => nodups ctxt th :: ths  (*no work to do*)
  113.47        and cnf_nil th = cnf_aux (th, [])
  113.48 @@ -500,7 +500,7 @@
  113.49  
  113.50  (* resolve_from_net_tac actually made it slower... *)
  113.51  fun prolog_step_tac ctxt horns i =
  113.52 -    (assume_tac ctxt i APPEND resolve_tac horns i) THEN check_tac THEN
  113.53 +    (assume_tac ctxt i APPEND resolve_tac ctxt horns i) THEN check_tac THEN
  113.54      TRYALL_eq_assume_tac;
  113.55  
  113.56  (*Sums the sizes of the subgoals, ignoring hypotheses (ancestors)*)
  113.57 @@ -698,14 +698,14 @@
  113.58  fun gocls cls = name_thms "Goal#" (map make_goal (neg_clauses cls));
  113.59  
  113.60  fun skolemize_prems_tac ctxt prems =
  113.61 -  cut_facts_tac (maps (try_skolemize_etc ctxt) prems) THEN' REPEAT o eresolve_tac [exE]
  113.62 +  cut_facts_tac (maps (try_skolemize_etc ctxt) prems) THEN' REPEAT o eresolve_tac ctxt [exE]
  113.63  
  113.64  (*Basis of all meson-tactics.  Supplies cltac with clauses: HOL disjunctions.
  113.65    Function mkcl converts theorems to clauses.*)
  113.66  fun MESON preskolem_tac mkcl cltac ctxt i st =
  113.67    SELECT_GOAL
  113.68      (EVERY [Object_Logic.atomize_prems_tac ctxt 1,
  113.69 -            resolve_tac @{thms ccontr} 1,
  113.70 +            resolve_tac ctxt @{thms ccontr} 1,
  113.71              preskolem_tac,
  113.72              Subgoal.FOCUS (fn {context = ctxt', prems = negs, ...} =>
  113.73                        EVERY1 [skolemize_prems_tac ctxt negs,
  113.74 @@ -719,7 +719,7 @@
  113.75  fun best_meson_tac sizef ctxt =
  113.76    MESON all_tac (make_clauses ctxt)
  113.77      (fn cls =>
  113.78 -         THEN_BEST_FIRST (resolve_tac (gocls cls) 1)
  113.79 +         THEN_BEST_FIRST (resolve_tac ctxt (gocls cls) 1)
  113.80                           (has_fewer_prems 1, sizef)
  113.81                           (prolog_step_tac ctxt (make_horns cls) 1))
  113.82      ctxt
  113.83 @@ -732,7 +732,7 @@
  113.84  
  113.85  fun depth_meson_tac ctxt =
  113.86    MESON all_tac (make_clauses ctxt)
  113.87 -    (fn cls => EVERY [resolve_tac (gocls cls) 1, depth_prolog_tac ctxt (make_horns cls)])
  113.88 +    (fn cls => EVERY [resolve_tac ctxt (gocls cls) 1, depth_prolog_tac ctxt (make_horns cls)])
  113.89      ctxt
  113.90  
  113.91  (** Iterative deepening version **)
  113.92 @@ -764,7 +764,7 @@
  113.93                ["clauses:"] @ map (Display.string_of_thm ctxt) horns))
  113.94          in
  113.95            THEN_ITER_DEEPEN iter_deepen_limit
  113.96 -            (resolve_tac goes 1) (has_fewer_prems 1) (prolog_step_tac' ctxt horns)
  113.97 +            (resolve_tac ctxt goes 1) (has_fewer_prems 1) (prolog_step_tac' ctxt horns)
  113.98          end));
  113.99  
 113.100  fun meson_tac ctxt ths =
   114.1 --- a/src/HOL/Tools/Meson/meson_clausify.ML	Tue Feb 10 14:29:36 2015 +0100
   114.2 +++ b/src/HOL/Tools/Meson/meson_clausify.ML	Tue Feb 10 14:48:26 2015 +0100
   114.3 @@ -208,7 +208,7 @@
   114.4        |> Drule.beta_conv cabs |> Thm.apply cTrueprop
   114.5      fun tacf [prem] =
   114.6        rewrite_goals_tac ctxt @{thms skolem_def [abs_def]}
   114.7 -      THEN resolve_tac [(prem |> rewrite_rule ctxt @{thms skolem_def [abs_def]})
   114.8 +      THEN resolve_tac ctxt [(prem |> rewrite_rule ctxt @{thms skolem_def [abs_def]})
   114.9                   RS Global_Theory.get_thm thy "Hilbert_Choice.someI_ex"] 1
  114.10    in
  114.11      Goal.prove_internal ctxt [ex_tm] conc tacf
   115.1 --- a/src/HOL/Tools/Metis/metis_reconstruct.ML	Tue Feb 10 14:29:36 2015 +0100
   115.2 +++ b/src/HOL/Tools/Metis/metis_reconstruct.ML	Tue Feb 10 14:48:26 2015 +0100
   115.3 @@ -530,17 +530,19 @@
   115.4  
   115.5  val copy_prem = @{lemma "P ==> (P ==> P ==> Q) ==> Q" by fast}
   115.6  
   115.7 -fun copy_prems_tac [] ns i =
   115.8 -    if forall (curry (op =) 1) ns then all_tac else copy_prems_tac (rev ns) [] i
   115.9 -  | copy_prems_tac (1 :: ms) ns i = rotate_tac 1 i THEN copy_prems_tac ms (1 :: ns) i
  115.10 -  | copy_prems_tac (m :: ms) ns i =
  115.11 -    eresolve_tac [copy_prem] i THEN copy_prems_tac ms (m div 2 :: (m + 1) div 2 :: ns) i
  115.12 +fun copy_prems_tac ctxt [] ns i =
  115.13 +    if forall (curry (op =) 1) ns then all_tac else copy_prems_tac ctxt (rev ns) [] i
  115.14 +  | copy_prems_tac ctxt (1 :: ms) ns i = rotate_tac 1 i THEN copy_prems_tac ctxt ms (1 :: ns) i
  115.15 +  | copy_prems_tac ctxt (m :: ms) ns i =
  115.16 +    eresolve_tac ctxt [copy_prem] i THEN copy_prems_tac ctxt ms (m div 2 :: (m + 1) div 2 :: ns) i
  115.17  
  115.18  (* Metis generates variables of the form _nnn. *)
  115.19  val is_metis_fresh_variable = String.isPrefix "_"
  115.20  
  115.21 -fun instantiate_forall_tac thy t i st =
  115.22 +fun instantiate_forall_tac ctxt t i st =
  115.23    let
  115.24 +    val thy = Proof_Context.theory_of ctxt
  115.25 +
  115.26      val params = Logic.strip_params (Logic.get_goal (prop_of st) i) |> rev
  115.27  
  115.28      fun repair (t as (Var ((s, _), _))) =
  115.29 @@ -581,16 +583,16 @@
  115.30          end
  115.31        | _ => raise Fail "expected a single non-zapped, non-Metis Var")
  115.32    in
  115.33 -    (DETERM (eresolve_tac @{thms allE} i THEN rotate_tac ~1 i) THEN PRIMITIVE do_instantiate) st
  115.34 +    (DETERM (eresolve_tac ctxt @{thms allE} i THEN rotate_tac ~1 i) THEN PRIMITIVE do_instantiate) st
  115.35    end
  115.36  
  115.37 -fun fix_exists_tac t = eresolve_tac [exE] THEN' rename_tac [t |> dest_Var |> fst |> fst]
  115.38 +fun fix_exists_tac ctxt t = eresolve_tac ctxt [exE] THEN' rename_tac [t |> dest_Var |> fst |> fst]
  115.39  
  115.40 -fun release_quantifier_tac thy (skolem, t) =
  115.41 -  (if skolem then fix_exists_tac else instantiate_forall_tac thy) t
  115.42 +fun release_quantifier_tac ctxt (skolem, t) =
  115.43 +  (if skolem then fix_exists_tac ctxt else instantiate_forall_tac ctxt) t
  115.44  
  115.45  fun release_clusters_tac _ _ _ [] = K all_tac
  115.46 -  | release_clusters_tac thy ax_counts substs ((ax_no, cluster_no) :: clusters) =
  115.47 +  | release_clusters_tac ctxt ax_counts substs ((ax_no, cluster_no) :: clusters) =
  115.48      let
  115.49        val cluster_of_var = Meson_Clausify.cluster_of_zapped_var_name o fst o fst o dest_Var
  115.50        fun in_right_cluster ((_, (cluster_no', _)), _) = cluster_no' = cluster_no
  115.51 @@ -605,13 +607,13 @@
  115.52                            else
  115.53                              NONE)
  115.54        fun do_cluster_subst cluster_subst =
  115.55 -        map (release_quantifier_tac thy) cluster_subst @ [rotate_tac 1]
  115.56 +        map (release_quantifier_tac ctxt) cluster_subst @ [rotate_tac 1]
  115.57        val first_prem = find_index (fn (ax_no', _) => ax_no' = ax_no) substs
  115.58      in
  115.59        rotate_tac first_prem
  115.60        THEN' (EVERY' (maps do_cluster_subst cluster_substs))
  115.61        THEN' rotate_tac (~ first_prem - length cluster_substs)
  115.62 -      THEN' release_clusters_tac thy ax_counts substs clusters
  115.63 +      THEN' release_clusters_tac ctxt ax_counts substs clusters
  115.64      end
  115.65  
  115.66  fun cluster_key ((ax_no, (cluster_no, index_no)), skolem) =
  115.67 @@ -731,21 +733,20 @@
  115.68        val _ = tracing ("SUBSTS (" ^ string_of_int (length substs) ^ "):\n" ^
  115.69                         cat_lines (map string_of_subst_info substs))
  115.70  *)
  115.71 +      val ctxt' = fold Thm.declare_hyps (#hyps (Thm.crep_thm prems_imp_false)) ctxt
  115.72  
  115.73        fun cut_and_ex_tac axiom =
  115.74 -        cut_tac axiom 1 THEN TRY (REPEAT_ALL_NEW (eresolve_tac @{thms exE}) 1)
  115.75 +        cut_tac axiom 1 THEN TRY (REPEAT_ALL_NEW (eresolve_tac ctxt' @{thms exE}) 1)
  115.76        fun rotation_of_subgoal i =
  115.77          find_index (fn (_, (subgoal_no, _)) => subgoal_no = i) substs
  115.78 -
  115.79 -      val ctxt' = fold Thm.declare_hyps (#hyps (Thm.crep_thm prems_imp_false)) ctxt
  115.80      in
  115.81        Goal.prove ctxt' [] [] @{prop False}
  115.82          (K (DETERM (EVERY (map (cut_and_ex_tac o fst o the o nth axioms o fst o fst) ax_counts)
  115.83                THEN rename_tac outer_param_names 1
  115.84 -              THEN copy_prems_tac (map snd ax_counts) [] 1)
  115.85 -            THEN release_clusters_tac thy ax_counts substs ordered_clusters 1
  115.86 +              THEN copy_prems_tac ctxt' (map snd ax_counts) [] 1)
  115.87 +            THEN release_clusters_tac ctxt' ax_counts substs ordered_clusters 1
  115.88              THEN match_tac ctxt' [prems_imp_false] 1
  115.89 -            THEN ALLGOALS (fn i => resolve_tac @{thms Meson.skolem_COMBK_I} i
  115.90 +            THEN ALLGOALS (fn i => resolve_tac ctxt' @{thms Meson.skolem_COMBK_I} i
  115.91                THEN rotate_tac (rotation_of_subgoal i) i
  115.92                THEN PRIMITIVE (unify_first_prem_with_concl thy i)
  115.93                THEN assume_tac ctxt' i
   116.1 --- a/src/HOL/Tools/Metis/metis_tactic.ML	Tue Feb 10 14:29:36 2015 +0100
   116.2 +++ b/src/HOL/Tools/Metis/metis_tactic.ML	Tue Feb 10 14:48:26 2015 +0100
   116.3 @@ -61,7 +61,7 @@
   116.4  fun lam_lifted_of_metis ctxt type_enc sym_tab concealed mth =
   116.5    let
   116.6      val thy = Proof_Context.theory_of ctxt
   116.7 -    val tac = rewrite_goals_tac ctxt @{thms lambda_def [abs_def]} THEN resolve_tac [refl] 1
   116.8 +    val tac = rewrite_goals_tac ctxt @{thms lambda_def [abs_def]} THEN resolve_tac ctxt [refl] 1
   116.9      val t = hol_clause_of_metis ctxt type_enc sym_tab concealed mth
  116.10      val ct = cterm_of thy (HOLogic.mk_Trueprop t)
  116.11    in Goal.prove_internal ctxt [] ct (K tac) |> Meson.make_meta_clause end
  116.12 @@ -102,7 +102,7 @@
  116.13           so that "Thm.equal_elim" works below. *)
  116.14        val t0 $ _ $ t2 = prop_of eq_th
  116.15        val eq_ct = t0 $ prop_of th $ t2 |> cterm_of thy
  116.16 -      val eq_th' = Goal.prove_internal ctxt [] eq_ct (K (resolve_tac [eq_th] 1))
  116.17 +      val eq_th' = Goal.prove_internal ctxt [] eq_ct (K (resolve_tac ctxt [eq_th] 1))
  116.18      in Thm.equal_elim eq_th' th end
  116.19  
  116.20  fun clause_params ordering =
  116.21 @@ -257,7 +257,7 @@
  116.22        "Metis called with theorems\n" ^ cat_lines (map (Display.string_of_thm ctxt) ths))
  116.23      val type_encs = type_encs |> maps unalias_type_enc
  116.24      val combs = (lam_trans = combsN)
  116.25 -    fun tac clause = resolve_tac (FOL_SOLVE unused type_encs lam_trans ctxt clause ths) 1
  116.26 +    fun tac clause = resolve_tac ctxt (FOL_SOLVE unused type_encs lam_trans ctxt clause ths) 1
  116.27      val seq = Meson.MESON (preskolem_tac ctxt) (maps (neg_clausify ctxt combs)) tac ctxt i st0
  116.28    in
  116.29      (!unused, seq)
   117.1 --- a/src/HOL/Tools/Old_Datatype/old_datatype.ML	Tue Feb 10 14:29:36 2015 +0100
   117.2 +++ b/src/HOL/Tools/Old_Datatype/old_datatype.ML	Tue Feb 10 14:48:26 2015 +0100
   117.3 @@ -188,9 +188,9 @@
   117.4          (fn (((name, mx), tvs), c) =>
   117.5            Typedef.add_typedef_global false (name, tvs, mx)
   117.6              (Collect $ Const (c, UnivT')) NONE
   117.7 -            (fn _ => rtac exI 1 THEN rtac CollectI 1 THEN
   117.8 +            (fn ctxt => rtac exI 1 THEN rtac CollectI 1 THEN
   117.9                QUIET_BREADTH_FIRST (has_fewer_prems 1)
  117.10 -              (resolve_tac rep_intrs 1)))
  117.11 +              (resolve_tac ctxt rep_intrs 1)))
  117.12          (types_syntax ~~ tyvars ~~ take (length newTs) rep_set_names)
  117.13        ||> Sign.add_path big_name;
  117.14  
  117.15 @@ -425,15 +425,15 @@
  117.16                    REPEAT (EVERY
  117.17                      [hyp_subst_tac ctxt 1,
  117.18                       rewrite_goals_tac ctxt rewrites,
  117.19 -                     REPEAT (dresolve_tac [In0_inject, In1_inject] 1),
  117.20 -                     (eresolve_tac [In0_not_In1 RS notE, In1_not_In0 RS notE] 1)
  117.21 +                     REPEAT (dresolve_tac ctxt [In0_inject, In1_inject] 1),
  117.22 +                     (eresolve_tac ctxt [In0_not_In1 RS notE, In1_not_In0 RS notE] 1)
  117.23                       ORELSE (EVERY
  117.24 -                       [REPEAT (eresolve_tac (Scons_inject ::
  117.25 +                       [REPEAT (eresolve_tac ctxt (Scons_inject ::
  117.26                            map make_elim [Leaf_inject, Inl_inject, Inr_inject]) 1),
  117.27                          REPEAT (cong_tac ctxt 1), rtac refl 1,
  117.28                          REPEAT (assume_tac ctxt 1 ORELSE (EVERY
  117.29                            [REPEAT (rtac @{thm ext} 1),
  117.30 -                           REPEAT (eresolve_tac (mp :: allE ::
  117.31 +                           REPEAT (eresolve_tac ctxt (mp :: allE ::
  117.32                               map make_elim (Suml_inject :: Sumr_inject ::
  117.33                                 Lim_inject :: inj_thms') @ fun_congs) 1),
  117.34                             assume_tac ctxt 1]))])])])]);
  117.35 @@ -447,7 +447,7 @@
  117.36                EVERY [
  117.37                  (Old_Datatype_Aux.ind_tac induct [] THEN_ALL_NEW Object_Logic.atomize_prems_tac ctxt) 1,
  117.38                  rewrite_goals_tac ctxt rewrites,
  117.39 -                REPEAT ((resolve_tac rep_intrs THEN_ALL_NEW
  117.40 +                REPEAT ((resolve_tac ctxt rep_intrs THEN_ALL_NEW
  117.41                    ((REPEAT o etac allE) THEN' ares_tac elem_thms)) 1)]);
  117.42  
  117.43        in (inj_thms'' @ inj_thms, elem_thms @ Old_Datatype_Aux.split_conj_thm elem_thm) end;
  117.44 @@ -488,11 +488,11 @@
  117.45                  Thm.symmetric (mk_meta_eq @{thm fun_eq_iff}) :: range_eqs),
  117.46                rewrite_goals_tac ctxt (map Thm.symmetric range_eqs),
  117.47                REPEAT (EVERY
  117.48 -                [REPEAT (eresolve_tac ([rangeE, @{thm ex1_implies_ex} RS exE] @
  117.49 +                [REPEAT (eresolve_tac ctxt ([rangeE, @{thm ex1_implies_ex} RS exE] @
  117.50                     maps (mk_funs_inv thy5 o #1) newT_iso_axms) 1),
  117.51                   TRY (hyp_subst_tac ctxt 1),
  117.52                   rtac (sym RS range_eqI) 1,
  117.53 -                 resolve_tac iso_char_thms 1])])));
  117.54 +                 resolve_tac ctxt iso_char_thms 1])])));
  117.55  
  117.56      val Abs_inverse_thms' =
  117.57        map #1 newT_iso_axms @
  117.58 @@ -514,11 +514,11 @@
  117.59        in
  117.60          Goal.prove_sorry_global thy5 [] [] eqn
  117.61          (fn {context = ctxt, ...} => EVERY
  117.62 -          [resolve_tac inj_thms 1,
  117.63 +          [resolve_tac ctxt inj_thms 1,
  117.64             rewrite_goals_tac ctxt rewrites,
  117.65             rtac refl 3,
  117.66 -           resolve_tac rep_intrs 2,
  117.67 -           REPEAT (resolve_tac iso_elem_thms 1)])
  117.68 +           resolve_tac ctxt rep_intrs 2,
  117.69 +           REPEAT (resolve_tac ctxt iso_elem_thms 1)])
  117.70        end;
  117.71  
  117.72      (*--------------------------------------------------------------*)
  117.73 @@ -560,11 +560,11 @@
  117.74            (fn {context = ctxt, ...} => EVERY
  117.75              [rtac iffI 1,
  117.76               REPEAT (etac conjE 2), hyp_subst_tac ctxt 2, rtac refl 2,
  117.77 -             dresolve_tac rep_congs 1, dtac @{thm box_equals} 1,
  117.78 -             REPEAT (resolve_tac rep_thms 1),
  117.79 -             REPEAT (eresolve_tac inj_thms 1),
  117.80 +             dresolve_tac ctxt rep_congs 1, dtac @{thm box_equals} 1,
  117.81 +             REPEAT (resolve_tac ctxt rep_thms 1),
  117.82 +             REPEAT (eresolve_tac ctxt inj_thms 1),
  117.83               REPEAT (ares_tac [conjI] 1 ORELSE (EVERY [REPEAT (rtac @{thm ext} 1),
  117.84 -               REPEAT (eresolve_tac (make_elim fun_cong :: inj_thms) 1),
  117.85 +               REPEAT (eresolve_tac ctxt (make_elim fun_cong :: inj_thms) 1),
  117.86                 assume_tac ctxt 1]))])
  117.87        end;
  117.88  
  117.89 @@ -616,12 +616,12 @@
  117.90          (Logic.mk_implies
  117.91            (HOLogic.mk_Trueprop (Old_Datatype_Aux.mk_conj indrule_lemma_prems),
  117.92             HOLogic.mk_Trueprop (Old_Datatype_Aux.mk_conj indrule_lemma_concls)))
  117.93 -        (fn _ =>
  117.94 +        (fn {context = ctxt, ...} =>
  117.95            EVERY
  117.96             [REPEAT (etac conjE 1),
  117.97              REPEAT (EVERY
  117.98 -              [TRY (rtac conjI 1), resolve_tac Rep_inverse_thms 1,
  117.99 -               etac mp 1, resolve_tac iso_elem_thms 1])]);
 117.100 +              [TRY (rtac conjI 1), resolve_tac ctxt Rep_inverse_thms 1,
 117.101 +               etac mp 1, resolve_tac ctxt iso_elem_thms 1])]);
 117.102  
 117.103      val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of indrule_lemma)));
 117.104      val frees =
 117.105 @@ -640,7 +640,7 @@
 117.106             (Old_Datatype_Aux.ind_tac rep_induct [] THEN_ALL_NEW
 117.107                Object_Logic.atomize_prems_tac ctxt) 1,
 117.108             EVERY (map (fn (prem, r) => (EVERY
 117.109 -             [REPEAT (eresolve_tac Abs_inverse_thms 1),
 117.110 +             [REPEAT (eresolve_tac ctxt Abs_inverse_thms 1),
 117.111                simp_tac (put_simpset HOL_basic_ss ctxt
 117.112                  addsimps (Thm.symmetric r :: Rep_inverse_thms')) 1,
 117.113                DEPTH_SOLVE_1 (ares_tac [prem] 1 ORELSE etac allE 1)]))
   118.1 --- a/src/HOL/Tools/Old_Datatype/old_datatype_aux.ML	Tue Feb 10 14:29:36 2015 +0100
   118.2 +++ b/src/HOL/Tools/Old_Datatype/old_datatype_aux.ML	Tue Feb 10 14:48:26 2015 +0100
   118.3 @@ -150,7 +150,7 @@
   118.4            NONE => NONE
   118.5          | SOME u' => SOME (t |> getP |> snd |> head_of |> cert, cert u'))) (ts ~~ ts');
   118.6      val indrule' = cterm_instantiate insts indrule;
   118.7 -  in resolve_tac [indrule'] i end);
   118.8 +  in resolve0_tac [indrule'] i end);
   118.9  
  118.10  
  118.11  (* perform exhaustive case analysis on last parameter of subgoal i *)
   119.1 --- a/src/HOL/Tools/Old_Datatype/old_primrec.ML	Tue Feb 10 14:29:36 2015 +0100
   119.2 +++ b/src/HOL/Tools/Old_Datatype/old_primrec.ML	Tue Feb 10 14:48:26 2015 +0100
   119.3 @@ -248,7 +248,7 @@
   119.4        in
   119.5          map (fn eq => Goal.prove ctxt frees [] eq
   119.6            (fn {context = ctxt', ...} =>
   119.7 -            EVERY [rewrite_goals_tac ctxt' rewrites, resolve_tac [refl] 1])) eqs
   119.8 +            EVERY [rewrite_goals_tac ctxt' rewrites, resolve_tac ctxt' [refl] 1])) eqs
   119.9        end;
  119.10    in ((prefix, (fs, defs)), prove) end
  119.11    handle PrimrecError (msg, some_eqn) =>
   120.1 --- a/src/HOL/Tools/Old_Datatype/old_rep_datatype.ML	Tue Feb 10 14:29:36 2015 +0100
   120.2 +++ b/src/HOL/Tools/Old_Datatype/old_rep_datatype.ML	Tue Feb 10 14:48:26 2015 +0100
   120.3 @@ -55,12 +55,12 @@
   120.4          Goal.prove_sorry_global thy []
   120.5            (Logic.strip_imp_prems t)
   120.6            (Logic.strip_imp_concl t)
   120.7 -          (fn {prems, ...} =>
   120.8 +          (fn {context = ctxt, prems, ...} =>
   120.9              EVERY
  120.10 -              [resolve_tac [induct'] 1,
  120.11 -               REPEAT (resolve_tac [TrueI] 1),
  120.12 -               REPEAT ((resolve_tac [impI] 1) THEN (eresolve_tac prems 1)),
  120.13 -               REPEAT (resolve_tac [TrueI] 1)])
  120.14 +              [resolve_tac ctxt [induct'] 1,
  120.15 +               REPEAT (resolve_tac ctxt [TrueI] 1),
  120.16 +               REPEAT ((resolve_tac ctxt [impI] 1) THEN (eresolve_tac ctxt prems 1)),
  120.17 +               REPEAT (resolve_tac ctxt [TrueI] 1)])
  120.18        end;
  120.19  
  120.20      val casedist_thms =
  120.21 @@ -176,16 +176,17 @@
  120.22            in
  120.23              (EVERY
  120.24                [DETERM tac,
  120.25 -                REPEAT (eresolve_tac @{thms ex1E} 1), resolve_tac @{thms ex1I} 1,
  120.26 +                REPEAT (eresolve_tac ctxt @{thms ex1E} 1), resolve_tac ctxt @{thms ex1I} 1,
  120.27                  DEPTH_SOLVE_1 (ares_tac [intr] 1),
  120.28 -                REPEAT_DETERM_N k (eresolve_tac [thin_rl] 1 THEN rotate_tac 1 1),
  120.29 -                eresolve_tac [elim] 1,
  120.30 +                REPEAT_DETERM_N k (eresolve_tac ctxt [thin_rl] 1 THEN rotate_tac 1 1),
  120.31 +                eresolve_tac ctxt [elim] 1,
  120.32                  REPEAT_DETERM_N j distinct_tac,
  120.33 -                TRY (dresolve_tac inject 1),
  120.34 -                REPEAT (eresolve_tac [conjE] 1), hyp_subst_tac ctxt 1,
  120.35 -                REPEAT (EVERY [eresolve_tac [allE] 1, dresolve_tac [mp] 1, assume_tac ctxt 1]),
  120.36 +                TRY (dresolve_tac ctxt inject 1),
  120.37 +                REPEAT (eresolve_tac ctxt [conjE] 1), hyp_subst_tac ctxt 1,
  120.38 +                REPEAT
  120.39 +                  (EVERY [eresolve_tac ctxt [allE] 1, dresolve_tac ctxt [mp] 1, assume_tac ctxt 1]),
  120.40                  TRY (hyp_subst_tac ctxt 1),
  120.41 -                resolve_tac [refl] 1,
  120.42 +                resolve_tac ctxt [refl] 1,
  120.43                  REPEAT_DETERM_N (n - j - 1) distinct_tac],
  120.44                intrs, j + 1)
  120.45            end;
  120.46 @@ -211,7 +212,7 @@
  120.47            (HOLogic.mk_Trueprop (Old_Datatype_Aux.mk_conj rec_unique_ts))
  120.48            (fn {context = ctxt, ...} =>
  120.49              #1 (fold (mk_unique_tac ctxt) (descr' ~~ rec_elims ~~ recTs ~~ rec_result_Ts)
  120.50 -              (((resolve_tac [induct'] THEN_ALL_NEW Object_Logic.atomize_prems_tac ctxt) 1 THEN
  120.51 +              (((resolve_tac ctxt [induct'] THEN_ALL_NEW Object_Logic.atomize_prems_tac ctxt) 1 THEN
  120.52                    rewrite_goals_tac ctxt [mk_meta_eq @{thm choice_eq}], rec_intrs)))))
  120.53        end;
  120.54  
  120.55 @@ -254,10 +255,10 @@
  120.56          Goal.prove_sorry_global thy2 [] [] t
  120.57            (fn {context = ctxt, ...} => EVERY
  120.58              [rewrite_goals_tac ctxt reccomb_defs,
  120.59 -             resolve_tac @{thms the1_equality} 1,
  120.60 -             resolve_tac rec_unique_thms 1,
  120.61 -             resolve_tac rec_intrs 1,
  120.62 -             REPEAT (resolve_tac [allI] 1 ORELSE resolve_tac rec_total_thms 1)]))
  120.63 +             resolve_tac ctxt @{thms the1_equality} 1,
  120.64 +             resolve_tac ctxt rec_unique_thms 1,
  120.65 +             resolve_tac ctxt rec_intrs 1,
  120.66 +             REPEAT (resolve_tac ctxt [allI] 1 ORELSE resolve_tac ctxt rec_total_thms 1)]))
  120.67         (Old_Datatype_Prop.make_primrecs reccomb_names descr thy2);
  120.68    in
  120.69      thy2
  120.70 @@ -339,7 +340,7 @@
  120.71      fun prove_case t =
  120.72        Goal.prove_sorry_global thy2 [] [] t (fn {context = ctxt, ...} =>
  120.73          EVERY [rewrite_goals_tac ctxt (case_defs @ map mk_meta_eq primrec_thms),
  120.74 -          resolve_tac [refl] 1]);
  120.75 +          resolve_tac ctxt [refl] 1]);
  120.76  
  120.77      fun prove_cases (Type (Tcon, _)) ts =
  120.78        (case Ctr_Sugar.ctr_sugar_of ctxt Tcon of
  120.79 @@ -380,7 +381,7 @@
  120.80          val _ $ (_ $ lhs $ _) = hd (Logic.strip_assums_hyp (hd (prems_of exhaustion)));
  120.81          val exhaustion' = cterm_instantiate [(cert lhs, cert (Free ("x", T)))] exhaustion;
  120.82          fun tac ctxt =
  120.83 -          EVERY [resolve_tac [exhaustion'] 1,
  120.84 +          EVERY [resolve_tac ctxt [exhaustion'] 1,
  120.85              ALLGOALS (asm_simp_tac
  120.86                (put_simpset HOL_ss ctxt addsimps (dist_rewrites' @ inject @ case_thms')))];
  120.87        in
  120.88 @@ -406,7 +407,8 @@
  120.89    let
  120.90      fun prove_case_cong_weak t =
  120.91       Goal.prove_sorry_global thy [] (Logic.strip_imp_prems t) (Logic.strip_imp_concl t)
  120.92 -       (fn {prems, ...} => EVERY [resolve_tac [hd prems RS arg_cong] 1]);
  120.93 +       (fn {context = ctxt, prems, ...} =>
  120.94 +         EVERY [resolve_tac ctxt [hd prems RS arg_cong] 1]);
  120.95  
  120.96      val case_cong_weaks =
  120.97        map prove_case_cong_weak (Old_Datatype_Prop.make_case_cong_weaks case_names descr thy);
  120.98 @@ -424,13 +426,13 @@
  120.99        let
 120.100          (* For goal i, select the correct disjunct to attack, then prove it *)
 120.101          fun tac ctxt i 0 =
 120.102 -              EVERY [TRY (resolve_tac [disjI1] i), hyp_subst_tac ctxt i,
 120.103 -                REPEAT (resolve_tac [exI] i), resolve_tac [refl] i]
 120.104 -          | tac ctxt i n = resolve_tac [disjI2] i THEN tac ctxt i (n - 1);
 120.105 +              EVERY [TRY (resolve_tac ctxt [disjI1] i), hyp_subst_tac ctxt i,
 120.106 +                REPEAT (resolve_tac ctxt [exI] i), resolve_tac ctxt [refl] i]
 120.107 +          | tac ctxt i n = resolve_tac ctxt [disjI2] i THEN tac ctxt i (n - 1);
 120.108        in
 120.109          Goal.prove_sorry_global thy [] [] t
 120.110            (fn {context = ctxt, ...} =>
 120.111 -            EVERY [resolve_tac [allI] 1,
 120.112 +            EVERY [resolve_tac ctxt [allI] 1,
 120.113               Old_Datatype_Aux.exh_tac ctxt (K exhaustion) 1,
 120.114               ALLGOALS (fn i => tac ctxt i (i - 1))])
 120.115        end;
 120.116 @@ -459,8 +461,9 @@
 120.117                EVERY [
 120.118                  simp_tac (put_simpset HOL_ss ctxt addsimps [hd prems]) 1,
 120.119                  cut_tac nchotomy'' 1,
 120.120 -                REPEAT (eresolve_tac [disjE] 1 THEN REPEAT (eresolve_tac [exE] 1) THEN simplify 1),
 120.121 -                REPEAT (eresolve_tac [exE] 1) THEN simplify 1 (* Get last disjunct *)]
 120.122 +                REPEAT (eresolve_tac ctxt [disjE] 1 THEN
 120.123 +                  REPEAT (eresolve_tac ctxt [exE] 1) THEN simplify 1),
 120.124 +                REPEAT (eresolve_tac ctxt [exE] 1) THEN simplify 1 (* Get last disjunct *)]
 120.125              end)
 120.126        end;
 120.127  
   121.1 --- a/src/HOL/Tools/Old_Datatype/old_size.ML	Tue Feb 10 14:29:36 2015 +0100
   121.2 +++ b/src/HOL/Tools/Old_Datatype/old_size.ML	Tue Feb 10 14:48:26 2015 +0100
   121.3 @@ -131,7 +131,7 @@
   121.4            ||> Class.instantiation (tycos, map dest_TFree paramTs, [HOLogic.class_size])
   121.5            ||>> fold_map define_overloaded
   121.6              (def_names' ~~ map Logic.mk_equals (overloaded_size_fns ~~ map (app fs') rec_combs1))
   121.7 -          ||> Class.prove_instantiation_instance (K (Class.intro_classes_tac []))
   121.8 +          ||> Class.prove_instantiation_instance (fn ctxt => Class.intro_classes_tac ctxt [])
   121.9            ||> Local_Theory.exit_global;
  121.10  
  121.11          val ctxt = Proof_Context.init_global thy';
   122.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Tue Feb 10 14:29:36 2015 +0100
   122.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Tue Feb 10 14:48:26 2015 +0100
   122.3 @@ -1216,7 +1216,7 @@
   122.4            HOLogic.mk_Trueprop (list_comb (const, map Free vs')))
   122.5      val intro =
   122.6        Goal.prove (Proof_Context.init_global thy1) (map fst vs') [] t
   122.7 -        (fn _ => ALLGOALS Skip_Proof.cheat_tac)
   122.8 +        (fn {context = ctxt, ...} => ALLGOALS (Skip_Proof.cheat_tac ctxt))
   122.9    in
  122.10      ((((full_constname, constT), vs'), intro), thy1)
  122.11    end
   123.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Tue Feb 10 14:29:36 2015 +0100
   123.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Tue Feb 10 14:48:26 2015 +0100
   123.3 @@ -151,7 +151,7 @@
   123.4      val t' = Pattern.rewrite_term thy rewr [] t
   123.5      val th'' =
   123.6        Goal.prove ctxt (Term.add_free_names t' []) [] t'
   123.7 -        (fn _ => ALLGOALS Skip_Proof.cheat_tac)
   123.8 +        (fn _ => ALLGOALS (Skip_Proof.cheat_tac ctxt))
   123.9      val th''' = Local_Defs.unfold ctxt [@{thm split_conv}, @{thm fst_conv}, @{thm snd_conv}] th''
  123.10    in
  123.11      th'''
   124.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Tue Feb 10 14:29:36 2015 +0100
   124.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Tue Feb 10 14:48:26 2015 +0100
   124.3 @@ -135,7 +135,7 @@
   124.4        (flatten constname) (map prop_of intros) ([], thy)
   124.5      val ctxt'' = Proof_Context.transfer thy' ctxt'
   124.6      val intros'' =
   124.7 -      map (fn t => Goal.prove ctxt'' [] [] t (fn _ => ALLGOALS Skip_Proof.cheat_tac)) intros'
   124.8 +      map (fn t => Goal.prove ctxt'' [] [] t (fn _ => ALLGOALS (Skip_Proof.cheat_tac ctxt''))) intros'
   124.9        |> Variable.export ctxt'' ctxt
  124.10    in
  124.11      (intros'', (local_defs, thy'))
   125.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML	Tue Feb 10 14:29:36 2015 +0100
   125.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML	Tue Feb 10 14:48:26 2015 +0100
   125.3 @@ -502,7 +502,7 @@
   125.4          THEN trace_tac ctxt options "proved one direction"
   125.5          THEN prove_other_direction options ctxt pred mode moded_clauses
   125.6          THEN trace_tac ctxt options "proved other direction")
   125.7 -      else (fn _ => ALLGOALS Skip_Proof.cheat_tac))
   125.8 +      else (fn _ => ALLGOALS (Skip_Proof.cheat_tac ctxt)))
   125.9    end
  125.10  
  125.11  end
  125.12 \ No newline at end of file
   126.1 --- a/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Tue Feb 10 14:29:36 2015 +0100
   126.2 +++ b/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Tue Feb 10 14:48:26 2015 +0100
   126.3 @@ -211,7 +211,7 @@
   126.4        |> Quickcheck_Common.define_functions
   126.5            (fn functerms => mk_equations functerms (descr, vs, Ts @ Us), NONE)
   126.6            prfx argnames fullnames (map mk_T (Ts @ Us))
   126.7 -      |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
   126.8 +      |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
   126.9      end
  126.10    else
  126.11      (Old_Datatype_Aux.message config
   127.1 --- a/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Tue Feb 10 14:29:36 2015 +0100
   127.2 +++ b/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Tue Feb 10 14:48:26 2015 +0100
   127.3 @@ -54,7 +54,7 @@
   127.4      |> `(fn lthy => Syntax.check_term lthy eq)
   127.5      |-> (fn eq => Specification.definition (NONE, ((Binding.name (triv_name_of eq), []), eq)))
   127.6      |> snd
   127.7 -    |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
   127.8 +    |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
   127.9    end;
  127.10  
  127.11  fun ensure_partial_term_of (tyco, (raw_vs, _)) thy =
  127.12 @@ -187,7 +187,7 @@
  127.13        |> Quickcheck_Common.define_functions
  127.14          (fn narrowings => mk_equations descr vs narrowings, NONE)
  127.15          prfx [] narrowingsN (map narrowingT (Ts @ Us))
  127.16 -      |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
  127.17 +      |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
  127.18      else
  127.19        thy
  127.20    end;
   128.1 --- a/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Tue Feb 10 14:29:36 2015 +0100
   128.2 +++ b/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Tue Feb 10 14:48:26 2015 +0100
   128.3 @@ -379,7 +379,7 @@
   128.4        let
   128.5          val eqs_t = mk_equations consts
   128.6          val eqs = map (fn eq => Goal.prove lthy argnames [] eq
   128.7 -          (fn _ => ALLGOALS Skip_Proof.cheat_tac)) eqs_t
   128.8 +          (fn {context = ctxt, ...} => ALLGOALS (Skip_Proof.cheat_tac ctxt))) eqs_t
   128.9        in
  128.10          fold (fn (name, eq) => Local_Theory.note
  128.11            ((Binding.qualify true prfx
   129.1 --- a/src/HOL/Tools/Quickcheck/random_generators.ML	Tue Feb 10 14:29:36 2015 +0100
   129.2 +++ b/src/HOL/Tools/Quickcheck/random_generators.ML	Tue Feb 10 14:48:26 2015 +0100
   129.3 @@ -263,7 +263,7 @@
   129.4            Specification.definition (NONE, (apfst Binding.conceal
   129.5              Attrib.empty_binding, random_def))) random_defs')
   129.6      |> snd
   129.7 -    |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
   129.8 +    |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
   129.9    end;
  129.10  
  129.11  
   130.1 --- a/src/HOL/Tools/Quotient/quotient_tacs.ML	Tue Feb 10 14:29:36 2015 +0100
   130.2 +++ b/src/HOL/Tools/Quotient/quotient_tacs.ML	Tue Feb 10 14:48:26 2015 +0100
   130.3 @@ -55,14 +55,14 @@
   130.4  (** solvers for equivp and quotient assumptions **)
   130.5  
   130.6  fun equiv_tac ctxt =
   130.7 -  REPEAT_ALL_NEW (resolve_tac (rev (Named_Theorems.get ctxt @{named_theorems quot_equiv})))
   130.8 +  REPEAT_ALL_NEW (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems quot_equiv})))
   130.9  
  130.10  val equiv_solver = mk_solver "Equivalence goal solver" equiv_tac
  130.11  
  130.12  fun quotient_tac ctxt =
  130.13    (REPEAT_ALL_NEW (FIRST'
  130.14      [rtac @{thm identity_quotient3},
  130.15 -     resolve_tac (rev (Named_Theorems.get ctxt @{named_theorems quot_thm}))]))
  130.16 +     resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems quot_thm}))]))
  130.17  
  130.18  val quotient_solver = mk_solver "Quotient goal solver" quotient_tac
  130.19  
  130.20 @@ -167,10 +167,10 @@
  130.21    in
  130.22      simp_tac simpset THEN'
  130.23      TRY o REPEAT_ALL_NEW (CHANGED o FIRST'
  130.24 -      [resolve_tac @{thms ball_reg_right bex_reg_left bex1_bexeq_reg},
  130.25 -       resolve_tac (Inductive.get_monos ctxt),
  130.26 -       resolve_tac @{thms ball_all_comm bex_ex_comm},
  130.27 -       resolve_tac eq_eqvs,
  130.28 +      [resolve_tac ctxt @{thms ball_reg_right bex_reg_left bex1_bexeq_reg},
  130.29 +       resolve_tac ctxt (Inductive.get_monos ctxt),
  130.30 +       resolve_tac ctxt @{thms ball_all_comm bex_ex_comm},
  130.31 +       resolve_tac ctxt eq_eqvs,
  130.32         simp_tac simpset])
  130.33    end
  130.34  
  130.35 @@ -371,7 +371,7 @@
  130.36  
  130.37       (* respectfulness of constants; in particular of a simple relation *)
  130.38    | _ $ (Const _) $ (Const _)  (* rel_fun, list_rel, etc but not equality *)
  130.39 -      => resolve_tac (rev (Named_Theorems.get ctxt @{named_theorems quot_respect}))
  130.40 +      => resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems quot_respect}))
  130.41            THEN_ALL_NEW quotient_tac ctxt
  130.42  
  130.43        (* R (...) (Rep (Abs ...)) ----> R (...) (...) *)
  130.44 @@ -403,7 +403,7 @@
  130.45  
  130.46      (* reflexivity of the basic relations *)
  130.47      (* R ... ... *)
  130.48 -    resolve_tac rel_refl]
  130.49 +    resolve_tac ctxt rel_refl]
  130.50  
  130.51  fun injection_tac ctxt =
  130.52    let
   131.1 --- a/src/HOL/Tools/SMT/z3_replay.ML	Tue Feb 10 14:29:36 2015 +0100
   131.2 +++ b/src/HOL/Tools/SMT/z3_replay.ML	Tue Feb 10 14:48:26 2015 +0100
   131.3 @@ -147,10 +147,10 @@
   131.4      by (metis someI_ex)+}
   131.5  in
   131.6  
   131.7 -fun discharge_sk_tac i st =
   131.8 +fun discharge_sk_tac ctxt i st =
   131.9    (rtac @{thm trans} i
  131.10 -   THEN resolve_tac sk_rules i
  131.11 -   THEN (rtac @{thm refl} ORELSE' discharge_sk_tac) (i+1)
  131.12 +   THEN resolve_tac ctxt sk_rules i
  131.13 +   THEN (rtac @{thm refl} ORELSE' discharge_sk_tac ctxt) (i+1)
  131.14     THEN rtac @{thm refl} i) st
  131.15  
  131.16  end
  131.17 @@ -163,14 +163,16 @@
  131.18    "(P | ~ P) & (~ P | P)"
  131.19    by fast+}
  131.20  
  131.21 -fun discharge_assms_tac rules =
  131.22 -  REPEAT (HEADGOAL (resolve_tac (intro_def_rules @ rules) ORELSE' SOLVED' discharge_sk_tac))
  131.23 +fun discharge_assms_tac ctxt rules =
  131.24 +  REPEAT
  131.25 +    (HEADGOAL (resolve_tac ctxt (intro_def_rules @ rules) ORELSE'
  131.26 +      SOLVED' (discharge_sk_tac ctxt)))
  131.27  
  131.28  fun discharge_assms ctxt rules thm =
  131.29    (if Thm.nprems_of thm = 0 then
  131.30       thm
  131.31     else
  131.32 -     (case Seq.pull (discharge_assms_tac rules thm) of
  131.33 +     (case Seq.pull (discharge_assms_tac ctxt rules thm) of
  131.34         SOME (thm', _) => thm'
  131.35       | NONE => raise THM ("failed to discharge premise", 1, [thm])))
  131.36    |> Goal.norm_result ctxt
   132.1 --- a/src/HOL/Tools/SMT/z3_replay_methods.ML	Tue Feb 10 14:29:36 2015 +0100
   132.2 +++ b/src/HOL/Tools/SMT/z3_replay_methods.ML	Tue Feb 10 14:48:26 2015 +0100
   132.3 @@ -309,7 +309,7 @@
   132.4  (* congruence *)
   132.5  
   132.6  fun ctac ctxt prems i st = st |> (
   132.7 -  resolve_tac (@{thm refl} :: prems) i
   132.8 +  resolve_tac ctxt (@{thm refl} :: prems) i
   132.9    ORELSE (cong_tac ctxt i THEN ctac ctxt prems (i + 1) THEN ctac ctxt prems i))
  132.10  
  132.11  fun cong_basic ctxt thms t =
  132.12 @@ -328,7 +328,7 @@
  132.13  fun cong_full ctxt thms t = prove ctxt t (fn ctxt' =>
  132.14    Method.insert_tac thms
  132.15    THEN' (Classical.fast_tac ctxt'
  132.16 -    ORELSE' dresolve_tac cong_dest_rules
  132.17 +    ORELSE' dresolve_tac ctxt cong_dest_rules
  132.18      THEN' Classical.fast_tac ctxt'))
  132.19  
  132.20  fun cong ctxt thms = try_provers ctxt Z3_Proof.Monotonicity [
  132.21 @@ -346,7 +346,7 @@
  132.22    by fast+}
  132.23  
  132.24  fun quant_intro ctxt [thm] t =
  132.25 -    prove ctxt t (K (REPEAT_ALL_NEW (resolve_tac (thm :: quant_intro_rules))))
  132.26 +    prove ctxt t (K (REPEAT_ALL_NEW (resolve_tac ctxt (thm :: quant_intro_rules))))
  132.27    | quant_intro ctxt thms t = replay_rule_error ctxt Z3_Proof.Quant_Intro thms t
  132.28  
  132.29  
   133.1 --- a/src/HOL/Tools/TFL/post.ML	Tue Feb 10 14:29:36 2015 +0100
   133.2 +++ b/src/HOL/Tools/TFL/post.ML	Tue Feb 10 14:48:26 2015 +0100
   133.3 @@ -125,7 +125,7 @@
   133.4  (*lcp: put a theorem into Isabelle form, using meta-level connectives*)
   133.5  fun meta_outer ctxt =
   133.6    curry_rule ctxt o Drule.export_without_context o
   133.7 -  rule_by_tactic ctxt (REPEAT (FIRSTGOAL (resolve_tac [allI, impI, conjI] ORELSE' etac conjE)));
   133.8 +  rule_by_tactic ctxt (REPEAT (FIRSTGOAL (resolve_tac ctxt [allI, impI, conjI] ORELSE' etac conjE)));
   133.9  
  133.10  (*Strip off the outer !P*)
  133.11  val spec'= Rule_Insts.read_instantiate @{context} [(("x", 0), "P::'b=>bool")] [] spec;
   134.1 --- a/src/HOL/Tools/Transfer/transfer.ML	Tue Feb 10 14:29:36 2015 +0100
   134.2 +++ b/src/HOL/Tools/Transfer/transfer.ML	Tue Feb 10 14:48:26 2015 +0100
   134.3 @@ -611,12 +611,12 @@
   134.4        |> Thm.instantiate (map tinst binsts, map inst binsts)
   134.5    end
   134.6  
   134.7 -fun eq_rules_tac eq_rules = TRY o REPEAT_ALL_NEW (resolve_tac eq_rules)
   134.8 +fun eq_rules_tac eq_rules = TRY o REPEAT_ALL_NEW (resolve0_tac eq_rules)
   134.9    THEN_ALL_NEW rtac @{thm is_equality_eq}
  134.10  
  134.11  fun eq_tac ctxt = eq_rules_tac (get_relator_eq_raw ctxt)
  134.12  
  134.13 -fun transfer_step_tac ctxt = (REPEAT_ALL_NEW (resolve_tac (get_transfer_raw ctxt))
  134.14 +fun transfer_step_tac ctxt = (REPEAT_ALL_NEW (resolve_tac ctxt (get_transfer_raw ctxt))
  134.15    THEN_ALL_NEW (DETERM o eq_rules_tac (get_relator_eq_raw ctxt)))
  134.16  
  134.17  fun transfer_tac equiv ctxt i =
  134.18 @@ -633,7 +633,9 @@
  134.19        rtac start_rule i THEN
  134.20        (rtac (transfer_rule_of_term ctxt equiv (HOLogic.dest_Trueprop t))
  134.21          THEN_ALL_NEW
  134.22 -          (SOLVED' (REPEAT_ALL_NEW (resolve_tac rules) THEN_ALL_NEW (DETERM o eq_rules_tac eq_rules))
  134.23 +          (SOLVED'
  134.24 +            (REPEAT_ALL_NEW (resolve_tac ctxt rules) THEN_ALL_NEW
  134.25 +              (DETERM o eq_rules_tac eq_rules))
  134.26              ORELSE' end_tac)) (i + 1)
  134.27          handle TERM (_, ts) => raise TERM (err_msg, ts)
  134.28    in
  134.29 @@ -658,7 +660,8 @@
  134.30         rtac @{thm transfer_prover_start} i,
  134.31         ((rtac rule1 ORELSE' (CONVERSION expand_eq_in_rel THEN' rtac rule1))
  134.32          THEN_ALL_NEW
  134.33 -         (REPEAT_ALL_NEW (resolve_tac rules) THEN_ALL_NEW (DETERM o eq_rules_tac eq_rules))) (i+1),
  134.34 +         (REPEAT_ALL_NEW (resolve_tac ctxt rules) THEN_ALL_NEW
  134.35 +           (DETERM o eq_rules_tac eq_rules))) (i + 1),
  134.36         rtac @{thm refl} i]
  134.37    end)
  134.38  
  134.39 @@ -682,10 +685,10 @@
  134.40      val t = HOLogic.dest_Trueprop (Thm.concl_of thm2)
  134.41      val rule = transfer_rule_of_lhs ctxt' t
  134.42      val tac =
  134.43 -      resolve_tac [thm2 RS start_rule', thm2 RS start_rule] 1 THEN
  134.44 +      resolve_tac ctxt' [thm2 RS start_rule', thm2 RS start_rule] 1 THEN
  134.45        (rtac rule
  134.46          THEN_ALL_NEW
  134.47 -          (SOLVED' (REPEAT_ALL_NEW (resolve_tac rules)
  134.48 +          (SOLVED' (REPEAT_ALL_NEW (resolve_tac ctxt' rules)
  134.49              THEN_ALL_NEW (DETERM o eq_rules_tac eq_rules)))) 1
  134.50          handle TERM (_, ts) => raise TERM (err_msg, ts)
  134.51      val thm3 = Goal.prove_internal ctxt' [] @{cpat "Trueprop ?P"} (K tac)
  134.52 @@ -721,7 +724,7 @@
  134.53        rtac (thm2 RS start_rule) 1 THEN
  134.54        (rtac rule
  134.55          THEN_ALL_NEW
  134.56 -          (SOLVED' (REPEAT_ALL_NEW (resolve_tac rules)
  134.57 +          (SOLVED' (REPEAT_ALL_NEW (resolve_tac ctxt' rules)
  134.58              THEN_ALL_NEW (DETERM o eq_rules_tac eq_rules)))) 1
  134.59          handle TERM (_, ts) => raise TERM (err_msg, ts)
  134.60      val thm3 = Goal.prove_internal ctxt' [] @{cpat "Trueprop ?P"} (K tac)
   135.1 --- a/src/HOL/Tools/Transfer/transfer_bnf.ML	Tue Feb 10 14:29:36 2015 +0100
   135.2 +++ b/src/HOL/Tools/Transfer/transfer_bnf.ML	Tue Feb 10 14:48:26 2015 +0100
   135.3 @@ -201,19 +201,20 @@
   135.4    in
   135.5      EVERY' [rtac ext, SELECT_GOAL (Local_Defs.unfold_tac ctxt [@{thm Domainp.simps},
   135.6          in_rel_of_bnf bnf, pred_def]), rtac iffI,
   135.7 -        REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE], hyp_subst_tac ctxt,
   135.8 +        REPEAT_DETERM o eresolve_tac ctxt [exE, conjE, CollectE], hyp_subst_tac ctxt,
   135.9          CONJ_WRAP' (fn set_map => EVERY' [rtac ballI, dtac (set_map RS equalityD1 RS set_mp),
  135.10            etac imageE, dtac set_rev_mp, assume_tac ctxt,
  135.11 -          REPEAT_DETERM o eresolve_tac [CollectE, @{thm case_prodE}],
  135.12 +          REPEAT_DETERM o eresolve_tac ctxt [CollectE, @{thm case_prodE}],
  135.13            hyp_subst_tac ctxt, rtac @{thm iffD2[OF arg_cong2[of _ _ _ _ Domainp, OF refl fst_conv]]},
  135.14            etac @{thm DomainPI}]) set_map's,
  135.15 -        REPEAT_DETERM o etac conjE, REPEAT_DETERM o resolve_tac [exI, (refl RS conjI), rotate_prems 1 conjI],
  135.16 +        REPEAT_DETERM o etac conjE,
  135.17 +        REPEAT_DETERM o resolve_tac ctxt [exI, (refl RS conjI), rotate_prems 1 conjI],
  135.18          rtac refl, rtac (box_equals OF [map_cong0_of_bnf bnf, map_comp_of_bnf bnf RS sym,
  135.19            map_id_of_bnf bnf]),
  135.20          REPEAT_DETERM_N n o (EVERY' [rtac @{thm box_equals[OF _ sym[OF o_apply] sym[OF id_apply]]},
  135.21            rtac @{thm fst_conv}]), rtac CollectI,
  135.22          CONJ_WRAP' (fn set_map => EVERY' [rtac (set_map RS @{thm ord_eq_le_trans}),
  135.23 -          REPEAT_DETERM o resolve_tac [@{thm image_subsetI}, CollectI, @{thm case_prodI}],
  135.24 +          REPEAT_DETERM o resolve_tac ctxt [@{thm image_subsetI}, CollectI, @{thm case_prodI}],
  135.25            dtac (rotate_prems 1 bspec), assume_tac ctxt,
  135.26            etac @{thm DomainpE}, etac @{thm someI}]) set_map's
  135.27        ] i
   136.1 --- a/src/HOL/Tools/cnf.ML	Tue Feb 10 14:29:36 2015 +0100
   136.2 +++ b/src/HOL/Tools/cnf.ML	Tue Feb 10 14:48:26 2015 +0100
   136.3 @@ -39,7 +39,7 @@
   136.4    val is_clause: term -> bool
   136.5    val clause_is_trivial: term -> bool
   136.6  
   136.7 -  val clause2raw_thm: thm -> thm
   136.8 +  val clause2raw_thm: Proof.context -> thm -> thm
   136.9    val make_nnf_thm: theory -> term -> thm
  136.10  
  136.11    val weakening_tac: Proof.context -> int -> tactic  (* removes the first hypothesis of a subgoal *)
  136.12 @@ -132,7 +132,7 @@
  136.13  (*      where each xi' is the negation normal form of ~xi                    *)
  136.14  (* ------------------------------------------------------------------------- *)
  136.15  
  136.16 -fun clause2raw_thm clause =
  136.17 +fun clause2raw_thm ctxt clause =
  136.18    let
  136.19      (* eliminates negated disjunctions from the i-th premise, possibly *)
  136.20      (* adding new premises, then continues with the (i+1)-th premise   *)
  136.21 @@ -141,7 +141,8 @@
  136.22        if i > nprems_of thm then
  136.23          thm
  136.24        else
  136.25 -        not_disj_to_prem (i+1) (Seq.hd (REPEAT_DETERM (resolve_tac [clause2raw_not_disj] i) thm))
  136.26 +        not_disj_to_prem (i+1)
  136.27 +          (Seq.hd (REPEAT_DETERM (resolve_tac ctxt [clause2raw_not_disj] i) thm))
  136.28      (* moves all premises to hyps, i.e. "[...] |- A1 ==> ... ==> An ==> B" *)
  136.29      (* becomes "[..., A1, ..., An] |- B"                                   *)
  136.30      (* Thm.thm -> Thm.thm *)
  136.31 @@ -154,7 +155,7 @@
  136.32      (* [...] |- ~x1 ==> ... ==> ~xn ==> False *)
  136.33      |> not_disj_to_prem 1
  136.34      (* [...] |- x1' ==> ... ==> xn' ==> False *)
  136.35 -    |> Seq.hd o TRYALL (resolve_tac [clause2raw_not_not])
  136.36 +    |> Seq.hd o TRYALL (resolve_tac ctxt [clause2raw_not_not])
  136.37      (* [..., x1', ..., xn'] |- False *)
  136.38      |> prems_to_hyps
  136.39    end;
  136.40 @@ -529,7 +530,7 @@
  136.41  (* ------------------------------------------------------------------------- *)
  136.42  
  136.43  fun weakening_tac ctxt i =
  136.44 -  dresolve_tac [weakening_thm] i THEN assume_tac ctxt (i+1);
  136.45 +  dresolve_tac ctxt [weakening_thm] i THEN assume_tac ctxt (i+1);
  136.46  
  136.47  (* ------------------------------------------------------------------------- *)
  136.48  (* cnf_rewrite_tac: converts all premises of the 'i'-th subgoal to CNF       *)
   137.1 --- a/src/HOL/Tools/code_evaluation.ML	Tue Feb 10 14:29:36 2015 +0100
   137.2 +++ b/src/HOL/Tools/code_evaluation.ML	Tue Feb 10 14:48:26 2015 +0100
   137.3 @@ -45,7 +45,7 @@
   137.4      |> `(fn lthy => Syntax.check_term lthy eq)
   137.5      |-> (fn eq => Specification.definition (NONE, ((Binding.name (triv_name_of eq), []), eq)))
   137.6      |> snd
   137.7 -    |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
   137.8 +    |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
   137.9    end;
  137.10  
  137.11  fun ensure_term_of (tyco, (raw_vs, _)) thy =
   138.1 --- a/src/HOL/Tools/coinduction.ML	Tue Feb 10 14:29:36 2015 +0100
   138.2 +++ b/src/HOL/Tools/coinduction.ML	Tue Feb 10 14:48:26 2015 +0100
   138.3 @@ -34,7 +34,7 @@
   138.4    let
   138.5      val n = nth (prems_of st) (i - 1) |> Logic.strip_assums_hyp |> length;
   138.6    in
   138.7 -    (THEN_ALL_NEW_SKIP skip tac (REPEAT_DETERM_N n o eresolve_tac [thin_rl])) i st
   138.8 +    (THEN_ALL_NEW_SKIP skip tac (REPEAT_DETERM_N n o eresolve0_tac [thin_rl])) i st
   138.9    end;
  138.10  
  138.11  fun coinduction_tac ctxt raw_vars opt_raw_thm prems = HEADGOAL (SUBGOAL_CASES (fn (goal, _, _) =>
  138.12 @@ -84,17 +84,17 @@
  138.13            val e = length eqs;
  138.14            val p = length prems;
  138.15          in
  138.16 -          HEADGOAL (EVERY' [resolve_tac [thm],
  138.17 +          HEADGOAL (EVERY' [resolve_tac ctxt [thm],
  138.18              EVERY' (map (fn var =>
  138.19 -              resolve_tac
  138.20 +              resolve_tac ctxt
  138.21                  [Ctr_Sugar_Util.cterm_instantiate_pos
  138.22                    [NONE, SOME (Ctr_Sugar_Util.certify ctxt var)] exI]) vars),
  138.23 -            if p = 0 then Ctr_Sugar_Util.CONJ_WRAP' (K (resolve_tac [refl])) eqs
  138.24 +            if p = 0 then Ctr_Sugar_Util.CONJ_WRAP' (K (resolve_tac ctxt [refl])) eqs
  138.25              else
  138.26 -              REPEAT_DETERM_N e o (resolve_tac [conjI] THEN' resolve_tac [refl]) THEN'
  138.27 -              Ctr_Sugar_Util.CONJ_WRAP' (resolve_tac o single) prems,
  138.28 +              REPEAT_DETERM_N e o (resolve_tac ctxt [conjI] THEN' resolve_tac ctxt [refl]) THEN'
  138.29 +              Ctr_Sugar_Util.CONJ_WRAP' (resolve_tac ctxt o single) prems,
  138.30              K (ALLGOALS_SKIP skip
  138.31 -               (REPEAT_DETERM_N (length vars) o (eresolve_tac [exE] THEN' rotate_tac ~1) THEN'
  138.32 +               (REPEAT_DETERM_N (length vars) o (eresolve_tac ctxt [exE] THEN' rotate_tac ~1) THEN'
  138.33                 DELETE_PREMS_AFTER 0 (Subgoal.FOCUS (fn {prems, params, context = ctxt, ...} =>
  138.34                   (case prems of
  138.35                     [] => all_tac
   139.1 --- a/src/HOL/Tools/datatype_realizer.ML	Tue Feb 10 14:29:36 2015 +0100
   139.2 +++ b/src/HOL/Tools/datatype_realizer.ML	Tue Feb 10 14:48:26 2015 +0100
   139.3 @@ -117,7 +117,7 @@
   139.4              rtac (cterm_instantiate inst induct) 1,
   139.5              ALLGOALS (Object_Logic.atomize_prems_tac ctxt),
   139.6              rewrite_goals_tac ctxt (@{thm o_def} :: map mk_meta_eq rec_rewrites),
   139.7 -            REPEAT ((resolve_tac prems THEN_ALL_NEW (fn i =>
   139.8 +            REPEAT ((resolve_tac ctxt prems THEN_ALL_NEW (fn i =>
   139.9                REPEAT (etac allE i) THEN assume_tac ctxt i)) 1)])
  139.10        |> Drule.export_without_context;
  139.11  
  139.12 @@ -194,7 +194,7 @@
  139.13              rtac (cterm_instantiate [(cert y, cert y')] exhaust) 1,
  139.14              ALLGOALS (EVERY'
  139.15                [asm_simp_tac (put_simpset HOL_basic_ss ctxt addsimps case_rewrites),
  139.16 -               resolve_tac prems, asm_simp_tac (put_simpset HOL_basic_ss ctxt)])])
  139.17 +               resolve_tac ctxt prems, asm_simp_tac (put_simpset HOL_basic_ss ctxt)])])
  139.18        |> Drule.export_without_context;
  139.19  
  139.20      val exh_name = Thm.derivation_name exhaust;
   140.1 --- a/src/HOL/Tools/inductive.ML	Tue Feb 10 14:29:36 2015 +0100
   140.2 +++ b/src/HOL/Tools/inductive.ML	Tue Feb 10 14:48:26 2015 +0100
   140.3 @@ -169,8 +169,8 @@
   140.4    | mk_names a n = map (fn i => a ^ string_of_int i) (1 upto n);
   140.5  
   140.6  fun select_disj 1 1 = []
   140.7 -  | select_disj _ 1 = [resolve_tac [disjI1]]
   140.8 -  | select_disj n i = resolve_tac [disjI2] :: select_disj (n - 1) (i - 1);
   140.9 +  | select_disj _ 1 = [resolve0_tac [disjI1]]
  140.10 +  | select_disj n i = resolve0_tac [disjI2] :: select_disj (n - 1) (i - 1);
  140.11  
  140.12  
  140.13  
  140.14 @@ -261,7 +261,7 @@
  140.15      | _ $ (Const (@{const_name HOL.eq}, _) $ _ $ _) => eq_to_mono thm
  140.16      | _ $ (Const (@{const_name Orderings.less_eq}, _) $ _ $ _) =>
  140.17        dest_less_concl (Seq.hd (REPEAT (FIRSTGOAL
  140.18 -        (resolve_tac [@{thm le_funI}, @{thm le_boolI'}])) thm))
  140.19 +        (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}])) thm))
  140.20      | _ => thm)
  140.21    end handle THM _ => error ("Bad monotonicity theorem:\n" ^ Display.string_of_thm ctxt thm);
  140.22  
  140.23 @@ -378,13 +378,13 @@
  140.24      [] []
  140.25      (HOLogic.mk_Trueprop
  140.26        (Const (@{const_name Orderings.mono}, (predT --> predT) --> HOLogic.boolT) $ fp_fun))
  140.27 -    (fn _ => EVERY [resolve_tac @{thms monoI} 1,
  140.28 -      REPEAT (resolve_tac [@{thm le_funI}, @{thm le_boolI'}] 1),
  140.29 +    (fn _ => EVERY [resolve_tac ctxt @{thms monoI} 1,
  140.30 +      REPEAT (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}] 1),
  140.31        REPEAT (FIRST
  140.32          [assume_tac ctxt 1,
  140.33 -         resolve_tac (map (mk_mono ctxt) monos @ get_monos ctxt) 1,
  140.34 -         eresolve_tac @{thms le_funE} 1,
  140.35 -         dresolve_tac @{thms le_boolD} 1])]));
  140.36 +         resolve_tac ctxt (map (mk_mono ctxt) monos @ get_monos ctxt) 1,
  140.37 +         eresolve_tac ctxt @{thms le_funE} 1,
  140.38 +         dresolve_tac ctxt @{thms le_boolD} 1])]));
  140.39  
  140.40  
  140.41  (* prove introduction rules *)
  140.42 @@ -402,11 +402,11 @@
  140.43      val intrs = map_index (fn (i, intr) =>
  140.44        Goal.prove_sorry ctxt [] [] intr (fn _ => EVERY
  140.45         [rewrite_goals_tac ctxt rec_preds_defs,
  140.46 -        resolve_tac [unfold RS iffD2] 1,
  140.47 +        resolve_tac ctxt [unfold RS iffD2] 1,
  140.48          EVERY1 (select_disj (length intr_ts) (i + 1)),
  140.49          (*Not ares_tac, since refl must be tried before any equality assumptions;
  140.50            backtracking may occur if the premises have extra variables!*)
  140.51 -        DEPTH_SOLVE_1 (resolve_tac rules 1 APPEND assume_tac ctxt 1)])
  140.52 +        DEPTH_SOLVE_1 (resolve_tac ctxt rules 1 APPEND assume_tac ctxt 1)])
  140.53         |> singleton (Proof_Context.export ctxt ctxt')) intr_ts
  140.54  
  140.55    in (intrs, unfold) end;
  140.56 @@ -448,9 +448,9 @@
  140.57            (fn {context = ctxt4, prems} => EVERY
  140.58              [cut_tac (hd prems) 1,
  140.59               rewrite_goals_tac ctxt4 rec_preds_defs,
  140.60 -             dresolve_tac [unfold RS iffD1] 1,
  140.61 -             REPEAT (FIRSTGOAL (eresolve_tac rules1)),
  140.62 -             REPEAT (FIRSTGOAL (eresolve_tac rules2)),
  140.63 +             dresolve_tac ctxt4 [unfold RS iffD1] 1,
  140.64 +             REPEAT (FIRSTGOAL (eresolve_tac ctxt4 rules1)),
  140.65 +             REPEAT (FIRSTGOAL (eresolve_tac ctxt4 rules2)),
  140.66               EVERY (map (fn prem =>
  140.67                 DEPTH_SOLVE_1 (ares_tac [rewrite_rule ctxt4 rec_preds_defs prem, conjI] 1))
  140.68                  (tl prems))])
  140.69 @@ -493,42 +493,42 @@
  140.70            if null c_intrs then @{term False}
  140.71            else foldr1 HOLogic.mk_disj (map mk_intr_conj c_intrs);
  140.72          val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs));
  140.73 -        fun prove_intr1 (i, _) = Subgoal.FOCUS_PREMS (fn {params, prems, ...} =>
  140.74 +        fun prove_intr1 (i, _) = Subgoal.FOCUS_PREMS (fn {context = ctxt'', params, prems, ...} =>
  140.75              EVERY1 (select_disj (length c_intrs) (i + 1)) THEN
  140.76 -            EVERY (replicate (length params) (resolve_tac @{thms exI} 1)) THEN
  140.77 -            (if null prems then resolve_tac @{thms TrueI} 1
  140.78 +            EVERY (replicate (length params) (resolve_tac ctxt'' @{thms exI} 1)) THEN
  140.79 +            (if null prems then resolve_tac ctxt'' @{thms TrueI} 1
  140.80               else
  140.81                let
  140.82                  val (prems', last_prem) = split_last prems;
  140.83                in
  140.84                  EVERY (map (fn prem =>
  140.85 -                  (resolve_tac @{thms conjI} 1 THEN resolve_tac [prem] 1)) prems') THEN
  140.86 -                resolve_tac [last_prem] 1
  140.87 +                  (resolve_tac ctxt'' @{thms conjI} 1 THEN resolve_tac ctxt'' [prem] 1)) prems')
  140.88 +                THEN resolve_tac ctxt'' [last_prem] 1
  140.89                end)) ctxt' 1;
  140.90          fun prove_intr2 (((_, _, us, _), ts, params'), intr) =
  140.91 -          EVERY (replicate (length params') (eresolve_tac @{thms exE} 1)) THEN
  140.92 -          (if null ts andalso null us then resolve_tac [intr] 1
  140.93 +          EVERY (replicate (length params') (eresolve_tac ctxt' @{thms exE} 1)) THEN
  140.94 +          (if null ts andalso null us then resolve_tac ctxt' [intr] 1
  140.95             else
  140.96 -            EVERY (replicate (length ts + length us - 1) (eresolve_tac @{thms conjE} 1)) THEN
  140.97 +            EVERY (replicate (length ts + length us - 1) (eresolve_tac ctxt' @{thms conjE} 1)) THEN
  140.98              Subgoal.FOCUS_PREMS (fn {context = ctxt'', prems, ...} =>
  140.99                let
 140.100                  val (eqs, prems') = chop (length us) prems;
 140.101                  val rew_thms = map (fn th => th RS @{thm eq_reflection}) eqs;
 140.102                in
 140.103                  rewrite_goal_tac ctxt'' rew_thms 1 THEN
 140.104 -                resolve_tac [intr] 1 THEN
 140.105 -                EVERY (map (fn p => resolve_tac [p] 1) prems')
 140.106 +                resolve_tac ctxt'' [intr] 1 THEN
 140.107 +                EVERY (map (fn p => resolve_tac ctxt'' [p] 1) prems')
 140.108                end) ctxt' 1);
 140.109        in
 140.110          Goal.prove_sorry ctxt' [] [] eq (fn _ =>
 140.111 -          resolve_tac @{thms iffI} 1 THEN
 140.112 -          eresolve_tac [#1 elim] 1 THEN
 140.113 +          resolve_tac ctxt' @{thms iffI} 1 THEN
 140.114 +          eresolve_tac ctxt' [#1 elim] 1 THEN
 140.115            EVERY (map_index prove_intr1 c_intrs) THEN
 140.116 -          (if null c_intrs then eresolve_tac @{thms FalseE} 1
 140.117 +          (if null c_intrs then eresolve_tac ctxt' @{thms FalseE} 1
 140.118             else
 140.119              let val (c_intrs', last_c_intr) = split_last c_intrs in
 140.120 -              EVERY (map (fn ci => eresolve_tac @{thms disjE} 1 THEN prove_intr2 ci) c_intrs') THEN
 140.121 -              prove_intr2 last_c_intr
 140.122 +              EVERY (map (fn ci => eresolve_tac ctxt' @{thms disjE} 1 THEN prove_intr2 ci) c_intrs')
 140.123 +              THEN prove_intr2 last_c_intr
 140.124              end))
 140.125          |> rulify ctxt'
 140.126          |> singleton (Proof_Context.export ctxt' ctxt'')
 140.127 @@ -546,10 +546,13 @@
 140.128  val refl_thin = Goal.prove_global @{theory HOL} [] [] @{prop "!!P. a = a ==> P ==> P"}
 140.129    (fn {context = ctxt, ...} => assume_tac ctxt 1);
 140.130  val elim_rls = [asm_rl, FalseE, refl_thin, conjE, exE];
 140.131 -val elim_tac = REPEAT o eresolve_tac elim_rls;
 140.132 +fun elim_tac ctxt = REPEAT o eresolve_tac ctxt elim_rls;
 140.133  
 140.134  fun simp_case_tac ctxt i =
 140.135 -  EVERY' [elim_tac, asm_full_simp_tac ctxt, elim_tac, REPEAT o bound_hyp_subst_tac ctxt] i;
 140.136 +  EVERY' [elim_tac ctxt,
 140.137 +    asm_full_simp_tac ctxt,
 140.138 +    elim_tac ctxt,
 140.139 +    REPEAT o bound_hyp_subst_tac ctxt] i;
 140.140  
 140.141  in
 140.142  
 140.143 @@ -732,16 +735,17 @@
 140.144      val induct = Goal.prove_sorry ctxt'' [] ind_prems ind_concl
 140.145        (fn {context = ctxt3, prems} => EVERY
 140.146          [rewrite_goals_tac ctxt3 [inductive_conj_def],
 140.147 -         DETERM (resolve_tac [raw_fp_induct] 1),
 140.148 -         REPEAT (resolve_tac [@{thm le_funI}, @{thm le_boolI}] 1),
 140.149 +         DETERM (resolve_tac ctxt3 [raw_fp_induct] 1),
 140.150 +         REPEAT (resolve_tac ctxt3 [@{thm le_funI}, @{thm le_boolI}] 1),
 140.151           rewrite_goals_tac ctxt3 simp_thms2,
 140.152           (*This disjE separates out the introduction rules*)
 140.153 -         REPEAT (FIRSTGOAL (eresolve_tac [disjE, exE, FalseE])),
 140.154 +         REPEAT (FIRSTGOAL (eresolve_tac ctxt3 [disjE, exE, FalseE])),
 140.155           (*Now break down the individual cases.  No disjE here in case
 140.156             some premise involves disjunction.*)
 140.157 -         REPEAT (FIRSTGOAL (eresolve_tac [conjE] ORELSE' bound_hyp_subst_tac ctxt3)),
 140.158 +         REPEAT (FIRSTGOAL (eresolve_tac ctxt3 [conjE] ORELSE' bound_hyp_subst_tac ctxt3)),
 140.159           REPEAT (FIRSTGOAL
 140.160 -           (resolve_tac [conjI, impI] ORELSE' (eresolve_tac [notE] THEN' assume_tac ctxt3))),
 140.161 +           (resolve_tac ctxt3 [conjI, impI] ORELSE'
 140.162 +           (eresolve_tac ctxt3 [notE] THEN' assume_tac ctxt3))),
 140.163           EVERY (map (fn prem => DEPTH_SOLVE_1 (ares_tac [rewrite_rule ctxt3
 140.164               (inductive_conj_def :: rec_preds_defs @ simp_thms2) prem,
 140.165             conjI, refl] 1)) prems)]);
 140.166 @@ -750,8 +754,8 @@
 140.167        (Logic.mk_implies (ind_concl, mutual_ind_concl)) (fn {context = ctxt3, ...} => EVERY
 140.168          [rewrite_goals_tac ctxt3 rec_preds_defs,
 140.169           REPEAT (EVERY
 140.170 -           [REPEAT (resolve_tac [conjI, impI] 1),
 140.171 -            REPEAT (eresolve_tac [@{thm le_funE}, @{thm le_boolE}] 1),
 140.172 +           [REPEAT (resolve_tac ctxt3 [conjI, impI] 1),
 140.173 +            REPEAT (eresolve_tac ctxt3 [@{thm le_funE}, @{thm le_boolE}] 1),
 140.174              assume_tac ctxt3 1,
 140.175              rewrite_goals_tac ctxt3 simp_thms1,
 140.176              assume_tac ctxt3 1])]);
   141.1 --- a/src/HOL/Tools/inductive_realizer.ML	Tue Feb 10 14:29:36 2015 +0100
   141.2 +++ b/src/HOL/Tools/inductive_realizer.ML	Tue Feb 10 14:48:26 2015 +0100
   141.3 @@ -395,7 +395,7 @@
   141.4            (fn {context = ctxt, prems} => EVERY
   141.5            [rtac (#raw_induct ind_info) 1,
   141.6             rewrite_goals_tac ctxt rews,
   141.7 -           REPEAT ((resolve_tac prems THEN_ALL_NEW EVERY'
   141.8 +           REPEAT ((resolve_tac ctxt prems THEN_ALL_NEW EVERY'
   141.9               [K (rewrite_goals_tac ctxt rews), Object_Logic.atomize_prems_tac ctxt,
  141.10                DEPTH_SOLVE_1 o FIRST' [assume_tac ctxt, etac allE, etac impE]]) 1)]);
  141.11          val (thm', thy') = Global_Theory.store_thm (Binding.qualified_name (space_implode "_"
  141.12 @@ -459,7 +459,7 @@
  141.13               etac elimR 1,
  141.14               ALLGOALS (asm_simp_tac (put_simpset HOL_basic_ss ctxt)),
  141.15               rewrite_goals_tac ctxt rews,
  141.16 -             REPEAT ((resolve_tac prems THEN_ALL_NEW (Object_Logic.atomize_prems_tac ctxt THEN'
  141.17 +             REPEAT ((resolve_tac ctxt prems THEN_ALL_NEW (Object_Logic.atomize_prems_tac ctxt THEN'
  141.18                 DEPTH_SOLVE_1 o FIRST' [assume_tac ctxt, etac allE, etac impE])) 1)]);
  141.19          val (thm', thy') = Global_Theory.store_thm (Binding.qualified_name (space_implode "_"
  141.20            (name_of_thm elim :: vs @ Ps @ ["correctness"])), thm) thy
   142.1 --- a/src/HOL/Tools/inductive_set.ML	Tue Feb 10 14:29:36 2015 +0100
   142.2 +++ b/src/HOL/Tools/inductive_set.ML	Tue Feb 10 14:48:26 2015 +0100
   142.3 @@ -75,14 +75,15 @@
   142.4                SOME (close (Goal.prove ctxt [] [])
   142.5                  (Logic.mk_equals (t, fold_rev Term.abs xs (m $ p $ (bop $ S $ S'))))
   142.6                  (K (EVERY
   142.7 -                  [resolve_tac [eq_reflection] 1, REPEAT (resolve_tac @{thms ext} 1),
   142.8 -                   resolve_tac [iffI] 1,
   142.9 -                   EVERY [eresolve_tac [conjE] 1, resolve_tac [IntI] 1, simp, simp,
  142.10 -                     eresolve_tac [IntE] 1, resolve_tac [conjI] 1, simp, simp] ORELSE
  142.11 -                   EVERY [eresolve_tac [disjE] 1, resolve_tac [UnI1] 1, simp,
  142.12 -                     resolve_tac [UnI2] 1, simp,
  142.13 -                     eresolve_tac [UnE] 1, resolve_tac [disjI1] 1, simp,
  142.14 -                     resolve_tac [disjI2] 1, simp]])))
  142.15 +                  [resolve_tac ctxt [eq_reflection] 1,
  142.16 +                   REPEAT (resolve_tac ctxt @{thms ext} 1),
  142.17 +                   resolve_tac ctxt [iffI] 1,
  142.18 +                   EVERY [eresolve_tac ctxt [conjE] 1, resolve_tac ctxt [IntI] 1, simp, simp,
  142.19 +                     eresolve_tac ctxt [IntE] 1, resolve_tac ctxt [conjI] 1, simp, simp] ORELSE
  142.20 +                   EVERY [eresolve_tac ctxt [disjE] 1, resolve_tac ctxt [UnI1] 1, simp,
  142.21 +                     resolve_tac ctxt [UnI2] 1, simp,
  142.22 +                     eresolve_tac ctxt [UnE] 1, resolve_tac ctxt [disjI1] 1, simp,
  142.23 +                     resolve_tac ctxt [disjI2] 1, simp]])))
  142.24                  handle ERROR _ => NONE))
  142.25      in
  142.26        case strip_comb t of
  142.27 @@ -505,7 +506,7 @@
  142.28                 fold_rev (Term.abs o pair "x") Ts
  142.29                  (HOLogic.mk_mem (HOLogic.mk_ptuple fs U (map Bound (length fs downto 0)),
  142.30                    list_comb (c, params))))))
  142.31 -            (K (REPEAT (resolve_tac @{thms ext} 1) THEN
  142.32 +            (K (REPEAT (resolve_tac lthy @{thms ext} 1) THEN
  142.33                simp_tac (put_simpset HOL_basic_ss lthy addsimps
  142.34                  [def, mem_Collect_eq, @{thm split_conv}]) 1))
  142.35          in
   143.1 --- a/src/HOL/Tools/lin_arith.ML	Tue Feb 10 14:29:36 2015 +0100
   143.2 +++ b/src/HOL/Tools/lin_arith.ML	Tue Feb 10 14:48:26 2015 +0100
   143.3 @@ -732,11 +732,12 @@
   143.4        end)
   143.5    in
   143.6      EVERY' [
   143.7 -      REPEAT_DETERM o eresolve_tac [rev_mp],
   143.8 +      REPEAT_DETERM o eresolve_tac ctxt [rev_mp],
   143.9        cond_split_tac,
  143.10 -      resolve_tac @{thms ccontr},
  143.11 +      resolve_tac ctxt @{thms ccontr},
  143.12        prem_nnf_tac ctxt,
  143.13 -      TRY o REPEAT_ALL_NEW (DETERM o (eresolve_tac [conjE, exE] ORELSE' eresolve_tac [disjE]))
  143.14 +      TRY o REPEAT_ALL_NEW
  143.15 +        (DETERM o (eresolve_tac ctxt [conjE, exE] ORELSE' eresolve_tac ctxt [disjE]))
  143.16      ]
  143.17    end;
  143.18  
  143.19 @@ -753,13 +754,13 @@
  143.20      fun is_relevant t = is_some (decomp ctxt t)
  143.21    in
  143.22      DETERM (
  143.23 -      TRY (filter_prems_tac is_relevant i)
  143.24 +      TRY (filter_prems_tac ctxt is_relevant i)
  143.25          THEN (
  143.26            (TRY o REPEAT_ALL_NEW (split_once_tac ctxt split_thms))
  143.27              THEN_ALL_NEW
  143.28                (CONVERSION Drule.beta_eta_conversion
  143.29                  THEN'
  143.30 -              (TRY o (eresolve_tac [notE] THEN' eq_assume_tac)))
  143.31 +              (TRY o (eresolve_tac ctxt [notE] THEN' eq_assume_tac)))
  143.32          ) i
  143.33      )
  143.34    end;
  143.35 @@ -834,14 +835,14 @@
  143.36  fun refute_tac ctxt test prep_tac ref_tac =
  143.37    let val refute_prems_tac =
  143.38          REPEAT_DETERM
  143.39 -              (eresolve_tac [@{thm conjE}, @{thm exE}] 1 ORELSE
  143.40 -               filter_prems_tac test 1 ORELSE
  143.41 -               eresolve_tac @{thms disjE} 1) THEN
  143.42 -        (DETERM (eresolve_tac @{thms notE} 1 THEN eq_assume_tac 1) ORELSE
  143.43 +              (eresolve_tac ctxt [@{thm conjE}, @{thm exE}] 1 ORELSE
  143.44 +               filter_prems_tac ctxt test 1 ORELSE
  143.45 +               eresolve_tac ctxt @{thms disjE} 1) THEN
  143.46 +        (DETERM (eresolve_tac ctxt @{thms notE} 1 THEN eq_assume_tac 1) ORELSE
  143.47           ref_tac 1);
  143.48 -  in EVERY'[TRY o filter_prems_tac test,
  143.49 -            REPEAT_DETERM o eresolve_tac @{thms rev_mp}, prep_tac,
  143.50 -              resolve_tac @{thms ccontr}, prem_nnf_tac ctxt,
  143.51 +  in EVERY'[TRY o filter_prems_tac ctxt test,
  143.52 +            REPEAT_DETERM o eresolve_tac ctxt @{thms rev_mp}, prep_tac,
  143.53 +              resolve_tac ctxt @{thms ccontr}, prem_nnf_tac ctxt,
  143.54              SELECT_GOAL (DEPTH_SOLVE refute_prems_tac)]
  143.55    end;
  143.56  
  143.57 @@ -875,7 +876,7 @@
  143.58  fun gen_tac ex ctxt =
  143.59    FIRST' [simple_tac ctxt,
  143.60      Object_Logic.full_atomize_tac ctxt THEN'
  143.61 -    (REPEAT_DETERM o resolve_tac [impI]) THEN' raw_tac ctxt ex];
  143.62 +    (REPEAT_DETERM o resolve_tac ctxt [impI]) THEN' raw_tac ctxt ex];
  143.63  
  143.64  val tac = gen_tac true;
  143.65  
   144.1 --- a/src/HOL/Tools/record.ML	Tue Feb 10 14:29:36 2015 +0100
   144.2 +++ b/src/HOL/Tools/record.ML	Tue Feb 10 14:48:26 2015 +0100
   144.3 @@ -1128,7 +1128,7 @@
   144.4        (fn {context = ctxt, ...} =>
   144.5          simp_tac (put_simpset ss ctxt) 1 THEN
   144.6          REPEAT_DETERM (Iso_Tuple_Support.iso_tuple_intros_tac ctxt 1) THEN
   144.7 -        TRY (resolve_tac [updacc_cong_idI] 1))
   144.8 +        TRY (resolve_tac ctxt [updacc_cong_idI] 1))
   144.9    end;
  144.10  
  144.11  
  144.12 @@ -1634,7 +1634,7 @@
  144.13          Goal.prove_sorry_global defs_thy [] [assm] concl
  144.14            (fn {context = ctxt, prems, ...} =>
  144.15              cut_tac (split_meta RS Drule.equal_elim_rule2) 1 THEN
  144.16 -            resolve_tac prems 2 THEN
  144.17 +            resolve_tac ctxt prems 2 THEN
  144.18              asm_simp_tac (put_simpset HOL_ss ctxt) 1)
  144.19        end);
  144.20  
  144.21 @@ -1724,7 +1724,7 @@
  144.22      |> `(fn lthy => Syntax.check_term lthy eq)
  144.23      |-> (fn eq => Specification.definition (NONE, (apfst Binding.conceal Attrib.empty_binding, eq)))
  144.24      |> snd
  144.25 -    |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
  144.26 +    |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
  144.27    end;
  144.28  
  144.29  fun ensure_sort_record (sort, mk_eq) ext_tyco vs extN Ts thy =
  144.30 @@ -1749,7 +1749,7 @@
  144.31            (Const (@{const_name HOL.equal}, extT --> extT --> HOLogic.boolT),
  144.32             Const (@{const_name HOL.eq}, extT --> extT --> HOLogic.boolT)));
  144.33        fun tac ctxt eq_def =
  144.34 -        Class.intro_classes_tac []
  144.35 +        Class.intro_classes_tac ctxt []
  144.36          THEN rewrite_goals_tac ctxt [Simpdata.mk_eq eq_def]
  144.37          THEN ALLGOALS (rtac @{thm refl});
  144.38        fun mk_eq thy eq_def =
  144.39 @@ -2128,7 +2128,7 @@
  144.40          (fn {context = ctxt, prems, ...} =>
  144.41            try_param_tac ctxt rN induct_scheme 1
  144.42            THEN try_param_tac ctxt "more" @{thm unit.induct} 1
  144.43 -          THEN resolve_tac prems 1));
  144.44 +          THEN resolve_tac ctxt prems 1));
  144.45  
  144.46      val surjective = timeit_msg ctxt "record surjective proof:" (fn () =>
  144.47        Goal.prove_sorry_global defs_thy [] [] surjective_prop
  144.48 @@ -2144,8 +2144,8 @@
  144.49  
  144.50      val cases_scheme = timeit_msg ctxt "record cases_scheme proof:" (fn () =>
  144.51        Goal.prove_sorry_global defs_thy [] [#1 cases_scheme_prop] (#2 cases_scheme_prop)
  144.52 -        (fn {prems, ...} =>
  144.53 -          resolve_tac prems 1 THEN
  144.54 +        (fn {context = ctxt, prems, ...} =>
  144.55 +          resolve_tac ctxt prems 1 THEN
  144.56            rtac surjective 1));
  144.57  
  144.58      val cases = timeit_msg ctxt "record cases proof:" (fn () =>
   145.1 --- a/src/HOL/Tools/sat.ML	Tue Feb 10 14:29:36 2015 +0100
   145.2 +++ b/src/HOL/Tools/sat.ML	Tue Feb 10 14:48:26 2015 +0100
   145.3 @@ -226,7 +226,7 @@
   145.4            (* convert the original clause *)
   145.5            let
   145.6              val _ = cond_tracing ctxt (fn () => "Using original clause #" ^ string_of_int id)
   145.7 -            val raw = CNF.clause2raw_thm thm
   145.8 +            val raw = CNF.clause2raw_thm ctxt thm
   145.9              val hyps = sort (lit_ord o apply2 fst) (map_filter (fn chyp =>
  145.10                Option.map (rpair chyp) (index_of_literal chyp)) (#hyps (Thm.crep_thm raw)))
  145.11              val clause = (raw, hyps)
  145.12 @@ -409,7 +409,7 @@
  145.13  
  145.14  fun rawsat_tac ctxt i =
  145.15    Subgoal.FOCUS (fn {context = ctxt', prems, ...} =>
  145.16 -    resolve_tac [rawsat_thm ctxt' (map cprop_of prems)] 1) ctxt i;
  145.17 +    resolve_tac ctxt' [rawsat_thm ctxt' (map cprop_of prems)] 1) ctxt i;
  145.18  
  145.19  (* ------------------------------------------------------------------------- *)
  145.20  (* pre_cnf_tac: converts the i-th subgoal                                    *)
  145.21 @@ -424,7 +424,7 @@
  145.22  (* ------------------------------------------------------------------------- *)
  145.23  
  145.24  fun pre_cnf_tac ctxt =
  145.25 -  resolve_tac @{thms ccontr} THEN'
  145.26 +  resolve_tac ctxt @{thms ccontr} THEN'
  145.27    Object_Logic.atomize_prems_tac ctxt THEN'
  145.28    CONVERSION Drule.beta_eta_conversion;
  145.29  
  145.30 @@ -436,7 +436,8 @@
  145.31  (* ------------------------------------------------------------------------- *)
  145.32  
  145.33  fun cnfsat_tac ctxt i =
  145.34 -  (eresolve_tac [FalseE] i) ORELSE (REPEAT_DETERM (eresolve_tac [conjE] i) THEN rawsat_tac ctxt i);
  145.35 +  (eresolve_tac  ctxt [FalseE] i) ORELSE
  145.36 +  (REPEAT_DETERM (eresolve_tac ctxt [conjE] i) THEN rawsat_tac ctxt i);
  145.37  
  145.38  (* ------------------------------------------------------------------------- *)
  145.39  (* cnfxsat_tac: checks if the empty clause "False" occurs among the          *)
  145.40 @@ -446,8 +447,9 @@
  145.41  (* ------------------------------------------------------------------------- *)
  145.42  
  145.43  fun cnfxsat_tac ctxt i =
  145.44 -  (eresolve_tac [FalseE] i) ORELSE
  145.45 -    (REPEAT_DETERM (eresolve_tac [conjE] i ORELSE eresolve_tac [exE] i) THEN rawsat_tac ctxt i);
  145.46 +  (eresolve_tac ctxt [FalseE] i) ORELSE
  145.47 +    (REPEAT_DETERM (eresolve_tac ctxt [conjE] i ORELSE eresolve_tac ctxt [exE] i) THEN
  145.48 +      rawsat_tac ctxt i);
  145.49  
  145.50  (* ------------------------------------------------------------------------- *)
  145.51  (* sat_tac: tactic for calling an external SAT solver, taking as input an    *)
   146.1 --- a/src/HOL/Tools/set_comprehension_pointfree.ML	Tue Feb 10 14:29:36 2015 +0100
   146.2 +++ b/src/HOL/Tools/set_comprehension_pointfree.ML	Tue Feb 10 14:48:26 2015 +0100
   146.3 @@ -314,96 +314,99 @@
   146.4  val collectI' = @{lemma "\<not> P a ==> a \<notin> {x. P x}" by auto}
   146.5  val collectE' = @{lemma "a \<notin> {x. P x} ==> (\<not> P a ==> Q) ==> Q" by auto}
   146.6  
   146.7 -fun elim_Collect_tac ctxt = dresolve_tac @{thms iffD1 [OF mem_Collect_eq]}
   146.8 -  THEN' (REPEAT_DETERM o (eresolve_tac @{thms exE}))
   146.9 -  THEN' REPEAT_DETERM o eresolve_tac @{thms conjE}
  146.10 +fun elim_Collect_tac ctxt =
  146.11 +  dresolve_tac ctxt @{thms iffD1 [OF mem_Collect_eq]}
  146.12 +  THEN' (REPEAT_DETERM o (eresolve_tac ctxt @{thms exE}))
  146.13 +  THEN' REPEAT_DETERM o eresolve_tac ctxt @{thms conjE}
  146.14    THEN' TRY o hyp_subst_tac ctxt;
  146.15  
  146.16 -fun intro_image_tac ctxt = resolve_tac @{thms image_eqI}
  146.17 -    THEN' (REPEAT_DETERM1 o
  146.18 -      (resolve_tac @{thms refl}
  146.19 -      ORELSE' resolve_tac @{thms arg_cong2 [OF refl, where f = "op =", OF prod.case, THEN iffD2]}
  146.20 +fun intro_image_tac ctxt =
  146.21 +  resolve_tac ctxt @{thms image_eqI}
  146.22 +  THEN' (REPEAT_DETERM1 o
  146.23 +      (resolve_tac ctxt @{thms refl}
  146.24 +      ORELSE' resolve_tac ctxt @{thms arg_cong2 [OF refl, where f = "op =", OF prod.case, THEN iffD2]}
  146.25        ORELSE' CONVERSION (Conv.params_conv ~1 (K (Conv.concl_conv ~1
  146.26          (HOLogic.Trueprop_conv
  146.27            (HOLogic.eq_conv Conv.all_conv (Conv.rewr_conv (mk_meta_eq case_prod_distrib)))))) ctxt)))
  146.28  
  146.29 -fun elim_image_tac ctxt = eresolve_tac @{thms imageE}
  146.30 +fun elim_image_tac ctxt =
  146.31 +  eresolve_tac ctxt @{thms imageE}
  146.32    THEN' REPEAT_DETERM o CHANGED o
  146.33      (TRY o full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps @{thms split_paired_all prod.case})
  146.34 -    THEN' REPEAT_DETERM o eresolve_tac @{thms Pair_inject}
  146.35 +    THEN' REPEAT_DETERM o eresolve_tac ctxt @{thms Pair_inject}
  146.36      THEN' TRY o hyp_subst_tac ctxt)
  146.37  
  146.38  fun tac1_of_formula ctxt (Int (fm1, fm2)) =
  146.39 -    TRY o eresolve_tac @{thms conjE}
  146.40 -    THEN' resolve_tac @{thms IntI}
  146.41 +    TRY o eresolve_tac ctxt @{thms conjE}
  146.42 +    THEN' resolve_tac ctxt @{thms IntI}
  146.43      THEN' (fn i => tac1_of_formula ctxt fm2 (i + 1))
  146.44      THEN' tac1_of_formula ctxt fm1
  146.45    | tac1_of_formula ctxt (Un (fm1, fm2)) =
  146.46 -    eresolve_tac @{thms disjE} THEN' resolve_tac @{thms UnI1}
  146.47 +    eresolve_tac ctxt @{thms disjE} THEN' resolve_tac ctxt @{thms UnI1}
  146.48      THEN' tac1_of_formula ctxt fm1
  146.49 -    THEN' resolve_tac @{thms UnI2}
  146.50 +    THEN' resolve_tac ctxt @{thms UnI2}
  146.51      THEN' tac1_of_formula ctxt fm2
  146.52    | tac1_of_formula ctxt (Atom _) =
  146.53      REPEAT_DETERM1 o (assume_tac ctxt
  146.54 -      ORELSE' resolve_tac @{thms SigmaI}
  146.55 -      ORELSE' ((resolve_tac @{thms CollectI} ORELSE' resolve_tac [collectI']) THEN'
  146.56 +      ORELSE' resolve_tac ctxt @{thms SigmaI}
  146.57 +      ORELSE' ((resolve_tac ctxt @{thms CollectI} ORELSE' resolve_tac ctxt [collectI']) THEN'
  146.58          TRY o simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm prod.case}]))
  146.59 -      ORELSE' ((resolve_tac @{thms vimageI2} ORELSE' resolve_tac [vimageI2']) THEN'
  146.60 +      ORELSE' ((resolve_tac ctxt @{thms vimageI2} ORELSE' resolve_tac ctxt [vimageI2']) THEN'
  146.61          TRY o simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm prod.case}]))
  146.62 -      ORELSE' (resolve_tac @{thms image_eqI} THEN'
  146.63 +      ORELSE' (resolve_tac ctxt @{thms image_eqI} THEN'
  146.64      (REPEAT_DETERM o
  146.65 -      (resolve_tac @{thms refl}
  146.66 -      ORELSE' resolve_tac @{thms arg_cong2[OF refl, where f = "op =", OF prod.case, THEN iffD2]})))
  146.67 -      ORELSE' resolve_tac @{thms UNIV_I}
  146.68 -      ORELSE' resolve_tac @{thms iffD2[OF Compl_iff]}
  146.69 +      (resolve_tac ctxt @{thms refl}
  146.70 +      ORELSE' resolve_tac ctxt @{thms arg_cong2[OF refl, where f = "op =", OF prod.case, THEN iffD2]})))
  146.71 +      ORELSE' resolve_tac ctxt @{thms UNIV_I}
  146.72 +      ORELSE' resolve_tac ctxt @{thms iffD2[OF Compl_iff]}
  146.73        ORELSE' assume_tac ctxt)
  146.74  
  146.75  fun tac2_of_formula ctxt (Int (fm1, fm2)) =
  146.76 -    TRY o eresolve_tac @{thms IntE}
  146.77 -    THEN' TRY o resolve_tac @{thms conjI}
  146.78 +    TRY o eresolve_tac ctxt @{thms IntE}
  146.79 +    THEN' TRY o resolve_tac ctxt @{thms conjI}
  146.80      THEN' (fn i => tac2_of_formula ctxt fm2 (i + 1))
  146.81      THEN' tac2_of_formula ctxt fm1
  146.82    | tac2_of_formula ctxt (Un (fm1, fm2)) =
  146.83 -    eresolve_tac @{thms UnE} THEN' resolve_tac @{thms disjI1}
  146.84 +    eresolve_tac ctxt @{thms UnE} THEN' resolve_tac ctxt @{thms disjI1}
  146.85      THEN' tac2_of_formula ctxt fm1
  146.86 -    THEN' resolve_tac @{thms disjI2}
  146.87 +    THEN' resolve_tac ctxt @{thms disjI2}
  146.88      THEN' tac2_of_formula ctxt fm2
  146.89    | tac2_of_formula ctxt (Atom _) =
  146.90      REPEAT_DETERM o
  146.91        (assume_tac ctxt
  146.92 -       ORELSE' dresolve_tac @{thms iffD1[OF mem_Sigma_iff]}
  146.93 -       ORELSE' eresolve_tac @{thms conjE}
  146.94 -       ORELSE' ((eresolve_tac @{thms CollectE} ORELSE' eresolve_tac [collectE']) THEN'
  146.95 +       ORELSE' dresolve_tac ctxt @{thms iffD1[OF mem_Sigma_iff]}
  146.96 +       ORELSE' eresolve_tac ctxt @{thms conjE}
  146.97 +       ORELSE' ((eresolve_tac ctxt @{thms CollectE} ORELSE' eresolve_tac ctxt [collectE']) THEN'
  146.98           TRY o full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm prod.case}]) THEN'
  146.99 -         REPEAT_DETERM o eresolve_tac @{thms Pair_inject} THEN' TRY o hyp_subst_tac ctxt THEN'
 146.100 -         TRY o resolve_tac @{thms refl})
 146.101 -       ORELSE' (eresolve_tac @{thms imageE}
 146.102 +         REPEAT_DETERM o eresolve_tac ctxt @{thms Pair_inject} THEN' TRY o hyp_subst_tac ctxt THEN'
 146.103 +         TRY o resolve_tac ctxt @{thms refl})
 146.104 +       ORELSE' (eresolve_tac ctxt @{thms imageE}
 146.105           THEN' (REPEAT_DETERM o CHANGED o
 146.106           (TRY o full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps @{thms split_paired_all prod.case})
 146.107 -         THEN' REPEAT_DETERM o eresolve_tac @{thms Pair_inject}
 146.108 -         THEN' TRY o hyp_subst_tac ctxt THEN' TRY o resolve_tac @{thms refl})))
 146.109 -       ORELSE' eresolve_tac @{thms ComplE}
 146.110 -       ORELSE' ((eresolve_tac @{thms vimageE} ORELSE' eresolve_tac [vimageE'])
 146.111 +         THEN' REPEAT_DETERM o eresolve_tac ctxt @{thms Pair_inject}
 146.112 +         THEN' TRY o hyp_subst_tac ctxt THEN' TRY o resolve_tac ctxt @{thms refl})))
 146.113 +       ORELSE' eresolve_tac ctxt @{thms ComplE}
 146.114 +       ORELSE' ((eresolve_tac ctxt @{thms vimageE} ORELSE' eresolve_tac ctxt [vimageE'])
 146.115          THEN' TRY o full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm prod.case}])
 146.116 -        THEN' TRY o hyp_subst_tac ctxt THEN' TRY o resolve_tac @{thms refl}))
 146.117 +        THEN' TRY o hyp_subst_tac ctxt THEN' TRY o resolve_tac ctxt @{thms refl}))
 146.118  
 146.119  fun tac ctxt fm =
 146.120    let
 146.121 -    val subset_tac1 = resolve_tac @{thms subsetI}
 146.122 +    val subset_tac1 = resolve_tac ctxt @{thms subsetI}
 146.123        THEN' elim_Collect_tac ctxt
 146.124        THEN' intro_image_tac ctxt
 146.125        THEN' tac1_of_formula ctxt fm
 146.126 -    val subset_tac2 = resolve_tac @{thms subsetI}
 146.127 +    val subset_tac2 = resolve_tac ctxt @{thms subsetI}
 146.128        THEN' elim_image_tac ctxt
 146.129 -      THEN' resolve_tac @{thms iffD2[OF mem_Collect_eq]}
 146.130 -      THEN' REPEAT_DETERM o resolve_tac @{thms exI}
 146.131 -      THEN' (TRY o REPEAT_ALL_NEW (resolve_tac @{thms conjI}))
 146.132 -      THEN' (K (TRY (FIRSTGOAL ((TRY o hyp_subst_tac ctxt) THEN' resolve_tac @{thms refl}))))
 146.133 +      THEN' resolve_tac ctxt @{thms iffD2[OF mem_Collect_eq]}
 146.134 +      THEN' REPEAT_DETERM o resolve_tac ctxt @{thms exI}
 146.135 +      THEN' (TRY o REPEAT_ALL_NEW (resolve_tac ctxt @{thms conjI}))
 146.136 +      THEN' (K (TRY (FIRSTGOAL ((TRY o hyp_subst_tac ctxt) THEN' resolve_tac ctxt @{thms refl}))))
 146.137        THEN' (fn i => EVERY (rev (map_index (fn (j, f) =>
 146.138 -        REPEAT_DETERM (eresolve_tac @{thms IntE} (i + j)) THEN
 146.139 +        REPEAT_DETERM (eresolve_tac ctxt @{thms IntE} (i + j)) THEN
 146.140          tac2_of_formula ctxt f (i + j)) (strip_Int fm))))
 146.141    in
 146.142 -    resolve_tac @{thms subset_antisym} THEN' subset_tac1 THEN' subset_tac2
 146.143 +    resolve_tac ctxt @{thms subset_antisym} THEN' subset_tac1 THEN' subset_tac2
 146.144    end;
 146.145  
 146.146  
 146.147 @@ -430,14 +433,14 @@
 146.148      fun is_eq th = is_some (try (HOLogic.dest_eq o HOLogic.dest_Trueprop) (prop_of th))
 146.149      val unfold_thms = @{thms split_paired_all mem_Collect_eq prod.case}
 146.150      fun tac ctxt = 
 146.151 -      resolve_tac @{thms set_eqI}
 146.152 +      resolve_tac ctxt @{thms set_eqI}
 146.153        THEN' simp_tac (put_simpset HOL_basic_ss ctxt addsimps unfold_thms)
 146.154 -      THEN' resolve_tac @{thms iffI}
 146.155 -      THEN' REPEAT_DETERM o resolve_tac @{thms exI}
 146.156 -      THEN' resolve_tac @{thms conjI} THEN' resolve_tac @{thms refl} THEN' assume_tac ctxt
 146.157 -      THEN' REPEAT_DETERM o eresolve_tac @{thms exE}
 146.158 -      THEN' eresolve_tac @{thms conjE}
 146.159 -      THEN' REPEAT_DETERM o eresolve_tac @{thms Pair_inject}
 146.160 +      THEN' resolve_tac ctxt @{thms iffI}
 146.161 +      THEN' REPEAT_DETERM o resolve_tac ctxt @{thms exI}
 146.162 +      THEN' resolve_tac ctxt @{thms conjI} THEN' resolve_tac ctxt @{thms refl} THEN' assume_tac ctxt
 146.163 +      THEN' REPEAT_DETERM o eresolve_tac ctxt @{thms exE}
 146.164 +      THEN' eresolve_tac ctxt @{thms conjE}
 146.165 +      THEN' REPEAT_DETERM o eresolve_tac ctxt @{thms Pair_inject}
 146.166        THEN' Subgoal.FOCUS (fn {prems, ...} =>
 146.167          (* FIXME inner context!? *)
 146.168          simp_tac (put_simpset HOL_basic_ss ctxt addsimps (filter is_eq prems)) 1) ctxt
   147.1 --- a/src/HOL/Tools/simpdata.ML	Tue Feb 10 14:29:36 2015 +0100
   147.2 +++ b/src/HOL/Tools/simpdata.ML	Tue Feb 10 14:48:26 2015 +0100
   147.3 @@ -79,13 +79,15 @@
   147.4    end;
   147.5  
   147.6  (*Congruence rules for = (instead of ==)*)
   147.7 -fun mk_meta_cong (_: Proof.context) rl = zero_var_indexes
   147.8 -  (let val rl' = Seq.hd (TRYALL (fn i => fn st =>
   147.9 -     resolve_tac [lift_meta_eq_to_obj_eq i st] i st) rl)
  147.10 -   in mk_meta_eq rl' handle THM _ =>
  147.11 -     if can Logic.dest_equals (concl_of rl') then rl'
  147.12 -     else error "Conclusion of congruence rules must be =-equality"
  147.13 -   end);
  147.14 +fun mk_meta_cong ctxt rl =
  147.15 +  let
  147.16 +    val rl' = Seq.hd (TRYALL (fn i => fn st =>
  147.17 +      resolve_tac ctxt [lift_meta_eq_to_obj_eq i st] i st) rl)
  147.18 +  in
  147.19 +    mk_meta_eq rl' handle THM _ =>
  147.20 +      if can Logic.dest_equals (concl_of rl') then rl'
  147.21 +      else error "Conclusion of congruence rules must be =-equality"
  147.22 +  end |> zero_var_indexes;
  147.23  
  147.24  fun mk_atomize ctxt pairs =
  147.25    let
  147.26 @@ -120,7 +122,10 @@
  147.27      val sol_thms =
  147.28        reflexive_thm :: @{thm TrueI} :: @{thm refl} :: Simplifier.prems_of ctxt;
  147.29      fun sol_tac i =
  147.30 -      FIRST [resolve_tac sol_thms i, assume_tac ctxt i , eresolve_tac @{thms FalseE} i] ORELSE
  147.31 +      FIRST
  147.32 +       [resolve_tac ctxt sol_thms i,
  147.33 +        assume_tac ctxt i,
  147.34 +        eresolve_tac ctxt @{thms FalseE} i] ORELSE
  147.35        (match_tac ctxt intros THEN_ALL_NEW sol_tac) i
  147.36    in
  147.37      (fn i => REPEAT_DETERM (match_tac ctxt @{thms simp_impliesI} i)) THEN' sol_tac
   148.1 --- a/src/HOL/Typerep.thy	Tue Feb 10 14:29:36 2015 +0100
   148.2 +++ b/src/HOL/Typerep.thy	Tue Feb 10 14:48:26 2015 +0100
   148.3 @@ -60,7 +60,7 @@
   148.4      |> `(fn lthy => Syntax.check_term lthy eq)
   148.5      |-> (fn eq => Specification.definition (NONE, (Attrib.empty_binding, eq)))
   148.6      |> snd
   148.7 -    |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
   148.8 +    |> Class.prove_instantiation_exit (fn ctxt => Class.intro_classes_tac ctxt [])
   148.9    end;
  148.10  
  148.11  fun ensure_typerep tyco thy =
   149.1 --- a/src/HOL/UNITY/Simple/NSP_Bad.thy	Tue Feb 10 14:29:36 2015 +0100
   149.2 +++ b/src/HOL/UNITY/Simple/NSP_Bad.thy	Tue Feb 10 14:48:26 2015 +0100
   149.3 @@ -105,7 +105,7 @@
   149.4    SELECT_GOAL
   149.5      (EVERY
   149.6       [REPEAT (etac @{thm Always_ConstrainsI} 1),
   149.7 -      REPEAT (resolve_tac [@{thm StableI}, @{thm stableI}, @{thm constrains_imp_Constrains}] 1),
   149.8 +      REPEAT (resolve_tac ctxt [@{thm StableI}, @{thm stableI}, @{thm constrains_imp_Constrains}] 1),
   149.9        rtac @{thm ns_constrainsI} 1,
  149.10        full_simp_tac ctxt 1,
  149.11        REPEAT (FIRSTGOAL (etac disjE)),
   150.1 --- a/src/HOL/UNITY/UNITY_tactics.ML	Tue Feb 10 14:29:36 2015 +0100
   150.2 +++ b/src/HOL/UNITY/UNITY_tactics.ML	Tue Feb 10 14:48:26 2015 +0100
   150.3 @@ -21,7 +21,7 @@
   150.4        (*reduce the fancy safety properties to "constrains"*)
   150.5        REPEAT (etac @{thm Always_ConstrainsI} 1
   150.6                ORELSE
   150.7 -              resolve_tac [@{thm StableI}, @{thm stableI},
   150.8 +              resolve_tac ctxt [@{thm StableI}, @{thm stableI},
   150.9                             @{thm constrains_imp_Constrains}] 1),
  150.10        (*for safety, the totalize operator can be ignored*)
  150.11        simp_tac (put_simpset HOL_ss ctxt
   151.1 --- a/src/HOL/Word/Word.thy	Tue Feb 10 14:29:36 2015 +0100
   151.2 +++ b/src/HOL/Word/Word.thy	Tue Feb 10 14:48:26 2015 +0100
   151.3 @@ -1561,7 +1561,7 @@
   151.4            |> fold Splitter.add_split @{thms uint_splits}
   151.5            |> fold Simplifier.add_cong @{thms power_False_cong})),
   151.6        rewrite_goals_tac ctxt @{thms word_size}, 
   151.7 -      ALLGOALS  (fn n => REPEAT (resolve_tac [allI, impI] n) THEN      
   151.8 +      ALLGOALS  (fn n => REPEAT (resolve_tac ctxt [allI, impI] n) THEN
   151.9                           REPEAT (etac conjE n) THEN
  151.10                           REPEAT (dtac @{thm word_of_int_inverse} n 
  151.11                                   THEN assume_tac ctxt n 
  151.12 @@ -2063,7 +2063,7 @@
  151.13            |> fold Splitter.add_split @{thms unat_splits}
  151.14            |> fold Simplifier.add_cong @{thms power_False_cong})),
  151.15        rewrite_goals_tac ctxt @{thms word_size}, 
  151.16 -      ALLGOALS  (fn n => REPEAT (resolve_tac [allI, impI] n) THEN      
  151.17 +      ALLGOALS  (fn n => REPEAT (resolve_tac ctxt [allI, impI] n) THEN      
  151.18                           REPEAT (etac conjE n) THEN
  151.19                           REPEAT (dtac @{thm of_nat_inverse} n THEN atac n)),
  151.20        TRYALL arith_tac' ] 
   152.1 --- a/src/HOL/Word/WordBitwise.thy	Tue Feb 10 14:29:36 2015 +0100
   152.2 +++ b/src/HOL/Word/WordBitwise.thy	Tue Feb 10 14:48:26 2015 +0100
   152.3 @@ -518,7 +518,7 @@
   152.4        in
   152.5          try (fn () =>
   152.6            Goal.prove_internal ctxt [] prop 
   152.7 -            (K (REPEAT_DETERM (resolve_tac @{thms upt_eq_list_intros} 1
   152.8 +            (K (REPEAT_DETERM (resolve_tac ctxt @{thms upt_eq_list_intros} 1
   152.9                  ORELSE simp_tac (put_simpset word_ss ctxt) 1))) |> mk_meta_eq) ()
  152.10        end
  152.11    | _ => NONE;
   153.1 --- a/src/LCF/LCF.thy	Tue Feb 10 14:29:36 2015 +0100
   153.2 +++ b/src/LCF/LCF.thy	Tue Feb 10 14:48:26 2015 +0100
   153.3 @@ -322,7 +322,7 @@
   153.4    Scan.lift Args.name_inner_syntax >> (fn v => fn ctxt =>
   153.5      SIMPLE_METHOD' (fn i =>
   153.6        res_inst_tac ctxt [(("f", 0), v)] @{thm induct} i THEN
   153.7 -      REPEAT (resolve_tac @{thms adm_lemmas} i)))
   153.8 +      REPEAT (resolve_tac ctxt @{thms adm_lemmas} i)))
   153.9  *}
  153.10  
  153.11  lemma least_FIX: "f(p) = p \<Longrightarrow> FIX(f) << p"
  153.12 @@ -381,7 +381,7 @@
  153.13  ML {*
  153.14  fun induct2_tac ctxt (f, g) i =
  153.15    res_inst_tac ctxt [(("f", 0), f), (("g", 0), g)] @{thm induct2} i THEN
  153.16 -  REPEAT(resolve_tac @{thms adm_lemmas} i)
  153.17 +  REPEAT(resolve_tac ctxt @{thms adm_lemmas} i)
  153.18  *}
  153.19  
  153.20  end
   154.1 --- a/src/Provers/Arith/cancel_numerals.ML	Tue Feb 10 14:29:36 2015 +0100
   154.2 +++ b/src/Provers/Arith/cancel_numerals.ML	Tue Feb 10 14:48:26 2015 +0100
   154.3 @@ -92,12 +92,12 @@
   154.4      Option.map (export o Data.simplify_meta_eq ctxt)
   154.5        (if n2 <= n1 then
   154.6           Data.prove_conv
   154.7 -           [Data.trans_tac reshape, resolve_tac [Data.bal_add1] 1,
   154.8 +           [Data.trans_tac reshape, resolve_tac ctxt [Data.bal_add1] 1,
   154.9              Data.numeral_simp_tac ctxt] ctxt prems
  154.10             (t', Data.mk_bal (newshape(n1-n2,terms1'), Data.mk_sum T terms2'))
  154.11         else
  154.12           Data.prove_conv
  154.13 -           [Data.trans_tac reshape, resolve_tac [Data.bal_add2] 1,
  154.14 +           [Data.trans_tac reshape, resolve_tac ctxt [Data.bal_add2] 1,
  154.15              Data.numeral_simp_tac ctxt] ctxt prems
  154.16             (t', Data.mk_bal (Data.mk_sum T terms1', newshape(n2-n1,terms2'))))
  154.17    end
   155.1 --- a/src/Provers/Arith/combine_numerals.ML	Tue Feb 10 14:29:36 2015 +0100
   155.2 +++ b/src/Provers/Arith/combine_numerals.ML	Tue Feb 10 14:48:26 2015 +0100
   155.3 @@ -83,7 +83,7 @@
   155.4    in
   155.5      Option.map (export o Data.simplify_meta_eq ctxt)
   155.6        (Data.prove_conv
   155.7 -         [Data.trans_tac reshape, resolve_tac [Data.left_distrib] 1,
   155.8 +         [Data.trans_tac reshape, resolve_tac ctxt [Data.left_distrib] 1,
   155.9            Data.numeral_simp_tac ctxt] ctxt
  155.10           (t', Data.mk_sum T (Data.mk_coeff(Data.add(m,n), u) :: terms)))
  155.11    end
   156.1 --- a/src/Provers/Arith/fast_lin_arith.ML	Tue Feb 10 14:29:36 2015 +0100
   156.2 +++ b/src/Provers/Arith/fast_lin_arith.ML	Tue Feb 10 14:48:26 2015 +0100
   156.3 @@ -810,15 +810,15 @@
   156.4        fun just1 j =
   156.5          (* eliminate inequalities *)
   156.6          (if split_neq then
   156.7 -          REPEAT_DETERM (eresolve_tac neqE i)
   156.8 +          REPEAT_DETERM (eresolve_tac ctxt neqE i)
   156.9          else
  156.10            all_tac) THEN
  156.11            PRIMITIVE (trace_thm ctxt ["State after neqE:"]) THEN
  156.12            (* use theorems generated from the actual justifications *)
  156.13 -          Subgoal.FOCUS (fn {prems, ...} => resolve_tac [mkthm ctxt prems j] 1) ctxt i
  156.14 +          Subgoal.FOCUS (fn {prems, ...} => resolve_tac ctxt [mkthm ctxt prems j] 1) ctxt i
  156.15      in
  156.16        (* rewrite "[| A1; ...; An |] ==> B" to "[| A1; ...; An; ~B |] ==> False" *)
  156.17 -      DETERM (resolve_tac [LA_Logic.notI, LA_Logic.ccontr] i) THEN
  156.18 +      DETERM (resolve_tac ctxt [LA_Logic.notI, LA_Logic.ccontr] i) THEN
  156.19        (* user-defined preprocessing of the subgoal *)
  156.20        DETERM (LA_Data.pre_tac ctxt i) THEN
  156.21        PRIMITIVE (trace_thm ctxt ["State after pre_tac:"]) THEN
   157.1 --- a/src/Provers/blast.ML	Tue Feb 10 14:29:36 2015 +0100
   157.2 +++ b/src/Provers/blast.ML	Tue Feb 10 14:48:26 2015 +0100
   157.3 @@ -488,8 +488,11 @@
   157.4  
   157.5  (*Resolution/matching tactics: if upd then the proof state may be updated.
   157.6    Matching makes the tactics more deterministic in the presence of Vars.*)
   157.7 -fun emtac ctxt upd rl = TRACE ctxt rl (if upd then eresolve_tac [rl] else ematch_tac ctxt [rl]);
   157.8 -fun rmtac ctxt upd rl = TRACE ctxt rl (if upd then resolve_tac [rl] else match_tac ctxt [rl]);
   157.9 +fun emtac ctxt upd rl =
  157.10 +  TRACE ctxt rl (if upd then eresolve_tac ctxt [rl] else ematch_tac ctxt [rl]);
  157.11 +
  157.12 +fun rmtac ctxt upd rl =
  157.13 +  TRACE ctxt rl (if upd then resolve_tac ctxt [rl] else match_tac ctxt [rl]);
  157.14  
  157.15  (*Tableau rule from elimination rule.
  157.16    Flag "upd" says that the inference updated the branch.
  157.17 @@ -624,7 +627,7 @@
  157.18  
  157.19  (*Tactic.  Convert *Goal* to negated assumption in FIRST position*)
  157.20  fun negOfGoal_tac ctxt i =
  157.21 -  TRACE ctxt Data.ccontr (resolve_tac [Data.ccontr]) i THEN rotate_tac ~1 i;
  157.22 +  TRACE ctxt Data.ccontr (resolve_tac ctxt [Data.ccontr]) i THEN rotate_tac ~1 i;
  157.23  
  157.24  fun traceTerm ctxt t =
  157.25    let val thy = Proof_Context.theory_of ctxt
   158.1 --- a/src/Provers/classical.ML	Tue Feb 10 14:29:36 2015 +0100
   158.2 +++ b/src/Provers/classical.ML	Tue Feb 10 14:48:26 2015 +0100
   158.3 @@ -157,7 +157,7 @@
   158.4        val rule'' =
   158.5          rule' |> ALLGOALS (SUBGOAL (fn (goal, i) =>
   158.6            if i = 1 orelse redundant_hyp goal
   158.7 -          then eresolve_tac [thin_rl] i
   158.8 +          then eresolve0_tac [thin_rl] i
   158.9            else all_tac))
  158.10          |> Seq.hd
  158.11          |> Drule.zero_var_indexes;
  158.12 @@ -180,11 +180,12 @@
  158.13    No backtracking if it finds an equal assumption.  Perhaps should call
  158.14    ematch_tac instead of eresolve_tac, but then cannot prove ZF/cantor.*)
  158.15  fun contr_tac ctxt =
  158.16 -  eresolve_tac [Data.not_elim] THEN' (eq_assume_tac ORELSE' assume_tac ctxt);
  158.17 +  eresolve_tac ctxt [Data.not_elim] THEN' (eq_assume_tac ORELSE' assume_tac ctxt);
  158.18  
  158.19  (*Finds P-->Q and P in the assumptions, replaces implication by Q.
  158.20    Could do the same thing for P<->Q and P... *)
  158.21 -fun mp_tac ctxt i = eresolve_tac [Data.not_elim, Data.imp_elim] i THEN assume_tac ctxt i;
  158.22 +fun mp_tac ctxt i =
  158.23 +  eresolve_tac ctxt [Data.not_elim, Data.imp_elim] i THEN assume_tac ctxt i;
  158.24  
  158.25  (*Like mp_tac but instantiates no variables*)
  158.26  fun eq_mp_tac ctxt i = ematch_tac ctxt [Data.not_elim, Data.imp_elim] i THEN eq_assume_tac i;
  158.27 @@ -199,7 +200,7 @@
  158.28    let fun addrl rl brls = (false, rl) :: (true, rl RSN (2, Data.swap)) :: brls in
  158.29      assume_tac ctxt ORELSE'
  158.30      contr_tac ctxt ORELSE'
  158.31 -    biresolve_tac (fold_rev addrl rls [])
  158.32 +    biresolve_tac ctxt (fold_rev addrl rls [])
  158.33    end;
  158.34  
  158.35  (*Duplication of hazardous rules, for complete provers*)
  158.36 @@ -212,7 +213,7 @@
  158.37          SOME c => Context.proof_of c
  158.38        | NONE => Proof_Context.init_global (Thm.theory_of_thm th));
  158.39      val rl = (th RSN (2, revcut_rl)) |> Thm.assumption (SOME ctxt) 2 |> Seq.hd;
  158.40 -  in rule_by_tactic ctxt (TRYALL (eresolve_tac [revcut_rl])) rl end;
  158.41 +  in rule_by_tactic ctxt (TRYALL (eresolve_tac ctxt [revcut_rl])) rl end;
  158.42  
  158.43  
  158.44  (**** Classical rule sets ****)
  158.45 @@ -679,9 +680,9 @@
  158.46    ctxt addWrapper (name, fn ctxt => fn tac1 => tac1 APPEND' tac2 ctxt);
  158.47  
  158.48  fun ctxt addD2 (name, thm) =
  158.49 -  ctxt addafter (name, fn ctxt' => dresolve_tac [thm] THEN' assume_tac ctxt');
  158.50 +  ctxt addafter (name, fn ctxt' => dresolve_tac ctxt' [thm] THEN' assume_tac ctxt');
  158.51  fun ctxt addE2 (name, thm) =
  158.52 -  ctxt addafter (name, fn ctxt' => eresolve_tac [thm] THEN' assume_tac ctxt');
  158.53 +  ctxt addafter (name, fn ctxt' => eresolve_tac ctxt' [thm] THEN' assume_tac ctxt');
  158.54  fun ctxt addSD2 (name, thm) =
  158.55    ctxt addSafter (name, fn ctxt' => dmatch_tac ctxt' [thm] THEN' eq_assume_tac);
  158.56  fun ctxt addSE2 (name, thm) =
  158.57 @@ -902,7 +903,7 @@
  158.58      val ruleq = Drule.multi_resolves (SOME ctxt) facts rules;
  158.59      val _ = Method.trace ctxt rules;
  158.60    in
  158.61 -    fn st => Seq.maps (fn rule => resolve_tac [rule] i st) ruleq
  158.62 +    fn st => Seq.maps (fn rule => resolve_tac ctxt [rule] i st) ruleq
  158.63    end)
  158.64    THEN_ALL_NEW Goal.norm_hhf_tac ctxt;
  158.65  
   159.1 --- a/src/Provers/hypsubst.ML	Tue Feb 10 14:29:36 2015 +0100
   159.2 +++ b/src/Provers/hypsubst.ML	Tue Feb 10 14:48:26 2015 +0100
   159.3 @@ -51,7 +51,7 @@
   159.4    val hyp_subst_thin         : bool Config.T
   159.5    val hyp_subst_tac          : Proof.context -> int -> tactic
   159.6    val blast_hyp_subst_tac    : Proof.context -> bool -> int -> tactic
   159.7 -  val stac                   : thm -> int -> tactic
   159.8 +  val stac                   : Proof.context -> thm -> int -> tactic
   159.9  end;
  159.10  
  159.11  functor Hypsubst(Data: HYPSUBST_DATA): HYPSUBST =
  159.12 @@ -122,13 +122,14 @@
  159.13  
  159.14    in  eq_var_aux 0 t [] end;
  159.15  
  159.16 -val thin_free_eq_tac = SUBGOAL (fn (t, i) => let
  159.17 -     val (k, _) = eq_var false false false t
  159.18 -     val ok = (eq_var false false true t |> fst) > k
  159.19 -        handle EQ_VAR => true
  159.20 -   in if ok then EVERY [rotate_tac k i, eresolve_tac [thin_rl] i, rotate_tac (~k) i]
  159.21 +fun thin_free_eq_tac ctxt = SUBGOAL (fn (t, i) =>
  159.22 +  let
  159.23 +    val (k, _) = eq_var false false false t
  159.24 +    val ok = (eq_var false false true t |> fst) > k handle EQ_VAR => true
  159.25 +  in
  159.26 +    if ok then EVERY [rotate_tac k i, eresolve_tac ctxt [thin_rl] i, rotate_tac (~k) i]
  159.27      else no_tac
  159.28 -   end handle EQ_VAR => no_tac)
  159.29 +  end handle EQ_VAR => no_tac)
  159.30  
  159.31  (*For the simpset.  Adds ALL suitable equalities, even if not first!
  159.32    No vars are allowed here, as simpsets are built from meta-assumptions*)
  159.33 @@ -151,11 +152,11 @@
  159.34          val (k, (orient, is_free)) = eq_var bnd true true Bi
  159.35          val hyp_subst_ctxt = empty_simpset ctxt |> Simplifier.set_mksimps (K (mk_eqs bnd))
  159.36        in EVERY [rotate_tac k i, asm_lr_simp_tac hyp_subst_ctxt i,
  159.37 -        if not is_free then eresolve_tac [thin_rl] i
  159.38 -          else if orient then eresolve_tac [Data.rev_mp] i
  159.39 -          else eresolve_tac [Data.sym RS Data.rev_mp] i,
  159.40 +        if not is_free then eresolve_tac ctxt [thin_rl] i
  159.41 +          else if orient then eresolve_tac ctxt [Data.rev_mp] i
  159.42 +          else eresolve_tac ctxt [Data.sym RS Data.rev_mp] i,
  159.43          rotate_tac (~k) i,
  159.44 -        if is_free then resolve_tac [Data.imp_intr] i else all_tac]
  159.45 +        if is_free then resolve_tac ctxt [Data.imp_intr] i else all_tac]
  159.46        end handle THM _ => no_tac | EQ_VAR => no_tac)
  159.47  
  159.48  end;
  159.49 @@ -194,7 +195,7 @@
  159.50        end
  159.51    | NONE => no_tac);
  159.52  
  159.53 -val imp_intr_tac = resolve_tac [Data.imp_intr];
  159.54 +fun imp_intr_tac ctxt = resolve_tac ctxt [Data.imp_intr];
  159.55  
  159.56  fun rev_dup_elim ctxt th = (th RSN (2, revcut_rl)) |> Thm.assumption (SOME ctxt) 2 |> Seq.hd;
  159.57  fun dup_subst ctxt = rev_dup_elim ctxt ssubst
  159.58 @@ -211,11 +212,11 @@
  159.59            val rl = if orient then rl else Data.sym RS rl
  159.60        in
  159.61           DETERM
  159.62 -           (EVERY [REPEAT_DETERM_N k (eresolve_tac [Data.rev_mp] i),
  159.63 +           (EVERY [REPEAT_DETERM_N k (eresolve_tac ctxt [Data.rev_mp] i),
  159.64                     rotate_tac 1 i,
  159.65 -                   REPEAT_DETERM_N (n-k) (eresolve_tac [Data.rev_mp] i),
  159.66 +                   REPEAT_DETERM_N (n-k) (eresolve_tac ctxt [Data.rev_mp] i),
  159.67                     inst_subst_tac ctxt orient rl i,
  159.68 -                   REPEAT_DETERM_N n (imp_intr_tac i THEN rotate_tac ~1 i)])
  159.69 +                   REPEAT_DETERM_N n (imp_intr_tac ctxt i THEN rotate_tac ~1 i)])
  159.70        end
  159.71        handle THM _ => no_tac | EQ_VAR => no_tac);
  159.72  
  159.73 @@ -225,7 +226,7 @@
  159.74  fun hyp_subst_tac_thin thin ctxt =
  159.75    REPEAT_DETERM1 o FIRST' [ematch_tac ctxt [Data.thin_refl],
  159.76      gen_hyp_subst_tac ctxt false, vars_gen_hyp_subst_tac ctxt false,
  159.77 -    if thin then thin_free_eq_tac else K no_tac];
  159.78 +    if thin then thin_free_eq_tac ctxt else K no_tac];
  159.79  
  159.80  val hyp_subst_thin = Attrib.setup_config_bool @{binding hypsubst_thin} (K false);
  159.81  
  159.82 @@ -242,16 +243,16 @@
  159.83      substitutions in the arguments of a function Var. **)
  159.84  
  159.85  (*final re-reversal of the changed assumptions*)
  159.86 -fun reverse_n_tac 0 i = all_tac
  159.87 -  | reverse_n_tac 1 i = rotate_tac ~1 i
  159.88 -  | reverse_n_tac n i =
  159.89 -      REPEAT_DETERM_N n (rotate_tac ~1 i THEN eresolve_tac [Data.rev_mp] i) THEN
  159.90 -      REPEAT_DETERM_N n (imp_intr_tac i THEN rotate_tac ~1 i);
  159.91 +fun reverse_n_tac _ 0 i = all_tac
  159.92 +  | reverse_n_tac _ 1 i = rotate_tac ~1 i
  159.93 +  | reverse_n_tac ctxt n i =
  159.94 +      REPEAT_DETERM_N n (rotate_tac ~1 i THEN eresolve_tac ctxt [Data.rev_mp] i) THEN
  159.95 +      REPEAT_DETERM_N n (imp_intr_tac ctxt i THEN rotate_tac ~1 i);
  159.96  
  159.97  (*Use imp_intr, comparing the old hyps with the new ones as they come out.*)
  159.98 -fun all_imp_intr_tac hyps i =
  159.99 +fun all_imp_intr_tac ctxt hyps i =
 159.100    let
 159.101 -    fun imptac (r, []) st = reverse_n_tac r i st
 159.102 +    fun imptac (r, []) st = reverse_n_tac ctxt r i st
 159.103        | imptac (r, hyp::hyps) st =
 159.104            let
 159.105              val (hyp', _) =
 159.106 @@ -260,8 +261,8 @@
 159.107                |> Data.dest_Trueprop |> Data.dest_imp;
 159.108              val (r', tac) =
 159.109                if Envir.aeconv (hyp, hyp')
 159.110 -              then (r, imp_intr_tac i THEN rotate_tac ~1 i)
 159.111 -              else (*leave affected hyps at end*) (r + 1, imp_intr_tac i);
 159.112 +              then (r, imp_intr_tac ctxt i THEN rotate_tac ~1 i)
 159.113 +              else (*leave affected hyps at end*) (r + 1, imp_intr_tac ctxt i);
 159.114            in
 159.115              (case Seq.pull (tac st) of
 159.116                NONE => Seq.single st
 159.117 @@ -270,28 +271,29 @@
 159.118    in imptac (0, rev hyps) end;
 159.119  
 159.120  
 159.121 -fun blast_hyp_subst_tac ctxt trace = SUBGOAL(fn (Bi,i) =>
 159.122 -      let val (k, (symopt, _)) = eq_var false false false Bi
 159.123 -          val hyps0 = map Data.dest_Trueprop (Logic.strip_assums_hyp Bi)
 159.124 -          (*omit selected equality, returning other hyps*)
 159.125 -          val hyps = List.take(hyps0, k) @ List.drop(hyps0, k+1)
 159.126 -          val n = length hyps
 159.127 -      in
 159.128 -         if trace then tracing "Substituting an equality" else ();
 159.129 -         DETERM
 159.130 -           (EVERY [REPEAT_DETERM_N k (eresolve_tac [Data.rev_mp] i),
 159.131 -                   rotate_tac 1 i,
 159.132 -                   REPEAT_DETERM_N (n-k) (eresolve_tac [Data.rev_mp] i),
 159.133 -                   inst_subst_tac ctxt symopt (if symopt then ssubst else Data.subst) i,
 159.134 -                   all_imp_intr_tac hyps i])
 159.135 -      end
 159.136 -      handle THM _ => no_tac | EQ_VAR => no_tac);
 159.137 +fun blast_hyp_subst_tac ctxt trace = SUBGOAL(fn (Bi, i) =>
 159.138 +  let
 159.139 +    val (k, (symopt, _)) = eq_var false false false Bi
 159.140 +    val hyps0 = map Data.dest_Trueprop (Logic.strip_assums_hyp Bi)
 159.141 +    (*omit selected equality, returning other hyps*)
 159.142 +    val hyps = List.take(hyps0, k) @ List.drop(hyps0, k+1)
 159.143 +    val n = length hyps
 159.144 +  in
 159.145 +    if trace then tracing "Substituting an equality" else ();
 159.146 +    DETERM
 159.147 +      (EVERY [REPEAT_DETERM_N k (eresolve_tac ctxt [Data.rev_mp] i),
 159.148 +              rotate_tac 1 i,
 159.149 +              REPEAT_DETERM_N (n-k) (eresolve_tac ctxt [Data.rev_mp] i),
 159.150 +              inst_subst_tac ctxt symopt (if symopt then ssubst else Data.subst) i,
 159.151 +              all_imp_intr_tac ctxt hyps i])
 159.152 +  end
 159.153 +  handle THM _ => no_tac | EQ_VAR => no_tac);
 159.154  
 159.155  (*apply an equality or definition ONCE;
 159.156    fails unless the substitution has an effect*)
 159.157 -fun stac th =
 159.158 +fun stac ctxt th =
 159.159    let val th' = th RS Data.rev_eq_reflection handle THM _ => th
 159.160 -  in CHANGED_GOAL (resolve_tac [th' RS ssubst]) end;
 159.161 +  in CHANGED_GOAL (resolve_tac ctxt [th' RS ssubst]) end;
 159.162  
 159.163  
 159.164  (* method setup *)
 159.165 @@ -305,7 +307,8 @@
 159.166        (Scan.succeed (fn ctxt => SIMPLE_METHOD'
 159.167            (CHANGED_PROP o hyp_subst_tac_thin true ctxt)))
 159.168        "substitution using an assumption, eliminating assumptions" #>
 159.169 -    Method.setup @{binding simplesubst} (Attrib.thm >> (fn th => K (SIMPLE_METHOD' (stac th))))
 159.170 +    Method.setup @{binding simplesubst}
 159.171 +      (Attrib.thm >> (fn th => fn ctxt => SIMPLE_METHOD' (stac ctxt th)))
 159.172        "simple substitution");
 159.173  
 159.174  end;
   160.1 --- a/src/Provers/order.ML	Tue Feb 10 14:29:36 2015 +0100
   160.2 +++ b/src/Provers/order.ML	Tue Feb 10 14:48:26 2015 +0100
   160.3 @@ -1241,12 +1241,13 @@
   160.4     val prfs = gen_solve mkconcl thy (lesss, C);
   160.5     val (subgoals, prf) = mkconcl decomp less_thms thy C;
   160.6    in
   160.7 -   Subgoal.FOCUS (fn {prems = asms, ...} =>
   160.8 +   Subgoal.FOCUS (fn {context = ctxt', prems = asms, ...} =>
   160.9       let val thms = map (prove (prems @ asms)) prfs
  160.10 -     in resolve_tac [prove thms prf] 1 end) ctxt n st
  160.11 +     in resolve_tac ctxt' [prove thms prf] 1 end) ctxt n st
  160.12    end
  160.13    handle Contr p =>
  160.14 -      (Subgoal.FOCUS (fn {prems = asms, ...} => resolve_tac [prove asms p] 1) ctxt n st
  160.15 +      (Subgoal.FOCUS (fn {context = ctxt', prems = asms, ...} =>
  160.16 +          resolve_tac ctxt' [prove asms p] 1) ctxt n st
  160.17          handle General.Subscript => Seq.empty)
  160.18     | Cannot => Seq.empty
  160.19     | General.Subscript => Seq.empty)
   161.1 --- a/src/Provers/quantifier1.ML	Tue Feb 10 14:29:36 2015 +0100
   161.2 +++ b/src/Provers/quantifier1.ML	Tue Feb 10 14:48:26 2015 +0100
   161.3 @@ -64,8 +64,8 @@
   161.4  
   161.5  signature QUANTIFIER1 =
   161.6  sig
   161.7 -  val prove_one_point_all_tac: tactic
   161.8 -  val prove_one_point_ex_tac: tactic
   161.9 +  val prove_one_point_all_tac: Proof.context -> tactic
  161.10 +  val prove_one_point_ex_tac: Proof.context -> tactic
  161.11    val rearrange_all: Proof.context -> cterm -> thm option
  161.12    val rearrange_ex: Proof.context -> cterm -> thm option
  161.13    val rearrange_ball: (Proof.context -> tactic) -> Proof.context -> cterm -> thm option
  161.14 @@ -126,10 +126,12 @@
  161.15        yield_singleton (Variable.import_terms true) (Logic.mk_equals tu) ctxt;
  161.16      val thm =
  161.17        Goal.prove ctxt' [] [] goal
  161.18 -        (fn {context = ctxt'', ...} => resolve_tac [Data.iff_reflection] 1 THEN tac ctxt'');
  161.19 +        (fn {context = ctxt'', ...} =>
  161.20 +          resolve_tac ctxt'' [Data.iff_reflection] 1 THEN tac ctxt'');
  161.21    in singleton (Variable.export ctxt' ctxt) thm end;
  161.22  
  161.23 -fun qcomm_tac qcomm qI i = REPEAT_DETERM (resolve_tac [qcomm] i THEN resolve_tac [qI] i);
  161.24 +fun qcomm_tac ctxt qcomm qI i =
  161.25 +  REPEAT_DETERM (resolve_tac ctxt [qcomm] i THEN resolve_tac ctxt [qI] i);
  161.26  
  161.27  (* Proves (? x0..xn. ... & x0 = t & ...) = (? x1..xn x0. x0 = t & ... & ...)
  161.28     Better: instantiate exI
  161.29 @@ -137,11 +139,11 @@
  161.30  local
  161.31    val excomm = Data.ex_comm RS Data.iff_trans;
  161.32  in
  161.33 -  val prove_one_point_ex_tac =
  161.34 -    qcomm_tac excomm Data.iff_exI 1 THEN resolve_tac [Data.iffI] 1 THEN
  161.35 +  fun prove_one_point_ex_tac ctxt =
  161.36 +    qcomm_tac ctxt excomm Data.iff_exI 1 THEN resolve_tac ctxt [Data.iffI] 1 THEN
  161.37      ALLGOALS
  161.38 -      (EVERY' [eresolve_tac [Data.exE], REPEAT_DETERM o eresolve_tac [Data.conjE],
  161.39 -        resolve_tac [Data.exI],
  161.40 +      (EVERY' [eresolve_tac ctxt [Data.exE], REPEAT_DETERM o eresolve_tac ctxt [Data.conjE],
  161.41 +        resolve_tac ctxt [Data.exI],
  161.42          DEPTH_SOLVE_1 o ares_tac [Data.conjI]])
  161.43  end;
  161.44  
  161.45 @@ -149,19 +151,19 @@
  161.46            (! x1..xn x0. x0 = t --> (... & ...) --> P x0)
  161.47  *)
  161.48  local
  161.49 -  val tac =
  161.50 +  fun tac ctxt =
  161.51      SELECT_GOAL
  161.52 -      (EVERY1 [REPEAT o dresolve_tac [Data.uncurry],
  161.53 -        REPEAT o resolve_tac [Data.impI],
  161.54 -        eresolve_tac [Data.mp],
  161.55 -        REPEAT o eresolve_tac [Data.conjE],
  161.56 +      (EVERY1 [REPEAT o dresolve_tac ctxt [Data.uncurry],
  161.57 +        REPEAT o resolve_tac ctxt [Data.impI],
  161.58 +        eresolve_tac ctxt [Data.mp],
  161.59 +        REPEAT o eresolve_tac ctxt [Data.conjE],
  161.60          REPEAT o ares_tac [Data.conjI]]);
  161.61    val allcomm = Data.all_comm RS Data.iff_trans;
  161.62  in
  161.63 -  val prove_one_point_all_tac =
  161.64 -    EVERY1 [qcomm_tac allcomm Data.iff_allI,
  161.65 -      resolve_tac [Data.iff_allI],
  161.66 -      resolve_tac [Data.iffI], tac, tac];
  161.67 +  fun prove_one_point_all_tac ctxt =
  161.68 +    EVERY1 [qcomm_tac ctxt allcomm Data.iff_allI,
  161.69 +      resolve_tac ctxt [Data.iff_allI],
  161.70 +      resolve_tac ctxt [Data.iffI], tac ctxt, tac ctxt];
  161.71  end
  161.72  
  161.73  fun renumber l u (Bound i) =
  161.74 @@ -185,7 +187,7 @@
  161.75          NONE => NONE
  161.76        | SOME (xs, eq, Q) =>
  161.77            let val R = quantify all x T xs (Data.imp $ eq $ Q)
  161.78 -          in SOME (prove_conv ctxt (F, R) (K prove_one_point_all_tac)) end)
  161.79 +          in SOME (prove_conv ctxt (F, R) prove_one_point_all_tac) end)
  161.80    | _ => NONE);
  161.81  
  161.82  fun rearrange_ball tac ctxt ct =
  161.83 @@ -207,7 +209,7 @@
  161.84          NONE => NONE
  161.85        | SOME (xs, eq, Q) =>
  161.86            let val R = quantify ex x T xs (Data.conj $ eq $ Q)
  161.87 -          in SOME (prove_conv ctxt (F, R) (K prove_one_point_ex_tac)) end)
  161.88 +          in SOME (prove_conv ctxt (F, R) prove_one_point_ex_tac) end)
  161.89    | _ => NONE);
  161.90  
  161.91  fun rearrange_bex tac ctxt ct =
   162.1 --- a/src/Provers/quasi.ML	Tue Feb 10 14:29:36 2015 +0100
   162.2 +++ b/src/Provers/quasi.ML	Tue Feb 10 14:48:26 2015 +0100
   162.3 @@ -563,12 +563,14 @@
   162.4  
   162.5    val (subgoal, prf) = mkconcl_trans thy C;
   162.6   in
   162.7 -  Subgoal.FOCUS (fn {prems, ...} =>
   162.8 +  Subgoal.FOCUS (fn {context = ctxt', prems, ...} =>
   162.9      let val thms = map (prove prems) prfs
  162.10 -    in resolve_tac [prove thms prf] 1 end) ctxt n st
  162.11 +    in resolve_tac ctxt' [prove thms prf] 1 end) ctxt n st
  162.12   end
  162.13 - handle Contr p => Subgoal.FOCUS (fn {prems, ...} => resolve_tac [prove prems p] 1) ctxt n st
  162.14 -  | Cannot  => Seq.empty);
  162.15 + handle Contr p =>
  162.16 +    Subgoal.FOCUS (fn {context = ctxt', prems, ...} =>
  162.17 +      resolve_tac ctxt' [prove prems p] 1) ctxt n st
  162.18 +  | Cannot => Seq.empty);
  162.19  
  162.20  
  162.21  (* quasi_tac - solves quasi orders *)
  162.22 @@ -583,13 +585,13 @@
  162.23    val prfs = solveQuasiOrder thy (lesss, C);
  162.24    val (subgoals, prf) = mkconcl_quasi thy C;
  162.25   in
  162.26 -  Subgoal.FOCUS (fn {prems, ...} =>
  162.27 +  Subgoal.FOCUS (fn {context = ctxt', prems, ...} =>
  162.28      let val thms = map (prove prems) prfs
  162.29 -    in resolve_tac [prove thms prf] 1 end) ctxt n st
  162.30 +    in resolve_tac ctxt' [prove thms prf] 1 end) ctxt n st
  162.31   end
  162.32   handle Contr p =>
  162.33 -    (Subgoal.FOCUS (fn {prems, ...} => resolve_tac [prove prems p] 1) ctxt n st
  162.34 -      handle General.Subscript => Seq.empty)
  162.35 +    (Subgoal.FOCUS (fn {context = ctxt', prems, ...} =>
  162.36 +      resolve_tac ctxt' [prove prems p] 1) ctxt n st handle General.Subscript => Seq.empty)
  162.37    | Cannot => Seq.empty
  162.38    | General.Subscript => Seq.empty);
  162.39  
   163.1 --- a/src/Provers/splitter.ML	Tue Feb 10 14:29:36 2015 +0100
   163.2 +++ b/src/Provers/splitter.ML	Tue Feb 10 14:48:26 2015 +0100
   163.3 @@ -99,7 +99,8 @@
   163.4  val lift = Goal.prove_global Pure.thy ["P", "Q", "R"]
   163.5    [Syntax.read_prop_global Pure.thy "!!x :: 'b. Q(x) == R(x) :: 'c"]
   163.6    (Syntax.read_prop_global Pure.thy "P(%x. Q(x)) == P(%x. R(x))")
   163.7 -  (fn {context = ctxt, prems} => rewrite_goals_tac ctxt prems THEN resolve_tac [reflexive_thm] 1)
   163.8 +  (fn {context = ctxt, prems} =>
   163.9 +    rewrite_goals_tac ctxt prems THEN resolve_tac ctxt [reflexive_thm] 1)
  163.10  
  163.11  val _ $ _ $ (_ $ (_ $ abs_lift) $ _) = prop_of lift;
  163.12  
  163.13 @@ -365,11 +366,11 @@
  163.14                     (case apsns of
  163.15                        [] => compose_tac ctxt (false, inst_split Ts t tt thm TB state i, 0) i state
  163.16                      | p::_ => EVERY [lift_tac Ts t p,
  163.17 -                                     resolve_tac [reflexive_thm] (i+1),
  163.18 +                                     resolve_tac ctxt [reflexive_thm] (i+1),
  163.19                                       lift_split_tac] state)
  163.20              end
  163.21    in COND (has_fewer_prems i) no_tac
  163.22 -          (resolve_tac [meta_iffD] i THEN lift_split_tac)
  163.23 +          (resolve_tac ctxt [meta_iffD] i THEN lift_split_tac)
  163.24    end;
  163.25  
  163.26  in (split_tac, exported_split_posns) end;  (* mk_case_split_tac *)
  163.27 @@ -400,16 +401,16 @@
  163.28        (* does not work properly if the split variable is bound by a quantifier *)
  163.29                fun flat_prems_tac i = SUBGOAL (fn (t,i) =>
  163.30                             (if first_prem_is_disj t
  163.31 -                            then EVERY[eresolve_tac [Data.disjE] i, rotate_tac ~1 i,
  163.32 +                            then EVERY[eresolve_tac ctxt [Data.disjE] i, rotate_tac ~1 i,
  163.33                                         rotate_tac ~1  (i+1),
  163.34                                         flat_prems_tac (i+1)]
  163.35                              else all_tac)
  163.36 -                           THEN REPEAT (eresolve_tac [Data.conjE,Data.exE] i)
  163.37 -                           THEN REPEAT (dresolve_tac [Data.notnotD]   i)) i;
  163.38 +                           THEN REPEAT (eresolve_tac ctxt [Data.conjE,Data.exE] i)
  163.39 +                           THEN REPEAT (dresolve_tac ctxt [Data.notnotD]   i)) i;
  163.40            in if n<0 then  no_tac  else (DETERM (EVERY'
  163.41 -                [rotate_tac n, eresolve_tac [Data.contrapos2],
  163.42 +                [rotate_tac n, eresolve_tac ctxt [Data.contrapos2],
  163.43                   split_tac ctxt splits,
  163.44 -                 rotate_tac ~1, eresolve_tac [Data.contrapos], rotate_tac ~1,
  163.45 +                 rotate_tac ~1, eresolve_tac ctxt [Data.contrapos], rotate_tac ~1,
  163.46                   flat_prems_tac] i))
  163.47            end;
  163.48    in SUBGOAL tac
   164.1 --- a/src/Provers/trancl.ML	Tue Feb 10 14:29:36 2015 +0100
   164.2 +++ b/src/Provers/trancl.ML	Tue Feb 10 14:48:26 2015 +0100
   164.3 @@ -541,11 +541,11 @@
   164.4    val prems = flat (map_index (mkasm_trancl rel o swap) Hs);
   164.5    val prfs = solveTrancl (prems, C);
   164.6   in
   164.7 -  Subgoal.FOCUS (fn {prems, concl, ...} =>
   164.8 +  Subgoal.FOCUS (fn {context = ctxt', prems, concl, ...} =>
   164.9      let
  164.10        val SOME (_, _, rel', _) = decomp (term_of concl);
  164.11        val thms = map (prove thy rel' prems) prfs
  164.12 -    in resolve_tac [prove thy rel' thms prf] 1 end) ctxt n st
  164.13 +    in resolve_tac ctxt' [prove thy rel' thms prf] 1 end) ctxt n st
  164.14   end
  164.15   handle Cannot => Seq.empty);
  164.16  
  164.17 @@ -560,11 +560,11 @@
  164.18    val prems = flat (map_index (mkasm_rtrancl rel o swap) Hs);
  164.19    val prfs = solveRtrancl (prems, C);
  164.20   in
  164.21 -  Subgoal.FOCUS (fn {prems, concl, ...} =>
  164.22 +  Subgoal.FOCUS (fn {context = ctxt', prems, concl, ...} =>
  164.23      let
  164.24        val SOME (_, _, rel', _) = decomp (term_of concl);
  164.25        val thms = map (prove thy rel' prems) prfs
  164.26 -    in resolve_tac [prove thy rel' thms prf] 1 end) ctxt n st
  164.27 +    in resolve_tac ctxt' [prove thy rel' thms prf] 1 end) ctxt n st
  164.28   end
  164.29   handle Cannot => Seq.empty | General.Subscript => Seq.empty);
  164.30  
   165.1 --- a/src/Provers/typedsimp.ML	Tue Feb 10 14:29:36 2015 +0100
   165.2 +++ b/src/Provers/typedsimp.ML	Tue Feb 10 14:48:26 2015 +0100
   165.3 @@ -109,16 +109,16 @@
   165.4  (*Single step for conditional rewriting: prove_cond_tac handles new subgoals.*)
   165.5  fun cond_step_tac ctxt (prove_cond_tac, congr_rls, asms) =
   165.6      asm_res_tac ctxt asms   ORELSE'  rewrite_res_tac ctxt  ORELSE'
   165.7 -    (resolve_tac [trans, red_trans]  THEN'  prove_cond_tac)  ORELSE'
   165.8 +    (resolve_tac ctxt [trans, red_trans]  THEN'  prove_cond_tac)  ORELSE'
   165.9      subconv_res_tac ctxt congr_rls;
  165.10  
  165.11  (*Unconditional normalization tactic*)
  165.12  fun norm_tac ctxt arg = REPEAT_FIRST (step_tac ctxt arg)  THEN
  165.13 -    TRYALL (resolve_tac [red_if_equal]);
  165.14 +    TRYALL (resolve_tac ctxt [red_if_equal]);
  165.15  
  165.16  (*Conditional normalization tactic*)
  165.17  fun cond_norm_tac ctxt arg = REPEAT_FIRST (cond_step_tac ctxt arg)  THEN
  165.18 -    TRYALL (resolve_tac [red_if_equal]);
  165.19 +    TRYALL (resolve_tac ctxt [red_if_equal]);
  165.20  
  165.21  end;
  165.22  end;
   166.1 --- a/src/Pure/Isar/class.ML	Tue Feb 10 14:29:36 2015 +0100
   166.2 +++ b/src/Pure/Isar/class.ML	Tue Feb 10 14:48:26 2015 +0100
   166.3 @@ -47,7 +47,7 @@
   166.4      -> morphism -> local_theory -> local_theory
   166.5  
   166.6    (*tactics*)
   166.7 -  val intro_classes_tac: thm list -> tactic
   166.8 +  val intro_classes_tac: Proof.context -> thm list -> tactic
   166.9    val default_intro_tac: Proof.context -> thm list -> tactic
  166.10  
  166.11    (*diagnostics*)
  166.12 @@ -437,7 +437,7 @@
  166.13          (fst o rules thy) sub];
  166.14      val classrel =
  166.15        Goal.prove_sorry_global thy [] [] (Logic.mk_classrel (sub, sup))
  166.16 -        (K (EVERY (map (TRYALL o resolve_tac o single) intros)));
  166.17 +        (fn {context = ctxt, ...} => EVERY (map (TRYALL o resolve_tac ctxt o single) intros));
  166.18      val diff_sort = Sign.complete_sort thy [sup]
  166.19        |> subtract (op =) (Sign.complete_sort thy [sub])
  166.20        |> filter (is_class thy);
  166.21 @@ -702,7 +702,7 @@
  166.22  
  166.23  (** tactics and methods **)
  166.24  
  166.25 -fun intro_classes_tac facts st =
  166.26 +fun intro_classes_tac ctxt facts st =
  166.27    let
  166.28      val thy = Thm.theory_of_thm st;
  166.29      val classes = Sign.all_classes thy;
  166.30 @@ -710,12 +710,12 @@
  166.31      val class_intros = map_filter (try (#intro o Axclass.get_info thy)) classes;
  166.32      val assm_intros = all_assm_intros thy;
  166.33    in
  166.34 -    Method.intros_tac (class_trivs @ class_intros @ assm_intros) facts st
  166.35 +    Method.intros_tac ctxt (class_trivs @ class_intros @ assm_intros) facts st
  166.36    end;
  166.37  
  166.38  fun default_intro_tac ctxt [] =
  166.39        COND Thm.no_prems no_tac
  166.40 -        (intro_classes_tac [] ORELSE Locale.intro_locales_tac true ctxt [])
  166.41 +        (intro_classes_tac ctxt [] ORELSE Locale.intro_locales_tac true ctxt [])
  166.42    | default_intro_tac _ _ = no_tac;
  166.43  
  166.44  fun default_tac rules ctxt facts =
  166.45 @@ -723,7 +723,7 @@
  166.46      default_intro_tac ctxt facts;
  166.47  
  166.48  val _ = Theory.setup
  166.49 - (Method.setup @{binding intro_classes} (Scan.succeed (K (METHOD intro_classes_tac)))
  166.50 + (Method.setup @{binding intro_classes} (Scan.succeed (METHOD o intro_classes_tac))
  166.51      "back-chain introduction rules of classes" #>
  166.52    Method.setup @{binding default} (Attrib.thms >> (METHOD oo default_tac))
  166.53      "apply some intro/elim rule");
   167.1 --- a/src/Pure/Isar/class_declaration.ML	Tue Feb 10 14:29:36 2015 +0100
   167.2 +++ b/src/Pure/Isar/class_declaration.ML	Tue Feb 10 14:48:26 2015 +0100
   167.3 @@ -56,7 +56,7 @@
   167.4          val loc_intro_tac =
   167.5            (case Locale.intros_of thy class of
   167.6              (_, NONE) => all_tac
   167.7 -          | (_, SOME intro) => ALLGOALS (resolve_tac [intro]));
   167.8 +          | (_, SOME intro) => ALLGOALS (resolve_tac empty_ctxt [intro]));
   167.9          val tac = loc_intro_tac
  167.10            THEN ALLGOALS (Proof_Context.fact_tac empty_ctxt (sup_axioms @ the_list assm_axiom));
  167.11        in Element.prove_witness empty_ctxt prop tac end) some_prop;
   168.1 --- a/src/Pure/Isar/element.ML	Tue Feb 10 14:29:36 2015 +0100
   168.2 +++ b/src/Pure/Isar/element.ML	Tue Feb 10 14:48:26 2015 +0100
   168.3 @@ -270,14 +270,14 @@
   168.4    Witness (t,
   168.5      Thm.close_derivation
   168.6        (Goal.prove ctxt [] [] (mark_witness t)
   168.7 -        (fn _ => resolve_tac [Drule.protectI] 1 THEN tac)));
   168.8 +        (fn _ => resolve_tac ctxt [Drule.protectI] 1 THEN tac)));
   168.9  
  168.10  
  168.11  local
  168.12  
  168.13  val refine_witness =
  168.14 -  Proof.refine (Method.Basic (K (NO_CASES o
  168.15 -    K (ALLGOALS (CONJUNCTS (ALLGOALS (CONJUNCTS (TRYALL (resolve_tac [Drule.protectI])))))))));
  168.16 +  Proof.refine (Method.Basic (fn ctxt => NO_CASES o
  168.17 +    K (ALLGOALS (CONJUNCTS (ALLGOALS (CONJUNCTS (TRYALL (resolve_tac ctxt [Drule.protectI]))))))));
  168.18  
  168.19  fun gen_witness_proof proof after_qed wit_propss eq_props =
  168.20    let
   169.1 --- a/src/Pure/Isar/local_defs.ML	Tue Feb 10 14:29:36 2015 +0100
   169.2 +++ b/src/Pure/Isar/local_defs.ML	Tue Feb 10 14:48:26 2015 +0100
   169.3 @@ -225,7 +225,7 @@
   169.4            ALLGOALS
   169.5              (CONVERSION (meta_rewrite_conv ctxt'') THEN'
   169.6                rewrite_goal_tac ctxt'' [def] THEN'
   169.7 -              resolve_tac [Drule.reflexive_thm]))
   169.8 +              resolve_tac ctxt'' [Drule.reflexive_thm]))
   169.9        handle ERROR msg => cat_error msg "Failed to prove definitional specification";
  169.10    in (((c, T), rhs), prove) end;
  169.11  
   170.1 --- a/src/Pure/Isar/locale.ML	Tue Feb 10 14:29:36 2015 +0100
   170.2 +++ b/src/Pure/Isar/locale.ML	Tue Feb 10 14:48:26 2015 +0100
   170.3 @@ -636,7 +636,7 @@
   170.4  (* Tactics *)
   170.5  
   170.6  fun gen_intro_locales_tac intros_tac eager ctxt =
   170.7 -  intros_tac
   170.8 +  intros_tac ctxt
   170.9      (get_witnesses ctxt @ get_intros ctxt @ (if eager then get_unfolds ctxt else []));
  170.10  
  170.11  val intro_locales_tac = gen_intro_locales_tac Method.intros_tac;
   171.1 --- a/src/Pure/Isar/method.ML	Tue Feb 10 14:29:36 2015 +0100
   171.2 +++ b/src/Pure/Isar/method.ML	Tue Feb 10 14:48:26 2015 +0100
   171.3 @@ -23,7 +23,7 @@
   171.4    val unfold: thm list -> Proof.context -> method
   171.5    val fold: thm list -> Proof.context -> method
   171.6    val atomize: bool -> Proof.context -> method
   171.7 -  val this: method
   171.8 +  val this: Proof.context -> method
   171.9    val fact: thm list -> Proof.context -> method
  171.10    val assm_tac: Proof.context -> int -> tactic
  171.11    val all_assm_tac: Proof.context -> tactic
  171.12 @@ -32,8 +32,8 @@
  171.13    val trace: Proof.context -> thm list -> unit
  171.14    val rule_tac: Proof.context -> thm list -> thm list -> int -> tactic
  171.15    val some_rule_tac: Proof.context -> thm list -> thm list -> int -> tactic
  171.16 -  val intros_tac: thm list -> thm list -> tactic
  171.17 -  val try_intros_tac: thm list -> thm list -> tactic
  171.18 +  val intros_tac: Proof.context -> thm list -> thm list -> tactic
  171.19 +  val try_intros_tac: Proof.context -> thm list -> thm list -> tactic
  171.20    val rule: Proof.context -> thm list -> method
  171.21    val erule: Proof.context -> int -> thm list -> method
  171.22    val drule: Proof.context -> int -> thm list -> method
  171.23 @@ -99,7 +99,7 @@
  171.24  local
  171.25  
  171.26  fun cut_rule_tac rule =
  171.27 -  resolve_tac [Drule.forall_intr_vars rule COMP_INCR revcut_rl];
  171.28 +  resolve0_tac [Drule.forall_intr_vars rule COMP_INCR revcut_rl];
  171.29  
  171.30  in
  171.31  
  171.32 @@ -120,7 +120,7 @@
  171.33  
  171.34  fun cheating ctxt int = METHOD (fn _ => fn st =>
  171.35    if int orelse Config.get ctxt quick_and_dirty then
  171.36 -    ALLGOALS Skip_Proof.cheat_tac st
  171.37 +    ALLGOALS (Skip_Proof.cheat_tac ctxt) st
  171.38    else error "Cheating requires quick_and_dirty mode!");
  171.39  
  171.40  
  171.41 @@ -146,7 +146,7 @@
  171.42  
  171.43  (* this -- resolve facts directly *)
  171.44  
  171.45 -val this = METHOD (EVERY o map (HEADGOAL o resolve_tac o single));
  171.46 +fun this ctxt = METHOD (EVERY o map (HEADGOAL o resolve_tac ctxt o single));
  171.47  
  171.48  
  171.49  (* fact -- composition by facts from context *)
  171.50 @@ -159,17 +159,17 @@
  171.51  
  171.52  local
  171.53  
  171.54 -fun cond_rtac cond rule = SUBGOAL (fn (prop, i) =>
  171.55 +fun cond_rtac ctxt cond rule = SUBGOAL (fn (prop, i) =>
  171.56    if cond (Logic.strip_assums_concl prop)
  171.57 -  then resolve_tac [rule] i else no_tac);
  171.58 +  then resolve_tac ctxt [rule] i else no_tac);
  171.59  
  171.60  in
  171.61  
  171.62  fun assm_tac ctxt =
  171.63    assume_tac ctxt APPEND'
  171.64    Goal.assume_rule_tac ctxt APPEND'
  171.65 -  cond_rtac (can Logic.dest_equals) Drule.reflexive_thm APPEND'
  171.66 -  cond_rtac (can Logic.dest_term) Drule.termI;
  171.67 +  cond_rtac ctxt (can Logic.dest_equals) Drule.reflexive_thm APPEND'
  171.68 +  cond_rtac ctxt (can Logic.dest_term) Drule.termI;
  171.69  
  171.70  fun all_assm_tac ctxt =
  171.71    let
  171.72 @@ -180,7 +180,7 @@
  171.73  
  171.74  fun assumption ctxt = METHOD (HEADGOAL o
  171.75    (fn [] => assm_tac ctxt
  171.76 -    | [fact] => solve_tac [fact]
  171.77 +    | [fact] => solve_tac ctxt [fact]
  171.78      | _ => K no_tac));
  171.79  
  171.80  fun finish immed ctxt =
  171.81 @@ -203,9 +203,9 @@
  171.82  
  171.83  fun gen_rule_tac tac ctxt rules facts =
  171.84    (fn i => fn st =>
  171.85 -    if null facts then tac rules i st
  171.86 +    if null facts then tac ctxt rules i st
  171.87      else
  171.88 -      Seq.maps (fn rule => (tac o single) rule i st)
  171.89 +      Seq.maps (fn rule => (tac ctxt o single) rule i st)
  171.90          (Drule.multi_resolves (SOME ctxt) facts rules))
  171.91    THEN_ALL_NEW Goal.norm_hhf_tac ctxt;
  171.92  
  171.93 @@ -238,9 +238,9 @@
  171.94  
  171.95  (* intros_tac -- pervasive search spanned by intro rules *)
  171.96  
  171.97 -fun gen_intros_tac goals intros facts =
  171.98 +fun gen_intros_tac goals ctxt intros facts =
  171.99    goals (insert_tac facts THEN'
 171.100 -      REPEAT_ALL_NEW (resolve_tac intros))
 171.101 +      REPEAT_ALL_NEW (resolve_tac ctxt intros))
 171.102      THEN Tactic.distinct_subgoals_tac;
 171.103  
 171.104  val intros_tac = gen_intros_tac ALLGOALS;
 171.105 @@ -313,7 +313,7 @@
 171.106  fun primitive_text r = Basic (SIMPLE_METHOD o PRIMITIVE o r);
 171.107  val succeed_text = Basic (K succeed);
 171.108  val default_text = Source (Token.src ("default", Position.none) []);
 171.109 -val this_text = Basic (K this);
 171.110 +val this_text = Basic this;
 171.111  val done_text = Basic (K (SIMPLE_METHOD all_tac));
 171.112  fun sorry_text int = Basic (fn ctxt => cheating ctxt int);
 171.113  
 171.114 @@ -603,7 +603,7 @@
 171.115    setup @{binding erule} (xrule_meth erule) "apply rule in elimination manner (improper)" #>
 171.116    setup @{binding drule} (xrule_meth drule) "apply rule in destruct manner (improper)" #>
 171.117    setup @{binding frule} (xrule_meth frule) "apply rule in forward manner (improper)" #>
 171.118 -  setup @{binding this} (Scan.succeed (K this)) "apply current facts as rules" #>
 171.119 +  setup @{binding this} (Scan.succeed this) "apply current facts as rules" #>
 171.120    setup @{binding fact} (Attrib.thms >> fact) "composition by facts from context" #>
 171.121    setup @{binding assumption} (Scan.succeed assumption)
 171.122      "proof by assumption, preferring facts" #>
   172.1 --- a/src/Pure/Isar/proof.ML	Tue Feb 10 14:29:36 2015 +0100
   172.2 +++ b/src/Pure/Isar/proof.ML	Tue Feb 10 14:48:26 2015 +0100
   172.3 @@ -440,12 +440,12 @@
   172.4        Goal.norm_hhf_tac ctxt THEN'
   172.5        SUBGOAL (fn (goal, i) =>
   172.6          if can Logic.unprotect (Logic.strip_assums_concl goal) then
   172.7 -          eresolve_tac [Drule.protectI] i THEN finish_tac ctxt (n - 1) i
   172.8 +          eresolve_tac ctxt [Drule.protectI] i THEN finish_tac ctxt (n - 1) i
   172.9          else finish_tac ctxt (n - 1) (i + 1));
  172.10  
  172.11  fun goal_tac ctxt rule =
  172.12    Goal.norm_hhf_tac ctxt THEN'
  172.13 -  resolve_tac [rule] THEN'
  172.14 +  resolve_tac ctxt [rule] THEN'
  172.15    finish_tac ctxt (Thm.nprems_of rule);
  172.16  
  172.17  fun FINDGOAL tac st =
  172.18 @@ -883,9 +883,9 @@
  172.19    in map (Logic.mk_term o Var) vars end;
  172.20  
  172.21  fun refine_terms n =
  172.22 -  refine (Method.Basic (K (NO_CASES o
  172.23 +  refine (Method.Basic (fn ctxt => NO_CASES o
  172.24      K (HEADGOAL (PRECISE_CONJUNCTS n
  172.25 -      (HEADGOAL (CONJUNCTS (ALLGOALS (resolve_tac [Drule.termI])))))))))
  172.26 +      (HEADGOAL (CONJUNCTS (ALLGOALS (resolve_tac ctxt [Drule.termI]))))))))
  172.27    #> Seq.hd;
  172.28  
  172.29  in
   173.1 --- a/src/Pure/Tools/find_theorems.ML	Tue Feb 10 14:29:36 2015 +0100
   173.2 +++ b/src/Pure/Tools/find_theorems.ML	Tue Feb 10 14:48:26 2015 +0100
   173.3 @@ -188,9 +188,9 @@
   173.4  
   173.5      fun limited_etac thm i =
   173.6        Seq.take (Options.default_int @{system_option find_theorems_tactic_limit}) o
   173.7 -        eresolve_tac [thm] i;
   173.8 +        eresolve_tac ctxt' [thm] i;
   173.9      fun try_thm thm =
  173.10 -      if Thm.no_prems thm then resolve_tac [thm] 1 goal'
  173.11 +      if Thm.no_prems thm then resolve_tac ctxt' [thm] 1 goal'
  173.12        else
  173.13          (limited_etac thm THEN_ALL_NEW (Goal.norm_hhf_tac ctxt' THEN' Method.assm_tac ctxt'))
  173.14            1 goal';
   174.1 --- a/src/Pure/Tools/rule_insts.ML	Tue Feb 10 14:29:36 2015 +0100
   174.2 +++ b/src/Pure/Tools/rule_insts.ML	Tue Feb 10 14:48:26 2015 +0100
   174.3 @@ -338,13 +338,13 @@
   174.4  (*warning: rule_tac etc. refer to dynamic subgoal context!*)
   174.5  
   174.6  val _ = Theory.setup
   174.7 - (Method.setup @{binding rule_tac} (method res_inst_tac (K resolve_tac))
   174.8 + (Method.setup @{binding rule_tac} (method res_inst_tac resolve_tac)
   174.9      "apply rule (dynamic instantiation)" #>
  174.10 -  Method.setup @{binding erule_tac} (method eres_inst_tac (K eresolve_tac))
  174.11 +  Method.setup @{binding erule_tac} (method eres_inst_tac eresolve_tac)
  174.12      "apply rule in elimination manner (dynamic instantiation)" #>
  174.13 -  Method.setup @{binding drule_tac} (method dres_inst_tac (K dresolve_tac))
  174.14 +  Method.setup @{binding drule_tac} (method dres_inst_tac dresolve_tac)
  174.15      "apply rule in destruct manner (dynamic instantiation)" #>
  174.16 -  Method.setup @{binding frule_tac} (method forw_inst_tac (K forward_tac))
  174.17 +  Method.setup @{binding frule_tac} (method forw_inst_tac forward_tac)
  174.18      "apply rule in forward manner (dynamic instantiation)" #>
  174.19    Method.setup @{binding cut_tac} (method cut_inst_tac (K cut_rules_tac))
  174.20      "cut rule (dynamic instantiation)" #>
   175.1 --- a/src/Pure/goal.ML	Tue Feb 10 14:29:36 2015 +0100
   175.2 +++ b/src/Pure/goal.ML	Tue Feb 10 14:48:26 2015 +0100
   175.3 @@ -205,7 +205,7 @@
   175.4      val stmt = Thm.weaken_sorts sorts (Conjunction.mk_conjunction_balanced cprops);
   175.5  
   175.6      fun tac' args st =
   175.7 -      if skip then ALLGOALS Skip_Proof.cheat_tac st before Skip_Proof.report ctxt
   175.8 +      if skip then ALLGOALS (Skip_Proof.cheat_tac ctxt) st before Skip_Proof.report ctxt
   175.9        else tac args st;
  175.10      fun result () =
  175.11        (case SINGLE (tac' {prems = prems, context = ctxt'}) (init stmt) of
  175.12 @@ -255,7 +255,7 @@
  175.13  
  175.14  fun prove_sorry ctxt xs asms prop tac =
  175.15    if Config.get ctxt quick_and_dirty then
  175.16 -    prove ctxt xs asms prop (fn _ => ALLGOALS Skip_Proof.cheat_tac)
  175.17 +    prove ctxt xs asms prop (fn _ => ALLGOALS (Skip_Proof.cheat_tac ctxt))
  175.18    else (if future_enabled 1 then prove_future_pri ~2 else prove) ctxt xs asms prop tac;
  175.19  
  175.20  fun prove_sorry_global thy xs asms prop tac =
  175.21 @@ -294,7 +294,7 @@
  175.22  
  175.23  val adhoc_conjunction_tac = REPEAT_ALL_NEW
  175.24    (SUBGOAL (fn (goal, i) =>
  175.25 -    if can Logic.dest_conjunction goal then resolve_tac [Conjunction.conjunctionI] i
  175.26 +    if can Logic.dest_conjunction goal then resolve0_tac [Conjunction.conjunctionI] i
  175.27      else no_tac));
  175.28  
  175.29  val conjunction_tac = SUBGOAL (fn (goal, i) =>
  175.30 @@ -318,7 +318,7 @@
  175.31  (* hhf normal form *)
  175.32  
  175.33  fun norm_hhf_tac ctxt =
  175.34 -  resolve_tac [Drule.asm_rl]  (*cheap approximation -- thanks to builtin Logic.flatten_params*)
  175.35 +  resolve_tac ctxt [Drule.asm_rl]  (*cheap approximation -- thanks to builtin Logic.flatten_params*)
  175.36    THEN' SUBGOAL (fn (t, i) =>
  175.37      if Drule.is_norm_hhf t then all_tac
  175.38      else rewrite_goal_tac ctxt Drule.norm_hhf_eqs i);
  175.39 @@ -336,7 +336,7 @@
  175.40      val goal'' = Drule.cterm_rule (singleton (Variable.export ctxt' ctxt)) goal';
  175.41      val Rs = filter (non_atomic o Thm.term_of) (Drule.strip_imp_prems goal'');
  175.42      val tacs = Rs |> map (fn R =>
  175.43 -      eresolve_tac [Raw_Simplifier.norm_hhf ctxt (Thm.trivial R)] THEN_ALL_NEW assume_tac ctxt);
  175.44 +      eresolve_tac ctxt [Raw_Simplifier.norm_hhf ctxt (Thm.trivial R)] THEN_ALL_NEW assume_tac ctxt);
  175.45    in fold_rev (curry op APPEND') tacs (K no_tac) i end);
  175.46  
  175.47  end;
   176.1 --- a/src/Pure/raw_simplifier.ML	Tue Feb 10 14:29:36 2015 +0100
   176.2 +++ b/src/Pure/raw_simplifier.ML	Tue Feb 10 14:48:26 2015 +0100
   176.3 @@ -1309,7 +1309,7 @@
   176.4    in bottomc (mode, Option.map (Drule.flexflex_unique (SOME ctxt)) oo prover, maxidx) ctxt ct end;
   176.5  
   176.6  val simple_prover =
   176.7 -  SINGLE o (fn ctxt => ALLGOALS (resolve_tac (prems_of ctxt)));
   176.8 +  SINGLE o (fn ctxt => ALLGOALS (resolve_tac ctxt (prems_of ctxt)));
   176.9  
  176.10  fun rewrite _ _ [] = Thm.reflexive
  176.11    | rewrite ctxt full thms =
   177.1 --- a/src/Pure/simplifier.ML	Tue Feb 10 14:29:36 2015 +0100
   177.2 +++ b/src/Pure/simplifier.ML	Tue Feb 10 14:48:26 2015 +0100
   177.3 @@ -384,7 +384,7 @@
   177.4      val trivialities = Drule.reflexive_thm :: trivs;
   177.5  
   177.6      fun unsafe_solver_tac ctxt =
   177.7 -      FIRST' [resolve_tac (trivialities @ Raw_Simplifier.prems_of ctxt), assume_tac ctxt];
   177.8 +      FIRST' [resolve_tac ctxt (trivialities @ Raw_Simplifier.prems_of ctxt), assume_tac ctxt];
   177.9      val unsafe_solver = mk_solver "easy unsafe" unsafe_solver_tac;
  177.10  
  177.11      (*no premature instantiation of variables during simplification*)
   178.1 --- a/src/Pure/skip_proof.ML	Tue Feb 10 14:29:36 2015 +0100
   178.2 +++ b/src/Pure/skip_proof.ML	Tue Feb 10 14:48:26 2015 +0100
   178.3 @@ -12,7 +12,7 @@
   178.4    val report: Proof.context -> unit
   178.5    val make_thm_cterm: cterm -> thm
   178.6    val make_thm: theory -> term -> thm
   178.7 -  val cheat_tac: int -> tactic
   178.8 +  val cheat_tac: Proof.context -> int -> tactic
   178.9  end;
  178.10  
  178.11  structure Skip_Proof: SKIP_PROOF =
  178.12 @@ -37,7 +37,7 @@
  178.13  
  178.14  (* cheat_tac *)
  178.15  
  178.16 -fun cheat_tac i st =
  178.17 -  resolve_tac [make_thm (Thm.theory_of_thm st) (Var (("A", 0), propT))] i st;
  178.18 +fun cheat_tac ctxt i st =
  178.19 +  resolve_tac ctxt [make_thm (Thm.theory_of_thm st) (Var (("A", 0), propT))] i st;
  178.20  
  178.21  end;
   179.1 --- a/src/Pure/tactic.ML	Tue Feb 10 14:29:36 2015 +0100
   179.2 +++ b/src/Pure/tactic.ML	Tue Feb 10 14:48:26 2015 +0100
   179.3 @@ -12,18 +12,23 @@
   179.4    val eq_assume_tac: int -> tactic
   179.5    val compose_tac: Proof.context -> (bool * thm * int) -> int -> tactic
   179.6    val make_elim: thm -> thm
   179.7 -  val biresolve_tac: (bool * thm) list -> int -> tactic
   179.8 -  val resolve_tac: thm list -> int -> tactic
   179.9 -  val eresolve_tac: thm list -> int -> tactic
  179.10 -  val forward_tac: thm list -> int -> tactic
  179.11 -  val dresolve_tac: thm list -> int -> tactic
  179.12 +  val biresolve0_tac: (bool * thm) list -> int -> tactic
  179.13 +  val biresolve_tac: Proof.context -> (bool * thm) list -> int -> tactic
  179.14 +  val resolve0_tac: thm list -> int -> tactic
  179.15 +  val resolve_tac: Proof.context -> thm list -> int -> tactic
  179.16 +  val eresolve0_tac: thm list -> int -> tactic
  179.17 +  val eresolve_tac: Proof.context -> thm list -> int -> tactic
  179.18 +  val forward0_tac: thm list -> int -> tactic
  179.19 +  val forward_tac: Proof.context -> thm list -> int -> tactic
  179.20 +  val dresolve0_tac: thm list -> int -> tactic
  179.21 +  val dresolve_tac: Proof.context -> thm list -> int -> tactic
  179.22    val atac: int -> tactic
  179.23    val rtac: thm -> int -> tactic
  179.24    val dtac: thm -> int -> tactic
  179.25    val etac: thm -> int -> tactic
  179.26    val ftac: thm -> int -> tactic
  179.27    val ares_tac: thm list -> int -> tactic
  179.28 -  val solve_tac: thm list -> int -> tactic
  179.29 +  val solve_tac: Proof.context -> thm list -> int -> tactic
  179.30    val bimatch_tac: Proof.context -> (bool * thm) list -> int -> tactic
  179.31    val match_tac: Proof.context -> thm list -> int -> tactic
  179.32    val ematch_tac: Proof.context -> thm list -> int -> tactic
  179.33 @@ -50,7 +55,7 @@
  179.34    val rotate_tac: int -> int -> tactic
  179.35    val defer_tac: int -> tactic
  179.36    val prefer_tac: int -> tactic
  179.37 -  val filter_prems_tac: (term -> bool) -> int -> tactic
  179.38 +  val filter_prems_tac: Proof.context -> (term -> bool) -> int -> tactic
  179.39  end;
  179.40  
  179.41  signature TACTIC =
  179.42 @@ -114,30 +119,35 @@
  179.43  fun make_elim rl = zero_var_indexes (rl RS revcut_rl);
  179.44  
  179.45  (*Attack subgoal i by resolution, using flags to indicate elimination rules*)
  179.46 -fun biresolve_tac brules i = PRIMSEQ (Thm.biresolution NONE false brules i);
  179.47 +fun biresolve0_tac brules i = PRIMSEQ (Thm.biresolution NONE false brules i);
  179.48 +fun biresolve_tac ctxt brules i = PRIMSEQ (Thm.biresolution (SOME ctxt) false brules i);
  179.49  
  179.50  (*Resolution: the simple case, works for introduction rules*)
  179.51 -fun resolve_tac rules = biresolve_tac (map (pair false) rules);
  179.52 +fun resolve0_tac rules = biresolve0_tac (map (pair false) rules);
  179.53 +fun resolve_tac ctxt rules = biresolve_tac ctxt (map (pair false) rules);
  179.54  
  179.55  (*Resolution with elimination rules only*)
  179.56 -fun eresolve_tac rules = biresolve_tac (map (pair true) rules);
  179.57 +fun eresolve0_tac rules = biresolve0_tac (map (pair true) rules);
  179.58 +fun eresolve_tac ctxt rules = biresolve_tac ctxt (map (pair true) rules);
  179.59  
  179.60  (*Forward reasoning using destruction rules.*)
  179.61 -fun forward_tac rls = resolve_tac (map make_elim rls) THEN' atac;
  179.62 +fun forward0_tac rls = resolve0_tac (map make_elim rls) THEN' atac;
  179.63 +fun forward_tac ctxt rls = resolve_tac ctxt (map make_elim rls) THEN' atac;
  179.64  
  179.65  (*Like forward_tac, but deletes the assumption after use.*)
  179.66 -fun dresolve_tac rls = eresolve_tac (map make_elim rls);
  179.67 +fun dresolve0_tac rls = eresolve0_tac (map make_elim rls);
  179.68 +fun dresolve_tac ctxt rls = eresolve_tac ctxt (map make_elim rls);
  179.69  
  179.70  (*Shorthand versions: for resolution with a single theorem*)
  179.71 -fun rtac rl =  resolve_tac [rl];
  179.72 -fun dtac rl = dresolve_tac [rl];
  179.73 -fun etac rl = eresolve_tac [rl];
  179.74 -fun ftac rl =  forward_tac [rl];
  179.75 +fun rtac rl =  resolve0_tac [rl];
  179.76 +fun dtac rl = dresolve0_tac [rl];
  179.77 +fun etac rl = eresolve0_tac [rl];
  179.78 +fun ftac rl =  forward0_tac [rl];
  179.79  
  179.80  (*Use an assumption or some rules ... A popular combination!*)
  179.81 -fun ares_tac rules = atac  ORELSE'  resolve_tac rules;
  179.82 +fun ares_tac rules = atac  ORELSE'  resolve0_tac rules;
  179.83  
  179.84 -fun solve_tac rules = resolve_tac rules THEN_ALL_NEW atac;
  179.85 +fun solve_tac ctxt rules = resolve_tac ctxt rules THEN_ALL_NEW assume_tac ctxt;
  179.86  
  179.87  (*Matching tactics -- as above, but forbid updating of state*)
  179.88  fun bimatch_tac ctxt brules i = PRIMSEQ (Thm.biresolution (SOME ctxt) true brules i);
  179.89 @@ -175,7 +185,7 @@
  179.90  
  179.91  (*The conclusion of the rule gets assumed in subgoal i,
  179.92    while subgoal i+1,... are the premises of the rule.*)
  179.93 -fun cut_tac rule i = resolve_tac [cut_rl] i THEN resolve_tac [rule] (i + 1);
  179.94 +fun cut_tac rule i = resolve0_tac [cut_rl] i THEN resolve0_tac [rule] (i + 1);
  179.95  
  179.96  (*"Cut" a list of rules into the goal.  Their premises will become new
  179.97    subgoals.*)
  179.98 @@ -300,12 +310,12 @@
  179.99  fun prefer_tac i = PRIMITIVE (Thm.permute_prems (i - 1) 1 #> Thm.permute_prems 0 ~1);
 179.100  
 179.101  (* remove premises that do not satisfy p; fails if all prems satisfy p *)
 179.102 -fun filter_prems_tac p =
 179.103 +fun filter_prems_tac ctxt p =
 179.104    let fun Then NONE tac = SOME tac
 179.105          | Then (SOME tac) tac' = SOME(tac THEN' tac');
 179.106        fun thins H (tac,n) =
 179.107          if p H then (tac,n+1)
 179.108 -        else (Then tac (rotate_tac n THEN' eresolve_tac [thin_rl]),0);
 179.109 +        else (Then tac (rotate_tac n THEN' eresolve_tac ctxt [thin_rl]),0);
 179.110    in SUBGOAL(fn (subg,n) =>
 179.111         let val Hs = Logic.strip_assums_hyp subg
 179.112         in case fst(fold thins Hs (NONE,0)) of
   180.1 --- a/src/Sequents/LK.thy	Tue Feb 10 14:29:36 2015 +0100
   180.2 +++ b/src/Sequents/LK.thy	Tue Feb 10 14:48:26 2015 +0100
   180.3 @@ -180,7 +180,7 @@
   180.4     apply (tactic {*
   180.5       REPEAT (rtac @{thm cut} 1 THEN
   180.6         DEPTH_SOLVE_1
   180.7 -         (resolve_tac [@{thm thinL}, @{thm thinR}, @{thm p2} COMP @{thm monotonic}] 1) THEN
   180.8 +         (resolve_tac @{context} [@{thm thinL}, @{thm thinR}, @{thm p2} COMP @{thm monotonic}] 1) THEN
   180.9             Cla.safe_tac @{context} 1) *})
  180.10    done
  180.11  
  180.12 @@ -193,7 +193,7 @@
  180.13     apply (tactic {*
  180.14       REPEAT (rtac @{thm cut} 1 THEN
  180.15         DEPTH_SOLVE_1
  180.16 -         (resolve_tac [@{thm thinL}, @{thm thinR}, @{thm p2} COMP @{thm monotonic}] 1) THEN
  180.17 +         (resolve_tac @{context} [@{thm thinL}, @{thm thinR}, @{thm p2} COMP @{thm monotonic}] 1) THEN
  180.18             Cla.safe_tac @{context} 1) *})
  180.19    done
  180.20  
   181.1 --- a/src/Sequents/modal.ML	Tue Feb 10 14:29:36 2015 +0100
   181.2 +++ b/src/Sequents/modal.ML	Tue Feb 10 14:48:26 2015 +0100
   181.3 @@ -50,22 +50,22 @@
   181.4  (*Like filt_resolve_tac, using could_resolve_seq
   181.5    Much faster than resolve_tac when there are many rules.
   181.6    Resolve subgoal i using the rules, unless more than maxr are compatible. *)
   181.7 -fun filseq_resolve_tac rules maxr = SUBGOAL(fn (prem,i) =>
   181.8 +fun filseq_resolve_tac ctxt rules maxr = SUBGOAL(fn (prem,i) =>
   181.9    let val rls = filter_thms could_resolve_seq (maxr+1, prem, rules)
  181.10 -  in  if length rls > maxr  then  no_tac  else resolve_tac rls i
  181.11 +  in  if length rls > maxr  then  no_tac  else resolve_tac ctxt rls i
  181.12    end);
  181.13  
  181.14 -fun fresolve_tac rls n = filseq_resolve_tac rls 999 n;
  181.15 +fun fresolve_tac ctxt rls n = filseq_resolve_tac ctxt rls 999 n;
  181.16  
  181.17  (* NB No back tracking possible with aside rules *)
  181.18  
  181.19  val aside_net = Tactic.build_net Modal_Rule.aside_rls;
  181.20  fun aside_tac ctxt n = DETERM (REPEAT (filt_resolve_from_net_tac ctxt 999 aside_net n));
  181.21 -fun rule_tac ctxt rls n = fresolve_tac rls n THEN aside_tac ctxt n;
  181.22 +fun rule_tac ctxt rls n = fresolve_tac ctxt rls n THEN aside_tac ctxt n;
  181.23  
  181.24 -val fres_safe_tac = fresolve_tac Modal_Rule.safe_rls;
  181.25 -fun fres_unsafe_tac ctxt = fresolve_tac Modal_Rule.unsafe_rls THEN' aside_tac ctxt;
  181.26 -val fres_bound_tac = fresolve_tac Modal_Rule.bound_rls;
  181.27 +fun fres_safe_tac ctxt = fresolve_tac ctxt Modal_Rule.safe_rls;
  181.28 +fun fres_unsafe_tac ctxt = fresolve_tac ctxt Modal_Rule.unsafe_rls THEN' aside_tac ctxt;
  181.29 +fun fres_bound_tac ctxt = fresolve_tac ctxt Modal_Rule.bound_rls;
  181.30  
  181.31  fun UPTOGOAL n tf = let fun tac i = if i<n then all_tac
  181.32                                      else tf(i) THEN tac(i-1)
  181.33 @@ -75,16 +75,16 @@
  181.34  fun solven_tac ctxt d n st = st |>
  181.35   (if d < 0 then no_tac
  181.36    else if nprems_of st = 0 then all_tac
  181.37 -  else (DETERM(fres_safe_tac n) THEN UPTOGOAL n (solven_tac ctxt d)) ORELSE
  181.38 +  else (DETERM(fres_safe_tac ctxt n) THEN UPTOGOAL n (solven_tac ctxt d)) ORELSE
  181.39             ((fres_unsafe_tac ctxt n  THEN UPTOGOAL n (solven_tac ctxt d)) APPEND
  181.40 -             (fres_bound_tac n  THEN UPTOGOAL n (solven_tac ctxt (d - 1)))));
  181.41 +             (fres_bound_tac ctxt n  THEN UPTOGOAL n (solven_tac ctxt (d - 1)))));
  181.42  
  181.43  fun solve_tac ctxt d =
  181.44    rewrite_goals_tac ctxt Modal_Rule.rewrite_rls THEN solven_tac ctxt d 1;
  181.45  
  181.46  fun step_tac ctxt n =
  181.47    COND (has_fewer_prems 1) all_tac
  181.48 -       (DETERM(fres_safe_tac n) ORELSE
  181.49 -        (fres_unsafe_tac ctxt n APPEND fres_bound_tac n));
  181.50 +       (DETERM(fres_safe_tac ctxt n) ORELSE
  181.51 +        (fres_unsafe_tac ctxt n APPEND fres_bound_tac ctxt n));
  181.52  
  181.53  end;
   182.1 --- a/src/Sequents/prover.ML	Tue Feb 10 14:29:36 2015 +0100
   182.2 +++ b/src/Sequents/prover.ML	Tue Feb 10 14:48:26 2015 +0100
   182.3 @@ -146,13 +146,13 @@
   182.4  (*Like filt_resolve_tac, using could_resolve_seq
   182.5    Much faster than resolve_tac when there are many rules.
   182.6    Resolve subgoal i using the rules, unless more than maxr are compatible. *)
   182.7 -fun filseq_resolve_tac rules maxr = SUBGOAL(fn (prem,i) =>
   182.8 +fun filseq_resolve_tac ctxt rules maxr = SUBGOAL(fn (prem,i) =>
   182.9    let val rls = filter_thms could_resolve_seq (maxr+1, prem, rules)
  182.10    in  if length rls > maxr  then  no_tac
  182.11            else (*((rtac derelict 1 THEN rtac impl 1
  182.12                   THEN (rtac identity 2 ORELSE rtac ll_mp 2)
  182.13                   THEN rtac context1 1)
  182.14 -                 ORELSE *) resolve_tac rls i
  182.15 +                 ORELSE *) resolve_tac ctxt rls i
  182.16    end);
  182.17  
  182.18  
  182.19 @@ -170,23 +170,23 @@
  182.20    The abstraction over state prevents needless divergence in recursion.
  182.21    The 9999 should be a parameter, to delay treatment of flexible goals. *)
  182.22  
  182.23 -fun RESOLVE_THEN rules =
  182.24 +fun RESOLVE_THEN ctxt rules =
  182.25    let val [rls0,rls1,rls2] = partition_list has_prems 0 2 rules;
  182.26        fun tac nextac i state = state |>
  182.27 -             (filseq_resolve_tac rls0 9999 i
  182.28 +             (filseq_resolve_tac ctxt rls0 9999 i
  182.29                ORELSE
  182.30 -              (DETERM(filseq_resolve_tac rls1 9999 i) THEN  TRY(nextac i))
  182.31 +              (DETERM(filseq_resolve_tac ctxt rls1 9999 i) THEN  TRY(nextac i))
  182.32                ORELSE
  182.33 -              (DETERM(filseq_resolve_tac rls2 9999 i) THEN  TRY(nextac(i+1))
  182.34 +              (DETERM(filseq_resolve_tac ctxt rls2 9999 i) THEN  TRY(nextac(i+1))
  182.35                                              THEN  TRY(nextac i)))
  182.36    in  tac  end;
  182.37  
  182.38  
  182.39  
  182.40  (*repeated resolution applied to the designated goal*)
  182.41 -fun reresolve_tac rules =
  182.42 +fun reresolve_tac ctxt rules =
  182.43    let
  182.44 -    val restac = RESOLVE_THEN rules;  (*preprocessing done now*)
  182.45 +    val restac = RESOLVE_THEN ctxt rules;  (*preprocessing done now*)
  182.46      fun gtac i = restac gtac i;
  182.47    in gtac end;
  182.48  
  182.49 @@ -194,8 +194,8 @@
  182.50  fun repeat_goal_tac ctxt =
  182.51    let
  182.52      val (safes, unsafes) = get_rules ctxt;
  182.53 -    val restac = RESOLVE_THEN safes;
  182.54 -    val lastrestac = RESOLVE_THEN unsafes;
  182.55 +    val restac = RESOLVE_THEN ctxt safes;
  182.56 +    val lastrestac = RESOLVE_THEN ctxt unsafes;
  182.57      fun gtac i =
  182.58        restac gtac i ORELSE
  182.59         (if Config.get ctxt trace then print_tac ctxt "" THEN lastrestac gtac i
  182.60 @@ -204,11 +204,11 @@
  182.61  
  182.62  
  182.63  (*Tries safe rules only*)
  182.64 -fun safe_tac ctxt = reresolve_tac (#1 (get_rules ctxt));
  182.65 +fun safe_tac ctxt = reresolve_tac ctxt (#1 (get_rules ctxt));
  182.66  
  182.67  (*Tries a safe rule or else a unsafe rule.  Single-step for tracing. *)
  182.68  fun step_tac ctxt =
  182.69 -  safe_tac ctxt ORELSE' filseq_resolve_tac (#2 (get_rules ctxt)) 9999;
  182.70 +  safe_tac ctxt ORELSE' filseq_resolve_tac ctxt (#2 (get_rules ctxt)) 9999;
  182.71  
  182.72  
  182.73  (* Tactic for reducing a goal, using Predicate Calculus rules.
   183.1 --- a/src/Sequents/simpdata.ML	Tue Feb 10 14:29:36 2015 +0100
   183.2 +++ b/src/Sequents/simpdata.ML	Tue Feb 10 14:48:26 2015 +0100
   183.3 @@ -43,7 +43,7 @@
   183.4  (*Replace premises x=y, X<->Y by X==Y*)
   183.5  fun mk_meta_prems ctxt =
   183.6      rule_by_tactic ctxt
   183.7 -      (REPEAT_FIRST (resolve_tac [@{thm meta_eq_to_obj_eq}, @{thm def_imp_iff}]));
   183.8 +      (REPEAT_FIRST (resolve_tac ctxt [@{thm meta_eq_to_obj_eq}, @{thm def_imp_iff}]));
   183.9  
  183.10  (*Congruence rules for = or <-> (instead of ==)*)
  183.11  fun mk_meta_cong ctxt rl =
  183.12 @@ -58,7 +58,7 @@
  183.13    @{thm iff_refl}, reflexive_thm];
  183.14  
  183.15  fun unsafe_solver ctxt =
  183.16 -  FIRST' [resolve_tac (triv_rls @ Simplifier.prems_of ctxt), assume_tac ctxt];
  183.17 +  FIRST' [resolve_tac ctxt (triv_rls @ Simplifier.prems_of ctxt), assume_tac ctxt];
  183.18  
  183.19  (*No premature instantiation of variables during simplification*)
  183.20  fun safe_solver ctxt =
   184.1 --- a/src/Tools/case_product.ML	Tue Feb 10 14:29:36 2015 +0100
   184.2 +++ b/src/Tools/case_product.ML	Tue Feb 10 14:48:26 2015 +0100
   184.3 @@ -70,9 +70,10 @@
   184.4      val (p_cons1 :: p_cons2 :: premss) = unflat struc prems
   184.5      val thm2' = thm2 OF p_cons2
   184.6    in
   184.7 -    resolve_tac [thm1 OF p_cons1]
   184.8 +    resolve_tac ctxt [thm1 OF p_cons1]
   184.9       THEN' EVERY' (map (fn p =>
  184.10 -       resolve_tac [thm2'] THEN' EVERY' (map (Proof_Context.fact_tac ctxt o single) p)) premss)
  184.11 +       resolve_tac ctxt [thm2'] THEN'
  184.12 +       EVERY' (map (Proof_Context.fact_tac ctxt o single) p)) premss)
  184.13    end
  184.14  
  184.15  fun combine ctxt thm1 thm2 =
   185.1 --- a/src/Tools/coherent.ML	Tue Feb 10 14:29:36 2015 +0100
   185.2 +++ b/src/Tools/coherent.ML	Tue Feb 10 14:48:26 2015 +0100
   185.3 @@ -215,7 +215,7 @@
   185.4  (** external interface **)
   185.5  
   185.6  fun coherent_tac ctxt rules = SUBPROOF (fn {prems, concl, params, context = ctxt', ...} =>
   185.7 -  resolve_tac [rulify_elim_conv ctxt' concl RS Drule.equal_elim_rule2] 1 THEN
   185.8 +  resolve_tac ctxt' [rulify_elim_conv ctxt' concl RS Drule.equal_elim_rule2] 1 THEN
   185.9    SUBPROOF (fn {prems = prems', concl, context = ctxt'', ...} =>
  185.10      let
  185.11        val xs =
  185.12 @@ -227,7 +227,7 @@
  185.13          valid ctxt'' (map (mk_rule ctxt'') (prems' @ prems @ rules)) (term_of concl)
  185.14            (mk_dom xs) Net.empty 0 0 of
  185.15          NONE => no_tac
  185.16 -      | SOME prf => resolve_tac [thm_of_cl_prf ctxt'' concl [] prf] 1)
  185.17 +      | SOME prf => resolve_tac ctxt'' [thm_of_cl_prf ctxt'' concl [] prf] 1)
  185.18      end) ctxt' 1) ctxt;
  185.19  
  185.20  val _ = Theory.setup
   186.1 --- a/src/Tools/eqsubst.ML	Tue Feb 10 14:29:36 2015 +0100
   186.2 +++ b/src/Tools/eqsubst.ML	Tue Feb 10 14:48:26 2015 +0100
   186.3 @@ -250,7 +250,7 @@
   186.4    RW_Inst.rw ctxt m rule conclthm
   186.5    |> unfix_frees cfvs
   186.6    |> Conv.fconv_rule Drule.beta_eta_conversion
   186.7 -  |> (fn r => resolve_tac [r] i st);
   186.8 +  |> (fn r => resolve_tac ctxt [r] i st);
   186.9  
  186.10  (* substitute within the conclusion of goal i of gth, using a meta
  186.11  equation rule. Note that we assume rule has var indicies zero'd *)
  186.12 @@ -332,7 +332,8 @@
  186.13        |> Conv.fconv_rule Drule.beta_eta_conversion; (* normal form *)
  186.14    in
  186.15      (* ~j because new asm starts at back, thus we subtract 1 *)
  186.16 -    Seq.map (Thm.rotate_rule (~ j) (Thm.nprems_of rule + i)) (dresolve_tac [preelimrule] i st2)
  186.17 +    Seq.map (Thm.rotate_rule (~ j) (Thm.nprems_of rule + i))
  186.18 +      (dresolve_tac ctxt [preelimrule] i st2)
  186.19    end;
  186.20  
  186.21  
   187.1 --- a/src/Tools/induct.ML	Tue Feb 10 14:29:36 2015 +0100
   187.2 +++ b/src/Tools/induct.ML	Tue Feb 10 14:48:26 2015 +0100
   187.3 @@ -507,7 +507,7 @@
   187.4          in
   187.5            CASES (Rule_Cases.make_common (thy,
   187.6                Thm.prop_of (Rule_Cases.internalize_params rule')) cases)
   187.7 -            ((Method.insert_tac more_facts THEN' resolve_tac [rule'] THEN_ALL_NEW
   187.8 +            ((Method.insert_tac more_facts THEN' resolve_tac ctxt [rule'] THEN_ALL_NEW
   187.9                  (if simp then TRY o trivial_tac ctxt else K all_tac)) i) st
  187.10          end)
  187.11    end;
  187.12 @@ -680,7 +680,7 @@
  187.13      (case goal_concl n [] goal of
  187.14        SOME concl =>
  187.15          (compose_tac ctxt (false, spec_rule (goal_prefix n goal) concl, 1) THEN'
  187.16 -          resolve_tac [asm_rl]) i
  187.17 +          resolve_tac ctxt [asm_rl]) i
  187.18      | NONE => all_tac)
  187.19    end);
  187.20  
  187.21 @@ -801,7 +801,7 @@
  187.22                |> Seq.map (rule_instance ctxt (burrow_options (Variable.polymorphic ctxt) taking))
  187.23                |> Seq.maps (fn rule' =>
  187.24                  CASES (rule_cases ctxt rule' cases)
  187.25 -                  (resolve_tac [rule'] i THEN
  187.26 +                  (resolve_tac ctxt [rule'] i THEN
  187.27                      PRIMITIVE (singleton (Proof_Context.export defs_ctxt ctxt))) st')))
  187.28        end)
  187.29        THEN_ALL_NEW_CASES
  187.30 @@ -859,7 +859,7 @@
  187.31          |> Seq.maps (fn rule' =>
  187.32            CASES (Rule_Cases.make_common (thy,
  187.33                Thm.prop_of (Rule_Cases.internalize_params rule')) cases)
  187.34 -            (Method.insert_tac more_facts i THEN resolve_tac [rule'] i) st))
  187.35 +            (Method.insert_tac more_facts i THEN resolve_tac ctxt [rule'] i) st))
  187.36    end);
  187.37  
  187.38  end;
   188.1 --- a/src/ZF/Datatype_ZF.thy	Tue Feb 10 14:29:36 2015 +0100
   188.2 +++ b/src/ZF/Datatype_ZF.thy	Tue Feb 10 14:48:26 2015 +0100
   188.3 @@ -95,7 +95,7 @@
   188.4           else ();
   188.5         val goal = Logic.mk_equals (old, new)
   188.6         val thm = Goal.prove ctxt [] [] goal
   188.7 -         (fn _ => resolve_tac @{thms iff_reflection} 1 THEN
   188.8 +         (fn _ => resolve_tac ctxt @{thms iff_reflection} 1 THEN
   188.9             simp_tac (put_simpset datatype_ss ctxt addsimps #free_iffs lcon_info) 1)
  188.10           handle ERROR msg =>
  188.11           (warning (msg ^ "\ndata_free simproc:\nfailed to prove " ^ Syntax.string_of_term ctxt goal);
   189.1 --- a/src/ZF/OrdQuant.thy	Tue Feb 10 14:29:36 2015 +0100
   189.2 +++ b/src/ZF/OrdQuant.thy	Tue Feb 10 14:48:26 2015 +0100
   189.3 @@ -370,14 +370,14 @@
   189.4    fn _ => Quantifier1.rearrange_bex
   189.5      (fn ctxt =>
   189.6        unfold_tac ctxt @{thms rex_def} THEN
   189.7 -      Quantifier1.prove_one_point_ex_tac)
   189.8 +      Quantifier1.prove_one_point_ex_tac ctxt)
   189.9  *}
  189.10  
  189.11  simproc_setup defined_rall ("\<forall>x[M]. P(x) \<longrightarrow> Q(x)") = {*
  189.12    fn _ => Quantifier1.rearrange_ball
  189.13      (fn ctxt =>
  189.14        unfold_tac ctxt @{thms rall_def} THEN
  189.15 -      Quantifier1.prove_one_point_all_tac)
  189.16 +      Quantifier1.prove_one_point_all_tac ctxt)
  189.17  *}
  189.18  
  189.19  end
   190.1 --- a/src/ZF/Tools/datatype_package.ML	Tue Feb 10 14:29:36 2015 +0100
   190.2 +++ b/src/ZF/Tools/datatype_package.ML	Tue Feb 10 14:48:26 2015 +0100
   190.3 @@ -286,9 +286,9 @@
   190.4        (*Proves a single case equation.  Could use simp_tac, but it's slower!*)
   190.5        (fn {context = ctxt, ...} => EVERY
   190.6          [rewrite_goals_tac ctxt [con_def],
   190.7 -         resolve_tac [case_trans] 1,
   190.8 +         resolve_tac ctxt [case_trans] 1,
   190.9           REPEAT
  190.10 -           (resolve_tac [@{thm refl}, split_trans,
  190.11 +           (resolve_tac ctxt [@{thm refl}, split_trans,
  190.12               Su.case_inl RS @{thm trans}, Su.case_inr RS @{thm trans}] 1)]);
  190.13  
  190.14    val free_iffs = map Drule.export_without_context (con_defs RL [@{thm def_swap_iff}]);
  190.15 @@ -327,7 +327,7 @@
  190.16              (Ind_Syntax.traceIt "next recursor equation = " thy1 (mk_recursor_eqn arg))
  190.17              (*Proves a single recursor equation.*)