From b90c8908da4a1b3b4ede3ec32adb586f8c4207fa Mon Sep 17 00:00:00 2001
From: Robbert Krebbers <mail@robbertkrebbers.nl>
Date: Thu, 13 Dec 2018 10:34:51 +0100
Subject: [PATCH] Improve docs of `iPoseProofCore`.

---
 theories/proofmode/ltac_tactics.v | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/theories/proofmode/ltac_tactics.v b/theories/proofmode/ltac_tactics.v
index 837f91c71..4a04cc565 100644
--- a/theories/proofmode/ltac_tactics.v
+++ b/theories/proofmode/ltac_tactics.v
@@ -760,14 +760,6 @@ Local Ltac iIntoEmpValid t :=
           [iSolveTC || fail 1 "iPoseProof: not a BI assertion"
           |exact t]].
 
-(* The tactic [tac] is called with a temporary fresh name [H]. The argument
-[lazy_tc] denotes whether type class inference on the premises of [lem] should
-be performed before (if false) or after (if true) [tac H] is called.
-
-The tactic [iApply] uses lazy type class inference, so that evars can first be
-instantiated by matching with the goal, whereas [iDestruct] does not, because
-eliminations may not be performed when type classes have not been resolved.
-*)
 Local Ltac iPoseProofCore_go Htmp t goal_tac :=
   lazymatch type of t with
   | ident =>
@@ -788,6 +780,29 @@ Local Ltac iPoseProofCore_go Htmp t goal_tac :=
     |goal_tac ()]
   end;
   try iSolveTC.
+
+(** The tactic [iPoseProofCore lem as p lazy_tc tac] inserts the resource
+described by [lem] into the context. The tactic takes a continuation [tac] as
+its argument, which is called with a temporary fresh name [H] that refers to
+the hypothesis containing [lem].
+
+There are a couple of additional arguments:
+
+- The argument [p] is like that of [iSpecialize]. It is a Boolean that denotes
+  whether the conclusion of the specialized term [lem] is persistent.
+- The argument [lazy_tc] denotes whether type class inference on the premises
+  of [lem] should be performed before (if [lazy_tc = false]) or after, i.e.
+  lazily (if [lazy_tc = true]) [tac H] is called.
+
+Both variants of [lazy_tc] are used in other tactics that build on top of
+[iPoseProofCore]:
+
+- The tactic [iApply] uses lazy type class inference (i.e. [lazy_tc = true]),
+  so that evars can first be matched against the goal before being solved by
+  type class inference.
+- The tactic [iDestruct] uses eager type class inference (i.e. [lazy_tc = false])
+  because it may be not possible to eliminate logical connectives before all
+  type class constraints have been resolved. *)
 Tactic Notation "iPoseProofCore" open_constr(lem)
     "as" constr(p) constr(lazy_tc) tactic(tac) :=
   iStartProof;
-- 
GitLab