aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Kunze2020-11-27 11:11:23 +0100
committerFabian Kunze2020-11-27 12:16:40 +0100
commitc6cabd1ff266a91022eb86caf4a99e89c0626430 (patch)
tree676ace0a7476e98dd34c5db6a66fa1896bfe58a8
parent66429ecca2cc28875ec37b879806744bd3a63179 (diff)
Improved error message on nested proofs
to include most common reason when this happens on accident
-rw-r--r--doc/sphinx/language/core/definitions.rst3
-rw-r--r--stm/stm.ml6
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/sphinx/language/core/definitions.rst b/doc/sphinx/language/core/definitions.rst
index 57771c9036..ee6679a29a 100644
--- a/doc/sphinx/language/core/definitions.rst
+++ b/doc/sphinx/language/core/definitions.rst
@@ -173,7 +173,8 @@ Chapter :ref:`Tactics`. The basic assertion command is:
The name you provided is already defined. You have then to choose
another name.
- .. exn:: Nested proofs are not allowed unless you turn the Nested Proofs Allowed flag on.
+ .. exn:: Nested proofs are discouraged and not allowed by default. This error probably means that you forgot to close the last "Proof." with "Qed." or "Defined.". \
+ If you really intended to use nested proofs, you can do so by turning the "Nested Proofs Allowed" flag on.
You are asserting a new statement while already being in proof editing mode.
This feature, called nested proofs, is disabled by default.
diff --git a/stm/stm.ml b/stm/stm.ml
index f7d66b7b53..1c06c1efb7 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -2681,8 +2681,10 @@ let process_transaction ~doc ?(newtip=Stateid.fresh ())
| VtStartProof (guarantee, names) ->
if not (get_allow_nested_proofs ()) && VCS.proof_nesting () > 0 then
- "Nested proofs are not allowed unless you turn the Nested Proofs Allowed flag on."
- |> Pp.str
+ "Nested proofs are discouraged and not allowed by default. \
+ This error probably means that you forgot to close the last \"Proof.\" with \"Qed.\" or \"Defined.\". \
+ If you really intended to use nested proofs, you can do so by turning the \"Nested Proofs Allowed\" flag on."
+ |> Pp.strbrk
|> (fun s -> (UserError (None, s), Exninfo.null))
|> State.exn_on ~valid:Stateid.dummy newtip
|> Exninfo.iraise