-- Lean 4 proof step from Mathlib.Algebra.Module.FinitePresentation (hypothesis)
Goal:
R : Type u_3
M : Type u_4
N : Type u_5
inst : CommRing R
inst_1 : AddCommGroup M
inst_2 : Module R M
inst_3 : AddCommGroup N
inst_4 : Module R N
S : Submonoid R
M' : Type u_1
inst_5 : AddCommGroup M'
inst_6 : Module R M'
f : M →ₗ[R] M'
inst_7 : IsLocalizedModule S f
N' : Type u_2
inst_8 : AddCommGroup N'
inst_9 : Module R N'
g : N →ₗ[R] N'
inst_10 : IsLocalizedModule S g
inst_11 : Module.Finite R M
inst_12 : Module.FinitePresentation R N
l : M →ₗ[R] N
hf :
  Function.Bijective.{u_1 + 1, u_2 + 1} (α := M') (β := N')
    (⇑((IsLocalizedModule.map S f g : (a : M →ₗ[R] N) → M' →ₗ[R] N') l : M' →ₗ[R] N') : (a : M') → N')
e : M' ≃ₗ[R] N' := LinearEquiv.ofBijective ((IsLocalizedModule.map S f g : (a : M →ₗ[R] N) → M' →ₗ[R] N') l) hf
l' : N →ₗ[R] M
s₀ : ↥S
H : f ∘ₗ l' = s₀ • (↑e.symm : N' →ₗ[R] M') ∘ₗ g
H₁ : g ∘ₗ l ∘ₗ l' = g ∘ₗ HSMul.hSMul (β := N →ₗ[R] N) s₀ LinearMap.id
s₁ : ↥S
hs₁ : s₁ • l ∘ₗ l' = s₁ • HSMul.hSMul (β := N →ₗ[R] N) s₀ LinearMap.id
H₂ : f ∘ₗ l' ∘ₗ l = f ∘ₗ HSMul.hSMul (β := M →ₗ[R] M) s₀ LinearMap.id
s₂ : ↥S
hs₂ : s₂ • l' ∘ₗ l = s₂ • HSMul.hSMul (β := M →ₗ[R] M) s₀ LinearMap.id
t : R
ht : (↑s₀ : R) * (↑s₁ : R) * (↑s₂ : R) ∣ t
Rₛ : Type u_3 := Localization (Submonoid.powers t)
lₛ : LinearMap (R := Localization (Submonoid.powers t)) (RingHom.id (Localization (Submonoid.powers t)))
  (LocalizedModule (Submonoid.powers t) M) (LocalizedModule (Submonoid.powers t) N) :=
  (LocalizedModule.map (Submonoid.powers t) :
      (a : M →ₗ[R] N) →
        LocalizedModule (Submonoid.powers t) M →ₗ[Localization (Submonoid.powers t)]
          LocalizedModule (Submonoid.powers t) N)
    l
hu :
  IsUnit (M := Rₛ)
    ((algebraMap R Rₛ : (a : R) → Rₛ)
        (↑(Subtype.mk (p := fun (x : R) ↦ Membership.mem (γ := Submonoid R) (Submonoid.powers t) x) t ⋯) : R) :
      Rₛ)
hu₀ : IsUnit (M := Rₛ) ((algebraMap R Rₛ : (a : R) → Rₛ) (↑s₀ : R) : Rₛ)
hu₁ : IsUnit (M := Rₛ) ((algebraMap R Rₛ : (a : R) → Rₛ) (↑s₁ : R) : Rₛ)
hu₂ : IsUnit (M := Rₛ) ((algebraMap R Rₛ : (a : R) → Rₛ) (↑s₂ : R) : Rₛ)
lₛ' : LinearMap (R := Localization (Submonoid.powers t)) (RingHom.id (Localization (Submonoid.powers t)))
  (LocalizedModule (Submonoid.powers t) N) (LocalizedModule (Submonoid.powers t) M) :=
  (LocalizedModule.map (Submonoid.powers t) :
      (a : N →ₗ[R] M) →
        LocalizedModule (Submonoid.powers t) N →ₗ[Localization (Submonoid.powers t)]
          LocalizedModule (Submonoid.powers t) M)
    l'
⊢ Function.Bijective (α := LocalizedModule (Submonoid.powers t) M) (β := LocalizedModule (Submonoid.powers t) N)
    (⇑((LocalizedModule.map (Submonoid.powers t) :
              (a : M →ₗ[R] N) →
                LocalizedModule (Submonoid.powers t) M →ₗ[Localization (Submonoid.powers t)]
                  LocalizedModule (Submonoid.powers t) N)
            l :
          LinearMap (R := Localization (Submonoid.powers t)) (RingHom.id (Localization (Submonoid.powers t)))
            (LocalizedModule (Submonoid.powers t) M) (LocalizedModule (Submonoid.powers t) N)) :
      (a : LocalizedModule (Submonoid.powers t) M) → LocalizedModule (Submonoid.powers t) N)
have H_left : ((↑hu₀.unit⁻¹ : Rₛ) • lₛ') ∘ₗ lₛ = LinearMap.id
Tactic: have H_left : ((hu₀.unit⁻¹).1 • lₛ') ∘ₗ lₛ = LinearMap.id := by
    apply ((Module.End.isUnit_iff _).mp (hu₂.map (algebraMap Rₛ (Module.End Rₛ _)))).1
    apply ((Module.End.isUnit_iff _).mp (hu₀.map (algebraMap Rₛ (Module.End Rₛ _)))).1
    simp only [Module.algebraMap_end_apply, algebraMap_smul, LinearMap.map_smul_of_tower]
    rw [LinearMap.smul_comp, ← smul_assoc s₀.1, Algebra.smul_def s₀.1, IsUnit.mul_val_inv, one_smul]
    apply LinearMap.restrictScalars_injective R
    apply IsLocalizedModule.ext (.powers t) (LocalizedModule.mkLinearMap (.powers t) M)
      (IsLocalizedModule.map_units (LocalizedModule.mkLinearMap (.powers t) M))
    ext x
    have : s₂.1 • l' (l x) = s₂.1 • s₀.1 • x := congr($hs₂ x)
    simp [lₛ, lₛ', LocalizedModule.smul'_mk, this]