src/Pure/subgoal.ML
changeset 32329 1527ff8c2dfb
parent 32284 d8ee8a956f19
child 34075 451b0c8a15cf
equal deleted inserted replaced
32327:0971cc0b6a57 32329:1527ff8c2dfb
   100           :
   100           :
   101           C
   101           C
   102 *)
   102 *)
   103 fun lift_subgoals params asms th =
   103 fun lift_subgoals params asms th =
   104   let
   104   let
   105     val lift = fold_rev Thm.all_name params o curry Drule.list_implies asms;
   105     fun lift ct = fold_rev Thm.all_name params (Drule.list_implies (asms, ct));
   106     val unlift =
   106     val unlift =
   107       fold (Thm.elim_implies o Thm.assume) asms o
   107       fold (Thm.elim_implies o Thm.assume) asms o
   108       Drule.forall_elim_list (map #2 params) o Thm.assume;
   108       Drule.forall_elim_list (map #2 params) o Thm.assume;
   109     val subgoals = map lift (Drule.strip_imp_prems (Thm.cprop_of th));
   109     val subgoals = map lift (Drule.strip_imp_prems (Thm.cprop_of th));
   110     val th' = fold (Thm.elim_implies o unlift) subgoals th;
   110     val th' = fold (Thm.elim_implies o unlift) subgoals th;
   131 (* tacticals *)
   131 (* tacticals *)
   132 
   132 
   133 fun GEN_FOCUS flags tac ctxt i st =
   133 fun GEN_FOCUS flags tac ctxt i st =
   134   if Thm.nprems_of st < i then Seq.empty
   134   if Thm.nprems_of st < i then Seq.empty
   135   else
   135   else
   136     let val (args as {context, params, asms, ...}, st') = gen_focus flags ctxt i st;
   136     let val (args as {context = ctxt', params, asms, ...}, st') = gen_focus flags ctxt i st;
   137     in Seq.lifts (retrofit context ctxt params asms i) (tac args st') st end;
   137     in Seq.lifts (retrofit ctxt' ctxt params asms i) (tac args st') st end;
   138 
   138 
   139 val FOCUS_PARAMS = GEN_FOCUS (false, false);
   139 val FOCUS_PARAMS = GEN_FOCUS (false, false);
   140 val FOCUS_PREMS = GEN_FOCUS (true, false);
   140 val FOCUS_PREMS = GEN_FOCUS (true, false);
   141 val FOCUS = GEN_FOCUS (true, true);
   141 val FOCUS = GEN_FOCUS (true, true);
   142 
   142 
   143 fun SUBPROOF tac = FOCUS (FILTER Thm.no_prems o tac);
   143 fun SUBPROOF tac ctxt = FOCUS (Seq.map (tap (Goal.check_finished ctxt)) oo tac) ctxt;
   144 
   144 
   145 end;
   145 end;
   146 
   146 
   147 val SUBPROOF = Subgoal.SUBPROOF;
   147 val SUBPROOF = Subgoal.SUBPROOF;
   148 
   148