The integers form a linear ordered ring #
This file contains:
- instances on
ℤ
. The stronger one isInt.instLinearOrderedCommRing
. - basic lemmas about integers that involve order properties.
Recursors #
Int.rec
: Sign disjunction. Something is true/defined onℤ
if it's true/defined for nonnegative and for negative values. (Defined in core Lean 3)Int.inductionOn
: Simple growing induction on positive numbers, plus simple decreasing induction on negative numbers. Note that this recursor is currently onlyProp
-valued.Int.inductionOn'
: Simple growing induction for numbers greater thanb
, plus simple decreasing induction on numbers less thanb
.
Miscellaneous lemmas #
theorem
Nat.exists_add_mul_eq_of_gcd_dvd_of_mul_pred_le
(p q n : ℕ)
(dvd : p.gcd q ∣ n)
(le : p.pred * q.pred ≤ n)
:
If the gcd of two natural numbers p
and q
divides a third natural number n
,
and if n
is at least (p - 1) * (q - 1)
, then n
can be represented as an ℕ
-linear
combination of p
and q
.
TODO: show that if p.gcd q = 1
and 0 ≤ n ≤ (p - 1) * (q - 1) - 1 = N
, then n
is
representable iff N - n
is not. In particular N
is not representable, solving the
coin problem for two coins: https://en.wikipedia.org/wiki/Coin_problem#n_=_2.