l3lab/ntp-mathlib huggingface dataset:
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.map ((Adjunction.ofRightAdjoint i).unit.app A) ((Adjunction.ofRightAdjoint i).unit.app B) =
    (Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫
      i.map (prodComparison (leftAdjoint i) A B) ≫
        (PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom

Next tactic:
erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.map ((Adjunction.ofRightAdjoint i).unit.app A) ((Adjunction.ofRightAdjoint i).unit.app B) =
    (Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫
      i.map (prodComparison (leftAdjoint i) A B) ≫ prodComparison i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)

Next tactic:
apply prod.hom_ext
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
  apply prod.hom_ext
  · 

Proof state:
case h₁
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.map ((Adjunction.ofRightAdjoint i).unit.app A) ((Adjunction.ofRightAdjoint i).unit.app B) ≫ prod.fst =
    ((Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫
        i.map (prodComparison (leftAdjoint i) A B) ≫ prodComparison i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)) ≫
      prod.fst

Next tactic:
rw [Limits.prod.map_fst, assoc, assoc, prodComparison_fst, ← i.map_comp, prodComparison_fst]
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
  apply prod.hom_ext
  · rw [Limits.prod.map_fst, assoc, assoc, prodComparison_fst, ← i.map_comp, prodComparison_fst]
    

Proof state:
case h₁
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.fst ≫ (Adjunction.ofRightAdjoint i).unit.app A =
    (Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫ i.map ((leftAdjoint i).map prod.fst)

Next tactic:
apply (Adjunction.ofRightAdjoint i).unit.naturality
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
  apply prod.hom_ext
  · rw [Limits.prod.map_fst, assoc, assoc, prodComparison_fst, ← i.map_comp, prodComparison_fst]
    apply (Adjunction.ofRightAdjoint i).unit.naturality
  · 

Proof state:
case h₂
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.map ((Adjunction.ofRightAdjoint i).unit.app A) ((Adjunction.ofRightAdjoint i).unit.app B) ≫ prod.snd =
    ((Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫
        i.map (prodComparison (leftAdjoint i) A B) ≫ prodComparison i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)) ≫
      prod.snd

Next tactic:
rw [Limits.prod.map_snd, assoc, assoc, prodComparison_snd, ← i.map_comp, prodComparison_snd]
theorem bijection_symm_apply_id (A B : C) :
    (bijection i A B _).symm (𝟙 _) = prodComparison _ _ _ := by
  -- Porting note: added
  have : PreservesLimits i := (Adjunction.ofRightAdjoint i).rightAdjointPreservesLimits
  have := preservesSmallestLimitsOfPreservesLimits i
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  rw [comp_id, comp_id, comp_id, i.map_id, comp_id, unitCompPartialBijective_symm_apply,
    unitCompPartialBijective_symm_apply, uncurry_natural_left, uncurry_curry,
    uncurry_natural_left, uncurry_curry, prod.lift_map_assoc, comp_id, prod.lift_map_assoc, comp_id]
  -- Porting note: added
  dsimp only [Functor.comp_obj]
  rw [prod.comp_lift_assoc, prod.lift_snd, prod.lift_fst_assoc, prod.lift_fst_comp_snd_comp,
    ← Adjunction.eq_homEquiv_apply, Adjunction.homEquiv_unit, Iso.comp_inv_eq, assoc]
  -- Porting note: rw became erw
  erw [PreservesLimitPair.iso_hom i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)]
  apply prod.hom_ext
  · rw [Limits.prod.map_fst, assoc, assoc, prodComparison_fst, ← i.map_comp, prodComparison_fst]
    apply (Adjunction.ofRightAdjoint i).unit.naturality
  · rw [Limits.prod.map_snd, assoc, assoc, prodComparison_snd, ← i.map_comp, prodComparison_snd]
    

Proof state:
case h₂
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
this✝ : PreservesLimits i
this : PreservesLimitsOfSize.{0, 0, v₁, v₁, u₂, u₁} i
⊢ prod.snd ≫ (Adjunction.ofRightAdjoint i).unit.app B =
    (Adjunction.ofRightAdjoint i).unit.app (A ⨯ B) ≫ i.map ((leftAdjoint i).map prod.snd)

Next tactic:
apply (Adjunction.ofRightAdjoint i).unit.naturality
theorem bijection_natural (A B : C) (X X' : D) (f : (leftAdjoint i).obj (A ⨯ B) ⟶ X) (g : X ⟶ X') :
    bijection i _ _ _ (f ≫ g) = bijection i _ _ _ f ≫ g := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
X X' : D
f : (leftAdjoint i).obj (A ⨯ B) ⟶ X
g : X ⟶ X'
⊢ (bijection i A B X') (f ≫ g) = (bijection i A B X) f ≫ g

Next tactic:
dsimp [bijection]
theorem bijection_natural (A B : C) (X X' : D) (f : (leftAdjoint i).obj (A ⨯ B) ⟶ X) (g : X ⟶ X') :
    bijection i _ _ _ (f ≫ g) = bijection i _ _ _ f ≫ g := by
  dsimp [bijection]
  -- Porting note: added
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
X X' : D
f : (leftAdjoint i).obj (A ⨯ B) ⟶ X
g : X ⟶ X'
⊢ i.preimage
      ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
        (Adjunction.homEquiv (exp.adjunction (i.obj ((leftAdjoint i).obj A))) (i.obj ((leftAdjoint i).obj B))
                (i.obj X')).symm
            ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X') ∈ Functor.essImage i))
              ((Adjunction.homEquiv (exp.adjunction (i.obj ((leftAdjoint i).obj A))) B (i.obj X'))
                (prod.lift prod.snd prod.fst ≫
                  (Adjunction.homEquiv (exp.adjunction B) (i.obj ((leftAdjoint i).obj A)) (i.obj X')).symm
                      ((unitCompPartialBijective A (_ : (B ⟹ i.obj X') ∈ Functor.essImage i))
                        ((Adjunction.homEquiv (exp.adjunction B) A (i.obj X'))
                          (prod.lift prod.snd prod.fst ≫
                            (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X') (f ≫ g) ≫ 𝟙 (i.obj X')))) ≫
                    𝟙 (i.obj X')))) ≫
          𝟙 (i.obj X')) =
    i.preimage
        ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
          (Adjunction.homEquiv (exp.adjunction (i.obj ((leftAdjoint i).obj A))) (i.obj ((leftAdjoint i).obj B))
                  (i.obj X)).symm
              ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X) ∈ Functor.essImage i))
                ((Adjunction.homEquiv (exp.adjunction (i.obj ((leftAdjoint i).obj A))) B (i.obj X))
                  (prod.lift prod.snd prod.fst ≫
                    (Adjunction.homEquiv (exp.adjunction B) (i.obj ((leftAdjoint i).obj A)) (i.obj X)).symm
                        ((unitCompPartialBijective A (_ : (B ⟹ i.obj X) ∈ Functor.essImage i))
                          ((Adjunction.homEquiv (exp.adjunction B) A (i.obj X))
                            (prod.lift prod.snd prod.fst ≫
                              (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X) f ≫ 𝟙 (i.obj X)))) ≫
                      𝟙 (i.obj X)))) ≫
            𝟙 (i.obj X)) ≫
      g

Next tactic:
erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq,
    homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
theorem bijection_natural (A B : C) (X X' : D) (f : (leftAdjoint i).obj (A ⨯ B) ⟶ X) (g : X ⟶ X') :
    bijection i _ _ _ (f ≫ g) = bijection i _ _ _ f ≫ g := by
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq,
    homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
X X' : D
f : (leftAdjoint i).obj (A ⨯ B) ⟶ X
g : X ⟶ X'
⊢ i.preimage
      ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
        CartesianClosed.uncurry
            ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X') ∈ Functor.essImage i))
              (CartesianClosed.curry
                (prod.lift prod.snd prod.fst ≫
                  CartesianClosed.uncurry
                      ((unitCompPartialBijective A (_ : (B ⟹ i.obj X') ∈ Functor.essImage i))
                        (CartesianClosed.curry
                          (prod.lift prod.snd prod.fst ≫
                            (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X') (f ≫ g) ≫ 𝟙 (i.obj X')))) ≫
                    𝟙 (i.obj X')))) ≫
          𝟙 (i.obj X')) =
    i.preimage
        ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
          CartesianClosed.uncurry
              ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X) ∈ Functor.essImage i))
                (CartesianClosed.curry
                  (prod.lift prod.snd prod.fst ≫
                    CartesianClosed.uncurry
                        ((unitCompPartialBijective A (_ : (B ⟹ i.obj X) ∈ Functor.essImage i))
                          (CartesianClosed.curry
                            (prod.lift prod.snd prod.fst ≫
                              (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X) f ≫ 𝟙 (i.obj X)))) ≫
                      𝟙 (i.obj X)))) ≫
            𝟙 (i.obj X)) ≫
      g

Next tactic:
apply i.map_injective
theorem bijection_natural (A B : C) (X X' : D) (f : (leftAdjoint i).obj (A ⨯ B) ⟶ X) (g : X ⟶ X') :
    bijection i _ _ _ (f ≫ g) = bijection i _ _ _ f ≫ g := by
  dsimp [bijection]
  -- Porting note: added
  erw [homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq,
    homEquiv_symm_apply_eq, homEquiv_symm_apply_eq, homEquiv_apply_eq, homEquiv_apply_eq]
  apply i.map_injective
  

Proof state:
case a
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
X X' : D
f : (leftAdjoint i).obj (A ⨯ B) ⟶ X
g : X ⟶ X'
⊢ i.map
      (i.preimage
        ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
          CartesianClosed.uncurry
              ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X') ∈ Functor.essImage i))
                (CartesianClosed.curry
                  (prod.lift prod.snd prod.fst ≫
                    CartesianClosed.uncurry
                        ((unitCompPartialBijective A (_ : (B ⟹ i.obj X') ∈ Functor.essImage i))
                          (CartesianClosed.curry
                            (prod.lift prod.snd prod.fst ≫
                              (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X') (f ≫ g) ≫ 𝟙 (i.obj X')))) ≫
                      𝟙 (i.obj X')))) ≫
            𝟙 (i.obj X'))) =
    i.map
      (i.preimage
          ((PreservesLimitPair.iso i ((leftAdjoint i).obj A) ((leftAdjoint i).obj B)).hom ≫
            CartesianClosed.uncurry
                ((unitCompPartialBijective B (_ : (i.obj ((leftAdjoint i).obj A) ⟹ i.obj X) ∈ Functor.essImage i))
                  (CartesianClosed.curry
                    (prod.lift prod.snd prod.fst ≫
                      CartesianClosed.uncurry
                          ((unitCompPartialBijective A (_ : (B ⟹ i.obj X) ∈ Functor.essImage i))
                            (CartesianClosed.curry
                              (prod.lift prod.snd prod.fst ≫
                                (Adjunction.homEquiv (Adjunction.ofRightAdjoint i) (A ⨯ B) X) f ≫ 𝟙 (i.obj X)))) ≫
                        𝟙 (i.obj X)))) ≫
              𝟙 (i.obj X)) ≫
        g)

Next tactic:
rw [i.image_preimage, i.map_comp, i.image_preimage, comp_id, comp_id, comp_id, comp_id, comp_id,
    comp_id, Adjunction.homEquiv_naturality_right, ← assoc, curry_natural_right _ (i.map g),
    unitCompPartialBijective_natural, uncurry_natural_right, ← assoc, curry_natural_right,
    unitCompPartialBijective_natural, uncurry_natural_right, assoc]
/--
The bijection allows us to show that `prodComparison L A B` is an isomorphism, where the inverse
is the forward map of the identity morphism.
-/
theorem prodComparison_iso (A B : C) : IsIso (prodComparison (leftAdjoint i) A B) :=
  ⟨⟨bijection i _ _ _ (𝟙 _), by
      

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
⊢ prodComparison (leftAdjoint i) A B ≫
      (bijection i A B ((leftAdjoint i).obj (A ⨯ B))) (𝟙 ((leftAdjoint i).obj (A ⨯ B))) =
    𝟙 ((leftAdjoint i).obj (A ⨯ B))

Next tactic:
rw [← (bijection i _ _ _).injective.eq_iff, bijection_natural, ← bijection_symm_apply_id,
        Equiv.apply_symm_apply, id_comp]
/--
The bijection allows us to show that `prodComparison L A B` is an isomorphism, where the inverse
is the forward map of the identity morphism.
-/
theorem prodComparison_iso (A B : C) : IsIso (prodComparison (leftAdjoint i) A B) :=
  ⟨⟨bijection i _ _ _ (𝟙 _), by
      rw [← (bijection i _ _ _).injective.eq_iff, bijection_natural, ← bijection_symm_apply_id,
        Equiv.apply_symm_apply, id_comp],
      by 

Proof state:
C : Type u₁
D : Type u₂
inst✝⁶ : Category.{v₁, u₁} C
inst✝⁵ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁴ : HasFiniteProducts C
inst✝³ : Reflective i
inst✝² : CartesianClosed C
inst✝¹ : HasFiniteProducts D
inst✝ : ExponentialIdeal i
A B : C
⊢ (bijection i A B ((leftAdjoint i).obj (A ⨯ B))) (𝟙 ((leftAdjoint i).obj (A ⨯ B))) ≫
      prodComparison (leftAdjoint i) A B =
    𝟙 ((leftAdjoint i).obj A ⨯ (leftAdjoint i).obj B)

Next tactic:
rw [← bijection_natural, id_comp, ← bijection_symm_apply_id, Equiv.apply_symm_apply]
/--
If a reflective subcategory is an exponential ideal, then the reflector preserves finite products.
-/
noncomputable def preservesFiniteProductsOfExponentialIdeal (J : Type) [Fintype J] :
    PreservesLimitsOfShape (Discrete J) (leftAdjoint i) := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁵ : HasFiniteProducts C
inst✝⁴ : Reflective i
inst✝³ : CartesianClosed C
inst✝² : HasFiniteProducts D
inst✝¹ : ExponentialIdeal i
J : Type
inst✝ : Fintype J
⊢ PreservesLimitsOfShape (Discrete J) (leftAdjoint i)

Next tactic:
letI := preservesBinaryProductsOfExponentialIdeal i
/--
If a reflective subcategory is an exponential ideal, then the reflector preserves finite products.
-/
noncomputable def preservesFiniteProductsOfExponentialIdeal (J : Type) [Fintype J] :
    PreservesLimitsOfShape (Discrete J) (leftAdjoint i) := by
  letI := preservesBinaryProductsOfExponentialIdeal i
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁵ : HasFiniteProducts C
inst✝⁴ : Reflective i
inst✝³ : CartesianClosed C
inst✝² : HasFiniteProducts D
inst✝¹ : ExponentialIdeal i
J : Type
inst✝ : Fintype J
this : PreservesLimitsOfShape (Discrete WalkingPair) (leftAdjoint i) := preservesBinaryProductsOfExponentialIdeal i
⊢ PreservesLimitsOfShape (Discrete J) (leftAdjoint i)

Next tactic:
letI := leftAdjointPreservesTerminalOfReflective.{0} i
/--
If a reflective subcategory is an exponential ideal, then the reflector preserves finite products.
-/
noncomputable def preservesFiniteProductsOfExponentialIdeal (J : Type) [Fintype J] :
    PreservesLimitsOfShape (Discrete J) (leftAdjoint i) := by
  letI := preservesBinaryProductsOfExponentialIdeal i
  letI := leftAdjointPreservesTerminalOfReflective.{0} i
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁷ : Category.{v₁, u₁} C
inst✝⁶ : Category.{v₁, u₂} D
i : D ⥤ C
inst✝⁵ : HasFiniteProducts C
inst✝⁴ : Reflective i
inst✝³ : CartesianClosed C
inst✝² : HasFiniteProducts D
inst✝¹ : ExponentialIdeal i
J : Type
inst✝ : Fintype J
this✝ : PreservesLimitsOfShape (Discrete WalkingPair) (leftAdjoint i) := preservesBinaryProductsOfExponentialIdeal i
this : PreservesLimitsOfShape (Discrete PEmpty.{1}) (leftAdjoint i) := leftAdjointPreservesTerminalOfReflective i
⊢ PreservesLimitsOfShape (Discrete J) (leftAdjoint i)

Next tactic:
apply preservesFiniteProductsOfPreservesBinaryAndTerminal (leftAdjoint i) J
/-- Central moment of a real random variable, `μ[(X - μ[X]) ^ p]`. -/
def centralMoment (X : Ω → ℝ) (p : ℕ) (μ : Measure Ω) : ℝ := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
m : MeasurableSpace Ω
X✝ : Ω → ℝ
p✝ : ℕ
μ✝ : Measure Ω
X : Ω → ℝ
p : ℕ
μ : Measure Ω
⊢ ℝ

Next tactic:
have m := fun (x : Ω) => μ[X]
/-- Central moment of a real random variable, `μ[(X - μ[X]) ^ p]`. -/
def centralMoment (X : Ω → ℝ) (p : ℕ) (μ : Measure Ω) : ℝ := by
  have m := fun (x : Ω) => μ[X] -- Porting note: Lean deems `μ[(X - fun x => μ[X]) ^ p]` ambiguous
  

Proof state:
Ω : Type u_1
ι : Type u_2
m✝ : MeasurableSpace Ω
X✝ : Ω → ℝ
p✝ : ℕ
μ✝ : Measure Ω
X : Ω → ℝ
p : ℕ
μ : Measure Ω
m : Ω → ℝ
⊢ ℝ

Next tactic:
exact μ[(X - m) ^ p]
@[simp]
theorem moment_zero (hp : p ≠ 0) : moment 0 p μ = 0 := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
m : MeasurableSpace Ω
X : Ω → ℝ
p : ℕ
μ : Measure Ω
hp : p ≠ 0
⊢ moment 0 p μ = 0

Next tactic:
simp only [moment, hp, zero_pow', Ne.def, not_false_iff, Pi.zero_apply, integral_const,
    smul_eq_mul, mul_zero]