# Documentation

Mathlib.Data.Int.Cast.Defs

# Cast of integers #

This file defines the canonical homomorphism from the integers into an additive group with a one (typically a Ring). In additive groups with a one element, there exists a unique such homomorphism and we store it in the intCast : ℤ → R→ R field.

Preferentially, the homomorphism is written as a coercion.

## Main declarations #

• Int.cast: Canonical homomorphism ℤ → R→ R.
• AddGroupWithOne: Type class for Int.cast.
def Int.castDef {R : Type u} [inst : ] [inst : Neg R] :
R

Default value for IntCast.intCast in an AddGroupWithOne.

Equations
• = match x with | => n | => -↑(n + 1)

### Additive groups with one #

class AddGroupWithOne (R : Type u) extends , , , :
• sub_eq_add_neg : autoParam (∀ (a b : R), a - b = a + -b) _auto✝
• zsmul : RR
• zsmul_zero' : autoParam (∀ (a : R), zsmul 0 a = 0) _auto✝
• zsmul_succ' : autoParam (∀ (n : ) (a : R), zsmul () a = a + zsmul () a) _auto✝
• zsmul_neg' : autoParam (∀ (n : ) (a : R), zsmul () a = -zsmul (↑()) a) _auto✝
• add_left_neg : ∀ (a : R), -a + a = 0
• The canonical homorphism ℤ → R→ R agrees with the one from ℕ → R→ R on ℕ.

intCast_ofNat : autoParam (∀ (n : ), = n) _auto✝
• The canonical homorphism ℤ → R→ R for negative values is just the negation of the values of the canonical homomorphism ℕ → R→ R.

intCast_negSucc : autoParam (∀ (n : ), = -↑(n + 1)) _auto✝

An AddGroupWithOne is an AddGroup with a 1. It also contains data for the unique homomorphisms ℕ → R→ R and ℤ → R→ R.

Instances
class AddCommGroupWithOne (R : Type u) extends , , , :
• The canonical map ℕ → R→ R sends 0 : ℕ to 0 : R.

natCast_zero :
• The canonical map ℕ → R→ R is a homomorphism.

natCast_succ : autoParam (∀ (n : ), NatCast.natCast (n + 1) = ) _auto✝
• The canonical homorphism ℤ → R→ R agrees with the one from ℕ → R→ R on ℕ.

intCast_ofNat : autoParam (∀ (n : ), = n) _auto✝
• The canonical homorphism ℤ → R→ R for negative values is just the negation of the values of the canonical homomorphism ℕ → R→ R.

intCast_negSucc : autoParam (∀ (n : ), = -↑(n + 1)) _auto✝

An AddCommGroupWithOne is an AddGroupWithOne satisfying a + b = b + a.

Instances