l3lab/ntp-mathlib huggingface dataset:
/-- Given a sequence of subsets `sᵢ` of a metric space, together with a sequence of radii `rᵢ`
such that `rᵢ → 0`, the set of points which belong to infinitely many of the
`rᵢ`-thickenings of `sᵢ` is unchanged almost everywhere for a uniformly locally doubling measure if
the `rᵢ` are all scaled by a positive constant.

This lemma is a generalisation of Lemma 9 appearing on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).

See also `blimsup_cthickening_mul_ae_eq`.

NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_thickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ)
    (hr : Tendsto r atTop (𝓝 0)) :
    (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
      (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
  let q : ℕ → Prop := fun i => p i ∧ 0 < r i
  have h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p =
      blimsup (fun i => thickening (r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace hi : 0 < r i; · contrapose! h; apply thickening_of_nonpos h
    simp only [hi, iff_self_and, imp_true_iff]
  have h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p =
      blimsup (fun i => thickening (M * r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace h : 0 < r i; · rw [← zero_lt_mul_left hM]; contrapose! h; apply thickening_of_nonpos h
    

Proof state:
α : Type u_1
inst✝⁵ : MetricSpace α
inst✝⁴ : SecondCountableTopology α
inst✝³ : MeasurableSpace α
inst✝² : BorelSpace α
μ : Measure α
inst✝¹ : IsLocallyFiniteMeasure μ
inst✝ : IsUnifLocDoublingMeasure μ
p : ℕ → Prop
s : ℕ → Set α
M : ℝ
hM : 0 < M
r : ℕ → ℝ
hr : Tendsto r atTop (𝓝 0)
q : ℕ → Prop := fun i => p i ∧ 0 < r i
h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p = blimsup (fun i => thickening (r i) (s i)) atTop q
i : ℕ
h : 0 < r i
⊢ p i ↔ q i

Next tactic:
simp only [h, iff_self_and, imp_true_iff]
/-- Given a sequence of subsets `sᵢ` of a metric space, together with a sequence of radii `rᵢ`
such that `rᵢ → 0`, the set of points which belong to infinitely many of the
`rᵢ`-thickenings of `sᵢ` is unchanged almost everywhere for a uniformly locally doubling measure if
the `rᵢ` are all scaled by a positive constant.

This lemma is a generalisation of Lemma 9 appearing on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).

See also `blimsup_cthickening_mul_ae_eq`.

NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_thickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ)
    (hr : Tendsto r atTop (𝓝 0)) :
    (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
      (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
  let q : ℕ → Prop := fun i => p i ∧ 0 < r i
  have h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p =
      blimsup (fun i => thickening (r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace hi : 0 < r i; · contrapose! h; apply thickening_of_nonpos h
    simp only [hi, iff_self_and, imp_true_iff]
  have h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p =
      blimsup (fun i => thickening (M * r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace h : 0 < r i; · rw [← zero_lt_mul_left hM]; contrapose! h; apply thickening_of_nonpos h
    simp only [h, iff_self_and, imp_true_iff]
  

Proof state:
α : Type u_1
inst✝⁵ : MetricSpace α
inst✝⁴ : SecondCountableTopology α
inst✝³ : MeasurableSpace α
inst✝² : BorelSpace α
μ : Measure α
inst✝¹ : IsLocallyFiniteMeasure μ
inst✝ : IsUnifLocDoublingMeasure μ
p : ℕ → Prop
s : ℕ → Set α
M : ℝ
hM : 0 < M
r : ℕ → ℝ
hr : Tendsto r atTop (𝓝 0)
q : ℕ → Prop := fun i => p i ∧ 0 < r i
h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p = blimsup (fun i => thickening (r i) (s i)) atTop q
h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p = blimsup (fun i => thickening (M * r i) (s i)) atTop q
⊢ blimsup (fun i => thickening (M * r i) (s i)) atTop p =ᵐ[μ] blimsup (fun i => thickening (r i) (s i)) atTop p

Next tactic:
rw [h₁, h₂]
/-- Given a sequence of subsets `sᵢ` of a metric space, together with a sequence of radii `rᵢ`
such that `rᵢ → 0`, the set of points which belong to infinitely many of the
`rᵢ`-thickenings of `sᵢ` is unchanged almost everywhere for a uniformly locally doubling measure if
the `rᵢ` are all scaled by a positive constant.

This lemma is a generalisation of Lemma 9 appearing on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).

See also `blimsup_cthickening_mul_ae_eq`.

NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_thickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ)
    (hr : Tendsto r atTop (𝓝 0)) :
    (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
      (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
  let q : ℕ → Prop := fun i => p i ∧ 0 < r i
  have h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p =
      blimsup (fun i => thickening (r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace hi : 0 < r i; · contrapose! h; apply thickening_of_nonpos h
    simp only [hi, iff_self_and, imp_true_iff]
  have h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p =
      blimsup (fun i => thickening (M * r i) (s i)) atTop q := by
    refine' blimsup_congr' (eventually_of_forall fun i h => _)
    replace h : 0 < r i; · rw [← zero_lt_mul_left hM]; contrapose! h; apply thickening_of_nonpos h
    simp only [h, iff_self_and, imp_true_iff]
  rw [h₁, h₂]
  

Proof state:
α : Type u_1
inst✝⁵ : MetricSpace α
inst✝⁴ : SecondCountableTopology α
inst✝³ : MeasurableSpace α
inst✝² : BorelSpace α
μ : Measure α
inst✝¹ : IsLocallyFiniteMeasure μ
inst✝ : IsUnifLocDoublingMeasure μ
p : ℕ → Prop
s : ℕ → Set α
M : ℝ
hM : 0 < M
r : ℕ → ℝ
hr : Tendsto r atTop (𝓝 0)
q : ℕ → Prop := fun i => p i ∧ 0 < r i
h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p = blimsup (fun i => thickening (r i) (s i)) atTop q
h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p = blimsup (fun i => thickening (M * r i) (s i)) atTop q
⊢ blimsup (fun i => thickening (M * r i) (s i)) atTop q =ᵐ[μ] blimsup (fun i => thickening (r i) (s i)) atTop q

Next tactic:
exact blimsup_thickening_mul_ae_eq_aux μ q s hM r hr (eventually_of_forall fun i hi => hi.2)
theorem tensor_id (M N : ModuleCat R) : tensorHom (𝟙 M) (𝟙 N) = 𝟙 (ModuleCat.of R (M ⊗ N)) := by
  -- Porting note: even with high priority ext fails to find this
  

Proof state:
R : Type u
inst✝ : CommRing R
M : ModuleCat R
N : ModuleCat R
⊢ tensorHom (𝟙 M) (𝟙 N) = 𝟙 (of R (↑M ⊗[R] ↑N))

Next tactic:
apply TensorProduct.ext
theorem tensor_id (M N : ModuleCat R) : tensorHom (𝟙 M) (𝟙 N) = 𝟙 (ModuleCat.of R (M ⊗ N)) := by
  -- Porting note: even with high priority ext fails to find this
  apply TensorProduct.ext
  

Proof state:
case H
R : Type u
inst✝ : CommRing R
M : ModuleCat R
N : ModuleCat R
⊢ LinearMap.compr₂ (TensorProduct.mk R ↑M ↑N) (tensorHom (𝟙 M) (𝟙 N)) =
    LinearMap.compr₂ (TensorProduct.mk R ↑M ↑N) (𝟙 (of R (↑M ⊗[R] ↑N)))

Next tactic:
rfl
theorem tensor_comp {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁)
    (g₂ : Y₂ ⟶ Z₂) : tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂ := by
  -- Porting note: even with high priority ext fails to find this
  

Proof state:
R : Type u
inst✝ : CommRing R
X₁ Y₁ Z₁ : ModuleCat R
X₂ Y₂ Z₂ : ModuleCat R
f₁ : X₁ ⟶ Y₁
f₂ : X₂ ⟶ Y₂
g₁ : Y₁ ⟶ Z₁
g₂ : Y₂ ⟶ Z₂
⊢ tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂

Next tactic:
apply TensorProduct.ext
theorem tensor_comp {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁)
    (g₂ : Y₂ ⟶ Z₂) : tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂ := by
  -- Porting note: even with high priority ext fails to find this
  apply TensorProduct.ext
  

Proof state:
case H
R : Type u
inst✝ : CommRing R
X₁ Y₁ Z₁ : ModuleCat R
X₂ Y₂ Z₂ : ModuleCat R
f₁ : X₁ ⟶ Y₁
f₂ : X₂ ⟶ Y₂
g₁ : Y₁ ⟶ Z₁
g₂ : Y₂ ⟶ Z₂
⊢ LinearMap.compr₂ (TensorProduct.mk R ↑X₁ ↑X₂) (tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂)) =
    LinearMap.compr₂ (TensorProduct.mk R ↑X₁ ↑X₂) (tensorHom f₁ f₂ ≫ tensorHom g₁ g₂)

Next tactic:
rfl
private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂]
    [AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*}
    [AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂]
    [Module R Y₃] (f₁ : X₁ →ₗ[R] Y₁) (f₂ : X₂ →ₗ[R] Y₂) (f₃ : X₃ →ₗ[R] Y₃) :
    ↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃) := by
  

Proof state:
R : Type u
inst✝¹² : CommRing R
X₁ : Type u_1
X₂ : Type u_2
X₃ : Type u_3
inst✝¹¹ : AddCommMonoid X₁
inst✝¹⁰ : AddCommMonoid X₂
inst✝⁹ : AddCommMonoid X₃
inst✝⁸ : Module R X₁
inst✝⁷ : Module R X₂
inst✝⁶ : Module R X₃
Y₁ : Type u_4
Y₂ : Type u_5
Y₃ : Type u_6
inst✝⁵ : AddCommMonoid Y₁
inst✝⁴ : AddCommMonoid Y₂
inst✝³ : AddCommMonoid Y₃
inst✝² : Module R Y₁
inst✝¹ : Module R Y₂
inst✝ : Module R Y₃
f₁ : X₁ →ₗ[R] Y₁
f₂ : X₂ →ₗ[R] Y₂
f₃ : X₃ →ₗ[R] Y₃
⊢ ↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃)

Next tactic:
apply TensorProduct.ext_threefold
private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂]
    [AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*}
    [AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂]
    [Module R Y₃] (f₁ : X₁ →ₗ[R] Y₁) (f₂ : X₂ →ₗ[R] Y₂) (f₃ : X₃ →ₗ[R] Y₃) :
    ↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃) := by
  apply TensorProduct.ext_threefold
  

Proof state:
case H
R : Type u
inst✝¹² : CommRing R
X₁ : Type u_1
X₂ : Type u_2
X₃ : Type u_3
inst✝¹¹ : AddCommMonoid X₁
inst✝¹⁰ : AddCommMonoid X₂
inst✝⁹ : AddCommMonoid X₃
inst✝⁸ : Module R X₁
inst✝⁷ : Module R X₂
inst✝⁶ : Module R X₃
Y₁ : Type u_4
Y₂ : Type u_5
Y₃ : Type u_6
inst✝⁵ : AddCommMonoid Y₁
inst✝⁴ : AddCommMonoid Y₂
inst✝³ : AddCommMonoid Y₃
inst✝² : Module R Y₁
inst✝¹ : Module R Y₂
inst✝ : Module R Y₃
f₁ : X₁ →ₗ[R] Y₁
f₂ : X₂ →ₗ[R] Y₂
f₃ : X₃ →ₗ[R] Y₃
⊢ ∀ (x : X₁) (y : X₂) (z : X₃),
    (↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃) ((x ⊗ₜ[R] y) ⊗ₜ[R] z) =
      (map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃)) ((x ⊗ₜ[R] y) ⊗ₜ[R] z)

Next tactic:
intro x y z
private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂]
    [AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*}
    [AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂]
    [Module R Y₃] (f₁ : X₁ →ₗ[R] Y₁) (f₂ : X₂ →ₗ[R] Y₂) (f₃ : X₃ →ₗ[R] Y₃) :
    ↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃) := by
  apply TensorProduct.ext_threefold
  intro x y z
  

Proof state:
case H
R : Type u
inst✝¹² : CommRing R
X₁ : Type u_1
X₂ : Type u_2
X₃ : Type u_3
inst✝¹¹ : AddCommMonoid X₁
inst✝¹⁰ : AddCommMonoid X₂
inst✝⁹ : AddCommMonoid X₃
inst✝⁸ : Module R X₁
inst✝⁷ : Module R X₂
inst✝⁶ : Module R X₃
Y₁ : Type u_4
Y₂ : Type u_5
Y₃ : Type u_6
inst✝⁵ : AddCommMonoid Y₁
inst✝⁴ : AddCommMonoid Y₂
inst✝³ : AddCommMonoid Y₃
inst✝² : Module R Y₁
inst✝¹ : Module R Y₂
inst✝ : Module R Y₃
f₁ : X₁ →ₗ[R] Y₁
f₂ : X₂ →ₗ[R] Y₂
f₃ : X₃ →ₗ[R] Y₃
x : X₁
y : X₂
z : X₃
⊢ (↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃) ((x ⊗ₜ[R] y) ⊗ₜ[R] z) =
    (map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃)) ((x ⊗ₜ[R] y) ⊗ₜ[R] z)

Next tactic:
rfl
private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid X]
    [AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] :
    ((map (1 : W →ₗ[R] W) (assoc R X Y Z).toLinearMap).comp
            (assoc R W (X ⊗[R] Y) Z).toLinearMap).comp
        (map ↑(assoc R W X Y) (1 : Z →ₗ[R] Z)) =
      (assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by
  

Proof state:
R : Type u
inst✝⁸ : CommRing R
W : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁷ : AddCommMonoid W
inst✝⁶ : AddCommMonoid X
inst✝⁵ : AddCommMonoid Y
inst✝⁴ : AddCommMonoid Z
inst✝³ : Module R W
inst✝² : Module R X
inst✝¹ : Module R Y
inst✝ : Module R Z
⊢ (map 1 ↑(assoc R X Y Z) ∘ₗ ↑(assoc R W (X ⊗[R] Y) Z)) ∘ₗ map (↑(assoc R W X Y)) 1 =
    ↑(assoc R W X (Y ⊗[R] Z)) ∘ₗ ↑(assoc R (W ⊗[R] X) Y Z)

Next tactic:
apply TensorProduct.ext_fourfold
private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid X]
    [AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] :
    ((map (1 : W →ₗ[R] W) (assoc R X Y Z).toLinearMap).comp
            (assoc R W (X ⊗[R] Y) Z).toLinearMap).comp
        (map ↑(assoc R W X Y) (1 : Z →ₗ[R] Z)) =
      (assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by
  apply TensorProduct.ext_fourfold
  

Proof state:
case H
R : Type u
inst✝⁸ : CommRing R
W : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁷ : AddCommMonoid W
inst✝⁶ : AddCommMonoid X
inst✝⁵ : AddCommMonoid Y
inst✝⁴ : AddCommMonoid Z
inst✝³ : Module R W
inst✝² : Module R X
inst✝¹ : Module R Y
inst✝ : Module R Z
⊢ ∀ (w : W) (x : X) (y : Y) (z : Z),
    ((map 1 ↑(assoc R X Y Z) ∘ₗ ↑(assoc R W (X ⊗[R] Y) Z)) ∘ₗ map (↑(assoc R W X Y)) 1)
        (((w ⊗ₜ[R] x) ⊗ₜ[R] y) ⊗ₜ[R] z) =
      (↑(assoc R W X (Y ⊗[R] Z)) ∘ₗ ↑(assoc R (W ⊗[R] X) Y Z)) (((w ⊗ₜ[R] x) ⊗ₜ[R] y) ⊗ₜ[R] z)

Next tactic:
intro w x y z
private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid X]
    [AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] :
    ((map (1 : W →ₗ[R] W) (assoc R X Y Z).toLinearMap).comp
            (assoc R W (X ⊗[R] Y) Z).toLinearMap).comp
        (map ↑(assoc R W X Y) (1 : Z →ₗ[R] Z)) =
      (assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by
  apply TensorProduct.ext_fourfold
  intro w x y z
  

Proof state:
case H
R : Type u
inst✝⁸ : CommRing R
W : Type u_1
X : Type u_2
Y : Type u_3
Z : Type u_4
inst✝⁷ : AddCommMonoid W
inst✝⁶ : AddCommMonoid X
inst✝⁵ : AddCommMonoid Y
inst✝⁴ : AddCommMonoid Z
inst✝³ : Module R W
inst✝² : Module R X
inst✝¹ : Module R Y
inst✝ : Module R Z
w : W
x : X
y : Y
z : Z
⊢ ((map 1 ↑(assoc R X Y Z) ∘ₗ ↑(assoc R W (X ⊗[R] Y) Z)) ∘ₗ map (↑(assoc R W X Y)) 1) (((w ⊗ₜ[R] x) ⊗ₜ[R] y) ⊗ₜ[R] z) =
    (↑(assoc R W X (Y ⊗[R] Z)) ∘ₗ ↑(assoc R (W ⊗[R] X) Y Z)) (((w ⊗ₜ[R] x) ⊗ₜ[R] y) ⊗ₜ[R] z)

Next tactic:
rfl
theorem associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂)
    (f₃ : X₃ ⟶ Y₃) :
    tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom =
      (associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃) := by
  

Proof state:
R : Type u
inst✝ : CommRing R
X₁ : ModuleCat R
X₂ : ModuleCat R
X₃ : ModuleCat R
Y₁ : ModuleCat R
Y₂ : ModuleCat R
Y₃ : ModuleCat R
f₁ : X₁ ⟶ Y₁
f₂ : X₂ ⟶ Y₂
f₃ : X₃ ⟶ Y₃
⊢ tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom =
    (associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃)

Next tactic:
convert associator_naturality_aux f₁ f₂ f₃ using 1
theorem pentagon (W X Y Z : ModuleCat R) :
    tensorHom (associator W X Y).hom (𝟙 Z) ≫
        (associator W (tensorObj X Y) Z).hom ≫ tensorHom (𝟙 W) (associator X Y Z).hom =
      (associator (tensorObj W X) Y Z).hom ≫ (associator W X (tensorObj Y Z)).hom := by
  

Proof state:
R : Type u
inst✝ : CommRing R
W : ModuleCat R
X : ModuleCat R
Y : ModuleCat R
Z : ModuleCat R
⊢ tensorHom (associator W X Y).hom (𝟙 Z) ≫
      (associator W (tensorObj X Y) Z).hom ≫ tensorHom (𝟙 W) (associator X Y Z).hom =
    (associator (tensorObj W X) Y Z).hom ≫ (associator W X (tensorObj Y Z)).hom

Next tactic:
convert pentagon_aux R W X Y Z using 1
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  

Proof state:
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ tensorHom (𝟙 (of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f

Next tactic:
apply TensorProduct.ext
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  

Proof state:
case H
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) (tensorHom (𝟙 (of R R)) f ≫ (leftUnitor N).hom) =
    LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) ((leftUnitor M).hom ≫ f)

Next tactic:
apply LinearMap.ext_ring
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  

Proof state:
case H.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ (LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) (tensorHom (𝟙 (of R R)) f ≫ (leftUnitor N).hom)) 1 =
    (LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) ((leftUnitor M).hom ≫ f)) 1

