l3lab/ntp-mathlib huggingface dataset:
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · 

Proof state:
case pos.Ha.a
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 ≤ na * ↑db

Next tactic:
apply mul_nonneg h.2 (Nat.cast_nonneg _)
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · 

Proof state:
case pos.Hb
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 < ↑(Nat.gcd (Int.natAbs (nb * ↑da - na * ↑db)) (db * da))

Next tactic:
simp only [Nat.cast_pos]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          

Proof state:
case pos.Hb
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 < Nat.gcd (Int.natAbs (nb * ↑da - na * ↑db)) (db * da)

Next tactic:
apply Nat.gcd_pos_of_pos_right
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          

Proof state:
case pos.Hb.npos
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 < db * da

Next tactic:
apply mul_pos
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> 

Proof state:
case pos.Hb.npos.ha
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 < db

Next tactic:
rwa [pos_iff_ne_zero]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> 

Proof state:
case pos.Hb.npos.hb
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : nb < 0 ∧ 0 ≤ na
⊢ 0 < da

Next tactic:
rwa [pos_iff_ne_zero]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · 

Proof state:
case pos
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : nb = 0
⊢ na ≤ 0 ↔ Rat.Nonneg (mk' nb db - mk' na da)

Next tactic:
simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        

Proof state:
case pos
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : nb = 0
⊢ na ≤ 0 ↔ Rat.Nonneg (mk' nb db - mk' na da)

Next tactic:
simp [h', Rat.Nonneg]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · 

Proof state:
case neg
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : ¬nb = 0
⊢ (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da ↔ Rat.Nonneg (mk' nb db - mk' na da)

Next tactic:
simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        

Proof state:
case neg
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : ¬nb = 0
⊢ (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da ↔
    0 ≤ (nb * ↑da - na * ↑db) / ↑(Nat.gcd (Int.natAbs (nb * ↑da - na * ↑db)) (db * da))

Next tactic:
refine ⟨fun H => ?_, fun H _ => ?_⟩
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · 

Proof state:
case neg.refine_1
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
⊢ 0 ≤ (nb * ↑da - na * ↑db) / ↑(Nat.gcd (Int.natAbs (nb * ↑da - na * ↑db)) (db * da))

Next tactic:
refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          

Proof state:
case neg.refine_1
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
⊢ 0 ≤ nb * ↑da - na * ↑db

Next tactic:
rw [sub_nonneg]
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          

Proof state:
case neg.refine_1
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h : ¬(nb < 0 ∧ 0 ≤ na)
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
⊢ na * ↑db ≤ nb * ↑da

Next tactic:
push_neg at h
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          push_neg at h
          

Proof state:
case neg.refine_1
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
h : nb < 0 → na < 0
⊢ na * ↑db ≤ nb * ↑da

Next tactic:
obtain hb|hb := Ne.lt_or_lt h'
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          push_neg at h
          obtain hb|hb := Ne.lt_or_lt h'
          · 

Proof state:
case neg.refine_1.inl
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb✝ : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
h : nb < 0 → na < 0
hb : nb < 0
⊢ na * ↑db ≤ nb * ↑da

Next tactic:
apply H
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          push_neg at h
          obtain hb|hb := Ne.lt_or_lt h'
          · apply H
            

Proof state:
case neg.refine_1.inl
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb✝ : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
h : nb < 0 → na < 0
hb : nb < 0
⊢ 0 < nb → 0 < na

Next tactic:
intro H'
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          push_neg at h
          obtain hb|hb := Ne.lt_or_lt h'
          · apply H
            intro H'
            

Proof state:
case neg.refine_1.inl
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb✝ : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
h : nb < 0 → na < 0
hb : nb < 0
H' : 0 < nb
⊢ 0 < na

Next tactic:
exact (hb.trans H').false.elim
protected theorem le_iff_Nonneg (a b : ℚ) : a ≤ b ↔ Rat.Nonneg (b - a) :=
  numDenCasesOn'' a fun na da ha hared =>
    numDenCasesOn'' b fun nb db hb hbred => by
      change Rat.blt _ _ = false ↔ _
      unfold Rat.blt
      simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
        decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le]
      split_ifs with h h'
      · rw [Rat.sub_def]
        simp only [Rat.Nonneg, false_iff, not_le]
        simp only [normalize_eq]
        apply Int.ediv_neg'
        · rw [sub_neg]
          apply lt_of_lt_of_le
          · apply mul_neg_of_neg_of_pos h.1
            rwa [Nat.cast_pos, pos_iff_ne_zero]
          · apply mul_nonneg h.2 (Nat.cast_nonneg _)
        · simp only [Nat.cast_pos]
          apply Nat.gcd_pos_of_pos_right
          apply mul_pos <;> rwa [pos_iff_ne_zero]
      · simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
        simp [h', Rat.Nonneg]
      · simp [Rat.Nonneg, Rat.sub_def, normalize_eq]
        refine ⟨fun H => ?_, fun H _ => ?_⟩
        · refine Int.ediv_nonneg ?_ (Nat.cast_nonneg _)
          rw [sub_nonneg]
          push_neg at h
          obtain hb|hb := Ne.lt_or_lt h'
          · apply H
            intro H'
            exact (hb.trans H').false.elim
          · 

Proof state:
case neg.refine_1.inr
a✝ b✝ c a b : ℚ
na : ℤ
da : ℕ
ha : da ≠ 0
hared : Nat.Coprime (Int.natAbs na) da
nb : ℤ
db : ℕ
hb✝ : db ≠ 0
hbred : Nat.Coprime (Int.natAbs nb) db
h' : ¬nb = 0
H : (0 < nb → 0 < na) → na * ↑db ≤ nb * ↑da
h : nb < 0 → na < 0
hb : 0 < nb
⊢ na * ↑db ≤ nb * ↑da

Next tactic:
obtain ha|ha := le_or_lt na 0