l3lab/ntp-mathlib huggingface dataset:
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
⊢ PreservesColimit F forgetToSheafedSpace

Next tactic:
suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
    · 

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
this :
  PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right))
    forgetToSheafedSpace
⊢ PreservesColimit F forgetToSheafedSpace

Next tactic:
apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
    · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
    

Proof state:
case this
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
⊢ PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right))
    forgetToSheafedSpace

Next tactic:
apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
    · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
    apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
    

Proof state:
case this
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
⊢ IsColimit
    (forgetToSheafedSpace.mapCocone
      (coequalizerCofork (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)))

Next tactic:
apply (isColimitMapCoconeCoforkEquiv _ _).symm _
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
    · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
    apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
    apply (isColimitMapCoconeCoforkEquiv _ _).symm _
    

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
⊢ IsColimit
    (Cofork.ofπ
      (forgetToSheafedSpace.map
        { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val,
          prop :=
            (_ :
              ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))),
                IsLocalRingHom
                  (PresheafedSpace.stalkMap
                    (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val)
                    x)) })
      (_ :
        forgetToSheafedSpace.map (F.map WalkingParallelPairHom.left) ≫
            forgetToSheafedSpace.map
              { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val,
                prop :=
                  (_ :
                    ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))),
                      IsLocalRingHom
                        (PresheafedSpace.stalkMap
                          (coequalizer.π (F.map WalkingParallelPairHom.left).val
                            (F.map WalkingParallelPairHom.right).val)
                          x)) } =
          forgetToSheafedSpace.map (F.map WalkingParallelPairHom.right) ≫
            forgetToSheafedSpace.map
              { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val,
                prop :=
                  (_ :
                    ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))),
                      IsLocalRingHom
                        (PresheafedSpace.stalkMap
                          (coequalizer.π (F.map WalkingParallelPairHom.left).val
                            (F.map WalkingParallelPairHom.right).val)
                          x)) }))

Next tactic:
dsimp only [forgetToSheafedSpace]
noncomputable instance preservesCoequalizer :
    PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} :=
  ⟨fun {F} => by
    -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation
    -- of colimit is provided later
    suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left)
      (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
    · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
    apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
    apply (isColimitMapCoconeCoforkEquiv _ _).symm _
    dsimp only [forgetToSheafedSpace]
    

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
F : WalkingParallelPair ⥤ LocallyRingedSpace
⊢ IsColimit
    (Cofork.ofπ (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val)
      (_ :
        (F.map WalkingParallelPairHom.left).val ≫
            coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val =
          (F.map WalkingParallelPairHom.right).val ≫
            coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val))

Next tactic:
exact coequalizerIsCoequalizer _ _
@[simp, norm_cast]
theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m :=
  eq_sub_of_add_eq <| by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
h : m ≤ n
⊢ ↑(n - m) + ↑m = ↑n

Next tactic:
rw [← cast_add, Nat.sub_add_cancel h]
@[simp, norm_cast]
theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1
  | 0, h => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
h : 0 < 0
⊢ ↑(0 - 1) = ↑0 - 1

Next tactic:
cases h
@[simp, norm_cast]
theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1
  | 0, h => by cases h
  | n + 1, _ => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℕ
x✝ : 0 < n + 1
⊢ ↑(n + 1 - 1) = ↑(n + 1) - 1

Next tactic:
rw [cast_succ, add_sub_cancel]
@[simp, norm_cast]
theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1
  | 0, h => by cases h
  | n + 1, _ => by rw [cast_succ, add_sub_cancel]; 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℕ
x✝ : 0 < n + 1
⊢ ↑(n + 1 - 1) = ↑n

Next tactic:
rfl
@[simp, norm_cast]
theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] :
    ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
  

Proof state:
R : Type u
inst✝¹ : AddGroupWithOne R
n : ℕ
inst✝ : AtLeastTwo n
⊢ ↑(OfNat.ofNat n) = OfNat.ofNat n

Next tactic:
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
@[simp, norm_cast]
theorem cast_one : ((1 : ℤ) : R) = 1 := by
  

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
⊢ ↑1 = 1

