l3lab/ntp-mathlib huggingface dataset:
/-- We verify that an enriched functor between `Type v` enriched categories
is just the same thing as an honest functor.
-/
@[simps]
def enrichedFunctorTypeEquivFunctor {C : Type u₁} [𝒞 : EnrichedCategory (Type v) C] {D : Type u₂}
    [𝒟 : EnrichedCategory (Type v) D] : EnrichedFunctor (Type v) C D ≃ C ⥤ D where
  toFun F :=
    { obj := fun X => F.obj X
      map := fun f => F.map _ _ f
      map_id := fun X => congr_fun (F.map_id X) PUnit.unit
      map_comp := fun f g => congr_fun (F.map_comp _ _ _) ⟨f, g⟩ }
  invFun F :=
    { obj := fun X => F.obj X
      map := fun X Y f => F.map f
      map_id := fun X => by ext ⟨⟩; 

Proof state:
case h.unit
V : Type v
inst✝² : Category.{w, v} V
inst✝¹ : MonoidalCategory V
C✝ : Type u₁
inst✝ : EnrichedCategory V C✝
C : Type u₁
𝒞 : EnrichedCategory (Type v) C
D : Type u₂
𝒟 : EnrichedCategory (Type v) D
F : C ⥤ D
X : C
⊢ (eId (Type v) X ≫ (fun X Y f => F.map f) X X) PUnit.unit = eId (Type v) ((fun X => F.obj X) X) PUnit.unit

Next tactic:
exact F.map_id X
/-- We verify that an enriched functor between `Type v` enriched categories
is just the same thing as an honest functor.
-/
@[simps]
def enrichedFunctorTypeEquivFunctor {C : Type u₁} [𝒞 : EnrichedCategory (Type v) C] {D : Type u₂}
    [𝒟 : EnrichedCategory (Type v) D] : EnrichedFunctor (Type v) C D ≃ C ⥤ D where
  toFun F :=
    { obj := fun X => F.obj X
      map := fun f => F.map _ _ f
      map_id := fun X => congr_fun (F.map_id X) PUnit.unit
      map_comp := fun f g => congr_fun (F.map_comp _ _ _) ⟨f, g⟩ }
  invFun F :=
    { obj := fun X => F.obj X
      map := fun X Y f => F.map f
      map_id := fun X => by ext ⟨⟩; exact F.map_id X
      map_comp := fun X Y Z => by 

Proof state:
V : Type v
inst✝² : Category.{w, v} V
inst✝¹ : MonoidalCategory V
C✝ : Type u₁
inst✝ : EnrichedCategory V C✝
C : Type u₁
𝒞 : EnrichedCategory (Type v) C
D : Type u₂
𝒟 : EnrichedCategory (Type v) D
F : C ⥤ D
X Y Z : C
⊢ eComp (Type v) X Y Z ≫ (fun X Y f => F.map f) X Z =
    ((fun X Y f => F.map f) X Y ⊗ (fun X Y f => F.map f) Y Z) ≫
      eComp (Type v) ((fun X => F.obj X) X) ((fun X => F.obj X) Y) ((fun X => F.obj X) Z)

Next tactic:
ext ⟨f, g⟩
/-- We verify that an enriched functor between `Type v` enriched categories
is just the same thing as an honest functor.
-/
@[simps]
def enrichedFunctorTypeEquivFunctor {C : Type u₁} [𝒞 : EnrichedCategory (Type v) C] {D : Type u₂}
    [𝒟 : EnrichedCategory (Type v) D] : EnrichedFunctor (Type v) C D ≃ C ⥤ D where
  toFun F :=
    { obj := fun X => F.obj X
      map := fun f => F.map _ _ f
      map_id := fun X => congr_fun (F.map_id X) PUnit.unit
      map_comp := fun f g => congr_fun (F.map_comp _ _ _) ⟨f, g⟩ }
  invFun F :=
    { obj := fun X => F.obj X
      map := fun X Y f => F.map f
      map_id := fun X => by ext ⟨⟩; exact F.map_id X
      map_comp := fun X Y Z => by ext ⟨f, g⟩; 

Proof state:
case h.mk
V : Type v
inst✝² : Category.{w, v} V
inst✝¹ : MonoidalCategory V
C✝ : Type u₁
inst✝ : EnrichedCategory V C✝
C : Type u₁
𝒞 : EnrichedCategory (Type v) C
D : Type u₂
𝒟 : EnrichedCategory (Type v) D
F : C ⥤ D
X Y Z : C
f : EnrichedCategory.Hom X Y
g : EnrichedCategory.Hom Y Z
⊢ (eComp (Type v) X Y Z ≫ (fun X Y f => F.map f) X Z) (f, g) =
    (((fun X Y f => F.map f) X Y ⊗ (fun X Y f => F.map f) Y Z) ≫
        eComp (Type v) ((fun X => F.obj X) X) ((fun X => F.obj X) Y) ((fun X => F.obj X) Z))
      (f, g)

Next tactic:
exact F.map_comp f g
/-- We verify that the presheaf representing natural transformations
between `Type v`-enriched functors is actually represented by
the usual type of natural transformations!
-/
def enrichedNatTransYonedaTypeIsoYonedaNatTrans {C : Type v} [EnrichedCategory (Type v) C]
    {D : Type v} [EnrichedCategory (Type v) D] (F G : EnrichedFunctor (Type v) C D) :
    enrichedNatTransYoneda F G ≅
      yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G) :=
  NatIso.ofComponents
    (fun α =>
      { hom := fun σ x =>
          { app := fun X => σ.app X x
            naturality := fun X Y f => congr_fun (σ.naturality X Y) ⟨x, f⟩ }
        inv := fun σ =>
          { app := fun X x => (σ x).app X
            naturality := fun X Y => by 

Proof state:
V : Type v
inst✝⁴ : Category.{w, v} V
inst✝³ : MonoidalCategory V
C✝ : Type u₁
inst✝² : EnrichedCategory V C✝
C : Type v
inst✝¹ : EnrichedCategory (Type v) C
D : Type v
inst✝ : EnrichedCategory (Type v) D
F G : EnrichedFunctor (Type v) C D
α : Type vᵒᵖ
σ : (yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G)).obj α
X Y : C
⊢ (HalfBraiding.β ((Center.ofBraided (Type v)).toLaxMonoidalFunctor.toFunctor.obj α.unop).snd
          (EnrichedCategory.Hom X Y)).hom ≫
      (EnrichedFunctor.map F X Y ⊗ (fun X x => (σ x).app X) Y) ≫
        eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj F Y) (EnrichedFunctor.obj G Y) =
    ((fun X x => (σ x).app X) X ⊗ EnrichedFunctor.map G X Y) ≫
      eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj G X) (EnrichedFunctor.obj G Y)

Next tactic:
ext ⟨x, f⟩
/-- We verify that the presheaf representing natural transformations
between `Type v`-enriched functors is actually represented by
the usual type of natural transformations!
-/
def enrichedNatTransYonedaTypeIsoYonedaNatTrans {C : Type v} [EnrichedCategory (Type v) C]
    {D : Type v} [EnrichedCategory (Type v) D] (F G : EnrichedFunctor (Type v) C D) :
    enrichedNatTransYoneda F G ≅
      yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G) :=
  NatIso.ofComponents
    (fun α =>
      { hom := fun σ x =>
          { app := fun X => σ.app X x
            naturality := fun X Y f => congr_fun (σ.naturality X Y) ⟨x, f⟩ }
        inv := fun σ =>
          { app := fun X x => (σ x).app X
            naturality := fun X Y => by ext ⟨x, f⟩; 

Proof state:
case h.mk
V : Type v
inst✝⁴ : Category.{w, v} V
inst✝³ : MonoidalCategory V
C✝ : Type u₁
inst✝² : EnrichedCategory V C✝
C : Type v
inst✝¹ : EnrichedCategory (Type v) C
D : Type v
inst✝ : EnrichedCategory (Type v) D
F G : EnrichedFunctor (Type v) C D
α : Type vᵒᵖ
σ : (yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G)).obj α
X Y : C
x : ((Center.ofBraided (Type v)).toLaxMonoidalFunctor.toFunctor.obj α.unop).fst
f : EnrichedCategory.Hom X Y
⊢ ((HalfBraiding.β ((Center.ofBraided (Type v)).toLaxMonoidalFunctor.toFunctor.obj α.unop).snd
            (EnrichedCategory.Hom X Y)).hom ≫
        (EnrichedFunctor.map F X Y ⊗ (fun X x => (σ x).app X) Y) ≫
          eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj F Y) (EnrichedFunctor.obj G Y))
      (x, f) =
    (((fun X x => (σ x).app X) X ⊗ EnrichedFunctor.map G X Y) ≫
        eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj G X) (EnrichedFunctor.obj G Y))
      (x, f)

Next tactic:
exact (σ x).naturality f
/-- We verify that the presheaf representing natural transformations
between `Type v`-enriched functors is actually represented by
the usual type of natural transformations!
-/
def enrichedNatTransYonedaTypeIsoYonedaNatTrans {C : Type v} [EnrichedCategory (Type v) C]
    {D : Type v} [EnrichedCategory (Type v) D] (F G : EnrichedFunctor (Type v) C D) :
    enrichedNatTransYoneda F G ≅
      yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G) :=
  NatIso.ofComponents
    (fun α =>
      { hom := fun σ x =>
          { app := fun X => σ.app X x
            naturality := fun X Y f => congr_fun (σ.naturality X Y) ⟨x, f⟩ }
        inv := fun σ =>
          { app := fun X x => (σ x).app X
            naturality := fun X Y => by ext ⟨x, f⟩; exact (σ x).naturality f } })
    (by 

Proof state:
V : Type v
inst✝⁴ : Category.{w, v} V
inst✝³ : MonoidalCategory V
C✝ : Type u₁
inst✝² : EnrichedCategory V C✝
C : Type v
inst✝¹ : EnrichedCategory (Type v) C
D : Type v
inst✝ : EnrichedCategory (Type v) D
F G : EnrichedFunctor (Type v) C D
⊢ ∀ {X Y : Type vᵒᵖ} (f : X ⟶ Y),
    (enrichedNatTransYoneda F G).map f ≫
        ((fun α =>
              Iso.mk (fun σ x => NatTrans.mk fun X => GradedNatTrans.app σ X x) fun σ =>
                { app := fun X x => (σ x).app X,
                  naturality :=
                    (_ :
                      ∀ (X Y : C),
                        (HalfBraiding.β ((Center.ofBraided (Type v)).toLaxMonoidalFunctor.toFunctor.obj α.unop).snd
                                (EnrichedCategory.Hom X Y)).hom ≫
                            (EnrichedFunctor.map F X Y ⊗ (fun X x => (σ x).app X) Y) ≫
                              eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj F Y)
                                (EnrichedFunctor.obj G Y) =
                          ((fun X x => (σ x).app X) X ⊗ EnrichedFunctor.map G X Y) ≫
                            eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj G X)
                              (EnrichedFunctor.obj G Y)) })
            Y).hom =
      ((fun α =>
              Iso.mk (fun σ x => NatTrans.mk fun X => GradedNatTrans.app σ X x) fun σ =>
                { app := fun X x => (σ x).app X,
                  naturality :=
                    (_ :
                      ∀ (X Y : C),
                        (HalfBraiding.β ((Center.ofBraided (Type v)).toLaxMonoidalFunctor.toFunctor.obj α.unop).snd
                                (EnrichedCategory.Hom X Y)).hom ≫
                            (EnrichedFunctor.map F X Y ⊗ (fun X x => (σ x).app X) Y) ≫
                              eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj F Y)
                                (EnrichedFunctor.obj G Y) =
                          ((fun X x => (σ x).app X) X ⊗ EnrichedFunctor.map G X Y) ≫
                            eComp (Type v) (EnrichedFunctor.obj F X) (EnrichedFunctor.obj G X)
                              (EnrichedFunctor.obj G Y)) })
            X).hom ≫
        (yoneda.obj (enrichedFunctorTypeEquivFunctor F ⟶ enrichedFunctorTypeEquivFunctor G)).map f

