I'm working my way through tutorials and also formalizing mathematics course and trying to solve other problems I find interesting. There is surprisingly little examples with inequalities.
How one can prove that if two ℤ
numbers are both even or both odd, the closest they can be if not equal is 2 apart?
import data.int.basic
import data.int.parity
theorem even_even_at_least_two_apart { x y : ℤ } : even x ∧ even y → x < y → x ≤ y - 2 :=
begin
sorry
end
I'm having trouble converting from mod
to minimal differences. Or I'm stuck with x ≤ y - 1
that can be obtained from lt
. I suspect my initial formalization can be off.
This is as far as i can get:
rintros ⟨ hx, hy ⟩ hlt,
rw int.even_iff at hx hy,
rw ← int.le_sub_one_iff at hlt,