-- Module: Mathlib.RingTheory.Smooth.StandardSmoothOfFree
Goal:
R_1 : Type u_1
S_1 : Type u_2
inst : CommRing R_1
inst_1 : CommRing S_1
inst_2 : Algebra R_1 S_1
R : Type u_1
S : Type u_2
inst_3 : CommRing R
inst_4 : CommRing S
inst_5 : Algebra R S
inst_6 : FinitePresentation R S
p : Ideal S
inst_7 : p.IsPrime
inst_8 : IsSmoothAt R p
h_1 : Smooth R S
κ : Type u_2
a : κ → S
b : Module.Basis κ (Localization.AtPrime p) Ω[Localization.AtPrime p⁄R]
hb :
  ∀ (i : κ),
    Eq (α := Ω[Localization.AtPrime p⁄R]) ((b : (a : κ) → Ω[Localization.AtPrime p⁄R]) i : Ω[Localization.AtPrime p⁄R])
      (Function.comp (β := Ω[S⁄R]) (⇑(map R R S (Localization.AtPrime p)) : (a : Ω[S⁄R]) → Ω[Localization.AtPrime p⁄R])
          (⇑(D R S) : (a : S) → Ω[S⁄R]) (a i) :
        Ω[Localization.AtPrime p⁄R])
e : (κ →₀ S) →ₗ[S] Ω[S⁄R] := Finsupp.linearCombination S fun (i : κ) ↦ (D R S : (a : S) → Ω[S⁄R]) (a i)
l₁ : (κ →₀ S) →ₗ[S] κ →₀ Localization.AtPrime p :=
  Finsupp.mapRange.linearMap (Algebra.linearMap S (Localization.AtPrime p))
l₂ : Ω[S⁄R] →ₗ[S] Ω[Localization.AtPrime p⁄R] := map R R S (Localization.AtPrime p)
eₚ : LinearMap (R := Localization.AtPrime p) (RingHom.id (Localization.AtPrime p)) (κ →₀ Localization.AtPrime p)
  Ω[Localization.AtPrime p⁄R] :=
  ((IsLocalizedModule.mapExtendScalars p.primeCompl l₁ l₂ (Localization.AtPrime p) :
        ((κ →₀ S) →ₗ[S] Ω[S⁄R]) →ₗ[S]
          LinearMap (R := Localization.AtPrime p) (RingHom.id (Localization.AtPrime p)) (κ →₀ Localization.AtPrime p)
            Ω[Localization.AtPrime p⁄R]) :
      (a : (κ →₀ S) →ₗ[S] Ω[S⁄R]) →
        (κ →₀ Localization.AtPrime p) →ₗ[Localization.AtPrime p] Ω[Localization.AtPrime p⁄R])
    e
this_1 : eₚ = (↑b.repr.symm : (κ →₀ Localization.AtPrime p) →ₗ[Localization.AtPrime p] Ω[Localization.AtPrime p⁄R])
heₚ :
  Function.Bijective (α := κ →₀ Localization.AtPrime p) (β := Ω[Localization.AtPrime p⁄R])
    (⇑eₚ : (a : κ →₀ Localization.AtPrime p) → Ω[Localization.AtPrime p⁄R])
this : Finite κ
g : S
hg : g ∉ p
l₁ₜ : (κ →₀ S) →ₗ[S] κ →₀ Localization.Away g := Finsupp.mapRange.linearMap (Algebra.linearMap S (Localization.Away g))
l₂ₜ : Ω[S⁄R] →ₗ[S] Ω[Localization.Away g⁄R] := map R R S (Localization.Away g)
h :
  Function.Bijective (α := κ →₀ Localization.Away g) (β := Ω[Localization.Away g⁄R])
    (⇑((IsLocalizedModule.map (Submonoid.powers g) l₁ₜ l₂ₜ :
              (a : (κ →₀ S) →ₗ[S] Ω[S⁄R]) → (κ →₀ Localization.Away g) →ₗ[S] Ω[Localization.Away g⁄R])
            e :
          (κ →₀ Localization.Away g) →ₗ[S] Ω[Localization.Away g⁄R]) :
      (a : κ →₀ Localization.Away g) → Ω[Localization.Away g⁄R])
eₜ' : LinearMap (R := Localization.Away g) (RingHom.id (Localization.Away g)) (κ →₀ Localization.Away g)
  Ω[Localization.Away g⁄R] :=
  ((IsLocalizedModule.mapExtendScalars (Submonoid.powers g) l₁ₜ l₂ₜ (Localization.Away g) :
        ((κ →₀ S) →ₗ[S] Ω[S⁄R]) →ₗ[S]
          LinearMap (R := Localization.Away g) (RingHom.id (Localization.Away g)) (κ →₀ Localization.Away g)
            Ω[Localization.Away g⁄R]) :
      (a : (κ →₀ S) →ₗ[S] Ω[S⁄R]) → (κ →₀ Localization.Away g) →ₗ[Localization.Away g] Ω[Localization.Away g⁄R])
    e
refine :
  Subset (α := Set Ω[Localization.Away g⁄R])
    (Set.range (ι := κ)
      (⇑{ repr := LinearEquiv.symm (LinearEquiv.ofBijective eₜ' h) :
            Module.Basis κ (Localization.Away g) Ω[Localization.Away g⁄R] } :
        (a : κ) → Ω[Localization.Away g⁄R]))
    (Set.range (ι := Localization.Away g)
      (⇑(D R (Localization.Away g)) : (a : Localization.Away g) → Ω[Localization.Away g⁄R]))
⊢ ∃ f ∉ p, IsStandardSmooth.{u_1, u_2} R (Localization.Away f)

Tactic:
refine ⟨g, hg, .of_basis_kaehlerDifferential (.ofRepr (LinearEquiv.ofBijective eₜ' h).symm) ?_⟩