Next tactic:
erw [cast_ofNat, Nat.cast_one]
@[simp, norm_cast]
theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n
  | (0 : ℕ) => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
⊢ ↑(-↑0) = -↑↑0

Next tactic:
erw [cast_zero, neg_zero]
@[simp, norm_cast]
theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n
  | (0 : ℕ) => by erw [cast_zero, neg_zero]
  | (n + 1 : ℕ) => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℕ
⊢ ↑(-↑(n + 1)) = -↑↑(n + 1)

Next tactic:
erw [cast_ofNat, cast_negSucc]
@[simp, norm_cast]
theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n
  | (0 : ℕ) => by erw [cast_zero, neg_zero]
  | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc]
  | -[n+1] => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℕ
⊢ ↑(- -[n+1]) = -↑-[n+1]

Next tactic:
erw [cast_ofNat, cast_negSucc, neg_neg]
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
  

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑(subNatNat m n) = ↑m - ↑n

Next tactic:
unfold subNatNat
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
  unfold subNatNat
  

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑(match n - m with
      | 0 => ofNat (m - n)
      | succ k => -[k+1]) =
    ↑m - ↑n

Next tactic:
cases e : n - m
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
  unfold subNatNat
  cases e : n - m
  · 

Proof state:
case zero
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
e : n - m = zero
⊢ ↑(match zero with
      | 0 => ofNat (m - n)
      | succ k => -[k+1]) =
    ↑m - ↑n

Next tactic:
simp only [ofNat_eq_coe]
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
  unfold subNatNat
  cases e : n - m
  · simp only [ofNat_eq_coe]
    

Proof state:
case zero
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
e : n - m = zero
⊢ ↑↑(m - n) = ↑m - ↑n

Next tactic:
simp [e, Nat.le_of_sub_eq_zero e]
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
  unfold subNatNat
  cases e : n - m
  · simp only [ofNat_eq_coe]
    simp [e, Nat.le_of_sub_eq_zero e]
  · 

Proof state:
case succ
R : Type u
inst✝ : AddGroupWithOne R
m n n✝ : ℕ
e : n - m = succ n✝
⊢ ↑(match succ n✝ with
      | 0 => ofNat (m - n)
      | succ k => -[k+1]) =
    ↑m - ↑n

Next tactic:
rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e,
      neg_sub]
@[simp]
theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℕ
⊢ ↑(negOfNat n) = -↑n

Next tactic:
simp [Int.cast_neg, negOfNat_eq]
@[simp, norm_cast]
theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n
  | (m : ℕ), (n : ℕ) => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑(↑m + ↑n) = ↑↑m + ↑↑n

Next tactic:
simp [-Int.natCast_add, ← Int.ofNat_add]
@[simp, norm_cast]
theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n
  | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add]
  | (m : ℕ), -[n+1] => by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑(↑m + -[n+1]) = ↑↑m + ↑-[n+1]

Next tactic:
erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg]
@[simp, norm_cast]
theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n
  | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add]
  | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg]
  | -[m+1], (n : ℕ) => by
    

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑(-[m+1] + ↑n) = ↑-[m+1] + ↑↑n

Next tactic:
erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc,
      eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm]
@[simp, norm_cast]
theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n
  | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add]
  | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg]
  | -[m+1], (n : ℕ) => by
    erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc,
      eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm]
  | -[m+1], -[n+1] =>
    show (-[m + n + 1+1] : R) = _ by
      

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℕ
⊢ ↑-[m + n + 1+1] = ↑-[m+1] + ↑-[n+1]

Next tactic:
rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add,
        Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
@[simp, norm_cast]
theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by
  

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
m n : ℤ
⊢ ↑(m - n) = ↑m - ↑n

Next tactic:
simp [Int.sub_eq_add_neg, sub_eq_add_neg, Int.cast_neg, Int.cast_add]
@[norm_cast, deprecated]
theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) :=
  by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℤ
⊢ ↑(bit1 n) = bit1 ↑n

Next tactic:
rw [bit1, Int.cast_add, Int.cast_one, cast_bit0]
@[norm_cast, deprecated]
theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) :=
  by rw [bit1, Int.cast_add, Int.cast_one, cast_bit0]; 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
