Theorem: Zsqrtd.lift_symm_apply_coe
File: Mathlib/NumberTheory/Zsqrtd/Basic.lean

Proof steps:
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
⊢ (↑{ toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯ }).toFun 0 = 0
state_after: no goals
tactic: simp
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
⊢ (↑{ toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯ }).toFun (a + b) =
    (↑{ toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯ }).toFun a +
      (↑{ toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯ }).toFun b
state_after: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
⊢ ↑a.re + ↑b.re + (↑a.im + ↑b.im) * ↑r = ↑a.re + ↑a.im * ↑r + (↑b.re + ↑b.im * ↑r)
tactic: simp only [add_re, Int.cast_add, add_im]
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
⊢ ↑a.re + ↑b.re + (↑a.im + ↑b.im) * ↑r = ↑a.re + ↑a.im * ↑r + (↑b.re + ↑b.im * ↑r)
state_after: no goals
tactic: ring
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
⊢ (fun a => ↑a.re + ↑a.im * ↑r) 1 = 1
state_after: no goals
tactic: simp
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
⊢ { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun (a * b) =
    { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun a *
      { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun b
state_after: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
this :
  (↑a.re + ↑a.im * ↑r) * (↑b.re + ↑b.im * ↑r) =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * (↑r * ↑r)
⊢ { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun (a * b) =
    { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun a *
      { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun b
tactic: have :
          (a.re + a.im * r : R) * (b.re + b.im * r) =
            a.re * b.re + (a.re * b.im + a.im * b.re) * r + a.im * b.im * (r * r) := by
          ring
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
this :
  (↑a.re + ↑a.im * ↑r) * (↑b.re + ↑b.im * ↑r) =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * (↑r * ↑r)
⊢ { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun (a * b) =
    { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun a *
      { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯ }.toFun b
state_after: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
this :
  (↑a.re + ↑a.im * ↑r) * (↑b.re + ↑b.im * ↑r) =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * (↑r * ↑r)
⊢ ↑a.re * ↑b.re + ↑d * ↑a.im * ↑b.im + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * ↑d
tactic: simp only [mul_re, Int.cast_add, Int.cast_mul, mul_im, this, r.prop]
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
a b : ℤ√d
this :
  (↑a.re + ↑a.im * ↑r) * (↑b.re + ↑b.im * ↑r) =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * (↑r * ↑r)
⊢ ↑a.re * ↑b.re + ↑d * ↑a.im * ↑b.im + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r =
    ↑a.re * ↑b.re + (↑a.re * ↑b.im + ↑a.im * ↑b.re) * ↑r + ↑a.im * ↑b.im * ↑d
state_after: no goals
tactic: ring
state_before: R : Type
inst✝ : CommRing R
d : ℤ
f : ℤ√d →+* R
⊢ f sqrtd * f sqrtd = ↑d
state_after: no goals
tactic: rw [← f.map_mul, dmuld, map_intCast]
state_before: R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
⊢ (fun f => ⟨f sqrtd, ⋯⟩)
      ((fun r => { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
        r) =
    r
state_after: case a
R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
⊢ ↑((fun f => ⟨f sqrtd, ⋯⟩)
        ((fun r =>
            { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
          r)) =
    ↑r
tactic: ext
state_before: case a
R : Type
inst✝ : CommRing R
d : ℤ
r : { r // r * r = ↑d }
⊢ ↑((fun f => ⟨f sqrtd, ⋯⟩)
        ((fun r =>
            { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
          r)) =
    ↑r
state_after: no goals
tactic: simp
state_before: R : Type
inst✝ : CommRing R
d : ℤ
f : ℤ√d →+* R
⊢ (fun r => { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
      ((fun f => ⟨f sqrtd, ⋯⟩) f) =
    f
state_after: R : Type
inst✝ : CommRing R
d : ℤ
f : ℤ√d →+* R
⊢ ((fun r => { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
        ((fun f => ⟨f sqrtd, ⋯⟩) f))
      sqrtd =
    f sqrtd
tactic: refine hom_ext _ _ ?_
state_before: R : Type
inst✝ : CommRing R
d : ℤ
f : ℤ√d →+* R
⊢ ((fun r => { toFun := fun a => ↑a.re + ↑a.im * ↑r, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ })
        ((fun f => ⟨f sqrtd, ⋯⟩) f))
      sqrtd =
    f sqrtd
state_after: no goals
tactic: simp