l3lab/ntp-mathlib huggingface dataset:
protected theorem le_antisymm {a b : ℚ} (hab : a ≤ b) (hba : b ≤ a) : a = b := by
  rw [Rat.le_iff_Nonneg] at hab hba
  rw [sub_eq_add_neg] at hba
  rw [← neg_sub, sub_eq_add_neg] at hab
  

Proof state:
a✝ b✝ c a b : ℚ
hab : Rat.Nonneg (-(a + -b))
hba : Rat.Nonneg (a + -b)
⊢ a = b

Next tactic:
have := eq_neg_of_add_eq_zero_left (Rat.nonneg_antisymm hba hab)
protected theorem le_antisymm {a b : ℚ} (hab : a ≤ b) (hba : b ≤ a) : a = b := by
  rw [Rat.le_iff_Nonneg] at hab hba
  rw [sub_eq_add_neg] at hba
  rw [← neg_sub, sub_eq_add_neg] at hab
  have := eq_neg_of_add_eq_zero_left (Rat.nonneg_antisymm hba hab)
  

Proof state:
a✝ b✝ c a b : ℚ
hab : Rat.Nonneg (-(a + -b))
hba : Rat.Nonneg (a + -b)
this : a = - -b
⊢ a = b

Next tactic:
rwa [neg_neg] at this
protected theorem le_trans {a b c : ℚ} (hab : a ≤ b) (hbc : b ≤ c) : a ≤ c := by
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
hab : a ≤ b
hbc : b ≤ c
⊢ a ≤ c

Next tactic:
rw [Rat.le_iff_Nonneg] at hab hbc
protected theorem le_trans {a b c : ℚ} (hab : a ≤ b) (hbc : b ≤ c) : a ≤ c := by
  rw [Rat.le_iff_Nonneg] at hab hbc
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
hab : Rat.Nonneg (b - a)
hbc : Rat.Nonneg (c - b)
⊢ a ≤ c

Next tactic:
have : Rat.Nonneg (b - a + (c - b)) := Rat.nonneg_add hab hbc
protected theorem le_trans {a b c : ℚ} (hab : a ≤ b) (hbc : b ≤ c) : a ≤ c := by
  rw [Rat.le_iff_Nonneg] at hab hbc
  have : Rat.Nonneg (b - a + (c - b)) := Rat.nonneg_add hab hbc
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
hab : Rat.Nonneg (b - a)
hbc : Rat.Nonneg (c - b)
this : Rat.Nonneg (b - a + (c - b))
⊢ a ≤ c

Next tactic:
simp_rw [sub_eq_add_neg, add_left_comm (b + -a) c (-b), add_comm (b + -a) (-b),
    add_left_comm (-b) b (-a), add_comm (-b) (-a), add_neg_cancel_comm_assoc,
    ← sub_eq_add_neg] at this
protected theorem le_trans {a b c : ℚ} (hab : a ≤ b) (hbc : b ≤ c) : a ≤ c := by
  rw [Rat.le_iff_Nonneg] at hab hbc
  have : Rat.Nonneg (b - a + (c - b)) := Rat.nonneg_add hab hbc
  simp_rw [sub_eq_add_neg, add_left_comm (b + -a) c (-b), add_comm (b + -a) (-b),
    add_left_comm (-b) b (-a), add_comm (-b) (-a), add_neg_cancel_comm_assoc,
    ← sub_eq_add_neg] at this
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
hab : Rat.Nonneg (b - a)
hbc : Rat.Nonneg (c - b)
this : Rat.Nonneg (c - a)
⊢ a ≤ c

