src/Pure/Isar/proof.ML
changeset 13698 d7ef5a3b3591
parent 13596 ee5f79b210c1
child 13869 18112403c809
equal deleted inserted replaced
13697:e4db4f06cec1 13698:d7ef5a3b3591
    37   val assert_forward_or_chain: state -> state
    37   val assert_forward_or_chain: state -> state
    38   val assert_backward: state -> state
    38   val assert_backward: state -> state
    39   val assert_no_chain: state -> state
    39   val assert_no_chain: state -> state
    40   val enter_forward: state -> state
    40   val enter_forward: state -> state
    41   val verbose: bool ref
    41   val verbose: bool ref
       
    42   val show_main_goal: bool ref
    42   val pretty_state: int -> state -> Pretty.T list
    43   val pretty_state: int -> state -> Pretty.T list
    43   val pretty_goals: bool -> state -> Pretty.T list
    44   val pretty_goals: bool -> state -> Pretty.T list
    44   val level: state -> int
    45   val level: state -> int
    45   type method
    46   type method
    46   val method: (thm list -> tactic) -> method
    47   val method: (thm list -> tactic) -> method
   318 
   319 
   319 
   320 
   320 
   321 
   321 (** pretty_state **)
   322 (** pretty_state **)
   322 
   323 
       
   324 val show_main_goal = ref true;
       
   325 
   323 val verbose = ProofContext.verbose;
   326 val verbose = ProofContext.verbose;
   324 
   327 
   325 fun pretty_goals_local ctxt = Display.pretty_goals_aux
   328 fun pretty_goals_local ctxt = Display.pretty_goals_aux
   326   (ProofContext.pretty_sort ctxt, ProofContext.pretty_typ ctxt, ProofContext.pretty_term ctxt);
   329   (ProofContext.pretty_sort ctxt, ProofContext.pretty_typ ctxt, ProofContext.pretty_term ctxt);
   327 
   330 
   349     fun prt_goal (_, (i, (((kind, names, _), (goal_facts, thm)), _))) =
   352     fun prt_goal (_, (i, (((kind, names, _), (goal_facts, thm)), _))) =
   350       pretty_facts "using " ctxt
   353       pretty_facts "using " ctxt
   351         (if mode <> Backward orelse null goal_facts then None else Some goal_facts) @
   354         (if mode <> Backward orelse null goal_facts then None else Some goal_facts) @
   352       [Pretty.str ("goal (" ^ kind_name (sign_of state) kind ^ prt_names names ^
   355       [Pretty.str ("goal (" ^ kind_name (sign_of state) kind ^ prt_names names ^
   353           levels_up (i div 2) ^ subgoals (Thm.nprems_of thm) ^ "):")] @
   356           levels_up (i div 2) ^ subgoals (Thm.nprems_of thm) ^ "):")] @
   354       pretty_goals_local ctxt begin_goal (true, true) (! Display.goals_limit) thm;
   357       pretty_goals_local ctxt begin_goal (true, !show_main_goal) (! Display.goals_limit) thm;
   355 
   358 
   356     val ctxt_prts =
   359     val ctxt_prts =
   357       if ! verbose orelse mode = Forward then ProofContext.pretty_context ctxt
   360       if ! verbose orelse mode = Forward then ProofContext.pretty_context ctxt
   358       else if mode = Backward then ProofContext.pretty_asms ctxt
   361       else if mode = Backward then ProofContext.pretty_asms ctxt
   359       else [];
   362       else [];
   462     fun err msg = raise STATE (msg, state);
   465     fun err msg = raise STATE (msg, state);
   463 
   466 
   464     val ngoals = Thm.nprems_of raw_th;
   467     val ngoals = Thm.nprems_of raw_th;
   465     val _ =
   468     val _ =
   466       if ngoals = 0 then ()
   469       if ngoals = 0 then ()
   467       else (err (Pretty.string_of (Pretty.chunks (pretty_goals_local ctxt "" (true, true)
   470       else (err (Pretty.string_of (Pretty.chunks (pretty_goals_local ctxt "" (true, !show_main_goal)
   468             (! Display.goals_limit) raw_th @
   471             (! Display.goals_limit) raw_th @
   469           [Pretty.str (string_of_int ngoals ^ " unsolved goal(s)!")]))));
   472           [Pretty.str (string_of_int ngoals ^ " unsolved goal(s)!")]))));
   470 
   473 
   471     val {hyps, sign, ...} = Thm.rep_thm raw_th;
   474     val {hyps, sign, ...} = Thm.rep_thm raw_th;
   472     val tsig = Sign.tsig_of sign;
   475     val tsig = Sign.tsig_of sign;