n : ℤ
⊢ bit0 ↑n + 1 = bit1 ↑n

Next tactic:
rfl
theorem cast_two : ((2 : ℤ) : R) = 2 :=
  show (((2 : ℕ) : ℤ) : R) = ((2 : ℕ) : R) by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
⊢ ↑↑2 = ↑2

Next tactic:
rw [cast_ofNat, Nat.cast_ofNat]
theorem cast_three : ((3 : ℤ) : R) = 3 :=
  show (((3 : ℕ) : ℤ) : R) = ((3 : ℕ) : R) by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
⊢ ↑↑3 = ↑3

Next tactic:
rw [cast_ofNat, Nat.cast_ofNat]
theorem cast_four : ((4 : ℤ) : R) = 4 :=
  show (((4 : ℕ) : ℤ) : R) = ((4 : ℕ) : R) by 

Proof state:
R : Type u
inst✝ : AddGroupWithOne R
⊢ ↑↑4 = ↑4

Next tactic:
rw [cast_ofNat, Nat.cast_ofNat]
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
⊢ Rat.Nonneg (a /. b) ↔ 0 ≤ a

Next tactic:
generalize ha : a /. b = x
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; 

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
x : ℚ
ha : a /. b = x
⊢ Rat.Nonneg x ↔ 0 ≤ a

Next tactic:
cases' x with n₁ d₁ h₁ c₁
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; 