Next tactic:
aesop_cat
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : NonAssocSemiring α
m n : ℕ
⊢ ↑(m * n) = ↑m * ↑n

Next tactic:
induction n
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
  induction n <;> 

Proof state:
case zero
α : Type u_1
β : Type u_2
inst✝ : NonAssocSemiring α
m : ℕ
⊢ ↑(m * zero) = ↑m * ↑zero

Next tactic:
simp [mul_succ, mul_add, *]
@[simp, norm_cast]
theorem cast_mul [NonAssocSemiring α] (m n : ℕ) : ((m * n : ℕ) : α) = m * n := by
  induction n <;> 

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝ : NonAssocSemiring α
m n✝ : ℕ
n_ih✝ : ↑(m * n✝) = ↑m * ↑n✝
⊢ ↑(m * succ n✝) = ↑m * ↑(succ n✝)

Next tactic:
simp [mul_succ, mul_add, *]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
⊢ ∀ (x : ℕ), f x = g x

Next tactic:
intro n
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    intro n
    

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
n : ℕ
⊢ f n = g n

Next tactic:
induction n with
    | zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
    | succ n ihn =>
      simp [Nat.succ_eq_add_one, h, ihn]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    intro n
    induction n with
    

Proof state:
case zero
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
⊢ f Nat.zero = g Nat.zero

