@@ -122,33 +122,16 @@ instance : ring ℤ√d := by apply_instance
122122instance : distrib ℤ√d := by apply_instance
123123
124124/-- Conjugation in `ℤ√d`. The conjugate of `a + b √d` is `a - b √d`. -/
125- def conj (z : ℤ√d) : ℤ√d := ⟨z.1 , -z.2 ⟩
126- @[simp] lemma conj_re (z : ℤ√d) : (conj z).re = z.re := rfl
127- @[simp] lemma conj_im (z : ℤ√d) : (conj z).im = -z.im := rfl
125+ instance : has_star ℤ√d :=
126+ { star := λ z, ⟨z.1 , -z.2 ⟩ }
127+ @[simp] lemma star_mk (x y : ℤ) : star (⟨x, y⟩ : ℤ√d) = ⟨x, -y⟩ := rfl
128+ @[simp] lemma star_re (z : ℤ√d) : (star z).re = z.re := rfl
129+ @[simp] lemma star_im (z : ℤ√d) : (star z).im = -z.im := rfl
128130
129- /-- `conj` as an `add_monoid_hom`. -/
130- def conj_hom : ℤ√d →+ ℤ√d :=
131- { to_fun := conj,
132- map_add' := λ ⟨a, ai⟩ ⟨b, bi⟩, ext.mpr ⟨rfl, neg_add _ _⟩,
133- map_zero' := ext.mpr ⟨rfl, neg_zero⟩ }
134-
135- @[simp] lemma conj_zero : conj (0 : ℤ√d) = 0 :=
136- conj_hom.map_zero
137-
138- @[simp] lemma conj_one : conj (1 : ℤ√d) = 1 :=
139- by simp only [zsqrtd.ext, zsqrtd.conj_re, zsqrtd.conj_im, zsqrtd.one_im, neg_zero, eq_self_iff_true,
140- and_self]
141-
142- @[simp] lemma conj_neg (x : ℤ√d) : (-x).conj = -x.conj := rfl
143-
144- @[simp] lemma conj_add (x y : ℤ√d) : (x + y).conj = x.conj + y.conj :=
145- conj_hom.map_add x y
146-
147- @[simp] lemma conj_sub (x y : ℤ√d) : (x - y).conj = x.conj - y.conj :=
148- conj_hom.map_sub x y
149-
150- @[simp] lemma conj_conj {d : ℤ} (x : ℤ√d) : x.conj.conj = x :=
151- by simp only [ext, true_and, conj_re, eq_self_iff_true, neg_neg, conj_im]
131+ instance : star_ring ℤ√d :=
132+ { star_involutive := λ x, ext.mpr ⟨rfl, neg_neg _⟩,
133+ star_mul := λ a b, ext.mpr ⟨by simp; ring, by simp; ring⟩,
134+ star_add := λ a b, ext.mpr ⟨rfl, neg_add _ _⟩ }
152135
153136instance : nontrivial ℤ√d :=
154137⟨⟨0 , 1 , dec_trivial⟩⟩
@@ -188,12 +171,9 @@ by simp [ext]
188171theorem decompose {x y : ℤ} : (⟨x, y⟩ : ℤ√d) = x + sqrtd * y :=
189172by simp [ext]
190173
191- theorem mul_conj {x y : ℤ} : (⟨x, y⟩ * conj ⟨x, y⟩ : ℤ√d) = x * x - d * y * y :=
174+ theorem mul_star {x y : ℤ} : (⟨x, y⟩ * star ⟨x, y⟩ : ℤ√d) = x * x - d * y * y :=
192175by simp [ext, sub_eq_add_neg, mul_comm]
193176
194- theorem conj_mul {a b : ℤ√d} : conj (a * b) = conj a * conj b :=
195- by { simp [ext], ring }
196-
197177protected lemma coe_int_add (m n : ℤ) : (↑(m + n) : ℤ√d) = ↑m + ↑n :=
198178(int.cast_ring_hom _).map_add _ _
199179protected lemma coe_int_sub (m n : ℤ) : (↑(m - n) : ℤ√d) = ↑m - ↑n :=
@@ -376,15 +356,15 @@ def norm_monoid_hom : ℤ√d →* ℤ :=
376356 map_mul' := norm_mul,
377357 map_one' := norm_one }
378358
379- lemma norm_eq_mul_conj (n : ℤ√d) : (norm n : ℤ√d) = n * n.conj :=
380- by cases n; simp [norm, conj , zsqrtd.ext, mul_comm, sub_eq_add_neg]
359+ lemma norm_eq_mul_conj (n : ℤ√d) : (norm n : ℤ√d) = n * star n :=
360+ by cases n; simp [norm, star , zsqrtd.ext, mul_comm, sub_eq_add_neg]
381361
382362@[simp] lemma norm_neg (x : ℤ√d) : (-x).norm = x.norm :=
383- coe_int_inj $ by simp only [norm_eq_mul_conj, conj_neg , neg_mul,
363+ coe_int_inj $ by simp only [norm_eq_mul_conj, star_neg , neg_mul,
384364 mul_neg, neg_neg]
385365
386- @[simp] lemma norm_conj (x : ℤ√d) : x.conj .norm = x.norm :=
387- coe_int_inj $ by simp only [norm_eq_mul_conj, conj_conj , mul_comm]
366+ @[simp] lemma norm_conj (x : ℤ√d) : (star x) .norm = x.norm :=
367+ coe_int_inj $ by simp only [norm_eq_mul_conj, star_star , mul_comm]
388368
389369lemma norm_nonneg (hd : d ≤ 0 ) (n : ℤ√d) : 0 ≤ n.norm :=
390370add_nonneg (mul_self_nonneg _)
@@ -394,10 +374,10 @@ add_nonneg (mul_self_nonneg _)
394374lemma norm_eq_one_iff {x : ℤ√d} : x.norm.nat_abs = 1 ↔ is_unit x :=
395375⟨λ h, is_unit_iff_dvd_one.2 $
396376 (le_total 0 (norm x)).cases_on
397- (λ hx, show x ∣ 1 , from ⟨x.conj ,
377+ (λ hx, show x ∣ 1 , from ⟨star x ,
398378 by rwa [← int.coe_nat_inj', int.nat_abs_of_nonneg hx,
399379 ← @int.cast_inj (ℤ√d) _ _, norm_eq_mul_conj, eq_comm] at h⟩)
400- (λ hx, show x ∣ 1 , from ⟨- x.conj ,
380+ (λ hx, show x ∣ 1 , from ⟨- star x ,
401381 by rwa [← int.coe_nat_inj', int.of_nat_nat_abs_of_nonpos hx,
402382 ← @int.cast_inj (ℤ√d) _ _, int.cast_neg, norm_eq_mul_conj, neg_mul_eq_mul_neg,
403383 eq_comm] at h⟩),
0 commit comments