Counting elements in an interval with given residue #
The theorems in this file generalise Nat.card_multiples in
Mathlib/Data/Nat/Factorization/Basic.lean to all integer intervals and any fixed residue (not just
zero, which reduces to the multiples). Theorems are given for Ico and Ioc intervals.
There are โb / rโ - โa / rโ multiples of r in [a, b), if a โค b.
There are โb / rโ - โa / rโ multiples of r in (a, b], if a โค b.
There are โ(b - v) / rโ - โ(a - v) / rโ numbers congruent to v mod r in [a, b),
if a โค b.
There are โ(b - v) / rโ - โ(a - v) / rโ numbers congruent to v mod r in (a, b],
if a โค b.
There are โ(b - v) / rโ - โ(a - v) / rโ numbers congruent to v mod r in [a, b),
if a โค b. Nat version of Int.Ico_filter_modEq_card.
There are โ(b - v) / rโ - โ(a - v) / rโ numbers congruent to v mod r in (a, b],
if a โค b. Nat version of Int.Ioc_filter_modEq_card.
There are โ(b - v % r) / rโ numbers in [0, b) congruent to v mod r.
There are b / r + [v % r < b % r] numbers in [0, b) congruent to v mod r,
where [ยท] is the Iverson bracket.