-
Robbert Krebbers authoredRobbert Krebbers authored
Tactic overview
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 trm
: match the conclusion of the current goal against the conclusion oftetrmrm
and generates goals for the premises oftrm
. See proof mode terms below.
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 "H1 ... Hn"
: clear the hypothesisH1 ... Hn
. The symbol★
can be used to clear entire spatial context. -
iRevert (x1 ... xn) "H1 ... Hn"
: revert the proof mode hypothesesH1 ... Hn
into wands, as well as the Coq level hypotheses/variablesx1 ... xn
into universal quantifiers. The symbol★
can be used to revert the entire spatial context. -
iRename "H1" into "H2"
: rename the hypothesisH1
intoH2
. -
iSpecialize trm
: instantiate universal quantifiers and eliminate implications/wands of a hypothesistrm
. See proof mode terms below. -
iPoseProof trm as "H"
: puttrm
into the context as a new hypothesisH
. -
iAssert P with "spat" as "ipat"
: create a new goal with conclusionP
and putP
in the context of the original goal. The specialization patternspat
specifies which hypotheses will be consumed by provingP
and the introduction patternipat
specifies how to eliminateP
.
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. -
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 trm as (x1 ... xn) "spat1 ... spatn"
: elimination of existential quantifiers using Coq introduction patternsx1 ... xn
and elimination of object level connectives using the proof mode introduction patternsipat1 ... ipatn
. -
iDestruct trm as %cpat
: elimination of a pure hypothesis using the Coq introduction patterncpat
.
Separating logic specific tactics
-
iFrame "H0 ... Hn"
: cancel the hypothesesH0 ... Hn
in the goal. -
iCombine "H1" "H2" as "H"
: turnsH1 : P1
andH2 : P2
intoH : P1 ★ P2
.
The later modality
-
iNext
: introduce a later by stripping laters from all hypotheses. -
iLöb (x1 ... xn) as "IH"
: perform Löb induction by generalizing over the Coq level variablesx1 ... xn
and the entire spatial context.
Rewriting
-
iRewrite trm
: rewrite an equality in the conclusion. -
iRewrite trm in "H"
: rewrite an equality in the hypothesisH
.
Iris
-
iPvsIntro
: introduction of a primitive view shift. Generates a goal if the masks are not syntactically equal. -
iPvs trm as (x1 ... xn) "ipat"
: runs a primitive view shifttrm
. -
iInv N as (x1 ... xn) "ipat"
: open the invariantN
. -
iInv> N as (x1 ... xn) "ipat"
: open the invariantN
and establish that it is timeless so no laters have to be added. -
iTimeless "H"
: strip a later of a timeless hypothesesH
in case the conclusion is a primitive view shifts or weakest precondition.
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 and later modalities, primitive view shifts, and pure connectives.
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 named H. -
?
: create an anonymous hypothesis. -
_
: remove the hypothesis. -
$
: frame the hypothesis in the goal. -
# ipat
: move the hypothesis to the persistent context. -
%
: move the hypothesis to the pure Coq context (anonymously). -
[ipat ipat]
: (separating) conjunction elimination. -
[ipat|ipat]
: disjunction elimination. -
[]
: false elimination.
Apart from this, there are the following introduction patterns that can only appear at the top level:
-
!
: introduce a box (provided that the spatial context is empty). -
>
: introduce a later (which strips laters from all hypotheses). -
{H1 ... Hn}
: clearH1 ... Hn
. -
{$H1 ... $Hn}
: frameH1 ... Hn
(this pattern can be mixed with the previous pattern, e.g.,{$H1 H2 $H3}
). -
/=
: performsimpl
. -
*
: 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
Specialization patterns
Since we are reasoning in a spatial logic, when eliminating a lemma or
hypotheses 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
so called specification patterns to express this splitting:
-
H
: use the hypothesisH
(it should match the premise exactly). IfH
is spatial, it will be consumed. -
[H1 ... Hn]
: generate a goal with the spatial hypothesesH1 ... Hn
and all persistent hypotheses. The hypothesesH1 ... Hn
will be consumed. -
[-H1 ... Hn]
: negated form of the above pattern -
=>[H1 ... Hn]
: same as the above pattern, but can only be used if the goal is a primitive view shift, in which case the view shift will be kept in the goal of the premise too. -
[#]
: This pattern can be used when eliminatingP -★ Q
when eitherP
orQ
is persistent. In this case, all hypotheses are available in the goal for the premise as none will be consumed. -
[%]
: This pattern can be used when eliminatingP -★ Q
whenP
is pure. It will generate a Coq goal forP
and does not consume any hypotheses. -
*
: instantiate all top-level universal quantifiers with meta variables.
For example, given:
H : □ P -★ P 2 -★ x = 0 -★ Q1 ∗ Q2
You can write:
iDestruct ("H" with "[#] [H1 H2] [%]") as "[H4 H5]".
Proof mode terms
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, called proof mode terms, of these tactics 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