Documentation

CslibFrontier.Foundations.Data.Fin.Prod

Coordinates of a flattened finite product #

Dividing the row-major index by the column count recovers the first coordinate, and taking its remainder recovers the second coordinate.

theorem finProdFinEquiv_val_div {m n : ℕ} (x : Fin m × Fin n) :
↑(finProdFinEquiv x) / n = ↑x.1

Division by the column count recovers the first coordinate of a flattened index.

theorem finProdFinEquiv_val_mod {m n : ℕ} (x : Fin m × Fin n) :
↑(finProdFinEquiv x) % n = ↑x.2

Remainder modulo the column count recovers the second coordinate of a flattened index.