src/Pure/goal.ML
changeset 17983 89103008502f
parent 17980 788836292b1a
child 17986 0450847646c3
equal deleted inserted replaced
17982:d20a9dd2a68c 17983:89103008502f
    34 struct
    34 struct
    35 
    35 
    36 (* managing goal states *)
    36 (* managing goal states *)
    37 
    37 
    38 (*
    38 (*
    39   ----------------- (init)
    39   ------------ (init)
    40   Goal C ==> Goal C
    40   C ==> Goal C
    41 *)
    41 *)
    42 fun init ct = Drule.instantiate' [] [SOME ct] Drule.goalI;
    42 fun init ct = Drule.instantiate' [] [SOME ct] Drule.goalI;
    43 
    43 
    44 (*
    44 (*
    45   A ==> ... ==> Goal C
    45   A ==> ... ==> Goal C
    54 
    54 
    55 (*
    55 (*
    56   Goal C
    56   Goal C
    57   ------ (finish)
    57   ------ (finish)
    58     C
    58     C
    59 *)  
    59 *)
    60 fun finish th =
    60 fun finish th =
    61   (case Thm.nprems_of th of
    61   (case Thm.nprems_of th of
    62     0 => conclude th
    62     0 => conclude th
    63   | n => raise THM ("Proof failed.\n" ^
    63   | n => raise THM ("Proof failed.\n" ^
    64       Pretty.string_of (Pretty.chunks (Display.pretty_goals n th)) ^
    64       Pretty.string_of (Pretty.chunks (Display.pretty_goals n th)) ^
    65       ("\n" ^ string_of_int n ^ " unsolved goal(s)!"), 0, [th]));
    65       ("\n" ^ string_of_int n ^ " unsolved goal(s)!"), 0, [th]));
    66 
    66 
    67 
    67 
    68 (* prove_raw -- minimal checks, no normalization *)
    68 (* prove_raw -- minimal checks, no normalization *)
    69 
    69 
    70 fun prove_raw thy goal tac =  
    70 fun prove_raw thy goal tac =
    71   (case SINGLE tac (init (Thm.cterm_of thy goal)) of
    71   (case SINGLE tac (init (Thm.cterm_of thy goal)) of
    72     SOME th => finish th
    72     SOME th => finish th
    73   | NONE => raise ERROR_MESSAGE "Tactic failed.");
    73   | NONE => raise ERROR_MESSAGE "Tactic failed.");
    74 
    74 
    75 
    75 
   155     if 1 <= i andalso i <= n then
   155     if 1 <= i andalso i <= n then
   156       if n = 1 then tac st else SELECT tac i st
   156       if n = 1 then tac st else SELECT tac i st
   157     else Seq.empty
   157     else Seq.empty
   158   end;
   158   end;
   159 
   159 
   160 
       
   161 end;
   160 end;
   162 
   161 
   163 structure BasicGoal: BASIC_GOAL = Goal;
   162 structure BasicGoal: BASIC_GOAL = Goal;
   164 open BasicGoal;
   163 open BasicGoal;