1.9. Inversion
instance : Inv ℚ[i] :=
⟨fun z => conj z * ((normSq z)⁻¹ : ℚ)⟩
theorem inv_def (z : ℚ[i])
: z⁻¹ = conj z * ((normSq z)⁻¹ : ℚ) :=
rfl
@[simp]
theorem inv_re (z : ℚ[i])
: z⁻¹.re = z.re / normSq z := z:ℚ[i]⊢ z⁻¹.re = z.re / normSq z
All goals completed! 🐙
@[simp]
theorem inv_im (z : ℚ[i])
: z⁻¹.im = -z.im / normSq z := z:ℚ[i]⊢ z⁻¹.im = -z.im / normSq z
All goals completed! 🐙
@[simp, norm_cast]
theorem ofRational_inv (r : ℚ)
: ((r⁻¹ : ℚ) : ℚ[i]) = (r : ℚ[i])⁻¹ := r:ℚ⊢ ↑r⁻¹ = (↑r)⁻¹
r:ℚ⊢ (↑r⁻¹).re = (↑r)⁻¹.re ∧ (↑r⁻¹).im = (↑r)⁻¹.im
All goals completed! 🐙
protected theorem complexQ.inv_zero
: (0⁻¹ : ℚ[i]) = 0 := ⊢ 0⁻¹ = 0
⊢ (↑0)⁻¹ = ↑0
⊢ ↑0⁻¹ = ↑0
All goals completed! 🐙
protected theorem complexQ.mul_inv_cancel
{z : ℚ[i]} (h : z ≠ 0)
: z * z⁻¹ = 1 := z:ℚ[i]h:z ≠ 0⊢ z * z⁻¹ = 1
z:ℚ[i]h:z ≠ 0⊢ z * ((starRingEnd ℚ[i]) z * ↑(normSq z)⁻¹) = 1
z:ℚ[i]h:z ≠ 0⊢ z * (starRingEnd ℚ[i]) z * ↑(normSq z)⁻¹ = 1
z:ℚ[i]h:z ≠ 0⊢ ↑(normSq z) * ↑(normSq z)⁻¹ = 1
z:ℚ[i]h:z ≠ 0⊢ ↑(normSq z * (normSq z)⁻¹) = 1
z:ℚ[i]h:z ≠ 0⊢ normSq z * (normSq z)⁻¹ = 1
All goals completed! 🐙
-- an instance of monoid with inverse and division
-- After ths point we can use the division operator
instance instDivInvMonoid : DivInvMonoid ℚ[i] where
#eval (2-I)/(1-I)
-- relation between division and
-- the real part and imaginary part
lemma div_re (z w : ℚ[i])
: (z / w).re =
z.re * w.re / normSq w + z.im * w.im / normSq w := z:ℚ[i]w:ℚ[i]⊢ (z / w).re = z.re * w.re / normSq w + z.im * w.im / normSq w
All goals completed! 🐙
lemma div_im (z w : ℚ[i])
: (z / w).im =
z.im * w.re / normSq w - z.re * w.im / normSq w := z:ℚ[i]w:ℚ[i]⊢ (z / w).im = z.im * w.re / normSq w - z.re * w.im / normSq w
All goals completed! 🐙