/-- If `R` is a ring, then prime ideals in the localization at `M`
correspond to prime ideals in the original ring `R` that are disjoint from `M` -/
def orderIsoOfPrime :
    { p : Ideal S // p.IsPrime } ≃o { p : Ideal R // p.IsPrime ∧ Disjoint (M : Set R) ↑p } where
  toFun p := ⟨Ideal.comap (algebraMap R S) p.1, (isPrime_iff_isPrime_disjoint M S p.1).1 p.2⟩
  invFun p := ⟨Ideal.map (algebraMap R S) p.1, isPrime_of_isPrime_disjoint M S p.1 p.2.1 p.2.2⟩
  left_inv J := Subtype.eq (map_comap M S J)
  right_inv I := Subtype.eq (comap_map_of_isPrime_disjoint M S I.1 I.2.1 I.2.2)
  map_rel_iff' := by
    

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
⊢ ∀ {a b : { p // Ideal.IsPrime p }},
    {
            toFun := fun p =>
              { val := Ideal.comap (algebraMap R S) ↑p,
                property :=
                  (_ :
                    Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧ Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) },
            invFun := fun p =>
              { val := Ideal.map (algebraMap R S) ↑p, property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) },
            left_inv :=
              (_ :
                ∀ (J : { p // Ideal.IsPrime p }),
                  (fun p =>
                        { val := Ideal.map (algebraMap R S) ↑p,
                          property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) })
                      ((fun p =>
                          { val := Ideal.comap (algebraMap R S) ↑p,
                            property :=
                              (_ :
                                Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧
                                  Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) })
                        J) =
                    J),
            right_inv :=
              (_ :
                ∀ (I : { p // Ideal.IsPrime p ∧ Disjoint ↑M ↑p }),
                  (fun p =>
                        { val := Ideal.comap (algebraMap R S) ↑p,
                          property :=
                            (_ :
                              Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧
                                Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) })
                      ((fun p =>
                          { val := Ideal.map (algebraMap R S) ↑p,
                            property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) })
                        I) =
                    I) }
          a ≤
        {
            toFun := fun p =>
              { val := Ideal.comap (algebraMap R S) ↑p,
                property :=
                  (_ :
                    Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧ Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) },
            invFun := fun p =>
              { val := Ideal.map (algebraMap R S) ↑p, property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) },
            left_inv :=
              (_ :
                ∀ (J : { p // Ideal.IsPrime p }),
                  (fun p =>
                        { val := Ideal.map (algebraMap R S) ↑p,
                          property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) })
                      ((fun p =>
                          { val := Ideal.comap (algebraMap R S) ↑p,
                            property :=
                              (_ :
                                Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧
                                  Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) })
                        J) =
                    J),
            right_inv :=
              (_ :
                ∀ (I : { p // Ideal.IsPrime p ∧ Disjoint ↑M ↑p }),
                  (fun p =>
                        { val := Ideal.comap (algebraMap R S) ↑p,
                          property :=
                            (_ :
                              Ideal.IsPrime (Ideal.comap (algebraMap R S) ↑p) ∧
                                Disjoint ↑M ↑(Ideal.comap (algebraMap R S) ↑p)) })
                      ((fun p =>
                          { val := Ideal.map (algebraMap R S) ↑p,
                            property := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) ↑p)) })
                        I) =
                    I) }
          b ↔
      a ≤ b

Next tactic:
rintro I I'