aboutsummaryrefslogtreecommitdiff
path: root/proofs
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-09-25 14:19:25 +0200
committerPierre-Marie Pédrot2015-09-25 14:19:25 +0200
commitccd23fa241ab11477b2fec48ba5262206a1134d5 (patch)
treed864a4ad99f869b03c2c08650029e03fa1400c32 /proofs
parent8a031dc29abf1e16b2ee78322a7221b8b5c19a33 (diff)
parent8e25e107a8715728a7227934d7b11035863ee5f0 (diff)
Merge branch 'v8.5'
Diffstat (limited to 'proofs')
-rw-r--r--proofs/pfedit.ml4
-rw-r--r--proofs/pfedit.mli2
-rw-r--r--proofs/proof.ml10
-rw-r--r--proofs/proof.mli3
-rw-r--r--proofs/proof_global.ml2
5 files changed, 15 insertions, 6 deletions
diff --git a/proofs/pfedit.ml b/proofs/pfedit.ml
index 5e8221b811..fae8716d9d 100644
--- a/proofs/pfedit.ml
+++ b/proofs/pfedit.ml
@@ -146,12 +146,12 @@ let build_constant_by_tactic id ctx sign ?(goal_kind = Global, false, Proof Theo
delete_current_proof ();
iraise reraise
-let build_by_tactic env ctx ?(poly=false) typ tac =
+let build_by_tactic ?(side_eff=true) env ctx ?(poly=false) typ tac =
let id = Id.of_string ("temporary_proof"^string_of_int (next())) in
let sign = val_of_named_context (named_context env) in
let gk = Global, poly, Proof Theorem in
let ce, status, univs = build_constant_by_tactic id ctx sign ~goal_kind:gk typ tac in
- let ce = Term_typing.handle_entry_side_effects env ce in
+ let ce = if side_eff then Term_typing.handle_entry_side_effects env ce else { ce with const_entry_body = Future.chain ~pure:true ce.const_entry_body (fun (pt, _) -> pt, Declareops.no_seff) } in
let (cb, ctx), se = Future.force ce.const_entry_body in
assert(Declareops.side_effects_is_empty se);
assert(Univ.ContextSet.is_empty ctx);
diff --git a/proofs/pfedit.mli b/proofs/pfedit.mli
index 5e0fb4dd36..4aa3c3bfd2 100644
--- a/proofs/pfedit.mli
+++ b/proofs/pfedit.mli
@@ -153,7 +153,7 @@ val build_constant_by_tactic :
types -> unit Proofview.tactic ->
Entries.definition_entry * bool * Evd.evar_universe_context
-val build_by_tactic : env -> Evd.evar_universe_context -> ?poly:polymorphic ->
+val build_by_tactic : ?side_eff:bool -> env -> Evd.evar_universe_context -> ?poly:polymorphic ->
types -> unit Proofview.tactic ->
constr * bool * Evd.evar_universe_context
diff --git a/proofs/proof.ml b/proofs/proof.ml
index a7077d9110..c7aa5bad97 100644
--- a/proofs/proof.ml
+++ b/proofs/proof.ml
@@ -173,6 +173,12 @@ let is_done p =
(* spiwack: for compatibility with <= 8.2 proof engine *)
let has_unresolved_evar p =
Proofview.V82.has_unresolved_evar p.proofview
+let has_shelved_goals p = not (CList.is_empty (p.shelf))
+let has_given_up_goals p = not (CList.is_empty (p.given_up))
+
+let is_complete p =
+ is_done p && not (has_unresolved_evar p) &&
+ not (has_shelved_goals p) && not (has_given_up_goals p)
(* Returns the list of partial proofs to initial goals *)
let partial_proof p = Proofview.partial_proof p.entry p.proofview
@@ -305,9 +311,9 @@ end
let return p =
if not (is_done p) then
raise UnfinishedProof
- else if not (CList.is_empty (p.shelf)) then
+ else if has_shelved_goals p then
raise HasShelvedGoals
- else if not (CList.is_empty (p.given_up)) then
+ else if has_given_up_goals p then
raise HasGivenUpGoals
else if has_unresolved_evar p then
(* spiwack: for compatibility with <= 8.3 proof engine *)
diff --git a/proofs/proof.mli b/proofs/proof.mli
index a2e10d8133..a0ed0654db 100644
--- a/proofs/proof.mli
+++ b/proofs/proof.mli
@@ -75,6 +75,9 @@ val initial_euctx : proof -> Evd.evar_universe_context
to be considered (this does not require that all evars have been solved). *)
val is_done : proof -> bool
+(* Like is_done, but this time it really means done (i.e. nothing left to do) *)
+val is_complete : proof -> bool
+
(* Returns the list of partial proofs to initial goals. *)
val partial_proof : proof -> Term.constr list
diff --git a/proofs/proof_global.ml b/proofs/proof_global.ml
index 10e7b758da..21009d1204 100644
--- a/proofs/proof_global.ml
+++ b/proofs/proof_global.ml
@@ -344,7 +344,7 @@ type closed_proof_output = (Term.constr * Declareops.side_effects) list * Evd.ev
let return_proof ?(allow_partial=false) () =
let { pid; proof; strength = (_,poly,_) } = cur_pstate () in
if allow_partial then begin
- if Proof.is_done proof then begin
+ if Proof.is_complete proof then begin
msg_warning (str"The proof of " ++ str (Names.Id.to_string pid) ++
str" is complete, no need to end it with Admitted");
end;