/-- The order isomorphism between the factors of `mk m` and the factors of `mk n` induced by a
  bijection between the factors of `m` and the factors of `n` that preserves `∣`. -/
@[simps]
def mkFactorOrderIsoOfFactorDvdEquiv {m : M} {n : N} {d : { l : M // l ∣ m } ≃ { l : N // l ∣ n }}
    (hd : ∀ l l', (d l : N) ∣ d l' ↔ (l : M) ∣ (l' : M)) :
    Set.Iic (Associates.mk m) ≃o Set.Iic (Associates.mk n)
    where
  toFun l :=
    ⟨Associates.mk
        (d
          ⟨associatesEquivOfUniqueUnits ↑l, by
            obtain ⟨x, hx⟩ := l
            rw [Subtype.coe_mk, associatesEquivOfUniqueUnits_apply, out_dvd_iff]
            exact hx⟩),
      mk_le_mk_iff_dvd_iff.mpr (Subtype.prop (d ⟨associatesEquivOfUniqueUnits ↑l, _⟩))⟩
  invFun l :=
    ⟨Associates.mk
        (d.symm
          ⟨associatesEquivOfUniqueUnits ↑l, by
            obtain ⟨x, hx⟩ := l
            rw [Subtype.coe_mk, associatesEquivOfUniqueUnits_apply, out_dvd_iff]
            exact hx⟩),
      mk_le_mk_iff_dvd_iff.mpr (Subtype.prop (d.symm ⟨associatesEquivOfUniqueUnits ↑l, _⟩))⟩
  left_inv := fun ⟨l, hl⟩ => by
    simp only [Subtype.coe_eta, Equiv.symm_apply_apply, Subtype.coe_mk,
      associatesEquivOfUniqueUnits_apply, mk_out, out_mk, normalize_eq]
  right_inv := fun ⟨l, hl⟩ => by
    simp only [Subtype.coe_eta, Equiv.apply_symm_apply, Subtype.coe_mk,
      associatesEquivOfUniqueUnits_apply, out_mk, normalize_eq, mk_out]
  map_rel_iff' := by
    rintro ⟨a, ha⟩ ⟨b, hb⟩
    

Proof state:
case mk.mk
M : Type u_1
inst✝³ : CancelCommMonoidWithZero M
N : Type u_2
inst✝² : CancelCommMonoidWithZero N
inst✝¹ : Unique Mˣ
inst✝ : Unique Nˣ
m : M
n : N
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(d l) ∣ ↑(d l') ↔ ↑l ∣ ↑l'
a : Associates M
ha : a ∈ Set.Iic (Associates.mk m)
b : Associates M
hb : b ∈ Set.Iic (Associates.mk m)
⊢ {
          toFun := fun l =>
            {
              val :=
                Associates.mk
                  ↑(d
                      { val := associatesEquivOfUniqueUnits ↑l,
                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
              property :=
                (_ :
                  Associates.mk
                      ↑(d
                          { val := associatesEquivOfUniqueUnits ↑l,
                            property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                    Associates.mk n) },
          invFun := fun l =>
            {
              val :=
                Associates.mk
                  ↑(d.symm
                      { val := associatesEquivOfUniqueUnits ↑l,
                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
              property :=
                (_ :
                  Associates.mk
                      ↑(d.symm
                          { val := associatesEquivOfUniqueUnits ↑l,
                            property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                    Associates.mk m) },
          left_inv :=
            (_ :
              ∀ (x : ↑(Set.Iic (Associates.mk m))),
                (fun l =>
                      {
                        val :=
                          Associates.mk
                            ↑(d.symm
                                { val := associatesEquivOfUniqueUnits ↑l,
                                  property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
                        property :=
                          (_ :
                            Associates.mk
                                ↑(d.symm
                                    { val := associatesEquivOfUniqueUnits ↑l,
                                      property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                              Associates.mk m) })
                    ((fun l =>
                        {
                          val :=
                            Associates.mk
                              ↑(d
                                  { val := associatesEquivOfUniqueUnits ↑l,
                                    property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
                          property :=
                            (_ :
                              Associates.mk
                                  ↑(d
                                      { val := associatesEquivOfUniqueUnits ↑l,
                                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                                Associates.mk n) })
                      x) =
                  x),
          right_inv :=
            (_ :
              ∀ (x : ↑(Set.Iic (Associates.mk n))),
                (fun l =>
                      {
                        val :=
                          Associates.mk
                            ↑(d
                                { val := associatesEquivOfUniqueUnits ↑l,
                                  property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
                        property :=
                          (_ :
                            Associates.mk
                                ↑(d
                                    { val := associatesEquivOfUniqueUnits ↑l,
                                      property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                              Associates.mk n) })
                    ((fun l =>
                        {
                          val :=
                            Associates.mk
                              ↑(d.symm
                                  { val := associatesEquivOfUniqueUnits ↑l,
                                    property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
                          property :=
                            (_ :
                              Associates.mk
                                  ↑(d.symm
                                      { val := associatesEquivOfUniqueUnits ↑l,
                                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                                Associates.mk m) })
                      x) =
                  x) }
        { val := a, property := ha } ≤
      {
          toFun := fun l =>
            {
              val :=
                Associates.mk
                  ↑(d
                      { val := associatesEquivOfUniqueUnits ↑l,
                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
              property :=
                (_ :
                  Associates.mk
                      ↑(d
                          { val := associatesEquivOfUniqueUnits ↑l,
                            property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                    Associates.mk n) },
          invFun := fun l =>
            {
              val :=
                Associates.mk
                  ↑(d.symm
                      { val := associatesEquivOfUniqueUnits ↑l,
                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
              property :=
                (_ :
                  Associates.mk
                      ↑(d.symm
                          { val := associatesEquivOfUniqueUnits ↑l,
                            property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                    Associates.mk m) },
          left_inv :=
            (_ :
              ∀ (x : ↑(Set.Iic (Associates.mk m))),
                (fun l =>
                      {
                        val :=
                          Associates.mk
                            ↑(d.symm
                                { val := associatesEquivOfUniqueUnits ↑l,
                                  property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
                        property :=
                          (_ :
                            Associates.mk
                                ↑(d.symm
                                    { val := associatesEquivOfUniqueUnits ↑l,
                                      property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                              Associates.mk m) })
                    ((fun l =>
                        {
                          val :=
                            Associates.mk
                              ↑(d
                                  { val := associatesEquivOfUniqueUnits ↑l,
                                    property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
                          property :=
                            (_ :
                              Associates.mk
                                  ↑(d
                                      { val := associatesEquivOfUniqueUnits ↑l,
                                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                                Associates.mk n) })
                      x) =
                  x),
          right_inv :=
            (_ :
              ∀ (x : ↑(Set.Iic (Associates.mk n))),
                (fun l =>
                      {
                        val :=
                          Associates.mk
                            ↑(d
                                { val := associatesEquivOfUniqueUnits ↑l,
                                  property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }),
                        property :=
                          (_ :
                            Associates.mk
                                ↑(d
                                    { val := associatesEquivOfUniqueUnits ↑l,
                                      property := (_ : associatesEquivOfUniqueUnits ↑l ∣ m) }) ≤
                              Associates.mk n) })
                    ((fun l =>
                        {
                          val :=
                            Associates.mk
                              ↑(d.symm
                                  { val := associatesEquivOfUniqueUnits ↑l,
                                    property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }),
                          property :=
                            (_ :
                              Associates.mk
                                  ↑(d.symm
                                      { val := associatesEquivOfUniqueUnits ↑l,
                                        property := (_ : associatesEquivOfUniqueUnits ↑l ∣ n) }) ≤
                                Associates.mk m) })
                      x) =
                  x) }
        { val := b, property := hb } ↔
    { val := a, property := ha } ≤ { val := b, property := hb }

Next tactic:
simp only [Equiv.coe_fn_mk, Subtype.mk_le_mk, Associates.mk_le_mk_iff_dvd_iff, hd,
        Subtype.coe_mk, associatesEquivOfUniqueUnits_apply, out_dvd_iff, mk_out]