Next tactic:
apply LinearMap.ext
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  apply LinearMap.ext; 

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ ∀ (x : ↑M),
    ((LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) (tensorHom (𝟙 (of R R)) f ≫ (leftUnitor N).hom)) 1) x =
      ((LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) ((leftUnitor M).hom ≫ f)) 1) x

Next tactic:
intro x
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  apply LinearMap.ext; intro x
  -- Porting note: used to be dsimp
  

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ ((LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) (tensorHom (𝟙 (of R R)) f ≫ (leftUnitor N).hom)) 1) x =
    ((LinearMap.compr₂ (TensorProduct.mk R ↑(of R R) ↑M) ((leftUnitor M).hom ≫ f)) 1) x

Next tactic:
change ((leftUnitor N).hom) ((tensorHom (𝟙 (of R R)) f) ((1 : R) ⊗ₜ[R] x)) =
    f (((leftUnitor M).hom) (1 ⊗ₜ[R] x))
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  apply LinearMap.ext; intro x
  -- Porting note: used to be dsimp
  change ((leftUnitor N).hom) ((tensorHom (𝟙 (of R R)) f) ((1 : R) ⊗ₜ[R] x)) =
    f (((leftUnitor M).hom) (1 ⊗ₜ[R] x))
  

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ (leftUnitor N).hom ((tensorHom (𝟙 (of R R)) f) (1 ⊗ₜ[R] x)) = f ((leftUnitor M).hom (1 ⊗ₜ[R] x))

