The generalizes
tactic #
This module defines the tactic.generalizes'
tactic and its interactive version
tactic.interactive.generalizes
. These work like generalize
, but they can
generalize over multiple expressions at once. This is particularly handy when
there are dependencies between the expressions, in which case generalize
will
usually fail but generalizes
may succeed.
Implementation notes #
To generalize the target T
over expressions j₁ : J₁, ..., jₙ : Jₙ
, we first
create the new target type
T' = ∀ (k₁ : J₁) ... (kₙ : Jₙ) (k₁_eq : k₁ = j₁) ... (kₙ_eq : kₙ == jₙ), U
where U
is T
with any occurrences of the jᵢ
replaced by the corresponding
kᵢ
. Note that some of the kᵢ_eq
may be heterogeneous; this happens when
there are dependencies between the jᵢ
. The construction of T'
is performed
by generalizes.step1
and generalizes.step2
.
Having constructed T'
, we can assert
it and use it to construct a proof of
the original target by instantiating the binders with
This leaves us with a generalized goal. This construction is performed by
generalizes.step3
.