Theorem: Int.exists_lt_and_lt_iff_not_dvd
File: Mathlib/Data/Int/Defs.lean

tactic: refine ⟨?_, fun h ↦ ?_⟩
state_before: a b c d m✝ n m : ℤ
hn : 0 < n
⊢ (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m
state_after: case refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
⊢ (∃ k, n * k < m ∧ m < n * (k + 1)) → ¬n ∣ m

case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : ¬n ∣ m
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)

tactic: rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
state_before: case refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
⊢ (∃ k, n * k < m ∧ m < n * (k + 1)) → ¬n ∣ m
state_after: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : n * k < n * l
h2k : n * l < n * (k + 1)
⊢ False

tactic: replace h1k := lt_of_mul_lt_mul_left h1k (by omega)
state_before: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : n * k < n * l
h2k : n * l < n * (k + 1)
⊢ False
state_after: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h2k : n * l < n * (k + 1)
h1k : k < l
⊢ False

tactic: replace h2k := lt_of_mul_lt_mul_left h2k (by omega)
state_before: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h2k : n * l < n * (k + 1)
h1k : k < l
⊢ False
state_after: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : l < k + 1
⊢ False

tactic: rw [Int.lt_add_one_iff, ← Int.not_lt] at h2k
state_before: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : l < k + 1
⊢ False
state_after: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : ¬k < l
⊢ False

tactic: exact h2k h1k
state_before: case refine_1.intro.intro.intro
a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : ¬k < l
⊢ False
state_after: no goals

tactic: omega
state_before: a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h1k : n * k < n * l
h2k : n * l < n * (k + 1)
⊢ 0 ≤ n
state_after: no goals

tactic: omega
state_before: a b c d m n : ℤ
hn : 0 < n
k l : ℤ
h2k : n * l < n * (k + 1)
h1k : k < l
⊢ 0 ≤ n
state_after: no goals

tactic: rw [dvd_iff_emod_eq_zero, ← Ne] at h
state_before: case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : ¬n ∣ m
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)
state_after: case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)

tactic: rw [← emod_add_ediv m n]
state_before: case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)
state_after: case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ ∃ k, n * k < m % n + n * (m / n) ∧ m % n + n * (m / n) < n * (k + 1)

tactic: refine ⟨m / n, Int.lt_add_of_pos_left _ ?_, ?_⟩
state_before: case refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ ∃ k, n * k < m % n + n * (m / n) ∧ m % n + n * (m / n) < n * (k + 1)
state_after: case refine_2.refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ 0 < m % n

case refine_2.refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ m % n + n * (m / n) < n * (m / n + 1)

tactic: have := emod_nonneg m (Int.ne_of_gt hn)
state_before: case refine_2.refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ 0 < m % n
state_after: case refine_2.refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 ≤ m % n
⊢ 0 < m % n

tactic: omega
state_before: case refine_2.refine_1
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 ≤ m % n
⊢ 0 < m % n
state_after: no goals

tactic: rw [Int.add_comm _ (1 : ℤ), Int.mul_add, Int.mul_one]
state_before: case refine_2.refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ m % n + n * (m / n) < n * (m / n + 1)
state_after: case refine_2.refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ m % n + n * (m / n) < n + n * (m / n)

tactic: exact Int.add_lt_add_right (emod_lt_of_pos _ hn) _
state_before: case refine_2.refine_2
a b c d m✝ n m : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ m % n + n * (m / n) < n + n * (m / n)
state_after: no goals