l3lab/ntp-mathlib huggingface dataset:
/-- A pair of continuous linear maps such that `f₁ ∘ f₂ = id` generates a continuous
linear equivalence `e` between `M` and `M₂ × f₁.ker` such that `(e x).2 = x` for `x ∈ f₁.ker`,
`(e x).1 = f₁ x`, and `(e (f₂ y)).2 = 0`. The map is given by `e x = (f₁ x, x - f₂ (f₁ x))`. -/
def equivOfRightInverse (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) :
    M ≃L[R] M₂ × ker f₁ :=
  equivOfInverse (f₁.prod (f₁.projKerOfRightInverse f₂ h)) (f₂.coprod (ker f₁).subtypeL)
    (fun x => by 

Proof state:
R : Type u_1
inst✝¹¹ : Ring R
R₂ : Type u_2
inst✝¹⁰ : Ring R₂
M : Type u_3
inst✝⁹ : TopologicalSpace M
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
M₂ : Type u_4
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : AddCommGroup M₂
inst✝⁴ : Module R₂ M₂
σ₁₂ : R →+* R₂
σ₂₁ : R₂ →+* R
inst✝³ : RingHomInvPair σ₁₂ σ₂₁
inst✝² : RingHomInvPair σ₂₁ σ₁₂
inst✝¹ : Module R M₂
inst✝ : TopologicalAddGroup M
f₁ : M →L[R] M₂
f₂ : M₂ →L[R] M
h : Function.RightInverse ⇑f₂ ⇑f₁
x : M
⊢ (ContinuousLinearMap.coprod f₂ (Submodule.subtypeL (LinearMap.ker f₁)))
      ((ContinuousLinearMap.prod f₁ (ContinuousLinearMap.projKerOfRightInverse f₁ f₂ h)) x) =
    x

Next tactic:
simp
/-- A pair of continuous linear maps such that `f₁ ∘ f₂ = id` generates a continuous
linear equivalence `e` between `M` and `M₂ × f₁.ker` such that `(e x).2 = x` for `x ∈ f₁.ker`,
`(e x).1 = f₁ x`, and `(e (f₂ y)).2 = 0`. The map is given by `e x = (f₁ x, x - f₂ (f₁ x))`. -/
def equivOfRightInverse (f₁ : M →L[R] M₂) (f₂ : M₂ →L[R] M) (h : Function.RightInverse f₂ f₁) :
    M ≃L[R] M₂ × ker f₁ :=
  equivOfInverse (f₁.prod (f₁.projKerOfRightInverse f₂ h)) (f₂.coprod (ker f₁).subtypeL)
    (fun x => by simp) fun ⟨x, y⟩ => by
      -- Porting note: `simp` timeouts.
      

Proof state:
R : Type u_1
inst✝¹¹ : Ring R
R₂ : Type u_2
inst✝¹⁰ : Ring R₂
M : Type u_3
inst✝⁹ : TopologicalSpace M
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
M₂ : Type u_4
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : AddCommGroup M₂
inst✝⁴ : Module R₂ M₂
σ₁₂ : R →+* R₂
σ₂₁ : R₂ →+* R
inst✝³ : RingHomInvPair σ₁₂ σ₂₁
inst✝² : RingHomInvPair σ₂₁ σ₁₂
inst✝¹ : Module R M₂
inst✝ : TopologicalAddGroup M
f₁ : M →L[R] M₂
f₂ : M₂ →L[R] M
h : Function.RightInverse ⇑f₂ ⇑f₁
x✝ : M₂ × ↥(LinearMap.ker f₁)
x : M₂
y : ↥(LinearMap.ker f₁)
⊢ (ContinuousLinearMap.prod f₁ (ContinuousLinearMap.projKerOfRightInverse f₁ f₂ h))
      ((ContinuousLinearMap.coprod f₂ (Submodule.subtypeL (LinearMap.ker f₁))) (x, y)) =
    (x, y)

Next tactic:
rw [ContinuousLinearMap.coprod_apply,
        Submodule.subtypeL_apply, _root_.map_add, ContinuousLinearMap.prod_apply, h x,
        ContinuousLinearMap.projKerOfRightInverse_comp_inv,
        ContinuousLinearMap.prod_apply, LinearMap.map_coe_ker,
        ContinuousLinearMap.projKerOfRightInverse_apply_idem, Prod.mk_add_mk, add_zero, zero_add]
/-- By definition, if `f` is invertible then `inverse f = f.symm`. -/
@[simp]
theorem inverse_equiv (e : M ≃L[R] M₂) : inverse (e : M →L[R] M₂) = e.symm := by
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁶ : TopologicalSpace M
inst✝⁵ : TopologicalSpace M₂
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M₂
inst✝² : Module R M₂
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
e : M ≃L[R] M₂
⊢ inverse ↑e = ↑(ContinuousLinearEquiv.symm e)

Next tactic:
have h : ∃ e' : M ≃L[R] M₂, (e' : M →L[R] M₂) = ↑e := ⟨e, rfl⟩
/-- By definition, if `f` is invertible then `inverse f = f.symm`. -/
@[simp]
theorem inverse_equiv (e : M ≃L[R] M₂) : inverse (e : M →L[R] M₂) = e.symm := by
  have h : ∃ e' : M ≃L[R] M₂, (e' : M →L[R] M₂) = ↑e := ⟨e, rfl⟩
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁶ : TopologicalSpace M
inst✝⁵ : TopologicalSpace M₂
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M₂
inst✝² : Module R M₂
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
e : M ≃L[R] M₂
h : ∃ e', ↑e' = ↑e
⊢ inverse ↑e = ↑(ContinuousLinearEquiv.symm e)

