src/Pure/goal.ML
changeset 32788 a65deb8f9434
parent 32738 15bb09ca0378
child 33768 bba9eac8aa25
equal deleted inserted replaced
32787:4271aab3aa4a 32788:a65deb8f9434
   298   (case Par_List.get_some (fn tac => SINGLE tac st) tacs of
   298   (case Par_List.get_some (fn tac => SINGLE tac st) tacs of
   299     NONE => Seq.empty
   299     NONE => Seq.empty
   300   | SOME st' => Seq.single st');
   300   | SOME st' => Seq.single st');
   301 
   301 
   302 (*parallel refinement of non-schematic goal by single results*)
   302 (*parallel refinement of non-schematic goal by single results*)
       
   303 exception FAILED of unit;
   303 fun PARALLEL_GOALS tac st =
   304 fun PARALLEL_GOALS tac st =
   304   let
   305   let
   305     val st0 = Thm.adjust_maxidx_thm ~1 st;
   306     val st0 = Thm.adjust_maxidx_thm ~1 st;
   306     val _ = Thm.maxidx_of st0 >= 0 andalso
   307     val _ = Thm.maxidx_of st0 >= 0 andalso
   307       raise THM ("PARALLEL_GOALS: schematic goal state", 0, [st]);
   308       raise THM ("PARALLEL_GOALS: schematic goal state", 0, [st]);
   308 
   309 
   309     exception FAILED;
       
   310     fun try_tac g =
   310     fun try_tac g =
   311       (case SINGLE tac g of
   311       (case SINGLE tac g of
   312         NONE => raise FAILED
   312         NONE => raise FAILED ()
   313       | SOME g' => g');
   313       | SOME g' => g');
   314 
   314 
   315     val goals = Drule.strip_imp_prems (Thm.cprop_of st0);
   315     val goals = Drule.strip_imp_prems (Thm.cprop_of st0);
   316     val results = Par_List.map (try_tac o init) goals;
   316     val results = Par_List.map (try_tac o init) goals;
   317   in ALLGOALS (fn i => retrofit i 1 (nth results (i - 1))) st0 end
   317   in ALLGOALS (fn i => retrofit i 1 (nth results (i - 1))) st0 end
   318   handle FAILED => Seq.empty;
   318   handle FAILED () => Seq.empty;
   319 
   319 
   320 end;
   320 end;
   321 
   321 
   322 structure Basic_Goal: BASIC_GOAL = Goal;
   322 structure Basic_Goal: BASIC_GOAL = Goal;
   323 open Basic_Goal;
   323 open Basic_Goal;