src/Pure/Isar/method.ML
changeset 29857 2cc976ed8a3c
parent 29301 2b845381ba6a
child 30165 6ee87f67d9cd
child 30240 5b25fee0362c
equal deleted inserted replaced
29856:984191be0357 29857:2cc976ed8a3c
    36   val unfold: thm list -> Proof.context -> method
    36   val unfold: thm list -> Proof.context -> method
    37   val fold: thm list -> Proof.context -> method
    37   val fold: thm list -> Proof.context -> method
    38   val atomize: bool -> method
    38   val atomize: bool -> method
    39   val this: method
    39   val this: method
    40   val fact: thm list -> Proof.context -> method
    40   val fact: thm list -> Proof.context -> method
       
    41   val assumption_tac: Proof.context -> int -> tactic
    41   val assumption: Proof.context -> method
    42   val assumption: Proof.context -> method
    42   val close: bool -> Proof.context -> method
    43   val close: bool -> Proof.context -> method
    43   val trace: Proof.context -> thm list -> unit
    44   val trace: Proof.context -> thm list -> unit
    44   val rule_tac: thm list -> thm list -> int -> tactic
    45   val rule_tac: thm list -> thm list -> int -> tactic
    45   val some_rule_tac: thm list -> Proof.context -> thm list -> int -> tactic
    46   val some_rule_tac: thm list -> Proof.context -> thm list -> int -> tactic
   220 
   221 
   221 fun cond_rtac cond rule = SUBGOAL (fn (prop, i) =>
   222 fun cond_rtac cond rule = SUBGOAL (fn (prop, i) =>
   222   if cond (Logic.strip_assums_concl prop)
   223   if cond (Logic.strip_assums_concl prop)
   223   then Tactic.rtac rule i else no_tac);
   224   then Tactic.rtac rule i else no_tac);
   224 
   225 
   225 fun assm_tac ctxt =
   226 in
       
   227 
       
   228 fun assumption_tac ctxt =
   226   assume_tac APPEND'
   229   assume_tac APPEND'
   227   Goal.assume_rule_tac ctxt APPEND'
   230   Goal.assume_rule_tac ctxt APPEND'
   228   cond_rtac (can Logic.dest_equals) Drule.reflexive_thm APPEND'
   231   cond_rtac (can Logic.dest_equals) Drule.reflexive_thm APPEND'
   229   cond_rtac (can Logic.dest_term) Drule.termI;
   232   cond_rtac (can Logic.dest_term) Drule.termI;
   230 
   233 
   231 in
       
   232 
       
   233 fun assumption ctxt = METHOD (HEADGOAL o
   234 fun assumption ctxt = METHOD (HEADGOAL o
   234   (fn [] => assm_tac ctxt
   235   (fn [] => assumption_tac ctxt
   235     | [fact] => solve_tac [fact]
   236     | [fact] => solve_tac [fact]
   236     | _ => K no_tac));
   237     | _ => K no_tac));
   237 
   238 
   238 fun close immed ctxt = METHOD (K
   239 fun close immed ctxt = METHOD (K
   239   (FILTER Thm.no_prems
   240   (FILTER Thm.no_prems
   240     ((if immed then ALLGOALS (assm_tac ctxt) else all_tac) THEN flexflex_tac)));
   241     ((if immed then ALLGOALS (assumption_tac ctxt) else all_tac) THEN flexflex_tac)));
   241 
   242 
   242 end;
   243 end;
   243 
   244 
   244 
   245 
   245 (* rule etc. -- single-step refinements *)
   246 (* rule etc. -- single-step refinements *)