Further lemmas about integer division, now that omega
is available. #
dvd #
Equations
- x✝¹.decidableDvd x✝ = decidable_of_decidable_of_iff ⋯
*div zero #
preliminaries for div equivalences #
div equivalences #
mod zero #
mod definitions #
Variant of tmod_add_tdiv
with the multiplication written the other way around.
Variant of tdiv_add_tmod
with the multiplication written the other way around.
Variant of fmod_add_fdiv
with the multiplication written the other way around.
Variant of fdiv_add_fmod
with the multiplication written the other way around.
mod equivalences #
/
ediv #
Equations
Instances For
Equations
Instances For
emod #
properties of /
and %
#
Instances For
/
and ordering #
tdiv #
There are no lemmas
add_mul_tdiv_right : c ≠ 0 → (a + b * c).tdiv c = a.tdiv c + b
add_mul_tdiv_left : b ≠ 0 → (a + b * c).tdiv b = a.tdiv b + c
- (similarly
mul_add_tdiv_right
,mul_add_tdiv_left
) add_tdiv_of_dvd_right : c ∣ b → (a + b).tdiv c = a.tdiv c + b.tdiv c
add_tdiv_of_dvd_left : c ∣ a → (a + b).tdiv c = a.tdiv c + b.tdiv c
because these statements are all incorrect, and require awkward conditional off-by-one corrections.
Equations
Instances For
tmod #
properties of tdiv
and tmod
tdiv
and ordering #
fdiv #
Equations
Instances For
One could prove the following, but as the statements are quite awkward, so far it doesn't seem worthwhile.
theorem natAbs_fdiv {a b : Int} (h : b ≠ 0) :
natAbs (a.fdiv b) = a.natAbs / b.natAbs + if a.sign = b.sign ∨ b ∣ a then 0 else 1 := ...
theorem sign_fdiv (a b : Int) :
sign (a.fdiv b) = if a.sign = b.sign ∧ natAbs a < natAbs b then 0 else sign a * sign b := ...
fmod #
Equations
Instances For
properties of fdiv
and fmod
#
fdiv
and ordering #
bmod #
Equations
Instances For
Instances For
When both x and y are negative we need stricter bounds on x and y
to establish the upper bound of x/y, i.e., x / y < x.natAbs.
In particular, consider the following counter examples:
· (-1) / (-2) = 1 and ¬ 1 < (-1).natAbs
(note that Int.neg_one_ediv already handles ediv
where the numerator is -1)
· (-2) / (-1) = 2 and ¬ 1 < (-2).natAbs
To exclude these cases, we enforce stricter bounds on the values of x and y.
Helper theorems for dvd
simproc