Next tactic:
| zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    intro n
    induction n with
    | zero => 

Proof state:
case zero
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
⊢ f Nat.zero = g Nat.zero

Next tactic:
simp_rw [Nat.zero_eq, map_zero f, map_zero g]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    intro n
    induction n with
    | zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
    

Proof state:
case succ
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
n : ℕ
ihn : f n = g n
⊢ f (Nat.succ n) = g (Nat.succ n)

Next tactic:
| succ n ihn =>
      simp [Nat.succ_eq_add_one, h, ihn]
theorem ext_nat' [AddMonoid A] [AddMonoidHomClass F ℕ A] (f g : F) (h : f 1 = g 1) : f = g :=
  FunLike.ext f g <| by
    intro n
    induction n with
    | zero => simp_rw [Nat.zero_eq, map_zero f, map_zero g]
    | succ n ihn =>
      

Proof state:
case succ
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoid A
inst✝ : AddMonoidHomClass F ℕ A
f g : F
h : f 1 = g 1
n : ℕ
ihn : f n = g n
⊢ f (Nat.succ n) = g (Nat.succ n)

Next tactic:
simp [Nat.succ_eq_add_one, h, ihn]
theorem eq_natCast' [AddMonoidHomClass F ℕ A] (f : F) (h1 : f 1 = 1) : ∀ n : ℕ, f n = n
  | 0 => by 

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoidWithOne A
inst✝ : AddMonoidHomClass F ℕ A
f : F
h1 : f 1 = 1
⊢ f 0 = ↑0

