Many of the tactics below apply to more goals than described in this document since the behavior of these tactics can be tuned via instances of the type classes in the file proofmode/classes. Most notable, many of the tactics can be applied when the to be introduced or to be eliminated connective appears under a later, an update modality, or in the conclusion of a weakest precondition.
iExact "H": finish the goal if the conclusion matches the hypothesisHiAssumption: finish the goal if the conclusion matches any hypothesisiApply pm_trm: match the conclusion of the current goal against the conclusion ofpm_trmand generates goals for the premises ofpm_trm. See proof mode terms below. If the applied term has more premises than given specialization patterns, the pattern is extended with[] ... []. As a consequence, all unused spatial hypotheses move to the last premise.
iIntros (x1 ... xn) "ipat1 ... ipatn": introduce universal quantifiers using Coq introduction patternsx1 ... xnand implications/wands using proof mode introduction patternsipat1 ... ipatn.iClear (x1 ... xn) "selpat": clear the hypotheses given by the selection patternselpatand the Coq level hypotheses/variablesx1 ... xn.iRevert (x1 ... xn) "selpat": revert the hypotheses given by the selection patternselpatinto wands, and the Coq level hypotheses/variablesx1 ... xninto universal quantifiers. Persistent hypotheses are wrapped into the persistence modality.iRename "H1" into "H2": rename the hypothesisH1intoH2.iSpecialize pm_trm: instantiate universal quantifiers and eliminate implications/wands of a hypothesispm_trm. See proof mode terms below.iSpecialize pm_trm as #: instantiate universal quantifiers and eliminate implications/wands of a hypothesis whose conclusion is persistent. In this case, all hypotheses can be used for proving the premises, as well as for the resulting goal.iPoseProof pm_trm as (x1 ... xn) "ipat": putpm_trminto the context and eliminates it. This tactic is essentially the same asiDestructwith the difference that whenpm_trmis a non-universally quantified intuitionistic hypothesis, it will not throw the hypothesis away.iAssert P with "spat" as "ipat": generates a new subgoalPand adds the hypothesisPto the current goal. The specialization patternspatspecifies which hypotheses will be consumed by provingP. The introduction patternipatspecifies how to eliminateP. In case all branches ofipatstart with a#(which causesPto be moved to the persistent context) or with an%(which causesPto be moved to the pure Coq context), then one can use all hypotheses for provingPas well as for proving the current goal.iAssert P as %cpat: assertPand eliminate it using the Coq introduction patterncpat. All hypotheses can be used for provingPas well as for proving the current goal.
-
iPureIntro: turn a pure goal into a Coq goal. This tactic works for goals of the shape⌜φ⌝,a ≡ bon discrete COFEs, and✓ aon discrete CMRAs. -
iLeft: left introduction of disjunction. -
iRight: right introduction of disjunction. -
iSplit: introduction of a conjunction, or separating conjunction provided one of the operands is persistent. -
iSplitL "H1 ... Hn": introduction of a separating conjunction. The hypothesesH1 ... Hnare used for the left conjunct, and the remaining ones for the right conjunct. Persistent hypotheses are ignored, since these do not need to be split. -
iSplitR "H0 ... Hn": symmetric version of the above. -
iExist t1, .., tn: introduction of an existential quantifier.
iExFalso: Ex falso sequitur quod libet.iDestruct pm_trm as (x1 ... xn) "ipat": elimination of a series of existential quantifiers using Coq introduction patternsx1 ... xn, and elimination of an object level connective using the proof mode introduction patternipat. In case all branches ofipatstart with a#(which causes the hypothesis to be moved to the persistent context) or with an%(which causes the hypothesis to be moved to the pure Coq context), then one can use all hypotheses for proving the premises ofpm_trm, as well as for proving the resulting goal. Note that in this case the hypotheses still need to be subdivided among the spatial premises.iDestruct pm_trm as %cpat: elimination of a pure hypothesis using the Coq introduction patterncpat. When using this tactic, all hypotheses can be used for proving the premises ofpm_trm, as well as for proving the resulting goal.
-
iFrame (t1 .. tn) "selpat": cancel the Coq terms (or Coq hypotheses)t1 ... tnand Iris hypotheses given byselpatin the goal. The constructs of the selection pattern have the following meaning:%: repeatedly frame hypotheses from the Coq context.#: repeatedly frame hypotheses from the persistent context.∗: frame as much of the spatial context as possible.
Notice that framing spatial hypotheses makes them disappear, but framing Coq or persistent hypotheses does not make them disappear.
This tactic finishes the goal in case everything in the conclusion has been framed.
-
iCombine "H1" "H2" as "pat": turnsH1 : P1andH2 : P2intoP1 ∗ P2, on whichiDetruct ... as patis called.
iModIntro mod: introduction of a modality. The type classFromModalis used to specify which modalities this tactic should introduce. Instances of that type class include: later, except 0, basic update and fancy update, persistently, affinely, plainly, absorbingly, objectively, and subjectively. The optional argumentmodcan be used to specify what modality to introduce in case of ambiguity, e.g.⎡|==> P⎤.iAlways: a deprecated alias ofiModIntro.iNext n: an alias ofiModIntro (▷^n P).iNext: an alias ofiModIntro (▷^1 P).iMod pm_trm as (x1 ... xn) "ipat": eliminate a modalitypm_trmthat is an instance of theElimModaltype class. Instances include: later, except 0, basic update and fancy update.
iLöb as "IH" forall (x1 ... xn) "selpat": perform Löb induction by generating a hypothesisIH : ▷ goal. The tactic generalizes over the Coq level variablesx1 ... xn, the hypotheses given by the selection patternselpat, and the spatial context.iInduction x as cpat "IH" forall (x1 ... xn) "selpat": perform induction on the Coq termx. The Coq introduction pattern is used to name the introduced variables. The induction hypotheses are inserted into the persistent context and given fresh names prefixedIH. The tactic generalizes over the Coq level variablesx1 ... xn, the hypotheses given by the selection patternselpat, and the spatial context.
iRewrite pm_trm/iRewrite pm_trm in "H": rewrite using an internal equality in the proof mode goal / hypothesisH.iEval (tac)/iEval (tac) in H: performs a tactictacon the proof mode goal / hypothesisH. The tactictacshould be a reduction or rewriting tactic likesimpl,cbv,lazy,rewriteorsetoid_rewrite. TheiEvaltactic is implemented by runningtacon?evar ⊢ P/P ⊢ ?evarwherePis the proof goal / hypothesisH. After runningtac,?evaris unified with the resultingP, which in turn becomes the new proof mode goal / hypothesisH. Note that parentheses aroundtacare needed.iSimpl/iSimpl in H: performssimplon the proof mode goal / hypothesisH. This is a shorthand foriEval (simpl).
iInv S with "selpat" as (x1 ... xn) "ipat" "Hclose": whereSis either a namespace N or an identifier "H". Open the invariant indicated by S. The selection patternselpatis used for any auxiliary assertions needed to open the invariant (e.g. for cancelable or non-atomic invariants). The update for closing the invariant is put in a hypothesis namedHclose.
- The tactic
doneis extended so that it also performsiAssumptionand introduces pure connectives. - The proof mode adds hints to the core
eautodatabase so thateautoautomatically introduces: conjunctions and disjunctions, universal and existential quantifiers, implications and wand, plainness, persistence, later and update modalities, and pure connectives.
Selection patterns are used to select hypotheses in the tactics iRevert,
iClear, iFrame, iLöb and iInduction. The proof mode supports the
following selection patterns:
H: select the hypothesis namedH.%: select the entire pure/Coq context.#: select the entire persistent context.∗: select the entire spatial context.
Introduction patterns are used to perform introductions and eliminations of multiple connectives on the fly. The proof mode supports the following introduction patterns:
H: create a hypothesis namedH.?: create an anonymous hypothesis._: remove the hypothesis.$: frame the hypothesis in the goal.[ipat1 ipat2]: (separating) conjunction elimination. In order to eliminate conjunctionsP ∧ Qin the spatial context, one of the following conditions should hold:- Either the proposition
PorQshould be persistent. - Either
ipat1oripat2should be_, which results in one of the conjuncts to be thrown away.
- Either the proposition
[ipat1|ipat2]: disjunction elimination.[]: false elimination.%: move the hypothesis to the pure Coq context (anonymously).->and<-: rewrite using a pure Coq equality# ipat: move the hypothesis to the persistent context.> ipat: eliminate a modality (if the goal permits).
Apart from this, there are the following introduction patterns that can only appear at the top level:
{selpat}: clear the hypotheses given by the selection patternselpat. Items of the selection pattern can be prefixed with$, which cause them to be framed instead of cleared.!%: introduce a pure goal (and leave the proof mode).!>: introduce a modality by callingiModIntro.!#: introduce a modality by callingiModIntro(deprecated)./=: performsimpl.//: performtry doneon all goals.//=: syntactic sugar for/= //*: introduce all universal quantifiers.**: introduce all universal quantifiers, as well as all arrows and wands.
For example, given:
∀ x, x = 0 ⊢ □ (P → False ∨ □ (Q ∧ ▷ R) -∗ P ∗ ▷ (R ∗ Q ∧ x = pred 2)).
You can write
iIntros (x) "% !# $ [[] | #[HQ HR]] /= !>".
which results in:
x : nat
H : x = 0
______________________________________(1/1)
"HQ" : Q
"HR" : R
--------------------------------------□
R ∗ Q ∧ x = 1
Since we are reasoning in a spatial logic, when eliminating a lemma or
hypothesis of type P_0 -∗ ... -∗ P_n -∗ R, one has to specify how the
hypotheses are split between the premises. The proof mode supports the following
specification patterns to express splitting of hypotheses:
-
H: use the hypothesisH(it should match the premise exactly). IfHis spatial, it will be consumed. -
[H1 .. Hn]and[H1 .. Hn //]: generate a goal for the premise with the (spatial) hypothesesH1 ... Hnand all persistent hypotheses. The spatial hypotheses amongH1 ... Hnwill be consumed, and will not be available for subsequent goals. Hypotheses prefixed with a$will be framed in the goal for the premise. The pattern can be terminated with a//, which causesdoneto be called to close the goal (after framing). -
[-H1 ... Hn]and[-H1 ... Hn //]: the negated forms of the above patterns, where the goal for the premise will have all spatial premises exceptH1 .. Hn. -
[> H1 ... Hn]and[> H1 ... Hn //]: like the above patterns, but these patterns can only be used if the goal is a modalityM, in which case the goal for the premise will be wrapped in the modalityM. -
[> -H1 ... Hn]and[> -H1 ... Hn //]: the negated forms of the above patterns. -
[# $H1 .. $Hn]and[# $H1 .. $Hn //]: generate a goal for a persistent premise in which all hypotheses are available. This pattern does not consume any hypotheses; all hypotheses are available in the goal for the premise, as well in the subsequent goal. The hypotheses$H1 ... $Hnwill be framed in the goal for the premise. These patterns can be terminated with a//, which causesdoneto be called to close the goal (after framing). -
[%]and[% //]: generate a Coq goal for a pure premise. This pattern does not consume any hypotheses. The pattern can be terminated with a//, which causesdoneto be called to close the goal. -
[$]: solve the premise by framing. It will first repeatedly frame the spatial hypotheses, and then repeatedly frame the persistent hypotheses. Spatial hypothesis that are not framed are carried over to the subsequent goal. -
[> $]: like the above pattern, but this pattern can only be used if the goal is a modalityM, in which case the goal for the premise will be wrapped in the modalityMbefore framing. -
[# $]: solve the persistent premise by framing. It will first repeatedly frame the spatial hypotheses, and then repeatedly frame the persistent hypotheses. This pattern does not consume any hypotheses.
For example, given:
H : □ P -∗ P 2 -∗ R -∗ x = 0 -∗ Q1 ∗ Q2
One can write:
iDestruct ("H" with "[#] [H1 $H2] [$] [% //]") as "[H4 H5]".
Many of the proof mode tactics (such as iDestruct, iApply, iRewrite) can
take both hypotheses and lemmas, and allow one to instantiate universal
quantifiers and implications/wands of these hypotheses/lemmas on the fly.
The syntax for the arguments of these tactics, called proof mode terms, is:
(H $! t1 ... tn with "spat1 .. spatn")
Here, H can be both a hypothesis, as well as a Coq lemma whose conclusion is
of the shape P ⊢ Q. In the above, t1 ... tn are arbitrary Coq terms used
for instantiation of universal quantifiers, and spat1 .. spatn are
specialization patterns to eliminate implications and wands.
Proof mode terms can be written down using the following short hands too:
(H with "spat1 .. spatn")
(H $! t1 ... tn)
H