chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
138
leanexplore_declaration
leanexplore:379813
leanexplore_sqlite
leanexplore_declarations
lemma hgcdbc (P : FreyPackage) : gcd P.b P.c = 1 := by rw [← gcdab_eq_gcdac P.hppos, gcd_comm, P.hgcdab] rw [add_comm] exact P.hFLT
3,076
leanexplore_declaration
leanexplore:379814
leanexplore_sqlite
leanexplore_declarations
/-- Given a counterexample a^p+b^p=c^p to Fermat's Last Theorem with p>=5, there exists a Frey package. -/ lemma of_not_FermatLastTheorem_p_ge_5 {a b c : ℤ} (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) {p : ℕ} (pp : p.Prime) (hp5 : 5 ≤ p) (H : a ^ p + b ^ p = c ^ p) : Nonempty FreyPackage := by have p_odd := pp.odd_of_...
384
leanexplore_declaration
leanexplore:379815
leanexplore_sqlite
leanexplore_declarations
/-- If Fermat's Last Theorem is false, then there exists a Frey Package. -/ lemma of_not_FermatLastTheorem (h : ¬ FermatLastTheorem) : Nonempty (FreyPackage) := by contrapose! h refine FermatLastTheorem.of_p_ge_5 fun p hp5 pp a b c ha hb _ h2 ↦ Nonempty.elim ?_ h.false apply FreyPackage.of_not_FermatLastTheor...
647
leanexplore_declaration
leanexplore:379816
leanexplore_sqlite
leanexplore_declarations
/-- The Weierstrass curve over `ℤ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of vari...
645
leanexplore_declaration
leanexplore:379817
leanexplore_sqlite
leanexplore_declarations
/-- The elliptic curve over `ℚ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of variabl...
1,175
leanexplore_declaration
leanexplore:379818
leanexplore_sqlite
leanexplore_declarations
theorem map (P : FreyPackage) : (freyCurveInt P).map (algebraMap ℤ ℚ) = freyCurve P := by have two_dvd_b : 2 ∣ P.b := (ZMod.intCast_zmod_eq_zero_iff_dvd P.b 2).1 P.hb2 ext · rfl · change (((P.b ^ P.p - 1 - P.a ^ P.p) / 4 : ℤ) : ℚ) = (P.b ^ P.p - 1 - P.a ^ P.p) / 4 rw [Rat.intCast_div] · norm_cast · ...
370
leanexplore_declaration
leanexplore:379819
leanexplore_sqlite
leanexplore_declarations
lemma Δ (P : FreyPackage) : P.freyCurve.Δ = (P.a*P.b*P.c)^(2*P.p) / 2 ^ 8 := by trans (P.a ^ P.p) ^ 2 * (P.b ^ P.p) ^ 2 * (P.c ^ P.p) ^ 2 / 2 ^ 8 · field_simp norm_cast simp [← P.hFLT, WeierstrassCurve.Δ, freyCurve, WeierstrassCurve.b₂, WeierstrassCurve.b₄, WeierstrassCurve.b₆, WeierstrassCurve.b₈] ...
258
leanexplore_declaration
leanexplore:379820
leanexplore_sqlite
leanexplore_declarations
instance (P : FreyPackage) : WeierstrassCurve.IsElliptic (freyCurve P) where isUnit := by rw [FreyCurve.Δ, isUnit_iff_ne_zero] apply div_ne_zero · norm_cast exact pow_ne_zero _ <| mul_ne_zero (mul_ne_zero P.ha0 P.hb0) P.hc0 · norm_num
124
leanexplore_declaration
leanexplore:379821
leanexplore_sqlite
leanexplore_declarations
lemma b₂ (P : FreyPackage) : P.freyCurve.b₂ = P.b ^ P.p - P.a ^ P.p := by simp [freyCurve, WeierstrassCurve.b₂] ring
126
leanexplore_declaration
leanexplore:379822
leanexplore_sqlite
leanexplore_declarations
lemma b₄ (P : FreyPackage) : P.freyCurve.b₄ = - (P.a * P.b) ^ P.p / 8 := by simp [freyCurve, WeierstrassCurve.b₄] ring
177
leanexplore_declaration
leanexplore:379823
leanexplore_sqlite
leanexplore_declarations
lemma c₄ (P : FreyPackage) : P.freyCurve.c₄ = (P.a ^ P.p) ^ 2 + P.a ^ P.p * P.b ^ P.p + (P.b ^ P.p) ^ 2 := by simp [FreyCurve.b₂, FreyCurve.b₄, WeierstrassCurve.c₄] ring
152
leanexplore_declaration
leanexplore:379824
leanexplore_sqlite
leanexplore_declarations
lemma c₄' (P : FreyPackage) : P.freyCurve.c₄ = P.c ^ (2 * P.p) - (P.a * P.b) ^ P.p := by rw [FreyCurve.c₄] rw_mod_cast [pow_mul', ← hFLT] ring
120
leanexplore_declaration
leanexplore:379825
leanexplore_sqlite
leanexplore_declarations
lemma Δ'inv (P : FreyPackage) : (↑(P.freyCurve.Δ'⁻¹) : ℚ) = 2 ^ 8 / (P.a*P.b*P.c)^(2*P.p) := by simp [FreyCurve.Δ]
190
leanexplore_declaration
leanexplore:379826
leanexplore_sqlite
leanexplore_declarations
lemma j (P : FreyPackage) : P.freyCurve.j = 2^8*(P.c^(2*P.p)-(P.a*P.b)^P.p) ^ 3 /(P.a*P.b*P.c)^(2*P.p) := by rw [mul_div_right_comm, WeierstrassCurve.j, FreyCurve.Δ'inv, FreyCurve.c₄']
1,969
leanexplore_declaration
leanexplore:379827
leanexplore_sqlite
leanexplore_declarations
/-- The q-adic valuation of the j-invariant of the Frey curve is a multiple of p if 2 < q is a prime of bad reduction. -/ lemma j_valuation_of_bad_prime (P : FreyPackage) {q : ℕ} (hqPrime : q.Prime) (hqbad : (q : ℤ) ∣ P.a * P.b * P.c) (hqodd : 2 < q) : (P.p : ℤ) ∣ padicValRat q P.freyCurve.j := by have := Fac...
257
leanexplore_declaration
leanexplore:379828
leanexplore_sqlite
leanexplore_declarations
/-- A classical decidable instance on `AlgebraicClosure ℚ`, given that there is no hope of a constructive one with the current definition of algebraic closure. -/ noncomputable local instance : DecidableEq (AlgebraicClosure ℚ) := Classical.typeDecidableEq _
150
leanexplore_declaration
leanexplore:379829
leanexplore_sqlite
leanexplore_declarations
theorem Mazur_Frey (P : FreyPackage) : haveI : Fact P.p.Prime := ⟨P.pp⟩ GaloisRep.IsIrreducible (P.freyCurve.galoisRep P.p P.hppos) := sorry
184
leanexplore_declaration
leanexplore:379830
leanexplore_sqlite
leanexplore_declarations
theorem Wiles_Frey (P : FreyPackage) : haveI : Fact P.p.Prime := ⟨P.pp⟩ ¬ GaloisRep.IsIrreducible (P.freyCurve.galoisRep P.p P.hppos) := FreyCurve.torsion_not_isIrreducible P
396
leanexplore_declaration
leanexplore:379831
leanexplore_sqlite
leanexplore_declarations
/-- There is no Frey package. This profound result is proved using work of Mazur and Wiles/Ribet to rule out all possibilities for the $p$-torsion in the corresponding Frey curve. -/ theorem FreyPackage.false (P : FreyPackage) : False := by -- by Wiles' result, the p-torsion is not irreducible apply Wiles_Frey P ...
304
leanexplore_declaration
leanexplore:379832
leanexplore_sqlite
leanexplore_declarations
/-- Fermat's Last Theorem is true -/ theorem Wiles_Taylor_Wiles : FermatLastTheorem := by -- Suppose Fermat's Last Theorem is false by_contra h -- then there exists a Frey package obtain ⟨P : FreyPackage⟩ := FreyPackage.of_not_FermatLastTheorem h -- but there is no Frey package exact P.false
253
leanexplore_declaration
leanexplore:379833
leanexplore_sqlite
leanexplore_declarations
@[ext] structure Hurwitz : Type where re : ℤ -- 1 im_o : ℤ -- ω im_i : ℤ -- i im_oi : ℤ -- ωi -- note iω + ωi + 1 + i = 0 notation "𝓞" => Hurwitz -- 𝓞 = \MCO namespace Hurwitz open Quaternion in noncomputable def toQuaternion (z : 𝓞) : ℍ where
215
leanexplore_declaration
leanexplore:379837
leanexplore_sqlite
leanexplore_declarations
noncomputable def toQuaternion (z : 𝓞) : ℍ where re := z.re - 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi imI := z.im_i + 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi imJ := 2⁻¹ * z.im_o + 2⁻¹ * z.im_oi imK := 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi
196
leanexplore_declaration
leanexplore:379838
leanexplore_sqlite
leanexplore_declarations
noncomputable def fromQuaternion (z : ℍ) : 𝓞 where re := Int.floor <| z.re + z.imJ im_o := Int.floor <| z.imJ + z.imK im_i := Int.floor <| z.imI - z.imK im_oi := Int.floor <| z.imJ - z.imK
390
leanexplore_declaration
leanexplore:379839
leanexplore_sqlite
leanexplore_declarations
lemma leftInverse_fromQuaternion_toQuaternion : Function.LeftInverse fromQuaternion toQuaternion := by intro z simp only [fromQuaternion, toQuaternion, sub_add_add_cancel, sub_add_cancel, Int.floor_intCast, add_add_sub_cancel, ← two_mul, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, mul_inv_cancel_left...
117
leanexplore_declaration
leanexplore:379840
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_injective : Function.Injective toQuaternion := leftInverse_fromQuaternion_toQuaternion.injective
723
leanexplore_declaration
leanexplore:379841
leanexplore_sqlite
leanexplore_declarations
lemma leftInvOn_toQuaternion_fromQuaternion : Set.LeftInvOn toQuaternion fromQuaternion { q : ℍ | ∃ a b c d : ℤ, q = ⟨a, b, c, d⟩ ∨ q = ⟨a + 2⁻¹, b + 2⁻¹, c + 2⁻¹, d + 2⁻¹⟩ } := by have h₀ (x y : ℤ) : (x + 2 ⁻¹ : ℝ) + (y + 2⁻¹) = ↑(x + y + 1) := by field_simp; norm_cast; ring intro q hq simp only [S...
199
leanexplore_declaration
leanexplore:379842
leanexplore_sqlite
leanexplore_declarations
lemma fromQuaternion_injOn : Set.InjOn fromQuaternion { q : ℍ | ∃ a b c d : ℤ, q = ⟨a, b, c, d⟩ ∨ q = ⟨a + 2⁻¹, b + 2⁻¹, c + 2⁻¹, d + 2⁻¹⟩ } := leftInvOn_toQuaternion_fromQuaternion.injOn
56
leanexplore_declaration
leanexplore:379843
leanexplore_sqlite
leanexplore_declarations
/-- The Hurwitz number 0 -/ def zero : 𝓞 := ⟨0, 0, 0, 0⟩
58
leanexplore_declaration
leanexplore:379844
leanexplore_sqlite
leanexplore_declarations
/-- notation `0` for `zero` -/ instance : Zero 𝓞 := ⟨zero⟩
95
leanexplore_declaration
leanexplore:379845
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma zero_re : re (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_o : im_o (0 : 𝓞) = 0 := rfl
99
leanexplore_declaration
leanexplore:379846
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma zero_im_o : im_o (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_i : im_i (0 : 𝓞) = 0 := rfl
101
leanexplore_declaration
leanexplore:379847
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma zero_im_i : im_i (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_oi : im_oi (0 : 𝓞) = 0 := rfl
51
leanexplore_declaration
leanexplore:379848
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma zero_im_oi : im_oi (0 : 𝓞) = 0 := rfl
90
leanexplore_declaration
leanexplore:379849
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_zero : toQuaternion 0 = 0 := by ext <;> (simp [toQuaternion]) <;> rfl
125
leanexplore_declaration
leanexplore:379850
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma toQuaternion_eq_zero_iff {z} : toQuaternion z = 0 ↔ z = 0 := toQuaternion_injective.eq_iff' toQuaternion_zero
117
leanexplore_declaration
leanexplore:379851
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_ne_zero_iff {z} : toQuaternion z ≠ 0 ↔ z ≠ 0 := toQuaternion_injective.ne_iff' toQuaternion_zero
55
leanexplore_declaration
leanexplore:379853
leanexplore_sqlite
leanexplore_declarations
/-- Notation `1` for `one` -/ instance : One 𝓞 := ⟨one⟩
93
leanexplore_declaration
leanexplore:379854
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma one_re : re (1 : 𝓞) = 1 := rfl @[simp] lemma one_im_o : im_o (1 : 𝓞) = 0 := rfl
97
leanexplore_declaration
leanexplore:379855
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma one_im_o : im_o (1 : 𝓞) = 0 := rfl @[simp] lemma one_im_i : im_i (1 : 𝓞) = 0 := rfl
99
leanexplore_declaration
leanexplore:379856
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma one_im_i : im_i (1 : 𝓞) = 0 := rfl @[simp] lemma one_im_oi : im_oi (1 : 𝓞) = 0 := rfl
50
leanexplore_declaration
leanexplore:379857
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma one_im_oi : im_oi (1 : 𝓞) = 0 := rfl
89
leanexplore_declaration
leanexplore:379858
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_one : toQuaternion 1 = 1 := by ext <;> (simp [toQuaternion]) <;> rfl
103
leanexplore_declaration
leanexplore:379859
leanexplore_sqlite
leanexplore_declarations
/-- The negation `-z` of a Hurwitz number -/ def neg (z : 𝓞) : 𝓞 := ⟨-re z, -im_o z, -im_i z, -im_oi z⟩
58
leanexplore_declaration
leanexplore:379860
leanexplore_sqlite
leanexplore_declarations
/-- Notation `-` for negation -/ instance : Neg 𝓞 := ⟨neg⟩
115
leanexplore_declaration
leanexplore:379861
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma neg_re (z : 𝓞) : re (-z) = -re z := rfl @[simp] lemma neg_im_o (z : 𝓞) : im_o (-z) = -im_o z := rfl
121
leanexplore_declaration
leanexplore:379862
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma neg_im_o (z : 𝓞) : im_o (-z) = -im_o z := rfl @[simp] lemma neg_im_i (z : 𝓞) : im_i (-z) = -im_i z := rfl
124
leanexplore_declaration
leanexplore:379863
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma neg_im_i (z : 𝓞) : im_i (-z) = -im_i z := rfl @[simp] lemma neg_im_oi (z : 𝓞) : im_oi (-z) = -im_oi z := rfl
63
leanexplore_declaration
leanexplore:379864
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma neg_im_oi (z : 𝓞) : im_oi (-z) = -im_oi z := rfl
118
leanexplore_declaration
leanexplore:379865
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_neg (z : 𝓞) : toQuaternion (-z) = - toQuaternion z := by ext <;> simp [toQuaternion] <;> ring
132
leanexplore_declaration
leanexplore:379866
leanexplore_sqlite
leanexplore_declarations
/-- addition `z+w` of complex numbers -/ def add (z w : 𝓞) : 𝓞 := ⟨z.re + w.re, z.im_o + w.im_o, z.im_i + w.im_i, z.im_oi + w.im_oi⟩
58
leanexplore_declaration
leanexplore:379867
leanexplore_sqlite
leanexplore_declarations
/-- Notation `+` for addition -/ instance : Add 𝓞 := ⟨add⟩
141
leanexplore_declaration
leanexplore:379868
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma add_re (z w : 𝓞) : re (z + w) = re z + re w := rfl @[simp] lemma add_im_o (z w : 𝓞) : im_o (z + w) = im_o z + im_o w := rfl
149
leanexplore_declaration
leanexplore:379869
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma add_im_o (z w : 𝓞) : im_o (z + w) = im_o z + im_o w := rfl @[simp] lemma add_im_i (z w : 𝓞) : im_i (z + w) = im_i z + im_i w := rfl
153
leanexplore_declaration
leanexplore:379870
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma add_im_i (z w : 𝓞) : im_i (z + w) = im_i z + im_i w := rfl @[simp] lemma add_im_oi (z w : 𝓞) : im_oi (z + w) = im_oi z + im_oi w := rfl
78
leanexplore_declaration
leanexplore:379871
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma add_im_oi (z w : 𝓞) : im_oi (z + w) = im_oi z + im_oi w := rfl
138
leanexplore_declaration
leanexplore:379872
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_add (z w : 𝓞) : toQuaternion (z + w) = toQuaternion z + toQuaternion w := by ext <;> simp [toQuaternion] <;> ring
72
leanexplore_declaration
leanexplore:379873
leanexplore_sqlite
leanexplore_declarations
/-- Notation `+` for addition -/ instance : Sub 𝓞 := ⟨fun a b => a + -b⟩
181
leanexplore_declaration
leanexplore:379874
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_sub (z w : 𝓞) : toQuaternion (z - w) = toQuaternion z - toQuaternion w := by convert toQuaternion_add z (-w) using 1 rw [sub_eq_add_neg, toQuaternion_neg]
44
leanexplore_declaration
leanexplore:379875
leanexplore_sqlite
leanexplore_declarations
instance : SMul ℕ 𝓞 where smul := nsmulRec
318
leanexplore_declaration
leanexplore:379876
leanexplore_sqlite
leanexplore_declarations
lemma preserves_nsmulRec {M N : Type*} [Zero M] [Add M] [AddMonoid N] (f : M → N) (zero : f 0 = 0) (add : ∀ x y, f (x + y) = f x + f y) (n : ℕ) (x : M) : f (nsmulRec n x) = n • f x := by induction n with | zero => rw [nsmulRec, zero, zero_smul] | succ n ih => rw [nsmulRec, add, add_nsmul, one_nsmul, ih]
153
leanexplore_declaration
leanexplore:379877
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_nsmul (z : 𝓞) (n : ℕ) : toQuaternion (n • z) = n • toQuaternion z := preserves_nsmulRec _ toQuaternion_zero toQuaternion_add _ _
44
leanexplore_declaration
leanexplore:379878
leanexplore_sqlite
leanexplore_declarations
instance : SMul ℤ 𝓞 where smul := zsmulRec
405
leanexplore_declaration
leanexplore:379879
leanexplore_sqlite
leanexplore_declarations
lemma preserves_zsmul {G H : Type*} [Zero G] [Add G] [Neg G] [SMul ℕ G] [SubNegMonoid H] (f : G → H) (nsmul : ∀ (g : G) (n : ℕ), f (n • g) = n • f g) (neg : ∀ x, f (-x) = -f x) (z : ℤ) (g : G) : f (zsmulRec (· • ·) z g) = z • f g := by cases z with | ofNat n => rw [zsmulRec, nsmul, Int.ofNat_eq_...
163
leanexplore_declaration
leanexplore:379880
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_zsmul (z : 𝓞) (n : ℤ) : toQuaternion (n • z) = n • toQuaternion z := preserves_zsmul _ toQuaternion_nsmul toQuaternion_neg n z
555
leanexplore_declaration
leanexplore:379881
leanexplore_sqlite
leanexplore_declarations
/-- Multiplication `z*w` of two Hurwitz numbers -/ def mul (z w : 𝓞) : 𝓞 where re := z.re * w.re - z.im_o * w.im_o - z.im_i * w.im_o - z.im_i * w.im_i + z.im_i * w.im_oi - z.im_oi * w.im_oi im_o := z.im_o * w.re + z.re * w.im_o - z.im_o * w.im_o - z.im_oi * w.im_o - z.im_oi * w.im_i + z.im_i * w.im_oi i...
64
leanexplore_declaration
leanexplore:379882
leanexplore_sqlite
leanexplore_declarations
/-- Notation `*` for multiplication -/ instance : Mul 𝓞 := ⟨mul⟩
167
leanexplore_declaration
leanexplore:379883
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma mul_re (z w : 𝓞) : re (z * w) = z.re * w.re - z.im_o * w.im_o - z.im_i * w.im_o - z.im_i * w.im_i + z.im_i * w.im_oi - z.im_oi * w.im_oi := rfl
171
leanexplore_declaration
leanexplore:379884
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma mul_im_o (z w : 𝓞) : im_o (z * w) = z.im_o * w.re + z.re * w.im_o - z.im_o * w.im_o - z.im_oi * w.im_o - z.im_oi * w.im_i + z.im_i * w.im_oi := rfl
171
leanexplore_declaration
leanexplore:379885
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma mul_im_i (z w : 𝓞) : im_i (z * w) = z.im_i * w.re - z.im_i * w.im_o + z.im_oi * w.im_o + z.re * w.im_i - z.im_o * w.im_oi - z.im_i * w.im_oi := rfl
175
leanexplore_declaration
leanexplore:379886
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma mul_im_oi (z w : 𝓞) : im_oi (z * w) = z.im_oi * w.re - z.im_i * w.im_o + z.im_o * w.im_i + z.re * w.im_oi - z.im_o * w.im_oi - z.im_oi * w.im_oi := rfl
138
leanexplore_declaration
leanexplore:379887
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_mul (z w : 𝓞) : toQuaternion (z * w) = toQuaternion z * toQuaternion w := by ext <;> simp [toQuaternion] <;> ring
194
leanexplore_declaration
leanexplore:379888
leanexplore_sqlite
leanexplore_declarations
lemma o_mul_i : { re := 0, im_o := 1, im_i := 0, im_oi := 0 } * { re := 0, im_o := 0, im_i := 1, im_oi := 0 } = ({ re := 0, im_o := 0, im_i := 0, im_oi := 1 } : 𝓞) := by ext <;> simp
46
leanexplore_declaration
leanexplore:379889
leanexplore_sqlite
leanexplore_declarations
instance : Pow 𝓞 ℕ := ⟨fun z n => npowRec n z⟩
301
leanexplore_declaration
leanexplore:379890
leanexplore_sqlite
leanexplore_declarations
lemma preserves_npowRec {M N : Type*} [One M] [Mul M] [Monoid N] (f : M → N) (one : f 1 = 1) (mul : ∀ x y : M, f (x * y) = f x * f y) (z : M) (n : ℕ) : f (npowRec n z) = (f z) ^ n := by induction n with | zero => rw [npowRec, one, pow_zero] | succ n ih => rw [npowRec, pow_succ, mul, ih]
159
leanexplore_declaration
leanexplore:379891
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_npow (z : 𝓞) (n : ℕ) : toQuaternion (z ^ n) = (toQuaternion z) ^ n := preserves_npowRec toQuaternion toQuaternion_one toQuaternion_mul z n
368
leanexplore_declaration
leanexplore:379893
leanexplore_sqlite
leanexplore_declarations
lemma preserves_unaryCast {R S : Type*} [One R] [Zero R] [Add R] [AddMonoidWithOne S] (f : R → S) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ x y, f (x + y) = f x + f y) (n : ℕ) : f (Nat.unaryCast n) = n := by induction n with | zero => rw [Nat.unaryCast, zero, Nat.cast_zero] | succ n ih => rw [Nat.unar...
136
leanexplore_declaration
leanexplore:379894
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_natCast (n : ℕ) : toQuaternion n = n := preserves_unaryCast _ toQuaternion_zero toQuaternion_one toQuaternion_add n
112
leanexplore_declaration
leanexplore:379896
leanexplore_sqlite
leanexplore_declarations
lemma Int.castDef_ofNat {R : Type*} [NatCast R] [Neg R] (n : ℕ) : (Int.castDef (Int.ofNat n) : R) = n := rfl
127
leanexplore_declaration
leanexplore:379897
leanexplore_sqlite
leanexplore_declarations
lemma Int.castDef_negSucc {R : Type*} [NatCast R] [Neg R] (n : ℕ) : (Int.castDef (Int.negSucc n) : R) = -(n + 1 : ℕ) := rfl
372
leanexplore_declaration
leanexplore:379898
leanexplore_sqlite
leanexplore_declarations
lemma preserves_castDef {R S : Type*} [NatCast R] [Neg R] [AddGroupWithOne S] (f : R → S) (natCast : ∀ n : ℕ, f n = n) (neg : ∀ x, f (-x) = - f x) (n : ℤ) : f (Int.castDef n) = n := by cases n with | ofNat n => rw [Int.castDef_ofNat, natCast, Int.ofNat_eq_natCast, Int.cast_natCast] | negSucc _ => rw [...
120
leanexplore_declaration
leanexplore:379899
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_intCast (n : ℤ) : toQuaternion n = n := preserves_castDef _ toQuaternion_natCast toQuaternion_neg n
472
leanexplore_declaration
leanexplore:379900
leanexplore_sqlite
leanexplore_declarations
noncomputable instance ring : Ring 𝓞 := toQuaternion_injective.ring _ toQuaternion_zero toQuaternion_one toQuaternion_add toQuaternion_mul toQuaternion_neg toQuaternion_sub (fun _ _ => toQuaternion_nsmul _ _) -- TODO for Yaël: these are inconsistent with addCommGroup (fun _ _ => t...
174
leanexplore_declaration
leanexplore:379901
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma natCast_re (n : ℕ) : (n : 𝓞).re = n := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_o (n : ℕ) : (n : 𝓞).im_o = 0 := by
178
leanexplore_declaration
leanexplore:379902
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma natCast_im_o (n : ℕ) : (n : 𝓞).im_o = 0 := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_i (n : ℕ) : (n : 𝓞).im_i = 0 := by
180
leanexplore_declaration
leanexplore:379903
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma natCast_im_i (n : ℕ) : (n : 𝓞).im_i = 0 := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_oi (n : ℕ) : (n : 𝓞).im_oi = 0 := by
120
leanexplore_declaration
leanexplore:379904
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma natCast_im_oi (n : ℕ) : (n : 𝓞).im_oi = 0 := by induction n with | zero => simp | succ n ih => simpa
195
leanexplore_declaration
leanexplore:379905
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma intCast_re (n : ℤ) : (n : 𝓞).re = n := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_o (n : ℤ) : (n : 𝓞).im_o = 0 := by
199
leanexplore_declaration
leanexplore:379906
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma intCast_im_o (n : ℤ) : (n : 𝓞).im_o = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_i (n : ℤ) : (n : 𝓞).im_i = 0 := by
201
leanexplore_declaration
leanexplore:379907
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma intCast_im_i (n : ℤ) : (n : 𝓞).im_i = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_oi (n : ℤ) : (n : 𝓞).im_oi = 0 := by
141
leanexplore_declaration
leanexplore:379908
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma intCast_im_oi (n : ℤ) : (n : 𝓞).im_oi = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ]
295
leanexplore_declaration
leanexplore:379909
leanexplore_sqlite
leanexplore_declarations
/-- Conjugate; sends $a+bi+cj+dk$ to $a-bi-cj-dk$. -/ instance starRing : StarRing 𝓞 where star z := ⟨z.re - z.im_o - z.im_oi, -z.im_o, -z.im_i, -z.im_oi⟩ star_involutive x := by ext <;> simp only <;> ring star_mul x y := by ext <;> simp <;> ring star_add x y := by ext <;> simp <;> ring
141
leanexplore_declaration
leanexplore:379910
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma star_re (z : 𝓞) : (star z).re = z.re - z.im_o - z.im_oi := rfl @[simp] lemma star_im_o (z : 𝓞) : (star z).im_o = -z.im_o := rfl
129
leanexplore_declaration
leanexplore:379911
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma star_im_o (z : 𝓞) : (star z).im_o = -z.im_o := rfl @[simp] lemma star_im_i (z : 𝓞) : (star z).im_i = -z.im_i := rfl
132
leanexplore_declaration
leanexplore:379912
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma star_im_i (z : 𝓞) : (star z).im_i = -z.im_i := rfl @[simp] lemma star_im_oi (z : 𝓞) : (star z).im_oi = -z.im_oi := rfl
67
leanexplore_declaration
leanexplore:379913
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma star_im_oi (z : 𝓞) : (star z).im_oi = -z.im_oi := rfl
296
leanexplore_declaration
leanexplore:379914
leanexplore_sqlite
leanexplore_declarations
lemma toQuaternion_star (z : 𝓞) : toQuaternion (star z) = star (toQuaternion z) := by ext <;> simp only [star_re, star_im_o, star_im_i, star_im_oi, toQuaternion, Quaternion.re_star, Quaternion.imI_star, Quaternion.imJ_star, Quaternion.imK_star] <;> field_simp <;> norm_cast <;> ring
181
leanexplore_declaration
leanexplore:379915
leanexplore_sqlite
leanexplore_declarations
lemma star_eq (z : 𝓞) : star z = (fromQuaternion ∘ star ∘ toQuaternion) z := by simp only [Function.comp_apply, ← toQuaternion_star] rw [leftInverse_fromQuaternion_toQuaternion]
92
leanexplore_declaration
leanexplore:379916
leanexplore_sqlite
leanexplore_declarations
instance : CharZero 𝓞 where cast_injective x y hxy := by simpa [Hurwitz.ext_iff] using hxy
153
leanexplore_declaration
leanexplore:379917
leanexplore_sqlite
leanexplore_declarations
def norm (z : 𝓞) : ℤ := z.re * z.re + z.im_o * z.im_o + z.im_i * z.im_i + z.im_oi * z.im_oi - z.re * (z.im_o + z.im_oi) + z.im_i * (z.im_o - z.im_oi)
241
leanexplore_declaration
leanexplore:379918
leanexplore_sqlite
leanexplore_declarations
lemma norm_eq_mul_conj (z : 𝓞) : (norm z : 𝓞) = z * star z := by ext <;> simp only [norm, intCast_re, intCast_im_o, intCast_im_i, intCast_im_oi, mul_re, mul_im_o, mul_im_i, mul_im_oi, star_re, star_im_o, star_im_i, star_im_oi] <;> ring