The norm_cast
family of tactics is used to normalize certain coercions (casts) in expressions.
-
norm_cast
normalizes casts in the target. -
norm_cast at h
normalizes casts in hypothesish
.
The tactic is basically a version of simp
with a specific set of lemmas to move casts
upwards in the expression.
Therefore even in situations where non-terminal simp
calls are discouraged (because of fragility),
norm_cast
is considered to be safe.
It also has special handling of numerals.
For instance, given an assumption
a b : ℤ h : ↑a + ↑b < (10 : ℚ)
writing norm_cast at h
will turn h
into
h : a + b < 10
There are also variants of basic tactics that use norm_cast
to normalize expressions during
their operation, to make them more flexible about the expressions they accept
(we say that it is a tactic modulo the effects of norm_cast
):
-
exact_mod_cast
forexact
andapply_mod_cast
forapply
. Writingexact_mod_cast h
andapply_mod_cast h
will normalize casts in the goal andh
before usingexact h
orapply h
. -
rw_mod_cast
forrw
. It appliesnorm_cast
between rewrites. -
assumption_mod_cast
forassumption
. This is effectivelynorm_cast at *; assumption
, but more efficient. It normalizes casts in the goal and, for every hypothesish
in the context, it will try to normalize casts inh
and useexact h
.
See also push_cast
, which moves casts inwards rather than lifting them outwards.