Next tactic:
rw [Rat.le_iff_Nonneg]
protected theorem le_trans {a b c : ℚ} (hab : a ≤ b) (hbc : b ≤ c) : a ≤ c := by
  rw [Rat.le_iff_Nonneg] at hab hbc
  have : Rat.Nonneg (b - a + (c - b)) := Rat.nonneg_add hab hbc
  simp_rw [sub_eq_add_neg, add_left_comm (b + -a) c (-b), add_comm (b + -a) (-b),
    add_left_comm (-b) b (-a), add_comm (-b) (-a), add_neg_cancel_comm_assoc,
    ← sub_eq_add_neg] at this
  rw [Rat.le_iff_Nonneg]
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
hab : Rat.Nonneg (b - a)
hbc : Rat.Nonneg (c - b)
this : Rat.Nonneg (c - a)
⊢ Rat.Nonneg (c - a)

Next tactic:
exact this
instance linearOrder : LinearOrder ℚ where
  le_refl := Rat.le_refl
  le_trans := @Rat.le_trans
  le_antisymm := @Rat.le_antisymm
  le_total := Rat.le_total
  decidableLE _ _ := by infer_instance
  lt_iff_le_not_le _ _ := by
    

Proof state:
a b c x✝¹ x✝ : ℚ
⊢ x✝¹ < x✝ ↔ x✝¹ ≤ x✝ ∧ ¬x✝ ≤ x✝¹

Next tactic:
rw [← Rat.not_le, and_iff_right_of_imp (Rat.le_total _ _).resolve_left]
instance linearOrder : LinearOrder ℚ where
  le_refl := Rat.le_refl
  le_trans := @Rat.le_trans
  le_antisymm := @Rat.le_antisymm
  le_total := Rat.le_total
  decidableLE _ _ := by 

Proof state:
a b c x✝¹ x✝ : ℚ
⊢ Decidable ((fun x x_1 => x ≤ x_1) x✝¹ x✝)

Next tactic:
infer_instance
instance : LT ℚ := by 

Proof state:
a b c : ℚ
⊢ LT ℚ

Next tactic:
infer_instance
instance : DistribLattice ℚ := by 

Proof state:
a b c : ℚ
⊢ DistribLattice ℚ

Next tactic:
infer_instance
instance : Lattice ℚ := by 

Proof state:
a b c : ℚ
⊢ Lattice ℚ

Next tactic:
infer_instance
instance : SemilatticeInf ℚ := by 

Proof state:
a b c : ℚ
⊢ SemilatticeInf ℚ

Next tactic:
infer_instance
instance : SemilatticeSup ℚ := by 

Proof state:
a b c : ℚ
⊢ SemilatticeSup ℚ

Next tactic:
infer_instance
instance : Inf ℚ := by 

Proof state:
a b c : ℚ
⊢ Inf ℚ

Next tactic:
infer_instance
instance : Sup ℚ := by 

Proof state:
a b c : ℚ
⊢ Sup ℚ

Next tactic:
infer_instance
instance : PartialOrder ℚ := by 

Proof state:
a b c : ℚ
⊢ PartialOrder ℚ

Next tactic:
infer_instance
instance : Preorder ℚ := by 

Proof state:
a b c : ℚ
⊢ Preorder ℚ

Next tactic:
infer_instance
protected theorem le_def' {p q : ℚ} : p ≤ q ↔ p.num * q.den ≤ q.num * p.den := by
  

Proof state:
a b c p q : ℚ
⊢ p ≤ q ↔ p.num * ↑q.den ≤ q.num * ↑p.den

Next tactic:
rw [← @num_den q, ← @num_den p]
protected theorem le_def' {p q : ℚ} : p ≤ q ↔ p.num * q.den ≤ q.num * p.den := by
  rw [← @num_den q, ← @num_den p]
  

Proof state:
a b c p q : ℚ
⊢ p.num /. ↑p.den ≤ q.num /. ↑q.den ↔
    (p.num /. ↑p.den).num * ↑(q.num /. ↑q.den).den ≤ (q.num /. ↑q.den).num * ↑(p.num /. ↑p.den).den

Next tactic:
conv_rhs => simp only [num_den]
protected theorem le_def' {p q : ℚ} : p ≤ q ↔ p.num * q.den ≤ q.num * p.den := by
  rw [← @num_den q, ← @num_den p]
  conv_rhs => 

