1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i $Id: decl_mode.ml 10739 2008-04-01 14:45:20Z herbelin $ i*)
16
let daimon_flag = ref false
18
let set_daimon_flag () = daimon_flag:=true
19
let clear_daimon_flag () = daimon_flag:=false
20
let get_daimon_flag () = !daimon_flag
27
let mode_of_pftreestate pts =
28
let goal = sig_it (Refiner.top_goal_of_pftreestate pts) in
29
if goal.evar_extra = None then
34
let get_current_mode () =
36
mode_of_pftreestate (Pfedit.get_pftreestate ())
39
let check_not_proof_mode str =
40
if get_current_mode () = Mode_proof then
44
Skip_patt of Idset.t * split_tree
45
| Split_patt of Idset.t * inductive *
46
(bool array * (Idset.t * split_tree) option) array
47
| Close_patt of split_tree
48
| End_patt of (identifier * int)
55
type recpath = int option*Declarations.wf_paths
63
per_params:constr list;
68
Per of Decl_expr.elim_type * per_info * elim_kind * identifier list
74
{ pm_stack : stack_info list}
76
let pm_in,pm_out = Dyn.create "pm_info"
79
match gl.evar_extra with
80
None -> invalid_arg "get_info"
82
try pm_out extra with _ -> invalid_arg "get_info"
85
let info = get_info (sig_it (Refiner.nth_goal_of_pftreestate 1 pts)) in
88
let get_top_stack pts =
89
let info = get_info (sig_it (Refiner.top_goal_of_pftreestate pts)) in
92
let get_end_command pts =
93
match mode_of_pftreestate pts with
97
match get_top_stack pts with
99
| Claim::_ -> "\"end claim\""
100
| Focus_claim::_-> "\"end focus\""
101
| (Suppose_case :: Per (et,_,_,_) :: _
102
| Per (et,_,_,_) :: _ ) ->
105
Decl_expr.ET_Case_analysis ->
106
"\"end cases\" or start a new case"
107
| Decl_expr.ET_Induction ->
108
"\"end induction\" or start a new case"
110
| _ -> anomaly "lonely suppose"
116
(Refiner.up_until_matching_rule Proof_trees.is_proof_instr pts);
118
with Not_found -> None
121
error "no proof in progress"
125
let (id,_,_) = List.hd (Environ.named_context env) in id
126
with Invalid_argument _ -> error "no previous statement to use"