Imports
/-
Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joseph Tooby-Smith
-/
module
public import Mathlib.Analysis.Complex.BasicRational complex numbers
@[expose] public sectionRational complex numbers. This type is mainly used when decidability is needed.
The real part of a RatComplexNum.
The imaginary part of a RatComplexNum.
structure RatComplexNum where fst : ℚ snd : ℚ@[ext]
lemma ext {x y : RatComplexNum} (h1 : x.1 = y.1) (h2 : x.2 = y.2) : x = y := x:RatComplexNumy:RatComplexNumh1:x.fst = y.fsth2:x.snd = y.snd⊢ x = y
y:RatComplexNumfst✝:ℚsnd✝:ℚh1:{ fst := fst✝, snd := snd✝ }.fst = y.fsth2:{ fst := fst✝, snd := snd✝ }.snd = y.snd⊢ { fst := fst✝, snd := snd✝ } = y
fst✝¹:ℚsnd✝¹:ℚfst✝:ℚsnd✝:ℚh1:{ fst := fst✝¹, snd := snd✝¹ }.fst = { fst := fst✝, snd := snd✝ }.fsth2:{ fst := fst✝¹, snd := snd✝¹ }.snd = { fst := fst✝, snd := snd✝ }.snd⊢ { fst := fst✝¹, snd := snd✝¹ } = { fst := fst✝, snd := snd✝ }
fst✝¹:ℚsnd✝¹:ℚfst✝:ℚsnd✝:ℚh1:fst✝¹ = fst✝h2:snd✝¹ = snd✝⊢ { fst := fst✝¹, snd := snd✝¹ } = { fst := fst✝, snd := snd✝ }
fst✝:ℚsnd✝:ℚ⊢ { fst := fst✝, snd := snd✝ } = { fst := fst✝, snd := snd✝ }
All goals completed! 🐙
The equivalence as a type of RatComplexNum with ℚ × ℚ.
def equivToProd : RatComplexNum ≃ ℚ × ℚ where
toFun := fun x => (x.1, x.2)
invFun := fun x => ⟨x.1, x.2⟩
left_inv := ⊢ Function.LeftInverse (fun x => { fst := x.1, snd := x.2 }) fun x => (x.fst, x.snd)
x:RatComplexNum⊢ (fun x => { fst := x.1, snd := x.2 }) ((fun x => (x.fst, x.snd)) x) = x
fst✝:ℚsnd✝:ℚ⊢ (fun x => { fst := x.1, snd := x.2 }) ((fun x => (x.fst, x.snd)) { fst := fst✝, snd := snd✝ }) =
{ fst := fst✝, snd := snd✝ }
All goals completed! 🐙
right_inv := ⊢ Function.RightInverse (fun x => { fst := x.1, snd := x.2 }) fun x => (x.fst, x.snd)
x:ℚ × ℚ⊢ (fun x => (x.fst, x.snd)) ((fun x => { fst := x.1, snd := x.2 }) x) = x
fst✝:ℚsnd✝:ℚ⊢ (fun x => (x.fst, x.snd)) ((fun x => { fst := x.1, snd := x.2 }) (fst✝, snd✝)) = (fst✝, snd✝)
All goals completed! 🐙instance : DecidableEq RatComplexNum := Equiv.decidableEq equivToProdinstance : Add RatComplexNum where
add := fun x y => ⟨x.fst + y.fst, x.snd + y.snd⟩@[simp]
lemma add_fst (x y : RatComplexNum) : (x + y).fst = x.fst + y.fst := rfl@[simp]
lemma add_snd (x y : RatComplexNum) : (x + y).snd = x.snd + y.snd := rflinstance : AddCommGroup RatComplexNum where
add_assoc := ⊢ ∀ (a b c : RatComplexNum), a + b + c = a + (b + c)
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ a + b + c = a + (b + c)
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ (a + b + c).fst = (a + (b + c)).fsta:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ (a + b + c).snd = (a + (b + c)).snd
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ (a + b + c).fst = (a + (b + c)).fst a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ a.fst + b.fst + c.fst = a.fst + (b.fst + c.fst)
All goals completed! 🐙
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ (a + b + c).snd = (a + (b + c)).snd a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ a.snd + b.snd + c.snd = a.snd + (b.snd + c.snd)
All goals completed! 🐙
zero := ⟨0, 0⟩
zero_add := ⊢ ∀ (a : RatComplexNum), 0 + a = a
a:RatComplexNum⊢ 0 + a = a
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ 0 + { fst := a1, snd := a2 } = { fst := a1, snd := a2 }
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 + { fst := a1, snd := a2 }).fst = { fst := a1, snd := a2 }.fsta:RatComplexNuma1:ℚa2:ℚ⊢ (0 + { fst := a1, snd := a2 }).snd = { fst := a1, snd := a2 }.snd
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 + { fst := a1, snd := a2 }).fst = { fst := a1, snd := a2 }.fst a:RatComplexNuma1:ℚa2:ℚ⊢ 0 + a1 = a1
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 + { fst := a1, snd := a2 }).snd = { fst := a1, snd := a2 }.snd a:RatComplexNuma1:ℚa2:ℚ⊢ 0 + a2 = a2
All goals completed! 🐙
add_zero := ⊢ ∀ (a : RatComplexNum), a + 0 = a
a:RatComplexNum⊢ a + 0 = a
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ { fst := a1, snd := a2 } + 0 = { fst := a1, snd := a2 }
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } + 0).fst = { fst := a1, snd := a2 }.fsta:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } + 0).snd = { fst := a1, snd := a2 }.snd
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } + 0).fst = { fst := a1, snd := a2 }.fst a:RatComplexNuma1:ℚa2:ℚ⊢ a1 + 0 = a1
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } + 0).snd = { fst := a1, snd := a2 }.snd a:RatComplexNuma1:ℚa2:ℚ⊢ a2 + 0 = a2
All goals completed! 🐙
neg := fun x => ⟨-x.fst, -x.snd⟩
nsmul := fun n x => ⟨n • x.fst, n • x.snd⟩
zsmul := fun n x => ⟨n • x.1, n • x.2⟩
neg_add_cancel := ⊢ ∀ (a : RatComplexNum), { fst := -a.fst, snd := -a.snd } + a = 0
a:RatComplexNum⊢ { fst := -a.fst, snd := -a.snd } + a = 0
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ { fst := -{ fst := a1, snd := a2 }.fst, snd := -{ fst := a1, snd := a2 }.snd } + { fst := a1, snd := a2 } = 0
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := -{ fst := a1, snd := a2 }.fst, snd := -{ fst := a1, snd := a2 }.snd } + { fst := a1, snd := a2 }).fst = fst 0a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := -{ fst := a1, snd := a2 }.fst, snd := -{ fst := a1, snd := a2 }.snd } + { fst := a1, snd := a2 }).snd = snd 0
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := -{ fst := a1, snd := a2 }.fst, snd := -{ fst := a1, snd := a2 }.snd } + { fst := a1, snd := a2 }).fst = fst 0 a:RatComplexNuma1:ℚa2:ℚ⊢ -a1 + a1 = 0
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := -{ fst := a1, snd := a2 }.fst, snd := -{ fst := a1, snd := a2 }.snd } + { fst := a1, snd := a2 }).snd = snd 0 a:RatComplexNuma1:ℚa2:ℚ⊢ -a2 + a2 = 0
All goals completed! 🐙
add_comm := ⊢ ∀ (a b : RatComplexNum), a + b = b + a
x:RatComplexNumy:RatComplexNum⊢ x + y = y + x
x:RatComplexNumy:RatComplexNum⊢ (x + y).fst = (y + x).fstx:RatComplexNumy:RatComplexNum⊢ (x + y).snd = (y + x).snd
x:RatComplexNumy:RatComplexNum⊢ (x + y).fst = (y + x).fst x:RatComplexNumy:RatComplexNum⊢ x.fst + y.fst = y.fst + x.fst
All goals completed! 🐙
x:RatComplexNumy:RatComplexNum⊢ (x + y).snd = (y + x).snd x:RatComplexNumy:RatComplexNum⊢ x.snd + y.snd = y.snd + x.snd
All goals completed! 🐙
nsmul_zero := ⊢ ∀ (x : RatComplexNum), 0 • x = 0 x:RatComplexNum⊢ 0 • x = 0; x:RatComplexNum⊢ (0 • x).fst = fst 0x:RatComplexNum⊢ (0 • x).snd = snd 0 x:RatComplexNum⊢ (0 • x).fst = fst 0x:RatComplexNum⊢ (0 • x).snd = snd 0 All goals completed! 🐙
nsmul_succ := ⊢ ∀ (n : ℕ) (x : RatComplexNum), (n + 1) • x = n • x + x n:ℕx:RatComplexNum⊢ (n + 1) • x = n • x + x; n:ℕx:RatComplexNum⊢ ((n + 1) • x).fst = (n • x + x).fstn:ℕx:RatComplexNum⊢ ((n + 1) • x).snd = (n • x + x).snd n:ℕx:RatComplexNum⊢ ((n + 1) • x).fst = (n • x + x).fstn:ℕx:RatComplexNum⊢ ((n + 1) • x).snd = (n • x + x).snd All goals completed! 🐙
zsmul_zero' := ⊢ ∀ (a : RatComplexNum), 0 • a = 0 a:RatComplexNum⊢ 0 • a = 0; a:RatComplexNum⊢ (0 • a).fst = fst 0a:RatComplexNum⊢ (0 • a).snd = snd 0 a:RatComplexNum⊢ (0 • a).fst = fst 0a:RatComplexNum⊢ (0 • a).snd = snd 0 All goals completed! 🐙
zsmul_succ' := ⊢ ∀ (n : ℕ) (a : RatComplexNum), ↑n.succ • a = ↑n • a + a
n:ℕa:RatComplexNum⊢ ↑n.succ • a = ↑n • a + a
n:ℕa:RatComplexNum⊢ (↑n.succ • a).fst = (↑n • a + a).fstn:ℕa:RatComplexNum⊢ (↑n.succ • a).snd = (↑n • a + a).snd
n:ℕa:RatComplexNum⊢ (↑n.succ • a).fst = (↑n • a + a).fst n:ℕa:RatComplexNum⊢ (↑n + 1) • a.fst = ↑n • a.fst + a.fst
All goals completed! 🐙
n:ℕa:RatComplexNum⊢ (↑n.succ • a).snd = (↑n • a + a).snd n:ℕa:RatComplexNum⊢ (↑n + 1) • a.snd = ↑n • a.snd + a.snd
All goals completed! 🐙
zsmul_neg' := ⊢ ∀ (n : ℕ) (a : RatComplexNum), Int.negSucc n • a = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd } n:ℕa:RatComplexNum⊢ Int.negSucc n • a = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd }; n:ℕa:RatComplexNum⊢ (Int.negSucc n • a).fst = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd }.fstn:ℕa:RatComplexNum⊢ (Int.negSucc n • a).snd = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd }.snd n:ℕa:RatComplexNum⊢ (Int.negSucc n • a).fst = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd }.fstn:ℕa:RatComplexNum⊢ (Int.negSucc n • a).snd = { fst := -(↑n.succ • a).fst, snd := -(↑n.succ • a).snd }.snd All goals completed! 🐙instance : Mul RatComplexNum where
mul := fun x y => ⟨x.fst * y.fst - x.snd * y.snd, x.fst * y.snd + x.snd * y.fst⟩@[simp]
lemma mul_fst (x y : RatComplexNum) : (x * y).fst = x.fst * y.fst - x.snd * y.snd := rfl@[simp]
lemma mul_snd (x y : RatComplexNum) : (x * y).snd = x.fst * y.snd + x.snd * y.fst := rflinstance : Ring RatComplexNum where
one := ⟨1, 0⟩
mul_assoc := ⊢ ∀ (a b c : RatComplexNum), a * b * c = a * (b * c)
x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ x * y * z = x * (y * z)
x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x * y * z).fst = (x * (y * z)).fstx:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x * y * z).snd = (x * (y * z)).snd
x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x * y * z).fst = (x * (y * z)).fst x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x.fst * y.fst - x.snd * y.snd) * z.fst - (x.fst * y.snd + x.snd * y.fst) * z.snd =
x.fst * (y.fst * z.fst - y.snd * z.snd) - x.snd * (y.fst * z.snd + y.snd * z.fst)
All goals completed! 🐙
x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x * y * z).snd = (x * (y * z)).snd x:RatComplexNumy:RatComplexNumz:RatComplexNum⊢ (x.fst * y.fst - x.snd * y.snd) * z.snd + (x.fst * y.snd + x.snd * y.fst) * z.fst =
x.fst * (y.fst * z.snd + y.snd * z.fst) + x.snd * (y.fst * z.fst - y.snd * z.snd)
All goals completed! 🐙
one_mul := ⊢ ∀ (a : RatComplexNum), 1 * a = a
x:RatComplexNum⊢ 1 * x = x
match x with
x:RatComplexNumx1:ℚx2:ℚ⊢ 1 * { fst := x1, snd := x2 } = { fst := x1, snd := x2 }
x:RatComplexNumx1:ℚx2:ℚ⊢ (1 * { fst := x1, snd := x2 }).fst = { fst := x1, snd := x2 }.fstx:RatComplexNumx1:ℚx2:ℚ⊢ (1 * { fst := x1, snd := x2 }).snd = { fst := x1, snd := x2 }.snd
x:RatComplexNumx1:ℚx2:ℚ⊢ (1 * { fst := x1, snd := x2 }).fst = { fst := x1, snd := x2 }.fst x:RatComplexNumx1:ℚx2:ℚ⊢ 1 * x1 - 0 * x2 = x1
All goals completed! 🐙
x:RatComplexNumx1:ℚx2:ℚ⊢ (1 * { fst := x1, snd := x2 }).snd = { fst := x1, snd := x2 }.snd x:RatComplexNumx1:ℚx2:ℚ⊢ 1 * x2 + 0 * x1 = x2
All goals completed! 🐙
mul_one := ⊢ ∀ (a : RatComplexNum), a * 1 = a
x:RatComplexNum⊢ x * 1 = x
match x with
x:RatComplexNumx1:ℚx2:ℚ⊢ { fst := x1, snd := x2 } * 1 = { fst := x1, snd := x2 }
x:RatComplexNumx1:ℚx2:ℚ⊢ ({ fst := x1, snd := x2 } * 1).fst = { fst := x1, snd := x2 }.fstx:RatComplexNumx1:ℚx2:ℚ⊢ ({ fst := x1, snd := x2 } * 1).snd = { fst := x1, snd := x2 }.snd
x:RatComplexNumx1:ℚx2:ℚ⊢ ({ fst := x1, snd := x2 } * 1).fst = { fst := x1, snd := x2 }.fst x:RatComplexNumx1:ℚx2:ℚ⊢ x1 * 1 - x2 * 0 = x1
All goals completed! 🐙
x:RatComplexNumx1:ℚx2:ℚ⊢ ({ fst := x1, snd := x2 } * 1).snd = { fst := x1, snd := x2 }.snd x:RatComplexNumx1:ℚx2:ℚ⊢ x1 * 0 + x2 * 1 = x2
All goals completed! 🐙
left_distrib := ⊢ ∀ (a b c : RatComplexNum), a * (b + c) = a * b + a * c
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ a * (b + c) = a * b + a * c
match a, b, c with
a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ { fst := a1, snd := a2 } * ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) =
{ fst := a1, snd := a2 } * { fst := b1, snd := b2 } + { fst := a1, snd := a2 } * { fst := c1, snd := c2 }
a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ ({ fst := a1, snd := a2 } * ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 })).fst =
({ fst := a1, snd := a2 } * { fst := b1, snd := b2 } + { fst := a1, snd := a2 } * { fst := c1, snd := c2 }).fsta:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ ({ fst := a1, snd := a2 } * ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 })).snd =
({ fst := a1, snd := a2 } * { fst := b1, snd := b2 } + { fst := a1, snd := a2 } * { fst := c1, snd := c2 }).snd
a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ ({ fst := a1, snd := a2 } * ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 })).fst =
({ fst := a1, snd := a2 } * { fst := b1, snd := b2 } + { fst := a1, snd := a2 } * { fst := c1, snd := c2 }).fst a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ a1 * (b1 + c1) - a2 * (b2 + c2) = a1 * b1 - a2 * b2 + (a1 * c1 - a2 * c2)
All goals completed! 🐙
a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ ({ fst := a1, snd := a2 } * ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 })).snd =
({ fst := a1, snd := a2 } * { fst := b1, snd := b2 } + { fst := a1, snd := a2 } * { fst := c1, snd := c2 }).snd a:RatComplexNumb:RatComplexNumc:RatComplexNuma1:ℚa2:ℚb1:ℚb2:ℚc1:ℚc2:ℚ⊢ a1 * (b2 + c2) + a2 * (b1 + c1) = a1 * b2 + a2 * b1 + (a1 * c2 + a2 * c1)
All goals completed! 🐙
right_distrib := ⊢ ∀ (a b c : RatComplexNum), (a + b) * c = a * c + b * c
a:RatComplexNumb:RatComplexNumc:RatComplexNum⊢ (a + b) * c = a * c + b * c
match a, b, c with
a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ ({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) * { fst := a1, snd := a2 } =
{ fst := b1, snd := b2 } * { fst := a1, snd := a2 } + { fst := c1, snd := c2 } * { fst := a1, snd := a2 }
a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) * { fst := a1, snd := a2 }).fst =
({ fst := b1, snd := b2 } * { fst := a1, snd := a2 } + { fst := c1, snd := c2 } * { fst := a1, snd := a2 }).fsta:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) * { fst := a1, snd := a2 }).snd =
({ fst := b1, snd := b2 } * { fst := a1, snd := a2 } + { fst := c1, snd := c2 } * { fst := a1, snd := a2 }).snd
a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) * { fst := a1, snd := a2 }).fst =
({ fst := b1, snd := b2 } * { fst := a1, snd := a2 } + { fst := c1, snd := c2 } * { fst := a1, snd := a2 }).fst a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (b1 + c1) * a1 - (b2 + c2) * a2 = b1 * a1 - b2 * a2 + (c1 * a1 - c2 * a2)
All goals completed! 🐙
a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (({ fst := b1, snd := b2 } + { fst := c1, snd := c2 }) * { fst := a1, snd := a2 }).snd =
({ fst := b1, snd := b2 } * { fst := a1, snd := a2 } + { fst := c1, snd := c2 } * { fst := a1, snd := a2 }).snd a:RatComplexNumb:RatComplexNumc:RatComplexNumb1:ℚb2:ℚc1:ℚc2:ℚa1:ℚa2:ℚ⊢ (b1 + c1) * a2 + (b2 + c2) * a1 = b1 * a2 + b2 * a1 + (c1 * a2 + c2 * a1)
All goals completed! 🐙
zero_mul := ⊢ ∀ (a : RatComplexNum), 0 * a = 0
a:RatComplexNum⊢ 0 * a = 0
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ 0 * { fst := a1, snd := a2 } = 0
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 * { fst := a1, snd := a2 }).fst = fst 0a:RatComplexNuma1:ℚa2:ℚ⊢ (0 * { fst := a1, snd := a2 }).snd = snd 0
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 * { fst := a1, snd := a2 }).fst = fst 0 a:RatComplexNuma1:ℚa2:ℚ⊢ 0 * a1 - 0 * a2 = 0
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ (0 * { fst := a1, snd := a2 }).snd = snd 0 a:RatComplexNuma1:ℚa2:ℚ⊢ 0 * a2 + 0 * a1 = 0
All goals completed! 🐙
mul_zero := ⊢ ∀ (a : RatComplexNum), a * 0 = 0
a:RatComplexNum⊢ a * 0 = 0
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ { fst := a1, snd := a2 } * 0 = 0
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } * 0).fst = fst 0a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } * 0).snd = snd 0
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } * 0).fst = fst 0 a:RatComplexNuma1:ℚa2:ℚ⊢ a1 * 0 - a2 * 0 = 0
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ ({ fst := a1, snd := a2 } * 0).snd = snd 0 a:RatComplexNuma1:ℚa2:ℚ⊢ a1 * 0 + a2 * 0 = 0
All goals completed! 🐙
neg_add_cancel := ⊢ ∀ (a : RatComplexNum), -a + a = 0
a:RatComplexNum⊢ -a + a = 0
match a with
a:RatComplexNuma1:ℚa2:ℚ⊢ -{ fst := a1, snd := a2 } + { fst := a1, snd := a2 } = 0
a:RatComplexNuma1:ℚa2:ℚ⊢ (-{ fst := a1, snd := a2 } + { fst := a1, snd := a2 }).fst = fst 0a:RatComplexNuma1:ℚa2:ℚ⊢ (-{ fst := a1, snd := a2 } + { fst := a1, snd := a2 }).snd = snd 0
a:RatComplexNuma1:ℚa2:ℚ⊢ (-{ fst := a1, snd := a2 } + { fst := a1, snd := a2 }).fst = fst 0 a:RatComplexNuma1:ℚa2:ℚ⊢ -a1 + a1 = 0
All goals completed! 🐙
a:RatComplexNuma1:ℚa2:ℚ⊢ (-{ fst := a1, snd := a2 } + { fst := a1, snd := a2 }).snd = snd 0 a:RatComplexNuma1:ℚa2:ℚ⊢ -a2 + a2 = 0
All goals completed! 🐙@[simp]
lemma one_fst : (1 : RatComplexNum).fst = 1 := rfl@[simp]
lemma one_snd : (1 : RatComplexNum).snd = 0 := rfl@[simp]
lemma zero_fst : (0 : RatComplexNum).fst = 0 := rfl@[simp]
lemma zero_snd : (0 : RatComplexNum).snd = 0 := rfl@[simp]
lemma I_mul_toComplexNum (a : RatComplexNum) : I * toComplexNum a = toComplexNum (⟨0, 1⟩ * a) := a:RatComplexNum⊢ I * toComplexNum a = toComplexNum ({ fst := 0, snd := 1 } * a)
a:RatComplexNum⊢ I * (↑a.fst + ↑a.snd * I) = -↑a.snd + ↑a.fst * I
a:RatComplexNum⊢ I * ↑a.fst + I ^ 2 * ↑a.snd = I * ↑a.fst - ↑a.snd
a:RatComplexNum⊢ I * ↑a.fst + -↑a.snd = I * ↑a.fst - ↑a.snd
All goals completed! 🐙lemma ofNat_mul_toComplexNum (n : ℕ) (a : RatComplexNum) :
n * toComplexNum a = toComplexNum (n * a) := n:ℕa:RatComplexNum⊢ ↑n * toComplexNum a = toComplexNum (↑n * a)
All goals completed! 🐙a:RatComplexNumb:RatComplexNumha:(↑a.fst + ↑a.snd * I).re = (↑b.fst + ↑b.snd * I).re ∧ (↑a.fst + ↑a.snd * I).im = (↑b.fst + ↑b.snd * I).im⊢ a = b
simp only [add_re, ratCast_re, mul_re, I_re, mul_zero, ratCast_im, I_im, mul_one, sub_self,
add_zero, Rat.cast_inj, add_im, mul_im, zero_add] at ha a:RatComplexNumb:RatComplexNumha:a.fst = b.fst ∧ a.snd = b.snd⊢ a = b
ext h1 a:RatComplexNumb:RatComplexNumha:a.fst = b.fst ∧ a.snd = b.snd⊢ a.fst = b.fsth2 a:RatComplexNumb:RatComplexNumha:a.fst = b.fst ∧ a.snd = b.snd⊢ a.snd = b.snd
· h1 a:RatComplexNumb:RatComplexNumha:a.fst = b.fst ∧ a.snd = b.snd⊢ a.fst = b.fst exact ha.1 All goals completed! 🐙
· h2 a:RatComplexNumb:RatComplexNumha:a.fst = b.fst ∧ a.snd = b.snd⊢ a.snd = b.snd exact ha.2 All goals completed! 🐙