Proof state:
a b c p q : ℚ
| (p.num /. ↑p.den).num * ↑(q.num /. ↑q.den).den ≤ (q.num /. ↑q.den).num * ↑(p.num /. ↑p.den).den

Next tactic:
simp only [num_den]
protected theorem le_def' {p q : ℚ} : p ≤ q ↔ p.num * q.den ≤ q.num * p.den := by
  rw [← @num_den q, ← @num_den p]
  conv_rhs => simp only [num_den]
  

Proof state:
a b c p q : ℚ
⊢ p.num /. ↑p.den ≤ q.num /. ↑q.den ↔ p.num * ↑q.den ≤ q.num * ↑p.den

Next tactic:
exact Rat.le_def (mod_cast p.pos) (mod_cast q.pos)
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  

Proof state:
a b c p q : ℚ
⊢ p < q ↔ p.num * ↑q.den < q.num * ↑p.den

Next tactic:
rw [lt_iff_le_and_ne, Rat.le_def']
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  

Proof state:
a b c p q : ℚ
⊢ p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q ↔ p.num * ↑q.den < q.num * ↑p.den

Next tactic:
suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> intro h
    · exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
    · have tmp := lt_iff_le_and_ne.mp h
      exact ⟨tmp.left, this.mpr tmp.right⟩
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    

Proof state:
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
⊢ p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q ↔ p.num * ↑q.den < q.num * ↑p.den

Next tactic:
constructor
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> 

Proof state:
case mp
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
⊢ p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q → p.num * ↑q.den < q.num * ↑p.den

Next tactic:
intro h
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> 

Proof state:
case mpr
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
⊢ p.num * ↑q.den < q.num * ↑p.den → p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q

Next tactic:
intro h
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> intro h
    · 

Proof state:
case mp
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
h : p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q
⊢ p.num * ↑q.den < q.num * ↑p.den

Next tactic:
exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> intro h
    · exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
    · 

Proof state:
case mpr
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
h : p.num * ↑q.den < q.num * ↑p.den
⊢ p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q

Next tactic:
have tmp := lt_iff_le_and_ne.mp h
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> intro h
    · exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
    · have tmp := lt_iff_le_and_ne.mp h
      

Proof state:
case mpr
a b c p q : ℚ
this : p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den
h : p.num * ↑q.den < q.num * ↑p.den
tmp : p.num * ↑q.den ≤ q.num * ↑p.den ∧ p.num * ↑q.den ≠ q.num * ↑p.den
⊢ p.num * ↑q.den ≤ q.num * ↑p.den ∧ p ≠ q

Next tactic:
exact ⟨tmp.left, this.mpr tmp.right⟩
protected theorem lt_def {p q : ℚ} : p < q ↔ p.num * q.den < q.num * p.den := by
  rw [lt_iff_le_and_ne, Rat.le_def']
  suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
    constructor <;> intro h
    · exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
    · have tmp := lt_iff_le_and_ne.mp h
      exact ⟨tmp.left, this.mpr tmp.right⟩
  

Proof state:
a b c p q : ℚ
⊢ p ≠ q ↔ p.num * ↑q.den ≠ q.num * ↑p.den

Next tactic:
exact not_iff_not.mpr eq_iff_mul_eq_mul
theorem nonneg_iff_zero_le {a} : Rat.Nonneg a ↔ 0 ≤ a := by
  

Proof state:
a✝ b c a : ℚ
⊢ Rat.Nonneg a ↔ 0 ≤ a

Next tactic:
rw [Rat.le_iff_Nonneg]
theorem nonneg_iff_zero_le {a} : Rat.Nonneg a ↔ 0 ≤ a := by
  rw [Rat.le_iff_Nonneg]
  

Proof state:
a✝ b c a : ℚ
⊢ Rat.Nonneg a ↔ Rat.Nonneg (a - 0)

Next tactic:
show Rat.Nonneg a ↔ Rat.Nonneg (a - 0)
theorem nonneg_iff_zero_le {a} : Rat.Nonneg a ↔ 0 ≤ a := by
  rw [Rat.le_iff_Nonneg]
  show Rat.Nonneg a ↔ Rat.Nonneg (a - 0)
  

Proof state:
a✝ b c a : ℚ
⊢ Rat.Nonneg a ↔ Rat.Nonneg (a - 0)

Next tactic:
simp
protected theorem add_le_add_left {a b c : ℚ} : c + a ≤ c + b ↔ a ≤ b := by
  

Proof state:
a✝ b✝ c✝ a b c : ℚ
⊢ c + a ≤ c + b ↔ a ≤ b

Next tactic:
rw [Rat.le_iff_Nonneg, add_sub_add_left_eq_sub, Rat.le_iff_Nonneg]
protected theorem mul_nonneg {a b : ℚ} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a * b := by
  

Proof state:
a✝ b✝ c a b : ℚ
ha : 0 ≤ a
hb : 0 ≤ b
⊢ 0 ≤ a * b

Next tactic:
rw [← nonneg_iff_zero_le] at ha hb ⊢
protected theorem mul_nonneg {a b : ℚ} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a * b := by
  rw [← nonneg_iff_zero_le] at ha hb ⊢; 

Proof state:
a✝ b✝ c a b : ℚ
ha : Rat.Nonneg a
hb : Rat.Nonneg b
⊢ Rat.Nonneg (a * b)

Next tactic:
exact Rat.nonneg_mul ha hb
instance : LinearOrderedField ℚ :=
  { Rat.field, Rat.linearOrder, Rat.semiring with
    zero_le_one := by 

Proof state:
a b c : ℚ
src✝² : Field ℚ := field
src✝¹ : LinearOrder ℚ := linearOrder
src✝ : Semiring ℚ := semiring
⊢ 0 ≤ 1

Next tactic:
decide
instance : LinearOrderedCommRing ℚ := by 

Proof state:
a b c : ℚ
⊢ LinearOrderedCommRing ℚ

Next tactic:
infer_instance
instance : LinearOrderedRing ℚ := by 

Proof state:
a b c : ℚ
⊢ LinearOrderedRing ℚ

Next tactic:
infer_instance
instance : OrderedRing ℚ := by 

Proof state:
a b c : ℚ
⊢ OrderedRing ℚ

Next tactic:
infer_instance
instance : LinearOrderedSemiring ℚ := by 

Proof state:
a b c : ℚ
⊢ LinearOrderedSemiring ℚ

Next tactic:
infer_instance
instance : OrderedSemiring ℚ := by 

Proof state:
a b c : ℚ
⊢ OrderedSemiring ℚ

Next tactic:
infer_instance
instance : LinearOrderedAddCommGroup ℚ := by 

Proof state:
a b c : ℚ
⊢ LinearOrderedAddCommGroup ℚ

Next tactic:
infer_instance
instance : OrderedAddCommGroup ℚ := by 

Proof state:
a b c : ℚ
⊢ OrderedAddCommGroup ℚ

Next tactic:
infer_instance
instance : OrderedCancelAddCommMonoid ℚ := by 

Proof state:
a b c : ℚ
⊢ OrderedCancelAddCommMonoid ℚ

Next tactic:
infer_instance
instance : OrderedAddCommMonoid ℚ := by 

Proof state:
a b c : ℚ
⊢ OrderedAddCommMonoid ℚ

Next tactic:
infer_instance
theorem num_pos_iff_pos {a : ℚ} : 0 < a.num ↔ 0 < a :=
  lt_iff_lt_of_le_iff_le <| by
    

Proof state:
a✝ b c a : ℚ
⊢ a.num ≤ 0 ↔ a ≤ 0

Next tactic:
simpa [(by cases a; rfl : (-a).num = -a.num)] using @num_nonneg_iff_zero_le (-a)
theorem num_pos_iff_pos {a : ℚ} : 0 < a.num ↔ 0 < a :=
  lt_iff_lt_of_le_iff_le <| by
    simpa [(by 

Proof state:
a✝ b c a : ℚ
⊢ (-a).num = -a.num

Next tactic:
cases a
theorem num_pos_iff_pos {a : ℚ} : 0 < a.num ↔ 0 < a :=
  lt_iff_lt_of_le_iff_le <| by
    simpa [(by cases a; 

Proof state:
case mk'
a b c : ℚ
num✝ : ℤ
den✝ : ℕ
den_nz✝ : den✝ ≠ 0
reduced✝ : Nat.Coprime (Int.natAbs num✝) den✝
⊢ (-mk' num✝ den✝).num = -(mk' num✝ den✝).num

Next tactic:
rfl
theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
    (a : ℚ) / b < c / d ↔ a * d < c * b := by
  

Proof state:
a✝ b✝ c✝ : ℚ
a b c d : ℤ
b_pos : 0 < b
d_pos : 0 < d
⊢ ↑a / ↑b < ↑c / ↑d ↔ a * d < c * b

Next tactic:
simp only [lt_iff_le_not_le]
theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
    (a : ℚ) / b < c / d ↔ a * d < c * b := by
  simp only [lt_iff_le_not_le]
  

Proof state:
a✝ b✝ c✝ : ℚ
a b c d : ℤ
b_pos : 0 < b
d_pos : 0 < d
⊢ ↑a / ↑b ≤ ↑c / ↑d ∧ ¬↑c / ↑d ≤ ↑a / ↑b ↔ a * d ≤ c * b ∧ ¬c * b ≤ a * d

Next tactic:
apply and_congr
theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
    (a : ℚ) / b < c / d ↔ a * d < c * b := by
  simp only [lt_iff_le_not_le]
  apply and_congr
  · 

Proof state:
case h₁
a✝ b✝ c✝ : ℚ
a b c d : ℤ
b_pos : 0 < b
d_pos : 0 < d
⊢ ↑a / ↑b ≤ ↑c / ↑d ↔ a * d ≤ c * b

Next tactic:
simp [div_num_den, Rat.le_def b_pos d_pos]
theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
    (a : ℚ) / b < c / d ↔ a * d < c * b := by
  simp only [lt_iff_le_not_le]
  apply and_congr
  · simp [div_num_den, Rat.le_def b_pos d_pos]
  · 

Proof state:
case h₂
a✝ b✝ c✝ : ℚ
a b c d : ℤ
b_pos : 0 < b
d_pos : 0 < d
⊢ ¬↑c / ↑d ≤ ↑a / ↑b ↔ ¬c * b ≤ a * d

Next tactic:
apply not_congr
theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
    (a : ℚ) / b < c / d ↔ a * d < c * b := by
  simp only [lt_iff_le_not_le]
  apply and_congr
  · simp [div_num_den, Rat.le_def b_pos d_pos]
  · apply not_congr
    

Proof state:
case h₂.h
a✝ b✝ c✝ : ℚ
a b c d : ℤ
b_pos : 0 < b
d_pos : 0 < d
⊢ ↑c / ↑d ≤ ↑a / ↑b ↔ c * b ≤ a * d

Next tactic:
simp [div_num_den, Rat.le_def d_pos b_pos]
theorem lt_one_iff_num_lt_denom {q : ℚ} : q < 1 ↔ q.num < q.den := by 

Proof state:
a b c q : ℚ
⊢ q < 1 ↔ q.num < ↑q.den

Next tactic:
simp [Rat.lt_def]
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  

Proof state:
a b c q : ℚ
⊢ |q| = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rcases le_total q 0 with hq | hq
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · 

Proof state:
case inl
a b c q : ℚ
hq : q ≤ 0
⊢ |q| = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [abs_of_nonpos hq]
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · rw [abs_of_nonpos hq]
    

Proof state:
case inl
a b c q : ℚ
hq : q ≤ 0
⊢ -q = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [← @num_den q, ← divInt_zero_one, Rat.le_def (Int.coe_nat_pos.2 q.pos) zero_lt_one, mul_one,
      zero_mul] at hq
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · rw [abs_of_nonpos hq]
    rw [← @num_den q, ← divInt_zero_one, Rat.le_def (Int.coe_nat_pos.2 q.pos) zero_lt_one, mul_one,
      zero_mul] at hq
    

Proof state:
case inl
a b c q : ℚ
hq : q.num ≤ 0
⊢ -q = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [Int.ofNat_natAbs_of_nonpos hq, ← neg_def, num_den]
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · rw [abs_of_nonpos hq]
    rw [← @num_den q, ← divInt_zero_one, Rat.le_def (Int.coe_nat_pos.2 q.pos) zero_lt_one, mul_one,
      zero_mul] at hq
    rw [Int.ofNat_natAbs_of_nonpos hq, ← neg_def, num_den]
  · 

Proof state:
case inr
a b c q : ℚ
hq : 0 ≤ q
⊢ |q| = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [abs_of_nonneg hq]
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · rw [abs_of_nonpos hq]
    rw [← @num_den q, ← divInt_zero_one, Rat.le_def (Int.coe_nat_pos.2 q.pos) zero_lt_one, mul_one,
      zero_mul] at hq
    rw [Int.ofNat_natAbs_of_nonpos hq, ← neg_def, num_den]
  · rw [abs_of_nonneg hq]
    

Proof state:
case inr
a b c q : ℚ
hq : 0 ≤ q
⊢ q = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [← @num_den q, ← divInt_zero_one, Rat.le_def zero_lt_one (Int.coe_nat_pos.2 q.pos), mul_one,
      zero_mul] at hq
theorem abs_def (q : ℚ) : |q| = q.num.natAbs /. q.den := by
  rcases le_total q 0 with hq | hq
  · rw [abs_of_nonpos hq]
    rw [← @num_den q, ← divInt_zero_one, Rat.le_def (Int.coe_nat_pos.2 q.pos) zero_lt_one, mul_one,
      zero_mul] at hq
    rw [Int.ofNat_natAbs_of_nonpos hq, ← neg_def, num_den]
  · rw [abs_of_nonneg hq]
    rw [← @num_den q, ← divInt_zero_one, Rat.le_def zero_lt_one (Int.coe_nat_pos.2 q.pos), mul_one,
      zero_mul] at hq
    

Proof state:
case inr
a b c q : ℚ
hq : 0 ≤ q.num
⊢ q = ↑(Int.natAbs q.num) /. ↑q.den

Next tactic:
rw [Int.natAbs_of_nonneg hq, num_den]
theorem exists_simple_subobject {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    ∃ Y : Subobject X, Simple (Y : C) := by
  

Proof state:
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
⊢ ∃ Y, Simple (underlying.obj Y)

Next tactic:
haveI : Nontrivial (Subobject X) := nontrivial_of_not_isZero h
theorem exists_simple_subobject {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    ∃ Y : Subobject X, Simple (Y : C) := by
  haveI : Nontrivial (Subobject X) := nontrivial_of_not_isZero h
  

Proof state:
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
this : Nontrivial (Subobject X)
⊢ ∃ Y, Simple (underlying.obj Y)

Next tactic:
haveI := isAtomic_of_orderBot_wellFounded_lt (ArtinianObject.subobject_lt_wellFounded X)
theorem exists_simple_subobject {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    ∃ Y : Subobject X, Simple (Y : C) := by
  haveI : Nontrivial (Subobject X) := nontrivial_of_not_isZero h
  haveI := isAtomic_of_orderBot_wellFounded_lt (ArtinianObject.subobject_lt_wellFounded X)
  

Proof state:
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
this✝ : Nontrivial (Subobject X)
this : IsAtomic (Subobject X)
⊢ ∃ Y, Simple (underlying.obj Y)

Next tactic:
obtain ⟨Y, s⟩ := (IsAtomic.eq_bot_or_exists_atom_le (⊤ : Subobject X)).resolve_left top_ne_bot
theorem exists_simple_subobject {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    ∃ Y : Subobject X, Simple (Y : C) := by
  haveI : Nontrivial (Subobject X) := nontrivial_of_not_isZero h
  haveI := isAtomic_of_orderBot_wellFounded_lt (ArtinianObject.subobject_lt_wellFounded X)
  obtain ⟨Y, s⟩ := (IsAtomic.eq_bot_or_exists_atom_le (⊤ : Subobject X)).resolve_left top_ne_bot
  

Proof state:
case intro
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
this✝ : Nontrivial (Subobject X)
this : IsAtomic (Subobject X)
Y : Subobject X
s : IsAtom Y ∧ Y ≤ ⊤
⊢ ∃ Y, Simple (underlying.obj Y)

Next tactic:
exact ⟨Y, (subobject_simple_iff_isAtom _).mpr s.1⟩
instance mono_simpleSubobjectArrow {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    Mono (simpleSubobjectArrow h) := by
  

Proof state:
C : Type u_1
inst✝³ : Category.{?u.7072, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
⊢ Mono (simpleSubobjectArrow h)

Next tactic:
dsimp only [simpleSubobjectArrow]
instance mono_simpleSubobjectArrow {X : C} [ArtinianObject X] (h : ¬IsZero X) :
    Mono (simpleSubobjectArrow h) := by
  dsimp only [simpleSubobjectArrow]
  

Proof state:
C : Type u_1
inst✝³ : Category.{?u.7072, u_1} C
inst✝² : HasZeroMorphisms C
inst✝¹ : HasZeroObject C
X : C
inst✝ : ArtinianObject X
h : ¬IsZero X
⊢ Mono (arrow (Exists.choose (_ : ∃ Y, Simple (underlying.obj Y))))

Next tactic:
infer_instance
@[simp]
theorem ack_zero (n : ℕ) : ack 0 n = n + 1 := by 

Proof state:
n : ℕ
⊢ ack 0 n = n + 1

Next tactic:
rw [ack]
@[simp]
theorem ack_succ_zero (m : ℕ) : ack (m + 1) 0 = ack m 1 := by 

Proof state:
m : ℕ
⊢ ack (m + 1) 0 = ack m 1

Next tactic:
rw [ack]
@[simp]
theorem ack_succ_succ (m n : ℕ) : ack (m + 1) (n + 1) = ack m (ack (m + 1) n) := by 

Proof state:
m n : ℕ
⊢ ack (m + 1) (n + 1) = ack m (ack (m + 1) n)

Next tactic:
rw [ack]
@[simp]
theorem ack_one (n : ℕ) : ack 1 n = n + 2 := by
  

Proof state:
n : ℕ
⊢ ack 1 n = n + 2

Next tactic:
induction' n with n IH
@[simp]
theorem ack_one (n : ℕ) : ack 1 n = n + 2 := by
  induction' n with n IH
  · 

Proof state:
case zero
⊢ ack 1 zero = zero + 2

Next tactic:
rfl
@[simp]
theorem ack_one (n : ℕ) : ack 1 n = n + 2 := by
  induction' n with n IH
  · rfl
  · 

Proof state:
case succ
n : ℕ
IH : ack 1 n = n + 2
⊢ ack 1 (succ n) = succ n + 2

Next tactic:
simp [IH]
@[simp]
theorem ack_two (n : ℕ) : ack 2 n = 2 * n + 3 := by
  

Proof state:
n : ℕ
⊢ ack 2 n = 2 * n + 3

Next tactic:
induction' n with n IH
@[simp]
theorem ack_two (n : ℕ) : ack 2 n = 2 * n + 3 := by
  induction' n with n IH
  · 

Proof state:
case zero
⊢ ack 2 zero = 2 * zero + 3

Next tactic:
rfl
@[simp]
theorem ack_two (n : ℕ) : ack 2 n = 2 * n + 3 := by
  induction' n with n IH
  · rfl
  · 

Proof state:
case succ
n : ℕ
IH : ack 2 n = 2 * n + 3
⊢ ack 2 (succ n) = 2 * succ n + 3

Next tactic:
simpa [mul_succ]
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  

Proof state:
n : ℕ
⊢ ack 3 n = 2 ^ (n + 3) - 3

Next tactic:
induction' n with n IH
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · 

Proof state:
case zero
⊢ ack 3 zero = 2 ^ (zero + 3) - 3

Next tactic:
rfl
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · rfl
  · 

Proof state:
case succ
n : ℕ
IH : ack 3 n = 2 ^ (n + 3) - 3
⊢ ack 3 (succ n) = 2 ^ (succ n + 3) - 3

Next tactic:
rw [ack_succ_succ, IH, ack_two, Nat.succ_add, Nat.pow_succ 2 (n + 3), mul_comm _ 2,
        Nat.mul_sub_left_distrib, ← Nat.sub_add_comm, two_mul 3, Nat.add_sub_add_right]
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · rfl
  · rw [ack_succ_succ, IH, ack_two, Nat.succ_add, Nat.pow_succ 2 (n + 3), mul_comm _ 2,
        Nat.mul_sub_left_distrib, ← Nat.sub_add_comm, two_mul 3, Nat.add_sub_add_right]
    

Proof state:
case succ
n : ℕ
IH : ack 3 n = 2 ^ (n + 3) - 3
⊢ 2 * 3 ≤ 2 * 2 ^ (n + 3)

Next tactic:
have H : 2 * 3 ≤ 2 * 2 ^ 3 := by norm_num
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · rfl
  · rw [ack_succ_succ, IH, ack_two, Nat.succ_add, Nat.pow_succ 2 (n + 3), mul_comm _ 2,
        Nat.mul_sub_left_distrib, ← Nat.sub_add_comm, two_mul 3, Nat.add_sub_add_right]
    have H : 2 * 3 ≤ 2 * 2 ^ 3 := by 

Proof state:
n : ℕ
IH : ack 3 n = 2 ^ (n + 3) - 3
⊢ 2 * 3 ≤ 2 * 2 ^ 3

Next tactic:
norm_num
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · rfl
  · rw [ack_succ_succ, IH, ack_two, Nat.succ_add, Nat.pow_succ 2 (n + 3), mul_comm _ 2,
        Nat.mul_sub_left_distrib, ← Nat.sub_add_comm, two_mul 3, Nat.add_sub_add_right]
    have H : 2 * 3 ≤ 2 * 2 ^ 3 := by norm_num
    

Proof state:
case succ
n : ℕ
IH : ack 3 n = 2 ^ (n + 3) - 3
H : 2 * 3 ≤ 2 * 2 ^ 3
⊢ 2 * 3 ≤ 2 * 2 ^ (n + 3)

Next tactic:
apply H.trans
@[simp]
theorem ack_three (n : ℕ) : ack 3 n = 2 ^ (n + 3) - 3 := by
  induction' n with n IH
  · rfl
  · rw [ack_succ_succ, IH, ack_two, Nat.succ_add, Nat.pow_succ 2 (n + 3), mul_comm _ 2,
        Nat.mul_sub_left_distrib, ← Nat.sub_add_comm, two_mul 3, Nat.add_sub_add_right]
    have H : 2 * 3 ≤ 2 * 2 ^ 3 := by norm_num
    apply H.trans
    

Proof state:
case succ
n : ℕ
IH : ack 3 n = 2 ^ (n + 3) - 3
H : 2 * 3 ≤ 2 * 2 ^ 3
⊢ 2 * 2 ^ 3 ≤ 2 * 2 ^ (n + 3)

Next tactic:
simp [pow_le_pow_right (show 1 ≤ 2 by norm_num)]