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⟩
        

Proof state:
case mp.refine'_4.a.mp.intro.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
x : P
y : R
hy :
  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) }
eq_y : (Algebra.linearMap R P) y = x
⊢ x ∈ J

Next tactic:
rwa [← eq_y]