Next tactic:
erw [TensorProduct.lid_tmul, TensorProduct.lid_tmul]
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  apply LinearMap.ext; intro x
  -- Porting note: used to be dsimp
  change ((leftUnitor N).hom) ((tensorHom (𝟙 (of R R)) f) ((1 : R) ⊗ₜ[R] x)) =
    f (((leftUnitor M).hom) (1 ⊗ₜ[R] x))
  erw [TensorProduct.lid_tmul, TensorProduct.lid_tmul]
  

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ (𝟙 (of R R)) (1, x).1 • f (1, x).2 = f (1 • x)

Next tactic:
rw [LinearMap.map_smul]
theorem leftUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom (𝟙 (ModuleCat.of R R)) f ≫ (leftUnitor N).hom = (leftUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext_ring
  apply LinearMap.ext; intro x
  -- Porting note: used to be dsimp
  change ((leftUnitor N).hom) ((tensorHom (𝟙 (of R R)) f) ((1 : R) ⊗ₜ[R] x)) =
    f (((leftUnitor M).hom) (1 ⊗ₜ[R] x))
  erw [TensorProduct.lid_tmul, TensorProduct.lid_tmul]
  rw [LinearMap.map_smul]
  

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ (𝟙 (of R R)) (1, x).1 • f (1, x).2 = 1 • f x

Next tactic:
rfl
theorem rightUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom f (𝟙 (ModuleCat.of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  

Proof state:
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ tensorHom f (𝟙 (of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f

Next tactic:
apply TensorProduct.ext
theorem rightUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom f (𝟙 (ModuleCat.of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  

Proof state:
case H
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) (tensorHom f (𝟙 (of R R)) ≫ (rightUnitor N).hom) =
    LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) ((rightUnitor M).hom ≫ f)

Next tactic:
apply LinearMap.ext
theorem rightUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom f (𝟙 (ModuleCat.of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext; 

Proof state:
case H.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
⊢ ∀ (x : ↑M),
    (LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) (tensorHom f (𝟙 (of R R)) ≫ (rightUnitor N).hom)) x =
      (LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) ((rightUnitor M).hom ≫ f)) x

Next tactic:
intro x
theorem rightUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom f (𝟙 (ModuleCat.of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext; intro x
  

Proof state:
case H.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ (LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) (tensorHom f (𝟙 (of R R)) ≫ (rightUnitor N).hom)) x =
    (LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) ((rightUnitor M).hom ≫ f)) x

Next tactic:
apply LinearMap.ext_ring
theorem rightUnitor_naturality {M N : ModuleCat R} (f : M ⟶ N) :
    tensorHom f (𝟙 (ModuleCat.of R R)) ≫ (rightUnitor N).hom = (rightUnitor M).hom ≫ f := by
  -- Porting note: broken ext
  apply TensorProduct.ext
  apply LinearMap.ext; intro x
  apply LinearMap.ext_ring
  -- Porting note: used to be dsimp
  

Proof state:
case H.h.h
R : Type u
inst✝ : CommRing R
M N : ModuleCat R
f : M ⟶ N
x : ↑M
⊢ ((LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) (tensorHom f (𝟙 (of R R)) ≫ (rightUnitor N).hom)) x) 1 =
    ((LinearMap.compr₂ (TensorProduct.mk R ↑M ↑(of R R)) ((rightUnitor M).hom ≫ f)) x) 1

Next tactic:
change ((rightUnitor N).hom) ((tensorHom f (𝟙 (of R R))) (x ⊗ₜ[R] (1 : R))) =
    f (((rightUnitor M).hom) (x ⊗ₜ[R] 1))