English
The cast from ZMod n into another semiring R is a map that sends a residue to its representative in R; it becomes a ring homomorphism when Char(R) divides n.
Русский
Отображение ZMod n в другой полускольной кольцевой структурe R отправляет класс по модулю к соответствующему элементу в R; является колец-морфизмом, если характеристика R делит n.
LaTeX
$$$ \operatorname{cast} : \{ZMod\, n\} \to R \quad\text{is a ring homomorphism if } \operatorname{char}(R) \mid n.$$$
Lean4
/-- Cast an integer modulo `n` to another semiring.
This function is a morphism if the characteristic of `R` divides `n`.
See `ZMod.castHom` for a bundled version. -/
def cast : ∀ {n : ℕ}, ZMod n → R
| 0 => Int.cast
| _ + 1 => fun i => i.val