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
      · 

Proof state:
case mp.refine'_4.a.mp
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
x : P
⊢ x ∈
      ↑{
          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) } →
    x ∈ J

Next tactic:
rintro ⟨y, hy, eq_y⟩