Next tactic:
simp [map_zero f]
theorem eq_natCast' [AddMonoidHomClass F ℕ A] (f : F) (h1 : f 1 = 1) : ∀ n : ℕ, f n = n
  | 0 => by simp [map_zero f]
  | n + 1 => by 

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
F : Type u_5
inst✝² : AddMonoidWithOne B
inst✝¹ : AddMonoidWithOne A
inst✝ : AddMonoidHomClass F ℕ A
f : F
h1 : f 1 = 1
n : ℕ
⊢ f (n + 1) = ↑(n + 1)

Next tactic:
rw [map_add, h1, eq_natCast' f h1 n, Nat.cast_add_one]
theorem map_natCast' {A} [AddMonoidWithOne A] [AddMonoidHomClass F A B] (f : F) (h : f 1 = 1) :
    ∀ n : ℕ, f n = n
  | 0 => by 

Proof state:
α : Type u_1
β : Type u_2
A✝ : Type u_3
B : Type u_4
F : Type u_5
inst✝³ : AddMonoidWithOne B
inst✝² : AddMonoidWithOne A✝
A : Type u_6
inst✝¹ : AddMonoidWithOne A
inst✝ : AddMonoidHomClass F A B
f : F
h : f 1 = 1
⊢ f ↑0 = ↑0

Next tactic:
simp [map_zero f]
theorem map_natCast' {A} [AddMonoidWithOne A] [AddMonoidHomClass F A B] (f : F) (h : f 1 = 1) :
    ∀ n : ℕ, f n = n
  | 0 => by simp [map_zero f]
  | n + 1 => by
    

Proof state:
α : Type u_1
β : Type u_2
A✝ : Type u_3
B : Type u_4
F : Type u_5
inst✝³ : AddMonoidWithOne B
inst✝² : AddMonoidWithOne A✝
A : Type u_6
inst✝¹ : AddMonoidWithOne A
inst✝ : AddMonoidHomClass F A B
f : F
h : f 1 = 1
n : ℕ
⊢ f ↑(n + 1) = ↑(n + 1)

Next tactic:
rw [Nat.cast_add, map_add, Nat.cast_add, map_natCast' f h n, Nat.cast_one, h, Nat.cast_one]
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
    f = g := by
  

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
F : Type u_4
inst✝¹ : MulZeroOneClass A
inst✝ : MonoidWithZeroHomClass F ℕ A
f g : F
h_pos : ∀ {n : ℕ}, 0 < n → f n = g n
⊢ f = g

Next tactic:
apply FunLike.ext
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
    f = g := by
  apply FunLike.ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
A : Type u_3
F : Type u_4
inst✝¹ : MulZeroOneClass A
inst✝ : MonoidWithZeroHomClass F ℕ A
f g : F
h_pos : ∀ {n : ℕ}, 0 < n → f n = g n
⊢ ∀ (x : ℕ), f x = g x

Next tactic:
rintro (_ | n)
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
    f = g := by
  apply FunLike.ext
  rintro (_ | n)
  · 

Proof state:
case h.zero
α : Type u_1
β : Type u_2
A : Type u_3
F : Type u_4
inst✝¹ : MulZeroOneClass A
inst✝ : MonoidWithZeroHomClass F ℕ A
f g : F
h_pos : ∀ {n : ℕ}, 0 < n → f n = g n
⊢ f Nat.zero = g Nat.zero

Next tactic:
simp [map_zero f, map_zero g]
/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
    f = g := by
  apply FunLike.ext
  rintro (_ | n)
  · simp [map_zero f, map_zero g]
  · 

Proof state:
case h.succ
α : Type u_1
β : Type u_2
A : Type u_3
F : Type u_4
inst✝¹ : MulZeroOneClass A
inst✝ : MonoidWithZeroHomClass F ℕ A
f g : F
h_pos : ∀ {n : ℕ}, 0 < n → f n = g n
n : ℕ
⊢ f (Nat.succ n) = g (Nat.succ n)

Next tactic:
exact h_pos n.succ_pos
theorem ext_nat [RingHomClass F ℕ R] (f g : F) : f = g :=
  ext_nat' f g <| by 

Proof state:
α : Type u_1
β : Type u_2
R : Type u_3
S : Type u_4
F : Type u_5
inst✝² : NonAssocSemiring R
inst✝¹ : NonAssocSemiring S
inst✝ : RingHomClass F ℕ R
f g : F
⊢ f 1 = g 1

Next tactic:
simp only [map_one f, map_one g]
theorem NeZero.nat_of_neZero {R S} [Semiring R] [Semiring S] {F} [RingHomClass F R S] (f : F)
    {n : ℕ} [hn : NeZero (n : S)] : NeZero (n : R) :=
  .of_map (f := f) (neZero := by 

Proof state:
α : Type u_1
β : Type u_2
R✝ : Type u_3
S✝ : Type u_4
F✝ : Type u_5
inst✝⁴ : NonAssocSemiring R✝
inst✝³ : NonAssocSemiring S✝
R : Type u_6
S : Type u_7
inst✝² : Semiring R
inst✝¹ : Semiring S
F : Type u_8
inst✝ : RingHomClass F R S
f : F
n : ℕ
hn : NeZero ↑n
⊢ NeZero (f ↑n)

Next tactic:
simp only [map_natCast, hn]
instance (priority := 100) PseudoEpimorphismClass.toTopHomClass [PartialOrder α] [OrderTop α]
    [Preorder β] [OrderTop β] [PseudoEpimorphismClass F α β] : TopHomClass F α β where
  map_top f := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁴ : PartialOrder α
inst✝³ : OrderTop α
inst✝² : Preorder β
inst✝¹ : OrderTop β
inst✝ : PseudoEpimorphismClass F α β
f : F
⊢ f ⊤ = ⊤

Next tactic:
let ⟨b, h⟩ := exists_map_eq_of_map_le f (@le_top _ _ _ <| f ⊤)
instance (priority := 100) PseudoEpimorphismClass.toTopHomClass [PartialOrder α] [OrderTop α]
    [Preorder β] [OrderTop β] [PseudoEpimorphismClass F α β] : TopHomClass F α β where
  map_top f := by
    let ⟨b, h⟩ := exists_map_eq_of_map_le f (@le_top _ _ _ <| f ⊤)
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁴ : PartialOrder α
inst✝³ : OrderTop α
inst✝² : Preorder β
inst✝¹ : OrderTop β
inst✝ : PseudoEpimorphismClass F α β
f : F
b : α
h : ⊤ ≤ b ∧ f b = ⊤
⊢ f ⊤ = ⊤

Next tactic:
rw [← top_le_iff.1 h.1, h.2]
instance : PseudoEpimorphismClass (PseudoEpimorphism α β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
f g : PseudoEpimorphism α β
h : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g

Next tactic:
obtain ⟨⟨_, _⟩, _⟩ := f
instance : PseudoEpimorphismClass (PseudoEpimorphism α β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨_, _⟩, _⟩ := f
    

Proof state:
case mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
g : PseudoEpimorphism α β
toFun✝ : α → β
monotone'✝ : Monotone toFun✝
exists_map_eq_of_map_le'✝ :
  ∀ ⦃a : α⦄ ⦃b : β⦄,
    OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } a ≤ b →
      ∃ c, a ≤ c ∧ OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } c = b
h :
  (fun f => f.toFun)
      { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ },
        exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝ } =
    (fun f => f.toFun) g
⊢ { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ },
      exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝ } =
    g

Next tactic:
obtain ⟨⟨_, _⟩, _⟩ := g
instance : PseudoEpimorphismClass (PseudoEpimorphism α β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨_, _⟩, _⟩ := f
    obtain ⟨⟨_, _⟩, _⟩ := g
    

Proof state:
case mk.mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
toFun✝¹ : α → β
monotone'✝¹ : Monotone toFun✝¹
exists_map_eq_of_map_le'✝¹ :
  ∀ ⦃a : α⦄ ⦃b : β⦄,
    OrderHom.toFun { toFun := toFun✝¹, monotone' := monotone'✝¹ } a ≤ b →
      ∃ c, a ≤ c ∧ OrderHom.toFun { toFun := toFun✝¹, monotone' := monotone'✝¹ } c = b
toFun✝ : α → β
monotone'✝ : Monotone toFun✝
exists_map_eq_of_map_le'✝ :
  ∀ ⦃a : α⦄ ⦃b : β⦄,
    OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } a ≤ b →
      ∃ c, a ≤ c ∧ OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } c = b
