norm_fin
#
This file defines functions for dealing with fin n
numbers as expressions.
Main definitions #
-
tactic.norm_fin.eval_ineq
is anorm_num
plugin for normalizing equalities and inequalities of typefin n
. -
tactic.interactive.norm_fin
is a standalone tactic likenorm_num
for normalizingfin n
expressions anywhere in the goal.
normalize_fin n a b
means that a : fin n
is equivalent to b : ℕ
in the modular sense -
that is, ↑a ≡ b (mod n)
. This is used for translating the algebraic operations: addition,
multiplication, zero and one, which use modulo for reduction.
Equations
- tactic.norm_fin.normalize_fin n a b = (a.val = b % n)
normalize_fin_lt n a b
means that a : fin n
is equivalent to b : ℕ
in the embedding
sense - that is, ↑a = b
. This is used for operations that treat fin n
as the subset
{0, ..., n-1}
of ℕ
. For example, fin.succ : fin n → fin (n+1)
is thought of as the successor
function, but it does not lift to a map zmod n → zmod (n+1)
; this addition only makes sense if
the input is strictly less than n
.
normalize_fin_lt n a b
is equivalent to normalize_fin n a b ∧ b < n
.
Equations
- tactic.norm_fin.normalize_fin_lt n a b = (a.val = b)
Rewrites occurrences of fin expressions to normal form anywhere in the goal.
The norm_num
extension will only rewrite fin expressions if they appear in equalities and
inequalities. For example if the goal is P (2 + 2 : fin 3)
then norm_num
will not do anything
but norm_fin
will reduce the goal to P 1
.