Theorem: Rat.num_lt_succ_floor_mul_den
File: Mathlib/Data/Rat/Floor.lean

tactic: suffices (q.num : ℚ) < (⌊q⌋ + 1) * q.den by exact_mod_cast this
state_before: q : ℚ
⊢ q.num < (⌊q⌋ + 1) * ↑q.den

tactic: suffices (q.num : ℚ) < (q - fract q + 1) * q.den by
  have : (⌊q⌋ : ℚ) = q - fract q := eq_sub_of_add_eq <| floor_add_fract q
  rwa [this]
state_before: q : ℚ
⊢ ↑q.num < (↑⌊q⌋ + 1) * ↑q.den

tactic: suffices (q.num : ℚ) < q.num + (1 - fract q) * q.den by
  have : (q - fract q + 1) * q.den = q.num + (1 - fract q) * q.den
  calc
    (q - fract q + 1) * q.den = (q + (1 - fract q)) * q.den := by ring
    _ = q * q.den + (1 - fract q) * q.den := by rw [add_mul]
    _ = q.num + (1 - fract q) * q.den := by simp
  rwa [this]
state_before: q : ℚ
⊢ ↑q.num < (q - fract q + 1) * ↑q.den

tactic: suffices 0 < (1 - fract q) * q.den by
  rw [← sub_lt_iff_lt_add']
  simpa
state_before: q : ℚ
⊢ ↑q.num < ↑q.num + (1 - fract q) * ↑q.den

tactic: have : 0 < 1 - fract q := by
  have : fract q < 1 := fract_lt_one q
  have : 0 + fract q < 1 := by simp [this]
  rwa [lt_sub_iff_add_lt]
state_before: q : ℚ
⊢ 0 < (1 - fract q) * ↑q.den

tactic: exact mul_pos this (by exact_mod_cast q.pos)
state_before: q : ℚ
this : 0 < 1 - fract q
⊢ 0 < (1 - fract q) * ↑q.den

tactic: exact_mod_cast this
state_before: q : ℚ
this : ↑q.num < (↑⌊q⌋ + 1) * ↑q.den
⊢ q.num < (⌊q⌋ + 1) * ↑q.den

tactic: have : (⌊q⌋ : ℚ) = q - fract q := eq_sub_of_add_eq <| floor_add_fract q
state_before: q : ℚ
this : ↑q.num < (q - fract q + 1) * ↑q.den
⊢ ↑q.num < (↑⌊q⌋ + 1) * ↑q.den

tactic: rwa [this]
state_before: q : ℚ
this✝ : ↑q.num < (q - fract q + 1) * ↑q.den
this : ↑⌊q⌋ = q - fract q
⊢ ↑q.num < (↑⌊q⌋ + 1) * ↑q.den

tactic: have : (q - fract q + 1) * q.den = q.num + (1 - fract q) * q.den
state_before: q : ℚ
this : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
⊢ ↑q.num < (q - fract q + 1) * ↑q.den

tactic: calc
  (q - fract q + 1) * q.den = (q + (1 - fract q)) * q.den := by ring
  _ = q * q.den + (1 - fract q) * q.den := by rw [add_mul]
  _ = q.num + (1 - fract q) * q.den := by simp
state_before: case this
q : ℚ
this : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
⊢ (q - fract q + 1) * ↑q.den = ↑q.num + (1 - fract q) * ↑q.den

q : ℚ
this✝ : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
this : (q - fract q + 1) * ↑q.den = ↑q.num + (1 - fract q) * ↑q.den
⊢ ↑q.num < (q - fract q + 1) * ↑q.den

tactic: rwa [this]
state_before: q : ℚ
this✝ : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
this : (q - fract q + 1) * ↑q.den = ↑q.num + (1 - fract q) * ↑q.den
⊢ ↑q.num < (q - fract q + 1) * ↑q.den

tactic: ring
state_before: q : ℚ
this : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
⊢ (q - fract q + 1) * ↑q.den = (q + (1 - fract q)) * ↑q.den

tactic: rw [add_mul]
state_before: q : ℚ
this : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
⊢ (q + (1 - fract q)) * ↑q.den = q * ↑q.den + (1 - fract q) * ↑q.den

tactic: simp
state_before: q : ℚ
this : ↑q.num < ↑q.num + (1 - fract q) * ↑q.den
⊢ q * ↑q.den + (1 - fract q) * ↑q.den = ↑q.num + (1 - fract q) * ↑q.den

tactic: rw [← sub_lt_iff_lt_add']
state_before: q : ℚ
this : 0 < (1 - fract q) * ↑q.den
⊢ ↑q.num < ↑q.num + (1 - fract q) * ↑q.den

tactic: simpa
state_before: q : ℚ
this : 0 < (1 - fract q) * ↑q.den
⊢ ↑q.num - ↑q.num < (1 - fract q) * ↑q.den

tactic: have : fract q < 1 := fract_lt_one q
state_before: q : ℚ
⊢ 0 < 1 - fract q

tactic: have : 0 + fract q < 1 := by simp [this]
state_before: q : ℚ
this : fract q < 1
⊢ 0 < 1 - fract q

tactic: rwa [lt_sub_iff_add_lt]
state_before: q : ℚ
this✝ : fract q < 1
this : 0 + fract q < 1
⊢ 0 < 1 - fract q

tactic: simp [this]
state_before: q : ℚ
this : fract q < 1
⊢ 0 + fract q < 1

tactic: exact_mod_cast q.pos
state_before: q : ℚ
this : 0 < 1 - fract q
⊢ 0 < ↑q.den