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: pfedit.mli 11745 2009-01-04 18:43:08Z herbelin $ i*)
23
(*s Several proofs can be opened simultaneously but at most one is
24
focused at some time. The following functions work by side-effect
25
on current set of open proofs. In this module, ``proofs'' means an
26
open proof (something started by vernacular command [Goal], [Lemma]
27
or [Theorem]), and ``goal'' means a subgoal of the current focused
30
(*s [refining ()] tells if there is some proof in progress, even if a not
33
val refining : unit -> bool
35
(* [check_no_pending_proofs ()] fails if there is still some proof in
38
val check_no_pending_proofs : unit -> unit
40
(*s [delete_proof name] deletes proof of name [name] or fails if no proof
43
val delete_proof : identifier located -> unit
45
(* [delete_current_proof ()] deletes current focused proof or fails if
46
no proof is focused *)
48
val delete_current_proof : unit -> unit
50
(* [delete_all_proofs ()] deletes all open proofs if any *)
52
val delete_all_proofs : unit -> unit
54
(*s [undo n] undoes the effect of the last [n] tactics applied to the
55
current proof; it fails if no proof is focused or if the ``undo''
58
val undo : int -> unit
60
(* Same as undo, but undoes the current proof stack to reach depth
61
[n]. This is used in [vernac_backtrack]. *)
62
val undo_todepth : int -> unit
64
(* Returns the depth of the current focused proof stack, this is used
65
to put informations in coq prompt (in emacs mode). *)
66
val current_proof_depth: unit -> int
68
(* [set_undo (Some n)] sets the size of the ``undo'' stack; [set_undo None]
69
sets the size to the default value (12) *)
71
val set_undo : int option -> unit
72
val get_undo : unit -> int option
74
(*s [start_proof s str env t hook tac] starts a proof of name [s] and
75
conclusion [t]; [hook] is optionally a function to be applied at
76
proof end (e.g. to declare the built constructions as a coercion
77
or a setoid morphism); init_tac is possibly a tactic to
78
systematically apply at initialization time (e.g. to start the
79
proof of mutually dependent theorems) *)
82
identifier -> goal_kind -> named_context_val -> constr ->
83
?init_tac:tactic -> ?compute_guard:bool -> declaration_hook -> unit
85
(* [restart_proof ()] restarts the current focused proof from the beginning
86
or fails if no proof is focused *)
88
val restart_proof : unit -> unit
90
(*s [resume_last_proof ()] focus on the last unfocused proof or fails
91
if there is no suspended proofs *)
93
val resume_last_proof : unit -> unit
95
(* [resume_proof name] focuses on the proof of name [name] or
96
raises [UserError] if no proof has name [name] *)
98
val resume_proof : identifier located -> unit
100
(* [suspend_proof ()] unfocuses the current focused proof or
101
failed with [UserError] if no proof is currently focused *)
103
val suspend_proof : unit -> unit
105
(*s [cook_proof opacity] turns the current proof (assumed completed) into
106
a constant with its name, kind and possible hook (see [start_proof]);
107
it fails if there is no current proof of if it is not completed;
108
it also tells if the guardness condition has to be inferred. *)
110
val cook_proof : (Refiner.pftreestate -> unit) ->
111
identifier * (Entries.definition_entry * bool * goal_kind * declaration_hook)
113
(* To export completed proofs to xml *)
114
val set_xml_cook_proof : (goal_kind * pftreestate -> unit) -> unit
116
(*s [get_pftreestate ()] returns the current focused pending proof or
117
raises [UserError "no focused proof"] *)
119
val get_pftreestate : unit -> pftreestate
121
(* [get_end_tac ()] returns the current tactic to apply to all new subgoal *)
123
val get_end_tac : unit -> tactic option
125
(* [get_goal_context n] returns the context of the [n]th subgoal of
126
the current focused proof or raises a [UserError] if there is no
127
focused proof or if there is no more subgoals *)
129
val get_goal_context : int -> Evd.evar_map * env
131
(* [get_current_goal_context ()] works as [get_goal_context 1] *)
133
val get_current_goal_context : unit -> Evd.evar_map * env
135
(* [current_proof_statement] *)
137
val current_proof_statement :
138
unit -> identifier * goal_kind * types * declaration_hook
140
(*s [get_current_proof_name ()] return the name of the current focused
141
proof or failed if no proof is focused *)
143
val get_current_proof_name : unit -> identifier
145
(* [get_all_proof_names ()] returns the list of all pending proof names *)
147
val get_all_proof_names : unit -> identifier list
149
(*s [set_end_tac tac] applies tactic [tac] to all subgoal generate
152
val set_end_tac : tactic -> unit
154
(*s [solve_nth n tac] applies tactic [tac] to the [n]th subgoal of the
155
current focused proof or raises a UserError if no proof is focused or
156
if there is no [n]th subgoal *)
158
val solve_nth : int -> tactic -> unit
160
(* [by tac] applies tactic [tac] to the 1st subgoal of the current
161
focused proof or raises a UserError if there is no focused proof or
162
if there is no more subgoals *)
164
val by : tactic -> unit
166
(* [instantiate_nth_evar_com n c] instantiate the [n]th undefined
167
existential variable of the current focused proof by [c] or raises a
168
UserError if no proof is focused or if there is no such [n]th
169
existential variable *)
171
val instantiate_nth_evar_com : int -> Topconstr.constr_expr -> unit
173
(*s To deal with subgoal focus *)
175
val make_focus : int -> unit
176
val focus : unit -> int
177
val focused_goal : unit -> int
178
val subtree_solved : unit -> bool
179
val tree_solved : unit -> bool
180
val top_tree_solved : unit -> bool
182
val reset_top_of_tree : unit -> unit
183
val reset_top_of_script : unit -> unit
185
val traverse : int -> unit
186
val traverse_nth_goal : int -> unit
187
val traverse_next_unproven : unit -> unit
188
val traverse_prev_unproven : unit -> unit
191
(* These two functions make it possible to implement more elaborate
192
proof and goal management, as it is done, for instance in pcoq *)
193
val traverse_to : int list -> unit
194
val mutate : (pftreestate -> pftreestate) -> unit