l3lab/ntp-mathlib huggingface dataset:
instance algebra : Algebra R (A × B) :=
  { Prod.instModule,
    RingHom.prod (algebraMap R A) (algebraMap R B) with
    commutes' := by
      rintro r ⟨a, b⟩
      dsimp
      rw [commutes r a, commutes r b]
    smul_def' := by
      

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
src✝¹ : Module R (A × B) := instModule
src✝ : R →+* A × B := RingHom.prod (algebraMap R A) (algebraMap R B)
⊢ ∀ (r : R) (x : A × B),
    r • x =
      { toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
          r *
        x

Next tactic:
rintro r ⟨a, b⟩
instance algebra : Algebra R (A × B) :=
  { Prod.instModule,
    RingHom.prod (algebraMap R A) (algebraMap R B) with
    commutes' := by
      rintro r ⟨a, b⟩
      dsimp
      rw [commutes r a, commutes r b]
    smul_def' := by
      rintro r ⟨a, b⟩
      

Proof state:
case mk
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
src✝¹ : Module R (A × B) := instModule
src✝ : R →+* A × B := RingHom.prod (algebraMap R A) (algebraMap R B)
r : R
a : A
b : B
⊢ r • (a, b) =
    { toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
        r *
      (a, b)

Next tactic:
dsimp
instance algebra : Algebra R (A × B) :=
  { Prod.instModule,
    RingHom.prod (algebraMap R A) (algebraMap R B) with
    commutes' := by
      rintro r ⟨a, b⟩
      dsimp
      rw [commutes r a, commutes r b]
    smul_def' := by
      rintro r ⟨a, b⟩
      dsimp
      

Proof state:
case mk
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
src✝¹ : Module R (A × B) := instModule
src✝ : R →+* A × B := RingHom.prod (algebraMap R A) (algebraMap R B)
r : R
a : A
b : B
⊢ (r • a, r • b) = ((algebraMap R A) r * a, (algebraMap R B) r * b)

Next tactic:
rw [Algebra.smul_def r a, Algebra.smul_def r b]
/-- The `Pi.prod` of two morphisms is a morphism. -/
@[simps!]
def prod (f : A →ₐ[R] B) (g : A →ₐ[R] C) : A →ₐ[R] B × C :=
  { f.toRingHom.prod g.toRingHom with
    commutes' := fun r => by
      

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B
g : A →ₐ[R] C
src✝ : A →+* B × C := RingHom.prod ↑f ↑g
r : R
⊢ OneHom.toFun
      (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : A), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
      ((algebraMap R A) r) =
    (algebraMap R (B × C)) r

Next tactic:
simp only [toRingHom_eq_coe, RingHom.toFun_eq_coe, RingHom.prod_apply, coe_toRingHom,
        commutes, Prod.algebraMap_apply]
@[simp]
theorem fst_prod (f : A →ₐ[R] B) (g : A →ₐ[R] C) : (fst R B C).comp (prod f g) = f := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B
g : A →ₐ[R] C
⊢ comp (fst R B C) (prod f g) = f

Next tactic:
ext
@[simp]
theorem fst_prod (f : A →ₐ[R] B) (g : A →ₐ[R] C) : (fst R B C).comp (prod f g) = f := by ext; 

Proof state:
case H
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B
g : A →ₐ[R] C
x✝ : A
⊢ (comp (fst R B C) (prod f g)) x✝ = f x✝

Next tactic:
rfl
@[simp]
theorem snd_prod (f : A →ₐ[R] B) (g : A →ₐ[R] C) : (snd R B C).comp (prod f g) = g := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B
g : A →ₐ[R] C
⊢ comp (snd R B C) (prod f g) = g

Next tactic:
ext
@[simp]
theorem snd_prod (f : A →ₐ[R] B) (g : A →ₐ[R] C) : (snd R B C).comp (prod f g) = g := by ext; 

Proof state:
case H
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B
g : A →ₐ[R] C
x✝ : A
⊢ (comp (snd R B C) (prod f g)) x✝ = g x✝

Next tactic:
rfl
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : (A →ₐ[R] B) × (A →ₐ[R] C)
⊢ (fun f => (comp (fst R B C) f, comp (snd R B C) f)) ((fun f => prod f.1 f.2) f) = f

Next tactic:
ext
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by ext <;> 

Proof state:
case a.H
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : (A →ₐ[R] B) × (A →ₐ[R] C)
x✝ : A
⊢ ((fun f => (comp (fst R B C) f, comp (snd R B C) f)) ((fun f => prod f.1 f.2) f)).1 x✝ = f.1 x✝

Next tactic:
rfl
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by ext <;> 

Proof state:
case a.H
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : (A →ₐ[R] B) × (A →ₐ[R] C)
x✝ : A
⊢ ((fun f => (comp (fst R B C) f, comp (snd R B C) f)) ((fun f => prod f.1 f.2) f)).2 x✝ = f.2 x✝

Next tactic:
rfl
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by ext <;> rfl
  right_inv f := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B × C
⊢ (fun f => prod f.1 f.2) ((fun f => (comp (fst R B C) f, comp (snd R B C) f)) f) = f

Next tactic:
ext
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by ext <;> rfl
  right_inv f := by ext <;> 

Proof state:
case H.a
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B × C
x✝ : A
⊢ (((fun f => prod f.1 f.2) ((fun f => (comp (fst R B C) f, comp (snd R B C) f)) f)) x✝).1 = (f x✝).1

Next tactic:
rfl
/-- Taking the product of two maps with the same domain is equivalent to taking the product of
their codomains. -/
@[simps]
def prodEquiv : (A →ₐ[R] B) × (A →ₐ[R] C) ≃ (A →ₐ[R] B × C)
    where
  toFun f := f.1.prod f.2
  invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
  left_inv f := by ext <;> rfl
  right_inv f := by ext <;> 

Proof state:
case H.a
R : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : Algebra R A
inst✝³ : Semiring B
inst✝² : Algebra R B
inst✝¹ : Semiring C
inst✝ : Algebra R C
f : A →ₐ[R] B × C
x✝ : A
⊢ (((fun f => prod f.1 f.2) ((fun f => (comp (fst R B C) f, comp (snd R B C) f)) f)) x✝).2 = (f x✝).2

Next tactic:
rfl
theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ range some = Iio ⊤

Next tactic:
ext x
theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by
  ext x
  

Proof state:
case h
α : Type u_1
inst✝ : PartialOrder α
a b : α
x : WithTop α
⊢ x ∈ range some ↔ x ∈ Iio ⊤

Next tactic:
rw [mem_Iio, lt_top_iff_ne_top, mem_range, ← none_eq_top, Option.ne_none_iff_exists]
theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by
  ext x
  rw [mem_Iio, lt_top_iff_ne_top, mem_range, ← none_eq_top, Option.ne_none_iff_exists]
  

Proof state:
case h
α : Type u_1
inst✝ : PartialOrder α
a b : α
x : WithTop α
⊢ (∃ y, ↑y = x) ↔ ∃ x_1, Option.some x_1 = x

Next tactic:
rfl
@[simp]
theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Icc ↑a ↑b = Icc a b

Next tactic:
simp [← Ici_inter_Iic]
@[simp]
theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ico ↑a ↑b = Ico a b

Next tactic:
simp [← Ici_inter_Iio]
@[simp]
theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioc ↑a ↑b = Ioc a b

Next tactic:
simp [← Ioi_inter_Iic]
@[simp]
theorem preimage_coe_Ioo : (some : α → WithTop α) ⁻¹' Ioo a b = Ioo a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioo ↑a ↑b = Ioo a b

Next tactic:
simp [← Ioi_inter_Iio]
@[simp]
theorem preimage_coe_Iio_top : (some : α → WithTop α) ⁻¹' Iio ⊤ = univ := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Iio ⊤ = univ

Next tactic:
rw [← range_coe, preimage_range]
@[simp]
theorem preimage_coe_Ico_top : (some : α → WithTop α) ⁻¹' Ico a ⊤ = Ici a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ico ↑a ⊤ = Ici a

Next tactic:
simp [← Ici_inter_Iio]
@[simp]
theorem preimage_coe_Ioo_top : (some : α → WithTop α) ⁻¹' Ioo a ⊤ = Ioi a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioo ↑a ⊤ = Ioi a

Next tactic:
simp [← Ioi_inter_Iio]
theorem image_coe_Ioi : (some : α → WithTop α) '' Ioi a = Ioo (a : WithTop α) ⊤ := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioi a = Ioo ↑a ⊤

Next tactic:
rw [← preimage_coe_Ioi, image_preimage_eq_inter_range, range_coe, Ioi_inter_Iio]
theorem image_coe_Ici : (some : α → WithTop α) '' Ici a = Ico (a : WithTop α) ⊤ := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ici a = Ico ↑a ⊤

Next tactic:
rw [← preimage_coe_Ici, image_preimage_eq_inter_range, range_coe, Ici_inter_Iio]
theorem image_coe_Iio : (some : α → WithTop α) '' Iio a = Iio (a : WithTop α) := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Iio a = Iio ↑a

Next tactic:
rw [← preimage_coe_Iio, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Iio_subset_Iio le_top)]
theorem image_coe_Iic : (some : α → WithTop α) '' Iic a = Iic (a : WithTop α) := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Iic a = Iic ↑a

Next tactic:
rw [← preimage_coe_Iic, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Iic_subset_Iio.2 <| coe_lt_top a)]
theorem image_coe_Icc : (some : α → WithTop α) '' Icc a b = Icc (a : WithTop α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Icc a b = Icc ↑a ↑b

Next tactic:
rw [← preimage_coe_Icc, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left
      (Subset.trans Icc_subset_Iic_self <| Iic_subset_Iio.2 <| coe_lt_top b)]
theorem image_coe_Ico : (some : α → WithTop α) '' Ico a b = Ico (a : WithTop α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ico a b = Ico ↑a ↑b

Next tactic:
rw [← preimage_coe_Ico, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Subset.trans Ico_subset_Iio_self <| Iio_subset_Iio le_top)]
theorem image_coe_Ioc : (some : α → WithTop α) '' Ioc a b = Ioc (a : WithTop α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioc a b = Ioc ↑a ↑b

Next tactic:
rw [← preimage_coe_Ioc, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left
      (Subset.trans Ioc_subset_Iic_self <| Iic_subset_Iio.2 <| coe_lt_top b)]
theorem image_coe_Ioo : (some : α → WithTop α) '' Ioo a b = Ioo (a : WithTop α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioo a b = Ioo ↑a ↑b

Next tactic:
rw [← preimage_coe_Ioo, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Subset.trans Ioo_subset_Iio_self <| Iio_subset_Iio le_top)]
@[simp]
theorem preimage_coe_Icc : (some : α → WithBot α) ⁻¹' Icc a b = Icc a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Icc ↑a ↑b = Icc a b

Next tactic:
simp [← Ici_inter_Iic]
@[simp]
theorem preimage_coe_Ico : (some : α → WithBot α) ⁻¹' Ico a b = Ico a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ico ↑a ↑b = Ico a b

Next tactic:
simp [← Ici_inter_Iio]
@[simp]
theorem preimage_coe_Ioc : (some : α → WithBot α) ⁻¹' Ioc a b = Ioc a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioc ↑a ↑b = Ioc a b

Next tactic:
simp [← Ioi_inter_Iic]
@[simp]
theorem preimage_coe_Ioo : (some : α → WithBot α) ⁻¹' Ioo a b = Ioo a b := by 

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioo ↑a ↑b = Ioo a b

Next tactic:
simp [← Ioi_inter_Iio]
@[simp]
theorem preimage_coe_Ioi_bot : (some : α → WithBot α) ⁻¹' Ioi ⊥ = univ := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioi ⊥ = univ

Next tactic:
rw [← range_coe, preimage_range]
@[simp]
theorem preimage_coe_Ioc_bot : (some : α → WithBot α) ⁻¹' Ioc ⊥ a = Iic a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioc ⊥ ↑a = Iic a

Next tactic:
simp [← Ioi_inter_Iic]
@[simp]
theorem preimage_coe_Ioo_bot : (some : α → WithBot α) ⁻¹' Ioo ⊥ a = Iio a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some ⁻¹' Ioo ⊥ ↑a = Iio a

Next tactic:
simp [← Ioi_inter_Iio]
theorem image_coe_Iio : (some : α → WithBot α) '' Iio a = Ioo (⊥ : WithBot α) a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Iio a = Ioo ⊥ ↑a

Next tactic:
rw [← preimage_coe_Iio, image_preimage_eq_inter_range, range_coe, inter_comm, Ioi_inter_Iio]
theorem image_coe_Iic : (some : α → WithBot α) '' Iic a = Ioc (⊥ : WithBot α) a := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Iic a = Ioc ⊥ ↑a

Next tactic:
rw [← preimage_coe_Iic, image_preimage_eq_inter_range, range_coe, inter_comm, Ioi_inter_Iic]
theorem image_coe_Ioi : (some : α → WithBot α) '' Ioi a = Ioi (a : WithBot α) := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioi a = Ioi ↑a

Next tactic:
rw [← preimage_coe_Ioi, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Ioi_subset_Ioi bot_le)]
theorem image_coe_Ici : (some : α → WithBot α) '' Ici a = Ici (a : WithBot α) := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ici a = Ici ↑a

Next tactic:
rw [← preimage_coe_Ici, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Ici_subset_Ioi.2 <| bot_lt_coe a)]
theorem image_coe_Icc : (some : α → WithBot α) '' Icc a b = Icc (a : WithBot α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Icc a b = Icc ↑a ↑b

Next tactic:
rw [← preimage_coe_Icc, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left
      (Subset.trans Icc_subset_Ici_self <| Ici_subset_Ioi.2 <| bot_lt_coe a)]
theorem image_coe_Ioc : (some : α → WithBot α) '' Ioc a b = Ioc (a : WithBot α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioc a b = Ioc ↑a ↑b

Next tactic:
rw [← preimage_coe_Ioc, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Subset.trans Ioc_subset_Ioi_self <| Ioi_subset_Ioi bot_le)]
theorem image_coe_Ico : (some : α → WithBot α) '' Ico a b = Ico (a : WithBot α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ico a b = Ico ↑a ↑b

Next tactic:
rw [← preimage_coe_Ico, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left
      (Subset.trans Ico_subset_Ici_self <| Ici_subset_Ioi.2 <| bot_lt_coe a)]
theorem image_coe_Ioo : (some : α → WithBot α) '' Ioo a b = Ioo (a : WithBot α) b := by
  

Proof state:
α : Type u_1
inst✝ : PartialOrder α
a b : α
⊢ some '' Ioo a b = Ioo ↑a ↑b

Next tactic:
rw [← preimage_coe_Ioo, image_preimage_eq_inter_range, range_coe,
    inter_eq_self_of_subset_left (Subset.trans Ioo_subset_Ioi_self <| Ioi_subset_Ioi bot_le)]
instance (priority := 100) monoCoprodOfHasZeroMorphisms [HasZeroMorphisms C] : MonoCoprod C :=
  ⟨fun A B c hc => by
    

Proof state:
C : Type u_1
inst✝¹ : Category.{?u.561, u_1} C
inst✝ : HasZeroMorphisms C
A B : C
c : BinaryCofan A B
hc : IsColimit c
⊢ Mono (BinaryCofan.inl c)

Next tactic:
haveI : IsSplitMono c.inl :=
      IsSplitMono.mk' (SplitMono.mk (hc.desc (BinaryCofan.mk (𝟙 A) 0)) (IsColimit.fac _ _ _))
instance (priority := 100) monoCoprodOfHasZeroMorphisms [HasZeroMorphisms C] : MonoCoprod C :=
  ⟨fun A B c hc => by
    haveI : IsSplitMono c.inl :=
      IsSplitMono.mk' (SplitMono.mk (hc.desc (BinaryCofan.mk (𝟙 A) 0)) (IsColimit.fac _ _ _))
    

Proof state:
C : Type u_1
inst✝¹ : Category.{?u.561, u_1} C
inst✝ : HasZeroMorphisms C
A B : C
c : BinaryCofan A B
hc : IsColimit c
this : IsSplitMono (BinaryCofan.inl c)
⊢ Mono (BinaryCofan.inl c)

Next tactic:
infer_instance
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
⊢ Mono (BinaryCofan.inr c)

Next tactic:
haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by aesop_cat) (by aesop_cat)
      (fun f₁ f₂ m h₁ h₂ => BinaryCofan.IsColimit.hom_ext hc (by aesop_cat) (by aesop_cat))
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by 

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
⊢ ∀ {T : C} (f : (pair A B).obj { as := WalkingPair.right } ⟶ T) (g : (pair A B).obj { as := WalkingPair.left } ⟶ T),
    BinaryCofan.inl (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫
        (fun {T} f₁ f₂ => IsColimit.desc hc (BinaryCofan.mk f₂ f₁)) f g =
      f

Next tactic:
aesop_cat
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by aesop_cat) (by 

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
⊢ ∀ {T : C} (f : (pair A B).obj { as := WalkingPair.right } ⟶ T) (g : (pair A B).obj { as := WalkingPair.left } ⟶ T),
    BinaryCofan.inr (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫
        (fun {T} f₁ f₂ => IsColimit.desc hc (BinaryCofan.mk f₂ f₁)) f g =
      g

Next tactic:
aesop_cat
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by aesop_cat) (by aesop_cat)
      (fun f₁ f₂ m h₁ h₂ => BinaryCofan.IsColimit.hom_ext hc (by 

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
T✝ : C
f₁ : (pair A B).obj { as := WalkingPair.right } ⟶ T✝
f₂ : (pair A B).obj { as := WalkingPair.left } ⟶ T✝
m : (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)).pt ⟶ T✝
h₁ : BinaryCofan.inl (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫ m = f₁
h₂ : BinaryCofan.inr (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫ m = f₂
⊢ BinaryCofan.inl c ≫ m = BinaryCofan.inl c ≫ (fun {T} f₁ f₂ => IsColimit.desc hc (BinaryCofan.mk f₂ f₁)) f₁ f₂

Next tactic:
aesop_cat
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by aesop_cat) (by aesop_cat)
      (fun f₁ f₂ m h₁ h₂ => BinaryCofan.IsColimit.hom_ext hc (by aesop_cat) (by 

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
T✝ : C
f₁ : (pair A B).obj { as := WalkingPair.right } ⟶ T✝
f₂ : (pair A B).obj { as := WalkingPair.left } ⟶ T✝
m : (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)).pt ⟶ T✝
h₁ : BinaryCofan.inl (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫ m = f₁
h₂ : BinaryCofan.inr (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c)) ≫ m = f₂
⊢ BinaryCofan.inr c ≫ m = BinaryCofan.inr c ≫ (fun {T} f₁ f₂ => IsColimit.desc hc (BinaryCofan.mk f₂ f₁)) f₁ f₂

Next tactic:
aesop_cat
theorem binaryCofan_inr {A B : C} [MonoCoprod C] (c : BinaryCofan A B) (hc : IsColimit c) :
    Mono c.inr := by
  haveI hc' : IsColimit (BinaryCofan.mk c.inr c.inl) :=
    BinaryCofan.IsColimit.mk _ (fun f₁ f₂ => hc.desc (BinaryCofan.mk f₂ f₁))
      (by aesop_cat) (by aesop_cat)
      (fun f₁ f₂ m h₁ h₂ => BinaryCofan.IsColimit.hom_ext hc (by aesop_cat) (by aesop_cat))
  

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
A B : C
inst✝ : MonoCoprod C
c : BinaryCofan A B
hc : IsColimit c
hc' : IsColimit (BinaryCofan.mk (BinaryCofan.inr c) (BinaryCofan.inl c))
⊢ Mono (BinaryCofan.inr c)

Next tactic:
exact binaryCofan_inl _ hc'
theorem mono_inl_iff {A B : C} {c₁ c₂ : BinaryCofan A B} (hc₁ : IsColimit c₁) (hc₂ : IsColimit c₂) :
    Mono c₁.inl ↔ Mono c₂.inl := by
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
A B : C
c₁ c₂ : BinaryCofan A B
hc₁ : IsColimit c₁
hc₂ : IsColimit c₂
⊢ Mono (BinaryCofan.inl c₁) ↔ Mono (BinaryCofan.inl c₂)

Next tactic:
suffices
    ∀ (c₁ c₂ : BinaryCofan A B) (_ : IsColimit c₁) (_ : IsColimit c₂) (_ : Mono c₁.inl),
      Mono c₂.inl
    by exact ⟨fun h₁ => this _ _ hc₁ hc₂ h₁, fun h₂ => this _ _ hc₂ hc₁ h₂⟩