theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
    J ≤ (1 : FractionalIdeal S P) ↔ ∃ I : Ideal R, ↑I = J := by
  constructor
  · intro hJ
    refine' ⟨⟨⟨⟨{ x : R | algebraMap R P x ∈ J }, _⟩, _⟩, _⟩, _⟩
    · intro a b ha hb
      rw [mem_setOf, RingHom.map_add]
      exact J.val.add_mem ha hb
    · rw [mem_setOf, RingHom.map_zero]
      exact J.val.zero_mem
    · intro c x hx
      rw [smul_eq_mul, mem_setOf, RingHom.map_mul, ← Algebra.smul_def]
      exact J.val.smul_mem c hx
    · ext x
      constructor
      · rintro ⟨y, hy, eq_y⟩
        rwa [← eq_y]
      · intro hx
        obtain ⟨y, rfl⟩ := (mem_one_iff S).mp (hJ hx)
        

Proof state:
case mp.refine'_4.a.mpr.intro
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
J : FractionalIdeal S P
hJ : J ≤ 1
y : R
hx : (algebraMap R P) y ∈ J
⊢ (algebraMap R P) y ∈
    ↑{
        toAddSubmonoid :=
          {
            toAddSubsemigroup :=
              { carrier := {x | (algebraMap R P) x ∈ J},
                add_mem' :=
                  (_ :
                    ∀ {a b : R},
                      a ∈ {x | (algebraMap R P) x ∈ J} →
                        b ∈ {x | (algebraMap R P) x ∈ J} → a + b ∈ {x | (algebraMap R P) x ∈ J}) },
            zero_mem' :=
              (_ :
                0 ∈
                  { carrier := {x | (algebraMap R P) x ∈ J},
                      add_mem' :=
                        (_ :
                          ∀ {a b : R},
                            a ∈ {x | (algebraMap R P) x ∈ J} →
                              b ∈ {x | (algebraMap R P) x ∈ J} → a + b ∈ {x | (algebraMap R P) x ∈ J}) }.carrier) },
        smul_mem' :=
          (_ :
            ∀ (c : R) {x : R},
              x ∈
                  {
                        toAddSubsemigroup :=
                          { carrier := {x | (algebraMap R P) x ∈ J},
                            add_mem' :=
                              (_ :
                                ∀ {a b : R},
                                  a ∈ {x | (algebraMap R P) x ∈ J} →
                                    b ∈ {x | (algebraMap R P) x ∈ J} → a + b ∈ {x | (algebraMap R P) x ∈ J}) },
                        zero_mem' :=
                          (_ :
                            0 ∈
                              { carrier := {x | (algebraMap R P) x ∈ J},
                                  add_mem' :=
                                    (_ :
                                      ∀ {a b : R},
                                        a ∈ {x | (algebraMap R P) x ∈ J} →
                                          b ∈ {x | (algebraMap R P) x ∈ J} →
                                            a + b ∈
                                              {x | (algebraMap R P) x ∈ J}) }.carrier) }.toAddSubsemigroup.carrier →
                c • x ∈
                  {
                        toAddSubsemigroup :=
                          { carrier := {x | (algebraMap R P) x ∈ J},
                            add_mem' :=
                              (_ :
                                ∀ {a b : R},
                                  a ∈ {x | (algebraMap R P) x ∈ J} →
                                    b ∈ {x | (algebraMap R P) x ∈ J} → a + b ∈ {x | (algebraMap R P) x ∈ J}) },
                        zero_mem' :=
                          (_ :
                            0 ∈
                              { carrier := {x | (algebraMap R P) x ∈ J},
                                  add_mem' :=
                                    (_ :
                                      ∀ {a b : R},
                                        a ∈ {x | (algebraMap R P) x ∈ J} →
                                          b ∈ {x | (algebraMap R P) x ∈ J} →
                                            a + b ∈
                                              {x | (algebraMap R P) x ∈ J}) }.carrier) }.toAddSubsemigroup.carrier) }

Next tactic:
exact mem_setOf.mpr ⟨y, hx, rfl⟩