@@ -346,6 +346,14 @@ theorem homeomorphAddCircle_symm_apply_mk (hp : p ≠ 0) (hq : q ≠ 0) (x :
346346 rfl
347347end
348348
349+ lemma natCast_div_mul_eq_nsmul (r : 𝕜) (m : ℕ) :
350+ (↑(↑m / q * r) : AddCircle p) = m • (r / q : AddCircle p) := by
351+ rw [mul_comm_div, ← nsmul_eq_mul, coe_nsmul]
352+
353+ lemma intCast_div_mul_eq_zsmul (r : 𝕜) (m : ℤ) :
354+ (↑(↑m / q * r) : AddCircle p) = m • (r / q : AddCircle p) := by
355+ rw [mul_comm_div, ← zsmul_eq_mul, coe_zsmul]
356+
349357variable [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] [hp : Fact (0 < p)]
350358
351359section FloorRing
@@ -387,7 +395,7 @@ theorem addOrderOf_period_div {n : ℕ} (h : 0 < n) : addOrderOf ((p / n : 𝕜)
387395variable (p) in
388396theorem gcd_mul_addOrderOf_div_eq {n : ℕ} (m : ℕ) (hn : 0 < n) :
389397 m.gcd n * addOrderOf (↑(↑m / ↑n * p) : AddCircle p) = n := by
390- rw [mul_comm_div, ← nsmul_eq_mul, coe_nsmul , IsOfFinAddOrder.addOrderOf_nsmul]
398+ rw [natCast_div_mul_eq_nsmul , IsOfFinAddOrder.addOrderOf_nsmul]
391399 · rw [addOrderOf_period_div hn, Nat.gcd_comm, Nat.mul_div_cancel']
392400 exact n.gcd_dvd_left m
393401 · rwa [← addOrderOf_pos_iff, addOrderOf_period_div hn]
@@ -412,31 +420,35 @@ theorem addOrderOf_coe_rat {q : ℚ} : addOrderOf (↑(↑q * p) : AddCircle p)
412420 rw [← q.num_divInt_den, Rat.cast_divInt_of_ne_zero _ this, Int.cast_natCast, Rat.num_divInt_den,
413421 addOrderOf_div_of_gcd_eq_one' q.pos q.reduced]
414422
415- theorem addOrderOf_eq_pos_iff {u : AddCircle p} {n : ℕ} (h : 0 < n) :
416- addOrderOf u = n ↔ ∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n * p) = u := by
417- refine ⟨QuotientAddGroup.induction_on u fun k hk => ?_, ?_⟩
418- · rintro ⟨m, _, h₁, rfl⟩
419- exact addOrderOf_div_of_gcd_eq_one h h₁
420- have h0 := addOrderOf_nsmul_eq_zero (k : AddCircle p)
421- rw [hk, ← coe_nsmul, coe_eq_zero_iff] at h0
422- obtain ⟨a, ha⟩ := h0
423- have h0 : (_ : 𝕜) ≠ 0 := Nat.cast_ne_zero.2 h.ne'
423+ theorem nsmul_eq_zero_iff {u : AddCircle p} {n : ℕ} (h : 0 < n) :
424+ n • u = 0 ↔ ∃ m < n, ↑(↑m / ↑n * p) = u := by
425+ refine ⟨QuotientAddGroup.induction_on u fun k hk ↦ ?_, ?_⟩
426+ · rw [← addOrderOf_dvd_iff_nsmul_eq_zero]
427+ rintro ⟨m, -, rfl⟩
428+ constructor; rw [mul_comm, eq_comm]
429+ exact gcd_mul_addOrderOf_div_eq p m h
430+ rw [← coe_nsmul, coe_eq_zero_iff] at hk
431+ obtain ⟨a, ha⟩ := hk
432+ refine ⟨a.natMod n, Int.natMod_lt h.ne', ?_⟩
433+ have h0 : (n : 𝕜) ≠ 0 := Nat.cast_ne_zero.2 h.ne'
424434 rw [nsmul_eq_mul, mul_comm, ← div_eq_iff h0, ← a.ediv_add_emod' n, add_smul, add_div,
425435 zsmul_eq_mul, Int.cast_mul, Int.cast_natCast, mul_assoc, ← mul_div, mul_comm _ p,
426436 mul_div_cancel_right₀ p h0] at ha
427- have han : _ = a % n := Int.toNat_of_nonneg (Int.emod_nonneg _ <| mod_cast h.ne')
428- have he : (↑(↑((a % n).toNat) / ↑n * p) : AddCircle p) = k := by
429- convert congr_arg (QuotientAddGroup.mk : 𝕜 → (AddCircle p)) ha using 1
430- rw [coe_add, ← Int.cast_natCast, han, zsmul_eq_mul, mul_div_right_comm, eq_comm,
431- add_eq_right, ← zsmul_eq_mul, coe_zsmul, coe_period, smul_zero]
432- refine ⟨(a % n).toNat, ?_, ?_, he⟩
433- · rw [← Int.ofNat_lt, han]
434- exact Int.emod_lt_of_pos _ (Int.ofNat_lt.2 h)
435- · have := (gcd_mul_addOrderOf_div_eq p (Int.toNat (a % ↑n)) h).trans
436- ((congr_arg addOrderOf he).trans hk).symm
437- rw [he, Nat.mul_left_eq_self_iff] at this
438- · exact this
439- · rwa [hk]
437+ rw [← ha, coe_add, ← Int.cast_natCast, Int.natMod, Int.toNat_of_nonneg, zsmul_eq_mul,
438+ mul_div_right_comm, eq_comm, add_eq_right, ←zsmul_eq_mul, coe_zsmul, coe_period, smul_zero]
439+ exact Int.emod_nonneg _ (by exact_mod_cast h.ne')
440+
441+ theorem addOrderOf_eq_pos_iff {u : AddCircle p} {n : ℕ} (h : 0 < n) :
442+ addOrderOf u = n ↔ ∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n * p) = u := by
443+ refine ⟨QuotientAddGroup.induction_on u ?_, ?_⟩
444+ · rintro ⟨m, -, h₁, rfl⟩
445+ exact addOrderOf_div_of_gcd_eq_one h h₁
446+ rintro k rfl
447+ obtain ⟨m, hm, hk⟩ := (nsmul_eq_zero_iff h).mp (addOrderOf_nsmul_eq_zero (k : AddCircle p))
448+ refine ⟨m, hm, mul_right_cancel₀ h.ne' ?_, hk⟩
449+ convert gcd_mul_addOrderOf_div_eq p m h using 1
450+ · rw [hk]
451+ · apply one_mul
440452
441453theorem exists_gcd_eq_one_of_isOfFinAddOrder {u : AddCircle p} (h : IsOfFinAddOrder u) :
442454 ∃ m : ℕ, m.gcd (addOrderOf u) = 1 ∧ m < addOrderOf u ∧ ↑((m : 𝕜) / addOrderOf u * p) = u :=
@@ -468,21 +480,11 @@ def setAddOrderOfEquiv {n : ℕ} (hn : 0 < n) :
468480 Equiv.ofBijective (fun m => ⟨↑((m : 𝕜) / n * p), addOrderOf_div_of_gcd_eq_one hn m.prop.2 ⟩)
469481 (by
470482 refine ⟨fun m₁ m₂ h => Subtype.ext ?_, fun u => ?_⟩
471- · simp_rw [Subtype.ext_iff] at h
472- rw [← sub_eq_zero, ← coe_sub, ← sub_mul, ← sub_div, ← Int.cast_natCast m₁,
473- ← Int.cast_natCast m₂, ← Int.cast_sub, coe_eq_zero_iff] at h
474- obtain ⟨m, hm⟩ := h
475- rw [← mul_div_right_comm, eq_div_iff, mul_comm, ← zsmul_eq_mul, mul_smul_comm, ←
476- nsmul_eq_mul, ← natCast_zsmul, smul_smul,
477- zsmul_left_inj hp.out, mul_comm] at hm
478- swap
479- · exact Nat.cast_ne_zero.2 hn.ne'
480- rw [← @Nat.cast_inj ℤ, ← sub_eq_zero]
481- refine Int.eq_zero_of_abs_lt_dvd ⟨_, hm.symm⟩ (abs_sub_lt_iff.2 ⟨?_, ?_⟩) <;>
482- apply (Int.sub_le_self _ <| Nat.cast_nonneg _).trans_lt (Nat.cast_lt.2 _)
483+ · simp_rw [Subtype.mk_eq_mk, natCast_div_mul_eq_nsmul] at h
484+ refine nsmul_injOn_Iio_addOrderOf ?_ ?_ h <;> rw [addOrderOf_period_div hn]
483485 exacts [m₁.2 .1 , m₂.2 .1 ]
484- obtain ⟨m, hmn, hg, he⟩ := (addOrderOf_eq_pos_iff hn).mp u.2
485- exact ⟨⟨m, hmn, hg⟩, Subtype.ext he⟩)
486+ · obtain ⟨m, hmn, hg, he⟩ := (addOrderOf_eq_pos_iff hn).mp u.2
487+ exact ⟨⟨m, hmn, hg⟩, Subtype.ext he⟩)
486488
487489@[simp]
488490theorem card_addOrderOf_eq_totient {n : ℕ} :
@@ -507,6 +509,11 @@ theorem finite_setOf_addOrderOf_eq {n : ℕ} (hn : 0 < n) :
507509@[deprecated (since := "2025-03-26")]
508510alias finite_setOf_add_order_eq := finite_setOf_addOrderOf_eq
509511
512+ theorem finite_torsion {n : ℕ} (hn : 0 < n) :
513+ { u : AddCircle p | n • u = 0 }.Finite := by
514+ convert Set.finite_range (fun m : Fin n ↦ (↑(↑m / ↑n * p) : AddCircle p))
515+ simp_rw [nsmul_eq_zero_iff hn, range, Fin.exists_iff, exists_prop]
516+
510517end FiniteOrderPoints
511518
512519end LinearOrderedField
0 commit comments