l3lab/ntp-mathlib huggingface dataset:
theorem HasFDerivWithinAt.mul_const (hc : HasFDerivWithinAt c c' s x) (d : 𝔸') :
    HasFDerivWithinAt (fun y => c y * d) (d • c') s x := by
  

Proof state:
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivWithinAt c c' s x
d : 𝔸'
⊢ HasFDerivWithinAt (fun y => c y * d) (d • c') s x

Next tactic:
convert hc.mul_const' d
theorem HasFDerivWithinAt.mul_const (hc : HasFDerivWithinAt c c' s x) (d : 𝔸') :
    HasFDerivWithinAt (fun y => c y * d) (d • c') s x := by
  convert hc.mul_const' d
  

Proof state:
case h.e'_10
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivWithinAt c c' s x
d : 𝔸'
⊢ d • c' = smulRight c' d

Next tactic:
ext z
theorem HasFDerivWithinAt.mul_const (hc : HasFDerivWithinAt c c' s x) (d : 𝔸') :
    HasFDerivWithinAt (fun y => c y * d) (d • c') s x := by
  convert hc.mul_const' d
  ext z
  

Proof state:
case h.e'_10.h
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivWithinAt c c' s x
d : 𝔸'
z : E
⊢ (d • c') z = (smulRight c' d) z

Next tactic:
apply mul_comm
theorem HasFDerivAt.mul_const (hc : HasFDerivAt c c' x) (d : 𝔸') :
    HasFDerivAt (fun y => c y * d) (d • c') x := by
  

Proof state:
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivAt c c' x
d : 𝔸'
⊢ HasFDerivAt (fun y => c y * d) (d • c') x

Next tactic:
convert hc.mul_const' d
theorem HasFDerivAt.mul_const (hc : HasFDerivAt c c' x) (d : 𝔸') :
    HasFDerivAt (fun y => c y * d) (d • c') x := by
  convert hc.mul_const' d
  

Proof state:
case h.e'_10
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivAt c c' x
d : 𝔸'
⊢ d • c' = smulRight c' d

Next tactic:
ext z
theorem HasFDerivAt.mul_const (hc : HasFDerivAt c c' x) (d : 𝔸') :
    HasFDerivAt (fun y => c y * d) (d • c') x := by
  convert hc.mul_const' d
  ext z
  

Proof state:
case h.e'_10.h
𝕜 : Type u_1
inst✝¹² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹¹ : NormedAddCommGroup E
inst✝¹⁰ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁷ : NormedAddCommGroup G
inst✝⁶ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁵ : NormedAddCommGroup G'
inst✝⁴ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x : E
s t : Set E
L L₁ L₂ : Filter E
𝔸 : Type u_6
𝔸' : Type u_7
inst✝³ : NormedRing 𝔸
inst✝² : NormedCommRing 𝔸'
inst✝¹ : NormedAlgebra 𝕜 𝔸
inst✝ : NormedAlgebra 𝕜 𝔸'
a b : E → 𝔸
a' b' : E →L[𝕜] 𝔸
c d✝ : E → 𝔸'
c' d' : E →L[𝕜] 𝔸'
hc : HasFDerivAt c c' x
d : 𝔸'
z : E
⊢ (d • c') z = (smulRight c' d) z

Next tactic:
apply mul_comm
/-- At an invertible element `x` of a normed algebra `R`, the Fréchet derivative of the inversion
operation is the linear map `fun t ↦ - x⁻¹ * t * x⁻¹`.

TODO: prove that `Ring.inverse` is analytic and use it to prove a `HasStrictFDerivAt` lemma.
TODO (low prio): prove a version without assumption `[CompleteSpace R]` but within the set of
units. -/
theorem hasFDerivAt_ring_inverse (x : Rˣ) :
    HasFDerivAt Ring.inverse (-mulLeftRight 𝕜 R ↑x⁻¹ ↑x⁻¹) x :=
  have : (fun t : R => Ring.inverse (↑x + t) - ↑x⁻¹ + ↑x⁻¹ * t * ↑x⁻¹) =o[𝓝 0] id :=
    (inverse_add_norm_diff_second_order x).trans_isLittleO (isLittleO_norm_pow_id one_lt_two)
  by 

Proof state:
𝕜 : Type u_1
inst✝¹¹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹⁰ : NormedAddCommGroup E
inst✝⁹ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s t : Set E
L L₁ L₂ : Filter E
R : Type u_6
inst✝² : NormedRing R
inst✝¹ : NormedAlgebra 𝕜 R
inst✝ : CompleteSpace R
x : Rˣ
this : (fun t => Ring.inverse (↑x + t) - ↑x⁻¹ + ↑x⁻¹ * t * ↑x⁻¹) =o[𝓝 0] _root_.id
⊢ HasFDerivAt Ring.inverse (-((mulLeftRight 𝕜 R) ↑x⁻¹) ↑x⁻¹) ↑x

Next tactic:
simpa [hasFDerivAt_iff_isLittleO_nhds_zero] using this
/-- At an invertible element `x` of a normed division algebra `R`, the Fréchet derivative of the
inversion operation is the linear map `λ t, - x⁻¹ * t * x⁻¹`. -/
theorem hasFDerivAt_inv' {x : R} (hx : x ≠ 0) : HasFDerivAt Inv.inv (-mulLeftRight 𝕜 R x⁻¹ x⁻¹) x :=
  by 

Proof state:
𝕜 : Type u_1
inst✝¹¹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹⁰ : NormedAddCommGroup E
inst✝⁹ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s t : Set E
L L₁ L₂ : Filter E
R : Type u_6
inst✝² : NormedDivisionRing R
inst✝¹ : NormedAlgebra 𝕜 R
inst✝ : CompleteSpace R
x : R
hx : x ≠ 0
⊢ HasFDerivAt Inv.inv (-((mulLeftRight 𝕜 R) x⁻¹) x⁻¹) x

Next tactic:
simpa using hasFDerivAt_ring_inverse (Units.mk0 _ hx)
/-- Non-commutative version of `fderivWithin_inv` -/
theorem fderivWithin_inv' {s : Set R} {x : R} (hx : x ≠ 0) (hxs : UniqueDiffWithinAt 𝕜 s x) :
    fderivWithin 𝕜 (fun x => x⁻¹) s x = -mulLeftRight 𝕜 R x⁻¹ x⁻¹ := by
  

Proof state:
𝕜 : Type u_1
inst✝¹¹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹⁰ : NormedAddCommGroup E
inst✝⁹ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s✝ t : Set E
L L₁ L₂ : Filter E
R : Type u_6
inst✝² : NormedDivisionRing R
inst✝¹ : NormedAlgebra 𝕜 R
inst✝ : CompleteSpace R
s : Set R
x : R
hx : x ≠ 0
hxs : UniqueDiffWithinAt 𝕜 s x
⊢ fderivWithin 𝕜 (fun x => x⁻¹) s x = -((mulLeftRight 𝕜 R) x⁻¹) x⁻¹

Next tactic:
rw [DifferentiableAt.fderivWithin (differentiableAt_inv' hx) hxs]
/-- Non-commutative version of `fderivWithin_inv` -/
theorem fderivWithin_inv' {s : Set R} {x : R} (hx : x ≠ 0) (hxs : UniqueDiffWithinAt 𝕜 s x) :
    fderivWithin 𝕜 (fun x => x⁻¹) s x = -mulLeftRight 𝕜 R x⁻¹ x⁻¹ := by
  rw [DifferentiableAt.fderivWithin (differentiableAt_inv' hx) hxs]
  

Proof state:
𝕜 : Type u_1
inst✝¹¹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹⁰ : NormedAddCommGroup E
inst✝⁹ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace 𝕜 F
G : Type u_4
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedSpace 𝕜 G
G' : Type u_5
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace 𝕜 G'
f f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s✝ t : Set E
L L₁ L₂ : Filter E
R : Type u_6
inst✝² : NormedDivisionRing R
inst✝¹ : NormedAlgebra 𝕜 R
inst✝ : CompleteSpace R
s : Set R
x : R
hx : x ≠ 0
hxs : UniqueDiffWithinAt 𝕜 s x
⊢ fderiv 𝕜 Inv.inv x = -((mulLeftRight 𝕜 R) x⁻¹) x⁻¹

Next tactic:
exact fderiv_inv' hx
theorem Module.injective_object_of_injective_module [Module.Injective.{u, v} R Q] :
    CategoryTheory.Injective.{max u v} (⟨Q⟩ : ModuleCat.{max u v} R) :=
  { factors := fun g f mn => by
      

Proof state:
R : Type u
inst✝³ : Ring R
Q : TypeMax
inst✝² : AddCommGroup Q
inst✝¹ : Module R Q
inst✝ : Injective R Q
X✝ Y✝ : ModuleCat R
g : X✝ ⟶ ModuleCat.mk Q
f : X✝ ⟶ Y✝
mn : CategoryTheory.Mono f
⊢ ∃ h, CategoryTheory.CategoryStruct.comp f h = g

Next tactic:
rcases Module.Injective.out _ _ f ((ModuleCat.mono_iff_injective f).mp mn) g with ⟨h, eq1⟩
theorem Module.injective_object_of_injective_module [Module.Injective.{u, v} R Q] :
    CategoryTheory.Injective.{max u v} (⟨Q⟩ : ModuleCat.{max u v} R) :=
  { factors := fun g f mn => by
      rcases Module.Injective.out _ _ f ((ModuleCat.mono_iff_injective f).mp mn) g with ⟨h, eq1⟩
      

Proof state:
case intro
R : Type u
inst✝³ : Ring R
Q : TypeMax
inst✝² : AddCommGroup Q
inst✝¹ : Module R Q
inst✝ : Injective R Q
X✝ Y✝ : ModuleCat R
g : X✝ ⟶ ModuleCat.mk Q
f : X✝ ⟶ Y✝
mn : CategoryTheory.Mono f
h : ↑Y✝ →ₗ[R] ↑(ModuleCat.mk Q)
eq1 : ∀ (x : ↑X✝), h (f x) = g x
⊢ ∃ h, CategoryTheory.CategoryStruct.comp f h = g

Next tactic:
exact ⟨h, LinearMap.ext eq1⟩
theorem Module.injective_module_of_injective_object
    [CategoryTheory.Injective.{max u v} (⟨Q⟩ : ModuleCat.{max u v} R)] :
    Module.Injective.{u, v} R Q :=
  { out := fun X Y ins1 ins2 ins3 ins4 f hf g => by
      

Proof state:
R : Type u
inst✝³ : Ring R
Q : TypeMax
inst✝² : AddCommGroup Q
inst✝¹ : Module R Q
inst✝ : CategoryTheory.Injective (ModuleCat.mk Q)
X Y : TypeMax
ins1 : AddCommGroup X
ins2 : AddCommGroup Y
ins3 : Module R X
ins4 : Module R Y
f : X →ₗ[R] Y
hf : Function.Injective ⇑f
g : X →ₗ[R] Q
⊢ ∃ h, ∀ (x : X), h (f x) = g x

Next tactic:
skip
theorem Module.injective_module_of_injective_object
    [CategoryTheory.Injective.{max u v} (⟨Q⟩ : ModuleCat.{max u v} R)] :
    Module.Injective.{u, v} R Q :=
  { out := fun X Y ins1 ins2 ins3 ins4 f hf g => by
      skip
      

Proof state:
R : Type u
inst✝³ : Ring R
Q : TypeMax
inst✝² : AddCommGroup Q
inst✝¹ : Module R Q
inst✝ : CategoryTheory.Injective (ModuleCat.mk Q)
X Y : TypeMax
ins1 : AddCommGroup X
ins2 : AddCommGroup Y
ins3 : Module R X
ins4 : Module R Y
f : X →ₗ[R] Y
hf : Function.Injective ⇑f
g : X →ₗ[R] Q
⊢ ∃ h, ∀ (x : X), h (f x) = g x

Next tactic:
rcases@CategoryTheory.Injective.factors (ModuleCat R) _ ⟨Q⟩ _ ⟨X⟩ ⟨Y⟩ g f
          ((ModuleCat.mono_iff_injective _).mpr hf) with
        ⟨h, rfl⟩
theorem Module.injective_module_of_injective_object
    [CategoryTheory.Injective.{max u v} (⟨Q⟩ : ModuleCat.{max u v} R)] :
    Module.Injective.{u, v} R Q :=
  { out := fun X Y ins1 ins2 ins3 ins4 f hf g => by
      skip
      rcases@CategoryTheory.Injective.factors (ModuleCat R) _ ⟨Q⟩ _ ⟨X⟩ ⟨Y⟩ g f
          ((ModuleCat.mono_iff_injective _).mpr hf) with
        ⟨h, rfl⟩
      

Proof state:
case intro
R : Type u
inst✝³ : Ring R
Q : TypeMax
inst✝² : AddCommGroup Q
inst✝¹ : Module R Q
inst✝ : CategoryTheory.Injective (ModuleCat.mk Q)
X Y : TypeMax
ins1 : AddCommGroup X
ins2 : AddCommGroup Y
ins3 : Module R X
ins4 : Module R Y
f : X →ₗ[R] Y
hf : Function.Injective ⇑f
h : ModuleCat.mk Y ⟶ ModuleCat.mk Q
⊢ ∃ h_1, ∀ (x : X), h_1 (f x) = (CategoryTheory.CategoryStruct.comp f h) x

Next tactic:
exact ⟨h, fun x => rfl⟩
@[ext]
theorem ExtensionOf.ext {a b : ExtensionOf i f} (domain_eq : a.domain = b.domain)
    (to_fun_eq :
      ∀ ⦃x : a.domain⦄ ⦃y : b.domain⦄, (x : N) = y → a.toLinearPMap x = b.toLinearPMap y) :
    a = b := by
  

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
a b : ExtensionOf i f
domain_eq : a.domain = b.domain
to_fun_eq : ∀ ⦃x : ↥a.domain⦄ ⦃y : ↥b.domain⦄, ↑x = ↑y → ↑a.toLinearPMap x = ↑b.toLinearPMap y
⊢ a = b

Next tactic:
rcases a with ⟨a, a_le, e1⟩
@[ext]
theorem ExtensionOf.ext {a b : ExtensionOf i f} (domain_eq : a.domain = b.domain)
    (to_fun_eq :
      ∀ ⦃x : a.domain⦄ ⦃y : b.domain⦄, (x : N) = y → a.toLinearPMap x = b.toLinearPMap y) :
    a = b := by
  rcases a with ⟨a, a_le, e1⟩
  

Proof state:
case mk
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
b : ExtensionOf i f
a : N →ₗ.[R] Q
a_le : LinearMap.range i ≤ a.domain
e1 : ∀ (m : M), f m = ↑a { val := i m, property := (_ : i m ∈ a.domain) }
domain_eq : { toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain = b.domain
to_fun_eq :
  ∀ ⦃x : ↥{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain⦄ ⦃y : ↥b.domain⦄,
    ↑x = ↑y → ↑{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap x = ↑b.toLinearPMap y
⊢ { toLinearPMap := a, le := a_le, is_extension := e1 } = b

Next tactic:
rcases b with ⟨b, b_le, e2⟩
@[ext]
theorem ExtensionOf.ext {a b : ExtensionOf i f} (domain_eq : a.domain = b.domain)
    (to_fun_eq :
      ∀ ⦃x : a.domain⦄ ⦃y : b.domain⦄, (x : N) = y → a.toLinearPMap x = b.toLinearPMap y) :
    a = b := by
  rcases a with ⟨a, a_le, e1⟩
  rcases b with ⟨b, b_le, e2⟩
  

Proof state:
case mk.mk
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
a : N →ₗ.[R] Q
a_le : LinearMap.range i ≤ a.domain
e1 : ∀ (m : M), f m = ↑a { val := i m, property := (_ : i m ∈ a.domain) }
b : N →ₗ.[R] Q
b_le : LinearMap.range i ≤ b.domain
e2 : ∀ (m : M), f m = ↑b { val := i m, property := (_ : i m ∈ b.domain) }
domain_eq :
  { toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain =
    { toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap.domain
to_fun_eq :
  ∀ ⦃x : ↥{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain⦄
    ⦃y : ↥{ toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap.domain⦄,
    ↑x = ↑y →
      ↑{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap x =
        ↑{ toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap y
⊢ { toLinearPMap := a, le := a_le, is_extension := e1 } = { toLinearPMap := b, le := b_le, is_extension := e2 }

Next tactic:
congr
@[ext]
theorem ExtensionOf.ext {a b : ExtensionOf i f} (domain_eq : a.domain = b.domain)
    (to_fun_eq :
      ∀ ⦃x : a.domain⦄ ⦃y : b.domain⦄, (x : N) = y → a.toLinearPMap x = b.toLinearPMap y) :
    a = b := by
  rcases a with ⟨a, a_le, e1⟩
  rcases b with ⟨b, b_le, e2⟩
  congr
  

Proof state:
case mk.mk.e_toLinearPMap
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
a : N →ₗ.[R] Q
a_le : LinearMap.range i ≤ a.domain
e1 : ∀ (m : M), f m = ↑a { val := i m, property := (_ : i m ∈ a.domain) }
b : N →ₗ.[R] Q
b_le : LinearMap.range i ≤ b.domain
e2 : ∀ (m : M), f m = ↑b { val := i m, property := (_ : i m ∈ b.domain) }
domain_eq :
  { toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain =
    { toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap.domain
to_fun_eq :
  ∀ ⦃x : ↥{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap.domain⦄
    ⦃y : ↥{ toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap.domain⦄,
    ↑x = ↑y →
      ↑{ toLinearPMap := a, le := a_le, is_extension := e1 }.toLinearPMap x =
        ↑{ toLinearPMap := b, le := b_le, is_extension := e2 }.toLinearPMap y
⊢ a = b

Next tactic:
exact LinearPMap.ext domain_eq to_fun_eq
instance : Inf (ExtensionOf i f) where
  inf X1 X2 :=
    { X1.toLinearPMap ⊓
        X2.toLinearPMap with
      le := fun x hx =>
        (by
          

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X1 X2 : ExtensionOf i f
src✝ : N →ₗ.[R] Q := X1.toLinearPMap ⊓ X2.toLinearPMap
x : N
hx : x ∈ LinearMap.range i
⊢ x ∈ LinearPMap.eqLocus X1.toLinearPMap X2.toLinearPMap

Next tactic:
rcases hx with ⟨x, rfl⟩
instance : Inf (ExtensionOf i f) where
  inf X1 X2 :=
    { X1.toLinearPMap ⊓
        X2.toLinearPMap with
      le := fun x hx =>
        (by
          rcases hx with ⟨x, rfl⟩
          

Proof state:
case intro
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X1 X2 : ExtensionOf i f
src✝ : N →ₗ.[R] Q := X1.toLinearPMap ⊓ X2.toLinearPMap
x : M
⊢ i x ∈ LinearPMap.eqLocus X1.toLinearPMap X2.toLinearPMap

Next tactic:
refine' ⟨X1.le (Set.mem_range_self _), X2.le (Set.mem_range_self _), _⟩
instance : Inf (ExtensionOf i f) where
  inf X1 X2 :=
    { X1.toLinearPMap ⊓
        X2.toLinearPMap with
      le := fun x hx =>
        (by
          rcases hx with ⟨x, rfl⟩
          refine' ⟨X1.le (Set.mem_range_self _), X2.le (Set.mem_range_self _), _⟩
          

Proof state:
case intro
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X1 X2 : ExtensionOf i f
src✝ : N →ₗ.[R] Q := X1.toLinearPMap ⊓ X2.toLinearPMap
x : M
⊢ ↑X1.toLinearPMap { val := i x, property := (_ : i x ∈ X1.domain) } =
    ↑X2.toLinearPMap { val := i x, property := (_ : i x ∈ X2.domain) }

Next tactic:
rw [← X1.is_extension x, ← X2.is_extension x]
instance : SemilatticeInf (ExtensionOf i f) :=
  Function.Injective.semilatticeInf ExtensionOf.toLinearPMap
    (fun X Y h =>
      ExtensionOf.ext (by 

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X Y : ExtensionOf i f
h : X.toLinearPMap = Y.toLinearPMap
⊢ X.domain = Y.domain

Next tactic:
rw [h]
instance : SemilatticeInf (ExtensionOf i f) :=
  Function.Injective.semilatticeInf ExtensionOf.toLinearPMap
    (fun X Y h =>
      ExtensionOf.ext (by rw [h]) fun x y h' => by
        -- Porting note: induction didn't handle dependent rw like in Lean 3
        

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X Y : ExtensionOf i f
h : X.toLinearPMap = Y.toLinearPMap
x : ↥X.domain
y : ↥Y.domain
h' : ↑x = ↑y
⊢ ↑X.toLinearPMap x = ↑Y.toLinearPMap y

Next tactic:
have : {x y : N} → (h'' : x = y) → (hx : x ∈ X.toLinearPMap.domain) →
          (hy : y ∈ Y.toLinearPMap.domain) → X.toLinearPMap ⟨x,hx⟩ = Y.toLinearPMap ⟨y,hy⟩ := by
            rw [h]
            intro _ _ h _ _
            congr
instance : SemilatticeInf (ExtensionOf i f) :=
  Function.Injective.semilatticeInf ExtensionOf.toLinearPMap
    (fun X Y h =>
      ExtensionOf.ext (by rw [h]) fun x y h' => by
        -- Porting note: induction didn't handle dependent rw like in Lean 3
        have : {x y : N} → (h'' : x = y) → (hx : x ∈ X.toLinearPMap.domain) →
          (hy : y ∈ Y.toLinearPMap.domain) → X.toLinearPMap ⟨x,hx⟩ = Y.toLinearPMap ⟨y,hy⟩ := by
            

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X Y : ExtensionOf i f
h : X.toLinearPMap = Y.toLinearPMap
x : ↥X.domain
y : ↥Y.domain
h' : ↑x = ↑y
⊢ ∀ {x y : N},
    x = y →
      ∀ (hx : x ∈ X.domain) (hy : y ∈ Y.domain),
        ↑X.toLinearPMap { val := x, property := hx } = ↑Y.toLinearPMap { val := y, property := hy }

Next tactic:
rw [h]
instance : SemilatticeInf (ExtensionOf i f) :=
  Function.Injective.semilatticeInf ExtensionOf.toLinearPMap
    (fun X Y h =>
      ExtensionOf.ext (by rw [h]) fun x y h' => by
        -- Porting note: induction didn't handle dependent rw like in Lean 3
        have : {x y : N} → (h'' : x = y) → (hx : x ∈ X.toLinearPMap.domain) →
          (hy : y ∈ Y.toLinearPMap.domain) → X.toLinearPMap ⟨x,hx⟩ = Y.toLinearPMap ⟨y,hy⟩ := by
            rw [h]
            

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X Y : ExtensionOf i f
h : X.toLinearPMap = Y.toLinearPMap
x : ↥X.domain
y : ↥Y.domain
h' : ↑x = ↑y
⊢ ∀ {x y : N},
    x = y →
      ∀ (hx : x ∈ Y.domain) (hy : y ∈ Y.domain),
        ↑Y.toLinearPMap { val := x, property := hx } = ↑Y.toLinearPMap { val := y, property := hy }

Next tactic:
intro _ _ h _ _
instance : SemilatticeInf (ExtensionOf i f) :=
  Function.Injective.semilatticeInf ExtensionOf.toLinearPMap
    (fun X Y h =>
      ExtensionOf.ext (by rw [h]) fun x y h' => by
        -- Porting note: induction didn't handle dependent rw like in Lean 3
        have : {x y : N} → (h'' : x = y) → (hx : x ∈ X.toLinearPMap.domain) →
          (hy : y ∈ Y.toLinearPMap.domain) → X.toLinearPMap ⟨x,hx⟩ = Y.toLinearPMap ⟨y,hy⟩ := by
            rw [h]
            intro _ _ h _ _
            

Proof state:
R : Type u
inst✝⁶ : Ring R
Q : TypeMax
inst✝⁵ : AddCommGroup Q
inst✝⁴ : Module R Q
M N : Type (max u v)
inst✝³ : AddCommGroup M
inst✝² : AddCommGroup N
inst✝¹ : Module R M
inst✝ : Module R N
i : M →ₗ[R] N
f : M →ₗ[R] Q
X Y : ExtensionOf i f
h✝ : X.toLinearPMap = Y.toLinearPMap
x : ↥X.domain
y : ↥Y.domain
h' : ↑x = ↑y
x✝ y✝ : N
h : x✝ = y✝
hx✝ : x✝ ∈ Y.domain
hy✝ : y✝ ∈ Y.domain
⊢ ↑Y.toLinearPMap { val := x✝, property := hx✝ } = ↑Y.toLinearPMap { val := y✝, property := hy✝ }

Next tactic:
congr