src/Pure/goals.ML
changeset 577 776b5ba748d8
parent 545 fc4ff96bb0e9
child 678 6151b7f3b606
equal deleted inserted replaced
576:469279790410 577:776b5ba748d8
    13 signature GOALS =
    13 signature GOALS =
    14   sig
    14   sig
    15   structure Tactical: TACTICAL
    15   structure Tactical: TACTICAL
    16   local open Tactical Tactical.Thm in
    16   local open Tactical Tactical.Thm in
    17   type proof
    17   type proof
    18   val ba: int -> unit
    18   val ba		: int -> unit
    19   val back: unit -> unit
    19   val back		: unit -> unit
    20   val bd: thm -> int -> unit
    20   val bd		: thm -> int -> unit
    21   val bds: thm list -> int -> unit
    21   val bds		: thm list -> int -> unit
    22   val be: thm -> int -> unit
    22   val be		: thm -> int -> unit
    23   val bes: thm list -> int -> unit
    23   val bes		: thm list -> int -> unit
    24   val br: thm -> int -> unit
    24   val br		: thm -> int -> unit
    25   val brs: thm list -> int -> unit
    25   val brs		: thm list -> int -> unit
    26   val bw: thm -> unit
    26   val bw		: thm -> unit
    27   val bws: thm list -> unit
    27   val bws		: thm list -> unit
    28   val by: tactic -> unit
    28   val by		: tactic -> unit
    29   val byev: tactic list -> unit
    29   val byev		: tactic list -> unit
    30   val chop: unit -> unit
    30   val chop		: unit -> unit
    31   val choplev: int -> unit
    31   val choplev		: int -> unit
    32   val fa: unit -> unit
    32   val fa		: unit -> unit
    33   val fd: thm -> unit
    33   val fd		: thm -> unit
    34   val fds: thm list -> unit
    34   val fds		: thm list -> unit
    35   val fe: thm -> unit
    35   val fe		: thm -> unit
    36   val fes: thm list -> unit
    36   val fes		: thm list -> unit
    37   val filter_goal: (term*term->bool) -> thm list -> int -> thm list
    37   val filter_goal	: (term*term->bool) -> thm list -> int -> thm list
    38   val fr: thm -> unit
    38   val fr		: thm -> unit
    39   val frs: thm list -> unit
    39   val frs		: thm list -> unit
    40   val getgoal: int -> term
    40   val getgoal		: int -> term
    41   val gethyps: int -> thm list
    41   val gethyps		: int -> thm list
    42   val goal:  theory -> string -> thm list
    42   val goal		: theory -> string -> thm list
    43   val goalw: theory -> thm list -> string -> thm list
    43   val goalw		: theory -> thm list -> string -> thm list
    44   val goalw_cterm:     thm list -> cterm -> thm list
    44   val goalw_cterm	: thm list -> cterm -> thm list
    45   val pop_proof: unit -> thm list
    45   val pop_proof		: unit -> thm list
    46   val pr: unit -> unit
    46   val pr		: unit -> unit
    47   val premises: unit -> thm list
    47   val premises		: unit -> thm list
    48   val prin: term -> unit
    48   val prin		: term -> unit
    49   val printyp: typ -> unit
    49   val printyp		: typ -> unit
    50   val pprint_term: term -> pprint_args -> unit
    50   val pprint_term	: term -> pprint_args -> unit
    51   val pprint_typ: typ -> pprint_args -> unit
    51   val pprint_typ	: typ -> pprint_args -> unit
    52   val print_exn: exn -> 'a
    52   val print_exn		: exn -> 'a
    53   val prlev: int -> unit
    53   val print_sign_exn	: Sign.sg -> exn -> 'a
    54   val proof_timing: bool ref
    54   val prlev		: int -> unit
    55   val prove_goal: theory -> string -> (thm list -> tactic list) -> thm
    55   val proof_timing	: bool ref
    56   val prove_goalw: theory->thm list->string->(thm list->tactic list)->thm
    56   val prove_goal	: theory -> string -> (thm list -> tactic list) -> thm
    57   val prove_goalw_cterm: thm list->cterm->(thm list->tactic list)->thm
    57   val prove_goalw      : theory->thm list->string->(thm list->tactic list)->thm
    58   val push_proof: unit -> unit
    58   val prove_goalw_cterm	: thm list->cterm->(thm list->tactic list)->thm
    59   val read: string -> term
    59   val push_proof	: unit -> unit
    60   val ren: string -> int -> unit
    60   val read		: string -> term
    61   val restore_proof: proof -> thm list
    61   val ren		: string -> int -> unit
    62   val result: unit -> thm  
    62   val restore_proof	: proof -> thm list
    63   val rotate_proof: unit -> thm list
    63   val result		: unit -> thm  
    64   val uresult: unit -> thm  
    64   val rotate_proof	: unit -> thm list
    65   val save_proof: unit -> proof
    65   val uresult		: unit -> thm  
    66   val topthm: unit -> thm
    66   val save_proof	: unit -> proof
    67   val undo: unit -> unit
    67   val topthm		: unit -> thm
       
    68   val undo		: unit -> unit
    68   end
    69   end
    69   end;
    70   end;
    70 
    71 
    71 functor GoalsFun (structure Logic: LOGIC and Drule: DRULE and Tactic: TACTIC
    72 functor GoalsFun (structure Logic: LOGIC and Drule: DRULE and Tactic: TACTIC
    72                         and Pattern:PATTERN
    73                         and Pattern:PATTERN
   162 		 sign_error (sign, #sign(rep_thm st0)))
   163 		 sign_error (sign, #sign(rep_thm st0)))
   163   end
   164   end
   164   handle THM(s,_,_) => error("prepare_proof: exception THM was raised!\n" ^ s);
   165   handle THM(s,_,_) => error("prepare_proof: exception THM was raised!\n" ^ s);
   165 
   166 
   166 (*Prints exceptions readably to users*)
   167 (*Prints exceptions readably to users*)
   167 fun print_sign_exn sign e = 
   168 fun print_sign_exn_unit sign e = 
   168   case e of
   169   case e of
   169      THM (msg,i,thms) =>
   170      THM (msg,i,thms) =>
   170 	 (writeln ("Exception THM " ^ string_of_int i ^ " raised:\n" ^ msg);
   171 	 (writeln ("Exception THM " ^ string_of_int i ^ " raised:\n" ^ msg);
   171 	  seq print_thm thms)
   172 	  seq print_thm thms)
   172    | THEORY (msg,thys) =>
   173    | THEORY (msg,thys) =>
   179 	 (writeln ("Exception TYPE raised:\n" ^ msg);
   180 	 (writeln ("Exception TYPE raised:\n" ^ msg);
   180 	  seq (writeln o Sign.string_of_typ sign) Ts;
   181 	  seq (writeln o Sign.string_of_typ sign) Ts;
   181 	  seq (writeln o Sign.string_of_term sign) ts)
   182 	  seq (writeln o Sign.string_of_term sign) ts)
   182    | e => raise e;
   183    | e => raise e;
   183 
   184 
       
   185 (*Prints an exception, then fails*)
       
   186 fun print_sign_exn sign e = (print_sign_exn_unit sign e; raise ERROR);
       
   187 
   184 (** the prove_goal.... commands
   188 (** the prove_goal.... commands
   185     Prove theorem using the listed tactics; check it has the specified form.
   189     Prove theorem using the listed tactics; check it has the specified form.
   186     Augment signature with all type assignments of goal.
   190     Augment signature with all type assignments of goal.
   187     Syntax is similar to "goal" command for easy keyboard use. **)
   191     Syntax is similar to "goal" command for easy keyboard use. **)
   188 
   192