h :
  (fun f => f.toFun)
      { toOrderHom := { toFun := toFun✝¹, monotone' := monotone'✝¹ },
        exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝¹ } =
    (fun f => f.toFun)
      { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ },
        exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝ }
⊢ { toOrderHom := { toFun := toFun✝¹, monotone' := monotone'✝¹ },
      exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝¹ } =
    { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ },
      exists_map_eq_of_map_le' := exists_map_eq_of_map_le'✝ }

Next tactic:
congr
/-- Copy of a `PseudoEpimorphism` with a new `toFun` equal to the old one. Useful to fix
definitional equalities. -/
protected def copy (f : PseudoEpimorphism α β) (f' : α → β) (h : f' = f) : PseudoEpimorphism α β :=
  ⟨f.toOrderHom.copy f' h, by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
f : PseudoEpimorphism α β
f' : α → β
h : f' = ⇑f
⊢ ∀ ⦃a : α⦄ ⦃b : β⦄,
    OrderHom.toFun (OrderHom.copy f.toOrderHom f' h) a ≤ b →
      ∃ c, a ≤ c ∧ OrderHom.toFun (OrderHom.copy f.toOrderHom f' h) c = b

Next tactic:
simpa only [h.symm, toFun_eq_coe] using f.exists_map_eq_of_map_le'
/-- Composition of `PseudoEpimorphism`s as a `PseudoEpimorphism`. -/
def comp (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) : PseudoEpimorphism α γ :=
  ⟨g.toOrderHom.comp f.toOrderHom, fun a b h₀ => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
g : PseudoEpimorphism β γ
f : PseudoEpimorphism α β
a : α
b : γ
h₀ : OrderHom.toFun (OrderHom.comp g.toOrderHom f.toOrderHom) a ≤ b
⊢ ∃ c, a ≤ c ∧ OrderHom.toFun (OrderHom.comp g.toOrderHom f.toOrderHom) c = b

Next tactic:
obtain ⟨b, h₁, rfl⟩ := g.exists_map_eq_of_map_le' h₀
/-- Composition of `PseudoEpimorphism`s as a `PseudoEpimorphism`. -/
def comp (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) : PseudoEpimorphism α γ :=
  ⟨g.toOrderHom.comp f.toOrderHom, fun a b h₀ => by
    obtain ⟨b, h₁, rfl⟩ := g.exists_map_eq_of_map_le' h₀
    

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : Preorder γ
inst✝ : Preorder δ
g : PseudoEpimorphism β γ
f : PseudoEpimorphism α β
a : α
b : β
h₁ : f.toOrderHom a ≤ b
h₀ : OrderHom.toFun (OrderHom.comp g.toOrderHom f.toOrderHom) a ≤ OrderHom.toFun g.toOrderHom b
⊢ ∃ c, a ≤ c ∧ OrderHom.toFun (OrderHom.comp g.toOrderHom f.toOrderHom) c = OrderHom.toFun g.toOrderHom b

Next tactic:
obtain ⟨b, h₂, rfl⟩ := f.exists_map_eq_of_map_le' h₁