@[instance]
Equations
- coe_pnat_nat = {coe := subtype.val (λ (n : ℕ), 0 < n)}
@[instance]
Equations
- nat.primes.coe_pnat = {coe := λ (p : nat.primes), ⟨↑p, _⟩}
@[instance]
We now define a long list of structures on ℕ+ induced by similar structures on ℕ. Most of these behave in a completely obvious way, but there are a few things to be said about subtraction, division and powers.
Equations
- pnat.decidable_eq = λ (a b : ℕ+), subtype.decidable_eq a b
@[instance]
Equations
- pnat.decidable_linear_order = subtype.decidable_linear_order (λ (n : ℕ), 0 < n)
@[instance]
@[instance]
Equations
- pnat.add_left_cancel_semigroup = {add := add_comm_semigroup.add pnat.add_comm_semigroup, add_assoc := _, add_left_cancel := pnat.add_left_cancel_semigroup._proof_1}
@[instance]
Equations
- pnat.add_right_cancel_semigroup = {add := add_comm_semigroup.add pnat.add_comm_semigroup, add_assoc := _, add_right_cancel := pnat.add_right_cancel_semigroup._proof_1}
@[instance]
@[instance]
Equations
- pnat.order_bot = {bot := 1, le := partial_order.le (semilattice_inf.to_partial_order ℕ+), lt := partial_order.lt (semilattice_inf.to_partial_order ℕ+), le_refl := pnat.order_bot._proof_1, le_trans := pnat.order_bot._proof_2, lt_iff_le_not_le := pnat.order_bot._proof_3, le_antisymm := pnat.order_bot._proof_4, bot_le := pnat.order_bot._proof_5}
@[instance]
Equations
- pnat.left_cancel_semigroup = {mul := comm_monoid.mul pnat.comm_monoid, mul_assoc := _, mul_left_cancel := pnat.left_cancel_semigroup._proof_1}
@[instance]
Equations
- pnat.right_cancel_semigroup = {mul := comm_monoid.mul pnat.comm_monoid, mul_assoc := _, mul_right_cancel := pnat.right_cancel_semigroup._proof_1}
@[instance]
Equations
- pnat.ordered_cancel_comm_monoid = {mul := left_cancel_semigroup.mul pnat.left_cancel_semigroup, mul_assoc := _, one := comm_monoid.one pnat.comm_monoid, one_mul := _, mul_one := _, mul_comm := _, mul_left_cancel := _, mul_right_cancel := _, le := decidable_linear_order.le pnat.decidable_linear_order, lt := decidable_linear_order.lt pnat.decidable_linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, mul_le_mul_left := pnat.ordered_cancel_comm_monoid._proof_1, le_of_mul_le_mul_left := pnat.ordered_cancel_comm_monoid._proof_2}
@[instance]
Equations
- pnat.distrib = {mul := comm_monoid.mul pnat.comm_monoid, add := add_comm_semigroup.add pnat.add_comm_semigroup, left_distrib := pnat.distrib._proof_1, right_distrib := pnat.distrib._proof_2}
We define m % k and m / k in the same way as for nat except that when m = n * k we take m % k = k and m / k = n - 1. This ensures that m % k is always positive and m = (m % k) + k * (m / k) in all cases. Later we define a function div_exact which gives the usual m / k in the case where k divides m.
Equations
- k.mod_div_aux (r + 1) q = (⟨r + 1, _⟩, q)
- k.mod_div_aux 0 q = (k, q.pred)