Proof state:
case mk'
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = mk' n₁ d₁
⊢ Rat.Nonneg (mk' n₁ d₁) ↔ 0 ≤ a

Next tactic:
rw [num_den'] at ha
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  

Proof state:
case mk'
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
⊢ Rat.Nonneg (mk' n₁ d₁) ↔ 0 ≤ a

Next tactic:
simp only [Rat.Nonneg]
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  

Proof state:
case mk'
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
⊢ 0 ≤ n₁ ↔ 0 ≤ a

Next tactic:
have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  

Proof state:
case mk'
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
⊢ 0 ≤ n₁ ↔ 0 ≤ a

Next tactic:
have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  

Proof state:
case mk'
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
⊢ 0 ≤ n₁ ↔ 0 ≤ a

Next tactic:
constructor
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> 

Proof state:
case mk'.mp
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
⊢ 0 ≤ n₁ → 0 ≤ a

Next tactic:
intro h₂
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> 

Proof state:
case mk'.mpr
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
⊢ 0 ≤ a → 0 ≤ n₁

Next tactic:
intro h₂
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · 

Proof state:
case mk'.mp
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ n₁
⊢ 0 ≤ a

Next tactic:
apply nonneg_of_mul_nonneg_left _ d0
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · apply nonneg_of_mul_nonneg_left _ d0
    

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ n₁
⊢ 0 ≤ a * ↑d₁

Next tactic:
rw [this]
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · apply nonneg_of_mul_nonneg_left _ d0
    rw [this]
    

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ n₁
⊢ 0 ≤ n₁ * b

Next tactic:
exact mul_nonneg h₂ (le_of_lt h)
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · apply nonneg_of_mul_nonneg_left _ d0
    rw [this]
    exact mul_nonneg h₂ (le_of_lt h)
  · 

Proof state:
case mk'.mpr
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ a
⊢ 0 ≤ n₁

Next tactic:
apply nonneg_of_mul_nonneg_left _ h
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · apply nonneg_of_mul_nonneg_left _ d0
    rw [this]
    exact mul_nonneg h₂ (le_of_lt h)
  · apply nonneg_of_mul_nonneg_left _ h
    

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ a
⊢ 0 ≤ n₁ * b

Next tactic:
rw [← this]
@[simp]
theorem divInt_nonneg (a : ℤ) {b : ℤ} (h : 0 < b) : (a /. b).Nonneg ↔ 0 ≤ a := by
  generalize ha : a /. b = x; cases' x with n₁ d₁ h₁ c₁; rw [num_den'] at ha
  simp only [Rat.Nonneg]
  have d0 := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h₁)
  have := (divInt_eq_iff (ne_of_gt h) (ne_of_gt d0)).1 ha
  constructor <;> intro h₂
  · apply nonneg_of_mul_nonneg_left _ d0
    rw [this]
    exact mul_nonneg h₂ (le_of_lt h)
  · apply nonneg_of_mul_nonneg_left _ h
    rw [← this]
    

Proof state:
a✝ b✝ c : ℚ
a b : ℤ
h : 0 < b
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
ha : a /. b = n₁ /. ↑d₁
d0 : ↑0 < ↑d₁
this : a * ↑d₁ = n₁ * b
h₂ : 0 ≤ a
⊢ 0 ≤ a * ↑d₁

Next tactic:
exact mul_nonneg h₂ (Int.ofNat_zero_le _)
protected theorem nonneg_add {a b} : Rat.Nonneg a → Rat.Nonneg b → Rat.Nonneg (a + b) :=
  numDenCasesOn' a fun n₁ d₁ h₁ =>
    numDenCasesOn' b fun n₂ d₂ h₂ => by
      

Proof state:
a✝ b✝ c a b : ℚ
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
⊢ Rat.Nonneg (n₁ /. ↑d₁) → Rat.Nonneg (n₂ /. ↑d₂) → Rat.Nonneg (n₁ /. ↑d₁ + n₂ /. ↑d₂)

Next tactic:
have d₁0 : 0 < (d₁ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₁)
protected theorem nonneg_add {a b} : Rat.Nonneg a → Rat.Nonneg b → Rat.Nonneg (a + b) :=
  numDenCasesOn' a fun n₁ d₁ h₁ =>
    numDenCasesOn' b fun n₂ d₂ h₂ => by
      have d₁0 : 0 < (d₁ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₁)
      

Proof state:
a✝ b✝ c a b : ℚ
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
d₁0 : 0 < ↑d₁
⊢ Rat.Nonneg (n₁ /. ↑d₁) → Rat.Nonneg (n₂ /. ↑d₂) → Rat.Nonneg (n₁ /. ↑d₁ + n₂ /. ↑d₂)

Next tactic:
have d₂0 : 0 < (d₂ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₂)
protected theorem nonneg_add {a b} : Rat.Nonneg a → Rat.Nonneg b → Rat.Nonneg (a + b) :=
  numDenCasesOn' a fun n₁ d₁ h₁ =>
    numDenCasesOn' b fun n₂ d₂ h₂ => by
      have d₁0 : 0 < (d₁ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₁)
      have d₂0 : 0 < (d₂ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₂)
      

Proof state:
a✝ b✝ c a b : ℚ
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
d₁0 : 0 < ↑d₁
d₂0 : 0 < ↑d₂
⊢ Rat.Nonneg (n₁ /. ↑d₁) → Rat.Nonneg (n₂ /. ↑d₂) → Rat.Nonneg (n₁ /. ↑d₁ + n₂ /. ↑d₂)

Next tactic:
simp only [d₁0, d₂0, h₁, h₂, mul_pos, divInt_nonneg, add_def'', Ne.def,
        Nat.cast_eq_zero, not_false_iff]
protected theorem nonneg_add {a b} : Rat.Nonneg a → Rat.Nonneg b → Rat.Nonneg (a + b) :=
  numDenCasesOn' a fun n₁ d₁ h₁ =>
    numDenCasesOn' b fun n₂ d₂ h₂ => by
      have d₁0 : 0 < (d₁ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₁)
      have d₂0 : 0 < (d₂ : ℤ) := Int.coe_nat_pos.2 (Nat.pos_of_ne_zero h₂)
      simp only [d₁0, d₂0, h₁, h₂, mul_pos, divInt_nonneg, add_def'', Ne.def,
        Nat.cast_eq_zero, not_false_iff]
      

Proof state:
a✝ b✝ c a b : ℚ
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
d₁0 : 0 < ↑d₁
d₂0 : 0 < ↑d₂
⊢ 0 ≤ n₁ → 0 ≤ n₂ → 0 ≤ n₁ * ↑d₂ + n₂ * ↑d₁

Next tactic:
intro n₁0 n₂0