-
Dan Frumin authoredDan Frumin authored
Tactic overview
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.
Applying hypotheses and lemmas
-
iExact "H"
: finish the goal if the conclusion matches the hypothesisH
-
iAssumption
: finish the goal if the conclusion matches any hypothesis -
iApply pm_trm
: match the conclusion of the current goal against the conclusion ofpm_trm
and 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.
Context management
-
iIntros (x1 ... xn) "ipat1 ... ipatn"
: introduce universal quantifiers using Coq introduction patternsx1 ... xn
and implications/wands using proof mode introduction patternsipat1 ... ipatn
. -
iClear (x1 ... xn) "selpat"
: clear the hypotheses given by the selection patternselpat
and the Coq level hypotheses/variablesx1 ... xn
. -
iRevert (x1 ... xn) "selpat"
: revert the hypotheses given by the selection patternselpat
into wands, and the Coq level hypotheses/variablesx1 ... xn
into universal quantifiers. Persistent hypotheses are wrapped into the always modality. -
iRename "H1" into "H2"
: rename the hypothesisH1
intoH2
. -
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 "H"
: putpm_trm
into the context as a new hypothesisH
. -
iAssert P with "spat" as "ipat"
: generates a new subgoalP
and adds the hypothesisP
to the current goal. The specialization patternspat
specifies which hypotheses will be consumed by provingP
. The introduction patternipat
specifies how to eliminateP
. In case all branches ofipat
start with a#
(which causesP
to be moved to the persistent context) or with an%
(which causesP
to be moved to the pure Coq context), then one can use all hypotheses for provingP
as well as for proving the current goal. -
iAssert P as %cpat
: assertP
and eliminate it using the Coq introduction patterncpat
. All hypotheses can be used for provingP
as well as for proving the current goal.
Introduction of logical connectives
-
iPureIntro
: turn a pure goal into a Coq goal. This tactic works for goals of the shape⌜φ⌝
,a ≡ b
on discrete COFEs, and✓ a
on 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 ... Hn
are 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.
Elimination of logical connectives
-
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 ofipat
start 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.
Separating logic specific tactics
-
iFrame (t1 .. tn) "selpat"
: cancel the Coq terms (or Coq hypotheses)t1 ... tn
and Iris hypotheses given byselpat
in 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 "H"
: turnsH1 : P1
andH2 : P2
intoH : P1 ∗ P2
.
Modalities
-
iModIntro
: introduction of a modality that is an instance of theIntoModal
type class. Instances include: later, except 0, basic update and fancy update. -
iMod pm_trm as (x1 ... xn) "ipat"
: eliminate a modalitypm_trm
that is an instance of theElimModal
type class. Instances include: later, except 0, basic update and fancy update.
The later modality
-
iNext n
: introducen
laters by stripping that number of laters from all hypotheses. If the argumentn
is not given, it strips one later if the leftmost conjunct is of the shape▷ P
, orn
laters if the leftmost conjunct is of the shape▷^n P
. -
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.
Induction
-
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.
Rewriting
-
iRewrite pm_trm
: rewrite an equality in the conclusion. -
iRewrite pm_trm in "H"
: rewrite an equality in the hypothesisH
.
Iris
-
iInv N as (x1 ... xn) "ipat" "Hclose"
: open the invariantN
, the update for closing the invariant is put in a hypothesis namedHclose
.
Miscellaneous
- The tactic
done
is extended so that it also performsiAssumption
and introduces pure connectives. - The proof mode adds hints to the core
eauto
database so thateauto
automatically introduces: conjunctions and disjunctions, universal and existential quantifiers, implications and wand, always, later and update modalities, and pure connectives.
Selection patterns
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
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. -
[ipat ipat]
: (separating) conjunction elimination. -
[ipat|ipat]
: disjunction elimination. -
[]
: false elimination. -
%
: move the hypothesis to the pure Coq context (anonymously). -
# ipat
: move the hypothesis to the persistent context. -
> ipat
: eliminate a modality (if the goal permits).