Next tactic:
simp only [inverse, dif_pos h]
/-- By definition, if `f` is invertible then `inverse f = f.symm`. -/
@[simp]
theorem inverse_equiv (e : M ≃L[R] M₂) : inverse (e : M →L[R] M₂) = e.symm := by
  have h : ∃ e' : M ≃L[R] M₂, (e' : M →L[R] M₂) = ↑e := ⟨e, rfl⟩
  simp only [inverse, dif_pos h]
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁶ : TopologicalSpace M
inst✝⁵ : TopologicalSpace M₂
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M₂
inst✝² : Module R M₂
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
e : M ≃L[R] M₂
h : ∃ e', ↑e' = ↑e
⊢ ↑(ContinuousLinearEquiv.symm (choose h)) = ↑(ContinuousLinearEquiv.symm e)

Next tactic:
congr
/-- By definition, if `f` is invertible then `inverse f = f.symm`. -/
@[simp]
theorem inverse_equiv (e : M ≃L[R] M₂) : inverse (e : M →L[R] M₂) = e.symm := by
  have h : ∃ e' : M ≃L[R] M₂, (e' : M →L[R] M₂) = ↑e := ⟨e, rfl⟩
  simp only [inverse, dif_pos h]
  congr
  

Proof state:
case e_e.e_e
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁶ : TopologicalSpace M
inst✝⁵ : TopologicalSpace M₂
inst✝⁴ : Semiring R
inst✝³ : AddCommMonoid M₂
inst✝² : Module R M₂
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
e : M ≃L[R] M₂
h : ∃ e', ↑e' = ↑e
⊢ choose h = e

Next tactic:
exact mod_cast Classical.choose_spec h
@[simp]
theorem ring_inverse_equiv (e : M ≃L[R] M) : Ring.inverse ↑e = inverse (e : M →L[R] M) := by
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M
⊢ Ring.inverse ↑e = inverse ↑e

Next tactic:
suffices Ring.inverse ((ContinuousLinearEquiv.unitsEquiv _ _).symm e : M →L[R] M) = inverse ↑e by
    convert this
@[simp]
theorem ring_inverse_equiv (e : M ≃L[R] M) : Ring.inverse ↑e = inverse (e : M →L[R] M) := by
  suffices Ring.inverse ((ContinuousLinearEquiv.unitsEquiv _ _).symm e : M →L[R] M) = inverse ↑e by
    

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M
this : Ring.inverse ↑((MulEquiv.symm (ContinuousLinearEquiv.unitsEquiv R M)) e) = inverse ↑e
⊢ Ring.inverse ↑e = inverse ↑e

Next tactic:
convert this
@[simp]
theorem ring_inverse_equiv (e : M ≃L[R] M) : Ring.inverse ↑e = inverse (e : M →L[R] M) := by
  suffices Ring.inverse ((ContinuousLinearEquiv.unitsEquiv _ _).symm e : M →L[R] M) = inverse ↑e by
    convert this
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M
⊢ Ring.inverse ↑((MulEquiv.symm (ContinuousLinearEquiv.unitsEquiv R M)) e) = inverse ↑e

