instance : Algebra R (v.adicCompletionIntegers K) where
  smul r x :=
    ⟨r • (x : v.adicCompletion K), by
      have h :
        (algebraMap R (adicCompletion K v)) r = (algebraMap R K r : adicCompletion K v) := rfl
      rw [Algebra.smul_def]
      refine' ValuationSubring.mul_mem _ _ _ _ x.2
      --Porting note: added instance
      letI : Valued K ℤₘ₀ := adicValued v
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [mem_adicCompletionIntegers, h, Valued.valuedCompletion_apply]
      exact v.valuation_le_one _⟩
  toFun r :=
    ⟨(algebraMap R K r : adicCompletion K v), by
      -- Porting note: added instance
      letI : Valued K ℤₘ₀ := adicValued v
      --Porting note: rest of proof was `simpa only
      --   [mem_adicCompletionIntegers, Valued.valuedCompletion_apply] using
      --   v.valuation_le_one _
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [mem_adicCompletionIntegers, Valued.valuedCompletion_apply]
      exact v.valuation_le_one _⟩
  map_one' := by simp only [map_one]; rfl
  map_mul' x y := by
    ext
    --Porting note: added instance
    letI : Valued K ℤₘ₀ := adicValued v
    simp_rw [RingHom.map_mul, Subring.coe_mul, UniformSpace.Completion.coe_mul]
  map_zero' := by simp only [map_zero]; rfl
  map_add' x y := by
    ext
    --Porting note: added instance
    letI : Valued K ℤₘ₀ := adicValued v
    simp_rw [RingHom.map_add, Subring.coe_add, UniformSpace.Completion.coe_add]
  commutes' r x := by
    -- Porting note: added `dsimp` line
    

Proof state:
R : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
K : Type u_2
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
r : R
x : ↥(adicCompletionIntegers K v)
⊢ {
          toMonoidHom :=
            {
              toOneHom :=
                {
                  toFun := fun r =>
                    { val := ↑K ((algebraMap R K) r),
                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                  map_one' :=
                    (_ :
                      (fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                          1 =
                        1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun
                        {
                          toFun := fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                  1 =
                                1) }
                        (x * y) =
                      OneHom.toFun
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) }
                          x *
                        OneHom.toFun
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) }
                          y) },
          map_zero' :=
            (_ :
              OneHom.toFun
                  (↑{
                      toOneHom :=
                        {
                          toFun := fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                  1 =
                                1) },
                      map_mul' :=
                        (_ :
                          ∀ (x y : R),
                            OneHom.toFun
                                {
                                  toFun := fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                  map_one' :=
                                    (_ :
                                      (fun r =>
                                            { val := ↑K ((algebraMap R K) r),
                                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                          1 =
                                        1) }
                                (x * y) =
                              OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  x *
                                OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  y) })
                  0 =
                0),
          map_add' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) },
                        map_mul' :=
                          (_ :
                            ∀ (x y : R),
                              OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  (x * y) =
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    x *
                                  OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    y) })
                    (x + y) =
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun r =>
                                { val := ↑K ((algebraMap R K) r),
                                  property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                              map_one' :=
                                (_ :
                                  (fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                      1 =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : R),
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      y) })
                      x +
                    OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun r =>
                                { val := ↑K ((algebraMap R K) r),
                                  property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                              map_one' :=
                                (_ :
                                  (fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                      1 =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : R),
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      y) })
                      y) }
        r *
      x =
    x *
      {
          toMonoidHom :=
            {
              toOneHom :=
                {
                  toFun := fun r =>
                    { val := ↑K ((algebraMap R K) r),
                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                  map_one' :=
                    (_ :
                      (fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                          1 =
                        1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun
                        {
                          toFun := fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                  1 =
                                1) }
                        (x * y) =
                      OneHom.toFun
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) }
                          x *
                        OneHom.toFun
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) }
                          y) },
          map_zero' :=
            (_ :
              OneHom.toFun
                  (↑{
                      toOneHom :=
                        {
                          toFun := fun r =>
                            { val := ↑K ((algebraMap R K) r),
                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                  1 =
                                1) },
                      map_mul' :=
                        (_ :
                          ∀ (x y : R),
                            OneHom.toFun
                                {
                                  toFun := fun r =>
                                    { val := ↑K ((algebraMap R K) r),
                                      property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                  map_one' :=
                                    (_ :
                                      (fun r =>
                                            { val := ↑K ((algebraMap R K) r),
                                              property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                          1 =
                                        1) }
                                (x * y) =
                              OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  x *
                                OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  y) })
                  0 =
                0),
          map_add' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          {
                            toFun := fun r =>
                              { val := ↑K ((algebraMap R K) r),
                                property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                            map_one' :=
                              (_ :
                                (fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                    1 =
                                  1) },
                        map_mul' :=
                          (_ :
                            ∀ (x y : R),
                              OneHom.toFun
                                  {
                                    toFun := fun r =>
                                      { val := ↑K ((algebraMap R K) r),
                                        property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                    map_one' :=
                                      (_ :
                                        (fun r =>
                                              { val := ↑K ((algebraMap R K) r),
                                                property :=
                                                  (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                            1 =
                                          1) }
                                  (x * y) =
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    x *
                                  OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    y) })
                    (x + y) =
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun r =>
                                { val := ↑K ((algebraMap R K) r),
                                  property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                              map_one' :=
                                (_ :
                                  (fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                      1 =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : R),
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      y) })
                      x +
                    OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun r =>
                                { val := ↑K ((algebraMap R K) r),
                                  property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                              map_one' :=
                                (_ :
                                  (fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                      1 =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : R),
                                OneHom.toFun
                                    {
                                      toFun := fun r =>
                                        { val := ↑K ((algebraMap R K) r),
                                          property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                      map_one' :=
                                        (_ :
                                          (fun r =>
                                                { val := ↑K ((algebraMap R K) r),
                                                  property :=
                                                    (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                              1 =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun r =>
                                          { val := ↑K ((algebraMap R K) r),
                                            property := (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) },
                                        map_one' :=
                                          (_ :
                                            (fun r =>
                                                  { val := ↑K ((algebraMap R K) r),
                                                    property :=
                                                      (_ : ↑K ((algebraMap R K) r) ∈ adicCompletionIntegers K v) })
                                                1 =
                                              1) }
                                      y) })
                      y) }
        r

Next tactic:
dsimp