Basic instances on the integers #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file contains:
- instances on
ℤ
. The stronger one isint.comm_ring
. Seedata/int/defs/order
forint.linear_ordered_comm_ring
. - basic lemmas about the integers, but which do not use the ordered algebra hierarchy.
@[protected, instance]
Equations
@[protected, instance]
Equations
- int.comm_ring = {add := int.add, add_assoc := int.add_assoc, zero := int.zero, zero_add := int.zero_add, add_zero := int.add_zero, nsmul := ring.nsmul._default int.zero int.add int.zero_add int.add_zero, nsmul_zero' := int.comm_ring._proof_1, nsmul_succ' := int.comm_ring._proof_2, neg := int.neg, sub := int.sub, sub_eq_add_neg := int.comm_ring._proof_3, zsmul := has_mul.mul int.has_mul, zsmul_zero' := int.zero_mul, zsmul_succ' := int.comm_ring._proof_4, zsmul_neg' := int.comm_ring._proof_5, add_left_neg := int.add_left_neg, add_comm := int.add_comm, int_cast := λ (n : ℤ), n, nat_cast := int.of_nat, one := int.one, nat_cast_zero := int.comm_ring._proof_6, nat_cast_succ := int.comm_ring._proof_7, int_cast_of_nat := int.comm_ring._proof_8, int_cast_neg_succ_of_nat := int.comm_ring._proof_9, mul := int.mul, mul_assoc := int.mul_assoc, one_mul := int.one_mul, mul_one := int.mul_one, npow := ring.npow._default int.one int.mul int.one_mul int.mul_one, npow_zero' := int.comm_ring._proof_10, npow_succ' := int.comm_ring._proof_11, left_distrib := int.distrib_left, right_distrib := int.distrib_right, mul_comm := int.mul_comm}
Extra instances to short-circuit type class resolution #
These also prevent non-computable instances like int.normed_comm_ring
being used to construct
these instances non-computably.
@[protected, instance]
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
@[protected, instance]
Equations
@[protected, instance]
@[protected, instance]
Equations
@[protected, instance]
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
succ and pred #
nat abs #
/
#
mod #
properties of /
and %
#
to_nat #
If n : ℕ
, then int.to_nat' n = some n
, if n : ℤ
is negative, then int.to_nat' n = none
.
Equations
- -[1+ n].to_nat' = option.none
- ↑n.to_nat' = option.some n