Next tactic:
simp
@[simp]
theorem ring_inverse_equiv (e : M ≃L[R] M) : Ring.inverse ↑e = inverse (e : M →L[R] M) := by
  suffices Ring.inverse ((ContinuousLinearEquiv.unitsEquiv _ _).symm e : M →L[R] M) = inverse ↑e by
    convert this
  simp
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M
⊢ ↑((MulEquiv.symm (ContinuousLinearEquiv.unitsEquiv R M)) e)⁻¹ = ↑(ContinuousLinearEquiv.symm e)

Next tactic:
rfl
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
⊢ inverse f = comp (Ring.inverse (comp (↑(ContinuousLinearEquiv.symm e)) f)) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · 

Proof state:
case pos
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
h₁ : ∃ e', ↑e' = f
⊢ inverse f = comp (Ring.inverse (comp (↑(ContinuousLinearEquiv.symm e)) f)) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
obtain ⟨e', he'⟩ := h₁
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    

Proof state:
case pos.intro
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
e' : M ≃L[R] M₂
he' : ↑e' = f
⊢ inverse f = comp (Ring.inverse (comp (↑(ContinuousLinearEquiv.symm e)) f)) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
rw [← he']
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    

Proof state:
case pos.intro
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
e' : M ≃L[R] M₂
he' : ↑e' = f
⊢ inverse ↑e' = comp (Ring.inverse (comp ↑(ContinuousLinearEquiv.symm e) ↑e')) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    

