MAT3253 Complex Variables

1.3. Coercion🔗

Every rational number can be regarded as a number in ℚ[i] Rational number r is identified with the complex number ⟨r,0⟩

@[coe] def ofRational (r: ) : ℚ[i] := r,0 instance : Coe ℚ[i] := ofRational 1 + (2 : Rat)/3*I#eval sample1 + (3 : ) def sample6 := complexQ.mk 5 0 --The complex number 5+0i is the same as rational number 5 example : sample6 = (5:) := sample6 = 5 All goals completed! 🐙 @[simp, norm_cast] lemma ofRational_re (r: ) : (r:ℚ[i]).re = r := rfl @[simp, norm_cast] lemma ofRational_im (r: ) : (r:ℚ[i]).im = 0 := rfl @[simp, norm_cast] lemma ofRational_inj {r s : } : (r : ℚ[i]) = s r = s := r:s:r = s r = s r:s:r = s r = sr:s:r = s r = s r:s:r = s r = s r:s:h:r = sr = s have h1: (ofRational r).re = (ofRational s).re := r:s:r = s r = s All goals completed! 🐙 r:s:h:r = sh1:r = (↑s).rer = s r:s:h:r = sh1:r = sr = s All goals completed! 🐙 r:s:r = s r = s r:s:h:r = sr = s All goals completed! 🐙 @[simp] lemma ofRational_def (r:) : (complexQ.mk r 0) = (r:ℚ[i]) := r:{ re := r, im := 0 } = r All goals completed! 🐙 @[simp] lemma rational_eq_coe' (r:) : r = (r : ℚ[i]) := r:r = r All goals completed! 🐙 example (r s : ) (h: (r:ℚ[i])=s) : r = s := r:s:h:r = sr = s All goals completed! 🐙 @[simp, norm_cast] lemma ofRational_zero : ((0:) : ℚ[i]) = 0 := rfl @[simp] lemma ofRational_eq_zero {z:} : (z:ℚ[i]) = 0 z=0 := ofRational_inj lemma ofRational_ne_zero {z:} : (z:ℚ[i]) 0 z0 := not_congr ofRational_eq_zero @[simp] lemma ofRational_eq_one {z:} : (z:ℚ[i]) = 1 z=1 := ofRational_inj lemma ofRational_ne_one {z:} : (z:ℚ[i]) 1 z 1 := not_congr ofRational_eq_one @[simp, norm_cast] theorem ofRational_neg (r : ) : ((-r : ) : ℚ[i]) = -r := r:(-r) = -r r:(↑(-r)).re = (-r).re (↑(-r)).im = (-r).im All goals completed! 🐙 lemma ofRational_add (r s : ) : ( (r+s :) : ℚ[i]) = r+s := r:s:(r + s) = r + s r:s:(↑(r + s)).re = (r + s).re (↑(r + s)).im = (r + s).im r:s:(↑(r + s)).re = (r + s).rer:s:(↑(r + s)).im = (r + s).im r:s:(↑(r + s)).re = (r + s).re All goals completed! 🐙 r:s:(↑(r + s)).im = (r + s).im All goals completed! 🐙 @[simp, norm_cast] theorem ofRational_mul (r s : ) : ((r * s : ) : ℚ[i]) = r * s := r:s:(r * s) = r * s r:s:(↑(r * s)).re = (r * s).re (↑(r * s)).im = (r * s).im r:s:(↑(r * s)).re = (r * s).rer:s:(↑(r * s)).im = (r * s).im repeat r:s:0 = r * 0 + 0 * s r:s:0 = r * 0 + 0 * s All goals completed! 🐙 theorem re_ofRational_mul (r : ) (z : ℚ[i]) : (r * z).re = r * z.re := r:z:ℚ[i](r * z).re = r * z.re r:z:ℚ[i]r * z.re - 0 * z.im = r * z.re All goals completed! 🐙 theorem im_ofRational_mul (r : ) (z : ℚ[i]) : (r * z).im = r * z.im := r:z:ℚ[i](r * z).im = r * z.im r:z:ℚ[i]r * z.im + 0 * z.re = r * z.im All goals completed! 🐙 lemma re_mul_ofRational (z : ℚ[i]) (r : ) : (z * r).re = z.re * r := z:ℚ[i]r:(z * r).re = z.re * r z:ℚ[i]r:z.re * r - z.im * 0 = z.re * r; All goals completed! 🐙 lemma im_mul_ofRational (z : ℚ[i]) (r : ) : (z * r).im = z.im * r := z:ℚ[i]r:(z * r).im = z.im * r z:ℚ[i]r:z.re * 0 + z.im * r = z.im * r; All goals completed! 🐙 @[simp] theorem ofRational_mul' (r : ) (z : ℚ[i]) : r * z = r * z.re, r * z.im := ext (re_ofRational_mul _ _) (im_ofRational_mul _ _) theorem mk_eq_add_mul_I (a b : ) : (complexQ.mk a b) = a + b * I := ext_iff.2 <| a:b:{ re := a, im := b }.re = (a + b * I).re { re := a, im := b }.im = (a + b * I).im a:b:a = a + (b * 0 - 0 * 1) b = 0 + (b * 1 + 0 * 0) ; All goals completed! 🐙 @[simp] theorem re_add_im (z : ℚ[i]) : (z.re : ℚ[i]) + z.im * I = z := ext_iff.2 <| z:ℚ[i](z.re + z.im * I).re = z.re (z.re + z.im * I).im = z.im z:ℚ[i]z.re + (z.im * 0 - 0 * 1) = z.re 0 + (z.im * 1 + 0 * 0) = z.im; All goals completed! 🐙 theorem mul_I_re (z : ℚ[i]) : (z * I).re = -z.im := z:ℚ[i](z * I).re = -z.im All goals completed! 🐙 theorem mul_I_im (z : ℚ[i]) : (z * I).im = z.re := z:ℚ[i](z * I).im = z.re All goals completed! 🐙 theorem I_mul_re (z : ℚ[i]) : (I * z).re = -z.im := z:ℚ[i](I * z).re = -z.im All goals completed! 🐙 theorem I_mul_im (z : ℚ[i]) : (I * z).im = z.re := z:ℚ[i](I * z).im = z.re All goals completed! 🐙 -- Prove that 0 ≠ 1 in ℚ[i] instance : Nontrivial ℚ[i] := Nontrivial ℚ[i] 0 1 0 1 All goals completed! 🐙