Proof state:
case pos.intro
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
e' : M ≃L[R] M₂
he' : ↑e' = f
⊢ inverse ↑e' =
    comp (Ring.inverse ↑(ContinuousLinearEquiv.trans e' (ContinuousLinearEquiv.symm e))) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
ext
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    

Proof state:
case pos.intro.h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
e' : M ≃L[R] M₂
he' : ↑e' = f
x✝ : M₂
⊢ (inverse ↑e') x✝ =
    (comp (Ring.inverse ↑(ContinuousLinearEquiv.trans e' (ContinuousLinearEquiv.symm e)))
        ↑(ContinuousLinearEquiv.symm e))
      x✝

Next tactic:
simp
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · 

Proof state:
case neg
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
h₁ : ¬∃ e', ↑e' = f
⊢ inverse f = comp (Ring.inverse (comp (↑(ContinuousLinearEquiv.symm e)) f)) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by 

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
h₁ : ¬∃ e', ↑e' = f
this : ¬IsUnit (comp (↑(ContinuousLinearEquiv.symm e)) f)
⊢ inverse f = comp (Ring.inverse (comp (↑(ContinuousLinearEquiv.symm e)) f)) ↑(ContinuousLinearEquiv.symm e)

Next tactic:
simp [this, h₁]
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    

Proof state:
case neg
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
h₁ : ¬∃ e', ↑e' = f
⊢ ¬IsUnit (comp (↑(ContinuousLinearEquiv.symm e)) f)

Next tactic:
contrapose! h₁
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    

Proof state:
case neg
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
h₁ : IsUnit (comp (↑(ContinuousLinearEquiv.symm e)) f)
⊢ ∃ e', ↑e' = f

Next tactic:
rcases h₁ with ⟨F, hF⟩
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    rcases h₁ with ⟨F, hF⟩
    

Proof state:
case neg.intro
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
F : (M →L[R] M)ˣ
hF : ↑F = comp (↑(ContinuousLinearEquiv.symm e)) f
⊢ ∃ e', ↑e' = f

Next tactic:
use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    rcases h₁ with ⟨F, hF⟩
    use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e
    

Proof state:
case h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
F : (M →L[R] M)ˣ
hF : ↑F = comp (↑(ContinuousLinearEquiv.symm e)) f
⊢ ↑(ContinuousLinearEquiv.trans ((ContinuousLinearEquiv.unitsEquiv R M) F) e) = f

Next tactic:
ext
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    rcases h₁ with ⟨F, hF⟩
    use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e
    ext
    

Proof state:
case h.h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
F : (M →L[R] M)ˣ
hF : ↑F = comp (↑(ContinuousLinearEquiv.symm e)) f
x✝ : M
⊢ ↑(ContinuousLinearEquiv.trans ((ContinuousLinearEquiv.unitsEquiv R M) F) e) x✝ = f x✝

Next tactic:
dsimp
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    rcases h₁ with ⟨F, hF⟩
    use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e
    ext
    dsimp
    

Proof state:
case h.h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
F : (M →L[R] M)ˣ
hF : ↑F = comp (↑(ContinuousLinearEquiv.symm e)) f
x✝ : M
⊢ e (↑F x✝) = f x✝

Next tactic:
rw [hF]
/-- The function `ContinuousLinearEquiv.inverse` can be written in terms of `Ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse (e : M ≃L[R] M₂) (f : M →L[R] M₂) :
    inverse f = Ring.inverse ((e.symm : M₂ →L[R] M).comp f) ∘L e.symm := by
  by_cases h₁ : ∃ e' : M ≃L[R] M₂, e' = f
  · obtain ⟨e', he'⟩ := h₁
    rw [← he']
    change _ = Ring.inverse (e'.trans e.symm : M →L[R] M) ∘L (e.symm : M₂ →L[R] M)
    ext
    simp
  · suffices ¬IsUnit ((e.symm : M₂ →L[R] M).comp f) by simp [this, h₁]
    contrapose! h₁
    rcases h₁ with ⟨F, hF⟩
    use (ContinuousLinearEquiv.unitsEquiv _ _ F).trans e
    ext
    dsimp
    rw [hF]
    

Proof state:
case h.h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
e : M ≃L[R] M₂
f : M →L[R] M₂
F : (M →L[R] M)ˣ
hF : ↑F = comp (↑(ContinuousLinearEquiv.symm e)) f
x✝ : M
⊢ e ((comp (↑(ContinuousLinearEquiv.symm e)) f) x✝) = f x✝

Next tactic:
simp
theorem ring_inverse_eq_map_inverse : Ring.inverse = @inverse R M M _ _ _ _ _ _ _ := by
  

Proof state:
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
⊢ Ring.inverse = inverse

Next tactic:
ext
theorem ring_inverse_eq_map_inverse : Ring.inverse = @inverse R M M _ _ _ _ _ _ _ := by
  ext
  

Proof state:
case h.h
R : Type u_1
M : Type u_2
M₂ : Type u_3
inst✝⁷ : TopologicalSpace M
inst✝⁶ : TopologicalSpace M₂
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : TopologicalAddGroup M
inst✝² : Module R M
inst✝¹ : AddCommGroup M₂
inst✝ : Module R M₂
x✝¹ : M →L[R] M
x✝ : M
⊢ (Ring.inverse x✝¹) x✝ = (inverse x✝¹) x✝

Next tactic:
simp [to_ring_inverse (ContinuousLinearEquiv.refl R M)]
protected theorem ClosedComplemented.isClosed [TopologicalAddGroup M] [T1Space M]
    {p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by
  

Proof state:
R : Type u_1
inst✝⁸ : Ring R
M : Type u_2
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M₂ : Type u_3
inst✝⁴ : TopologicalSpace M₂
inst✝³ : AddCommGroup M₂
inst✝² : Module R M₂
inst✝¹ : TopologicalAddGroup M
inst✝ : T1Space M
p : Submodule R M
h : ClosedComplemented p
⊢ IsClosed ↑p

Next tactic:
rcases h with ⟨f, hf⟩
protected theorem ClosedComplemented.isClosed [TopologicalAddGroup M] [T1Space M]
    {p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by
  rcases h with ⟨f, hf⟩
  

Proof state:
case intro
R : Type u_1
inst✝⁸ : Ring R
M : Type u_2
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M₂ : Type u_3
inst✝⁴ : TopologicalSpace M₂
inst✝³ : AddCommGroup M₂
inst✝² : Module R M₂
inst✝¹ : TopologicalAddGroup M
inst✝ : T1Space M
p : Submodule R M
f : M →L[R] ↥p
hf : ∀ (x : ↥p), f ↑x = x
⊢ IsClosed ↑p

Next tactic:
have : ker (id R M - p.subtypeL.comp f) = p := LinearMap.ker_id_sub_eq_of_proj hf
protected theorem ClosedComplemented.isClosed [TopologicalAddGroup M] [T1Space M]
    {p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by
  rcases h with ⟨f, hf⟩
  have : ker (id R M - p.subtypeL.comp f) = p := LinearMap.ker_id_sub_eq_of_proj hf
  

Proof state:
case intro
R : Type u_1
inst✝⁸ : Ring R
M : Type u_2
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M₂ : Type u_3
inst✝⁴ : TopologicalSpace M₂
inst✝³ : AddCommGroup M₂
inst✝² : Module R M₂
inst✝¹ : TopologicalAddGroup M
inst✝ : T1Space M
p : Submodule R M
f : M →L[R] ↥p
hf : ∀ (x : ↥p), f ↑x = x
this : LinearMap.ker (ContinuousLinearMap.id R M - comp (subtypeL p) f) = p
⊢ IsClosed ↑p

Next tactic:
exact this ▸ isClosed_ker _