import Mathlib.Analysis.Fourier.FiniteAbelian.PontryaginDuality import Mathlib.Analysis.Fourier.FiniteAbelian.Orthogonality import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Finset.Card import Mathlib.Tactic.Linarith /-! # Sharp Rank-2 Non-Elementary Dichotomy: `ZMod (p^2) × ZMod p` Over the elementary abelian rank-2 `p`-group `ZMod p × ZMod p`, Rank-2 Rigidity forces every aperiodic single-point autocorrelation fiber to have cardinality at most `2` (strictly below `2^2`). In sharp contrast, we prove that keeping rank `2` and the same single prime `p`, raising the exponent from `p` to `p^2` in `G = ZMod (p^2) × ZMod p` jumps the exact maximum aperiodic fiber cardinality from `2` to `4 = 2^2`: 1. **Exact Upper Bound (`zmod_p2_prod_p_fiber_card_le_four`)**: For every prime `p`, every aperiodic `C : Finset (ZMod (p ^ 2) × ZMod p)`, and every `x₀ ∉ C`, `(Fiber C x₀).card ≤ 4`. (Proved via Burnside/Frattini basis lifting: active characters must span `G / pG ≅ (ZMod p)^2`, and any two active characters lifting a mod-`p` basis separate all points of `ZMod (p^2) × ZMod p`, embedding `Fiber C x₀` into a `2 × 2` grid.) 2. **Sharp Attainment (`zmod_p2_prod_p_sharp_fiber_four`)**: For every prime `p ≥ 5`, the explicit support `C = {(a, b) | a ∈ {0, p, -p} ∨ a ≡ 2 (mod p) ∨ (a ≡ ±1 (mod p) ∧ b = 0)}` in `ZMod (p ^ 2) × ZMod p` is aperiodic, avoids `(2 * p, 1)`, and satisfies `Fiber C (2 * p, 1) = {(2 * p, 1), (2 * p, -1), (-2 * p, 1), (-2 * p, -1)}`, attaining `(Fiber C (2 * p, 1)).card = 4`. -/ namespace OpenAlgebraTopology.NonElemRank2 open scoped BigOperators ComplexConjugate section Core variable {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] /-- Periodic autocorrelation of a support `S : Finset G` at lag `t : G`. -/ def autocorr (S : Finset G) (t : G) : ℕ := (S.filter fun u => u + t ∈ S).card /-- A support `C : Finset G` is aperiodic if its only translational period is `0`. -/ def IsAperiodic (C : Finset G) : Prop := ∀ g : G, C.image (· + g) = C → g = 0 /-- The single-point insertion fiber of `x₀` with fixed core `C`. -/ noncomputable def Fiber (C : Finset G) (x₀ : G) : Finset G := by classical exact (Finset.univ \ C).filter fun x => autocorr (insert x C) = autocorr (insert x₀ C) /-- Indicator function `1_C : G → ℕ`. -/ def indC (C : Finset G) (u : G) : ℕ := if u ∈ C then 1 else 0 /-- Complex Fourier coefficient `f_hat(χ) = ∑ u ∈ C, χ (-u)`. -/ def fourierCoeff (C : Finset G) (χ : AddChar G ℂ) : ℂ := ∑ u ∈ C, χ (-u) omit [Fintype G] in private lemma autocorr_insert_eq (C : Finset G) {x : G} (hx : x ∉ C) (t : G) : autocorr (insert x C) t = autocorr C t + (if t = 0 then 1 else 0) + indC C (x + t) + indC C (x - t) := by unfold autocorr indC rw [Finset.card_filter, Finset.card_filter, Finset.sum_insert hx] have h1 : (if x + t ∈ insert x C then (1 : ℕ) else 0) = (if t = 0 then 1 else 0) + (if x + t ∈ C then 1 else 0) := by by_cases ht : t = 0 · subst ht; simp [hx] · have hne : x + t ≠ x := fun h => ht (add_left_cancel (h.trans (add_zero x).symm)) simp [ht, hne] have h2 : ∑ u ∈ C, (if u + t ∈ insert x C then (1 : ℕ) else 0) = (∑ u ∈ C, if u + t ∈ C then 1 else 0) + (if x - t ∈ C then 1 else 0) := by have hsplit : ∀ u ∈ C, (if u + t ∈ insert x C then (1 : ℕ) else 0) = (if u + t ∈ C then 1 else 0) + (if u = x - t then 1 else 0) := by intro u _ by_cases hux : u + t = x · have hueq : u = x - t := eq_sub_of_add_eq hux simp [hx, hueq] · have huneq : u ≠ x - t := fun h => hux (by rw [h, sub_add_cancel]) simp [hux, huneq] rw [Finset.sum_congr rfl hsplit, Finset.sum_add_distrib] congr 1 simp [Finset.sum_ite_eq'] rw [h1, h2] omega omit [Fintype G] in private lemma autocorr_insert_eq_iff (C : Finset G) {x x₀ : G} (hx : x ∉ C) (hx₀ : x₀ ∉ C) : autocorr (insert x C) = autocorr (insert x₀ C) ↔ ∀ t : G, indC C (x + t) + indC C (x - t) = indC C (x₀ + t) + indC C (x₀ - t) := by constructor · intro h t have ht := congr_fun h t rw [autocorr_insert_eq C hx t, autocorr_insert_eq C hx₀ t] at ht omega · intro h funext t rw [autocorr_insert_eq C hx t, autocorr_insert_eq C hx₀ t] have ht := h t omega private lemma mem_fiber_iff (C : Finset G) {x₀ : G} (hx₀ : x₀ ∉ C) (x : G) : x ∈ Fiber C x₀ ↔ x ∉ C ∧ ∀ t : G, indC C (x + t) + indC C (x - t) = indC C (x₀ + t) + indC C (x₀ - t) := by classical simp only [Fiber, Finset.mem_filter, Finset.mem_sdiff, Finset.mem_univ, true_and] constructor · rintro ⟨hx, h⟩; exact ⟨hx, (autocorr_insert_eq_iff C hx hx₀).1 h⟩ · rintro ⟨hx, h⟩; exact ⟨hx, (autocorr_insert_eq_iff C hx hx₀).2 h⟩ private lemma sum_addChar_apply (a : G) : ∑ χ : AddChar G ℂ, χ a = if a = 0 then (Fintype.card G : ℂ) else 0 := by have h1 : (∑ χ : AddChar G ℂ, χ a) = ∑ χ : AddChar G ℂ, (AddChar.doubleDualEmb a : AddChar (AddChar G ℂ) ℂ) χ := rfl rw [h1, AddChar.sum_eq_ite] simp [AddChar.doubleDualEmb_eq_zero, AddChar.card_eq] private lemma fourier_inversion (g : G → ℂ) (s : G) : ∑ χ : AddChar G ℂ, (∑ t : G, g t * χ (-t)) * χ s = (Fintype.card G : ℂ) * g s := by calc ∑ χ : AddChar G ℂ, (∑ t : G, g t * χ (-t)) * χ s = ∑ χ : AddChar G ℂ, ∑ t : G, g t * (χ (-t) * χ s) := by refine Finset.sum_congr rfl fun χ _ => ?_ rw [Finset.sum_mul] refine Finset.sum_congr rfl fun t _ => by ring _ = ∑ t : G, ∑ χ : AddChar G ℂ, g t * χ (s - t) := by rw [Finset.sum_comm] refine Finset.sum_congr rfl fun t _ => Finset.sum_congr rfl fun χ _ => ?_ rw [← AddChar.map_add_eq_mul, neg_add_eq_sub] _ = ∑ t : G, g t * ∑ χ : AddChar G ℂ, χ (s - t) := by refine Finset.sum_congr rfl fun t _ => (Finset.mul_sum ..).symm _ = ∑ t : G, g t * (if s - t = 0 then (Fintype.card G : ℂ) else 0) := by refine Finset.sum_congr rfl fun t _ => by rw [sum_addChar_apply] _ = (Fintype.card G : ℂ) * g s := by have hsub : ∀ t : G, (s - t = 0) ↔ t = s := fun t => ⟨fun h => (sub_eq_zero.1 h).symm, fun h => by rw [h, sub_self]⟩ simp_rw [hsub] simp [mul_comm] omit [DecidableEq G] in private lemma addChar_conj_eq_neg (χ : AddChar G ℂ) (a : G) : star (χ a) = χ (-a) := by rw [AddChar.map_neg_eq_inv, AddChar.inv_apply_eq_conj, Complex.star_def] omit [DecidableEq G] in private lemma addChar_apply_ne_zero (χ : AddChar G ℂ) (a : G) : χ a ≠ 0 := by intro h have hn := χ.norm_apply a rw [h, norm_zero] at hn exact zero_ne_one hn private lemma fourier_profile_eq (C : Finset G) (x : G) (χ : AddChar G ℂ) : ∑ t : G, ((indC C (x + t) + indC C (x - t) : ℕ) : ℂ) * χ (-t) = 2 * ((fourierCoeff C χ * χ x).re : ℂ) := by have hcast : ∀ t : G, ((indC C (x + t) + indC C (x - t) : ℕ) : ℂ) * χ (-t) = (indC C (x + t) : ℂ) * χ (-t) + (indC C (x - t) : ℂ) * χ (-t) := fun t => by push_cast; ring simp_rw [hcast, Finset.sum_add_distrib] have hplus : ∑ t : G, (indC C (x + t) : ℂ) * χ (-t) = fourierCoeff C χ * χ x := by let e : G ≃ G := Equiv.addLeft x rw [← Equiv.sum_comp e.symm] have hterm : ∀ u : G, (indC C (x + e.symm u) : ℂ) * χ (-(e.symm u)) = (indC C u : ℂ) * (χ (-u) * χ x) := by intro u have h1 : x + e.symm u = u := by simp [e] have h2 : -(e.symm u) = -u + x := by simp [e] rw [h1, h2, AddChar.map_add_eq_mul] simp_rw [hterm, ← mul_assoc] rw [← Finset.sum_mul] congr 1; unfold fourierCoeff indC; simp have hminus : ∑ t : G, (indC C (x - t) : ℂ) * χ (-t) = star (fourierCoeff C χ * χ x) := by let e : G ≃ G := Equiv.subLeft x rw [← Equiv.sum_comp e.symm] have hterm : ∀ u : G, (indC C (x - e.symm u) : ℂ) * χ (-(e.symm u)) = (indC C u : ℂ) * (χ u * χ (-x)) := by intro u have h1 : x - e.symm u = u := by simp [e] have h2 : -(e.symm u) = u + -x := by simp [e]; abel rw [h1, h2, AddChar.map_add_eq_mul] simp_rw [hterm, ← mul_assoc] rw [← Finset.sum_mul] have hstar : star (fourierCoeff C χ * χ x) = (∑ u ∈ C, χ u) * χ (-x) := by rw [star_mul', addChar_conj_eq_neg] congr 1; unfold fourierCoeff; rw [star_sum] refine Finset.sum_congr rfl fun u _ => ?_ rw [addChar_conj_eq_neg, neg_neg] rw [hstar]; congr 1; unfold indC; simp rw [hplus, hminus] have hadd : ∀ z : ℂ, z + star z = 2 * (z.re : ℂ) := fun z => by rw [Complex.star_def, Complex.add_conj]; push_cast; ring exact hadd _ private lemma mem_fiber_fourier {C : Finset G} {x₀ x : G} (hx₀ : x₀ ∉ C) (hx : x ∈ Fiber C x₀) (χ : AddChar G ℂ) : (fourierCoeff C χ * χ x).re = (fourierCoeff C χ * χ x₀).re := by classical simp only [Fiber, Finset.mem_filter, Finset.mem_sdiff, Finset.mem_univ, true_and] at hx have hprof := (autocorr_insert_eq_iff C hx.1 hx₀).1 hx.2 have hsum : ∑ t : G, ((indC C (x + t) + indC C (x - t) : ℕ) : ℂ) * χ (-t) = ∑ t : G, ((indC C (x₀ + t) + indC C (x₀ - t) : ℕ) : ℂ) * χ (-t) := Finset.sum_congr rfl fun t _ => by rw [hprof t] rw [fourier_profile_eq, fourier_profile_eq] at hsum exact Complex.ofReal_injective (mul_left_cancel₀ (two_ne_zero : (2 : ℂ) ≠ 0) hsum) private lemma fourier_inversion_indC (C : Finset G) (s : G) : ∑ χ : AddChar G ℂ, fourierCoeff C χ * χ s = (Fintype.card G : ℂ) * (indC C s : ℂ) := by have h := fourier_inversion (fun t => (indC C t : ℂ)) s have hcoef : ∀ χ : AddChar G ℂ, ∑ t : G, (indC C t : ℂ) * χ (-t) = fourierCoeff C χ := by intro χ; unfold fourierCoeff indC; simp simp_rw [hcoef] at h exact h private lemma unit_circle_re_eq_at_most_two {z w₁ w₂ w₃ : ℂ} (hz : z ≠ 0) (hw₁ : ‖w₁‖ = 1) (hw₂ : ‖w₂‖ = 1) (hw₃ : ‖w₃‖ = 1) (h12 : (z * w₁).re = (z * w₂).re) (h13 : (z * w₁).re = (z * w₃).re) : w₁ = w₂ ∨ w₁ = w₃ ∨ w₂ = w₃ := by have hns : ∀ w : ℂ, ‖w‖ = 1 → Complex.normSq (z * w) = Complex.normSq z := fun w hw => by rw [map_mul, Complex.normSq_eq_norm_sq w, hw, one_pow, mul_one] have him : ∀ w : ℂ, ‖w‖ = 1 → (z * w₁).re = (z * w).re → (z * w).im = (z * w₁).im ∨ (z * w).im = -(z * w₁).im := fun w hw hre => by have hq1 := hns w₁ hw₁ have hq2 := hns w hw have hsq : (z * w).im ^ 2 = (z * w₁).im ^ 2 := by have h := hq2.trans hq1.symm rw [Complex.normSq_apply, Complex.normSq_apply, ← hre] at h nlinarith exact sq_eq_sq_iff_eq_or_eq_neg.1 hsq rcases him w₂ hw₂ h12 with h2 | h2 · left; exact mul_left_cancel₀ hz (Complex.ext h12 h2.symm) · rcases him w₃ hw₃ h13 with h3 | h3 · right; left; exact mul_left_cancel₀ hz (Complex.ext h13 h3.symm) · right; right; exact mul_left_cancel₀ hz (Complex.ext (h12.symm.trans h13) (h2.trans h3.symm)) end Core section UpperBound variable {p : ℕ} [Fact p.Prime] private lemma neZero_sq (p : ℕ) [Fact p.Prime] : NeZero (p ^ 2) := ⟨pow_ne_zero 2 (Fact.out : p.Prime).ne_zero⟩ private noncomputable def eN (n : ℕ) [NeZero n] : AddChar (ZMod n) ℂ := AddChar.zmodAddEquiv (1 : ZMod n) private lemma eN_apply_comm (n : ℕ) [NeZero n] (a : ZMod n) : eN n a = (AddChar.zmodAddEquiv a : AddChar (ZMod n) ℂ) 1 := by unfold eN rw [AddChar.zmodAddEquiv_apply, AddChar.zmodAddEquiv_apply] obtain ⟨k, rfl⟩ := ZMod.intCast_surjective a have h1 : (1 : ZMod n) = ((1 : ℤ) : ZMod n) := by simp rw [h1] change ((AddChar.zmod n ((1 : ℤ) : ZMod n) ((k : ℤ) : ZMod n) : Circle) : ℂ) = ((AddChar.zmod n ((k : ℤ) : ZMod n) ((1 : ℤ) : ZMod n) : Circle) : ℂ) rw [AddChar.zmod_intCast, AddChar.zmod_intCast] congr 2; ring private lemma eN_injective (n : ℕ) [NeZero n] : Function.Injective (eN n) := by intro a b hab have hsub : eN n (a - b) = 1 := by rw [AddChar.map_sub_eq_div, hab, div_self (addChar_apply_ne_zero (eN n) b)] have h1 : (AddChar.zmodAddEquiv (a - b) : AddChar (ZMod n) ℂ) 1 = 1 := by rw [← eN_apply_comm, hsub] have hall : (AddChar.zmodAddEquiv (a - b) : AddChar (ZMod n) ℂ) = 0 := by ext y have hy : y = y.val • (1 : ZMod n) := by simp rw [hy, AddChar.map_nsmul_eq_pow, h1, one_pow] rfl exact sub_eq_zero.1 (AddChar.zmodAddEquiv.injective (hall.trans (map_zero _).symm)) /-- Embedding `b : ZMod p ↦ (p * b.val : ZMod (p^2))`, an additive homomorphism. -/ private def mulPHom (p : ℕ) [Fact p.Prime] : ZMod p →+ ZMod (p ^ 2) where toFun b := (p : ZMod (p ^ 2)) * (b.val : ZMod (p ^ 2)) map_zero' := by simp map_add' b₁ b₂ := by have : NeZero (p ^ 2) := neZero_sq p have hmod : (b₁ + b₂).val = (b₁.val + b₂.val) % p := ZMod.val_add b₁ b₂ have hq := Nat.div_add_mod (b₁.val + b₂.val) p have heq : p * (b₁.val + b₂.val) = p ^ 2 * ((b₁.val + b₂.val) / p) + p * (b₁ + b₂).val := by rw [hmod]; nlinarith have hcast : ((p * (b₁.val + b₂.val) : ℕ) : ZMod (p ^ 2)) = ((p * (b₁ + b₂).val : ℕ) : ZMod (p ^ 2)) := by rw [heq, Nat.cast_add, Nat.cast_mul, ZMod.natCast_self, zero_mul, zero_add] push_cast at hcast rw [← hcast, mul_add] /-- Character parametrization `(ξ₁, ξ₂) ∈ ZMod (p^2) × ZMod p` on `ZMod (p^2) × ZMod p`. -/ private def dotHomP2 (p : ℕ) [Fact p.Prime] (ξ : ZMod (p ^ 2) × ZMod p) : (ZMod (p ^ 2) × ZMod p) →+ ZMod (p ^ 2) where toFun u := ξ.1 * u.1 + (ξ.2.val : ZMod (p ^ 2)) * mulPHom p u.2 map_zero' := by simp map_add' u v := by simp only [Prod.fst_add, Prod.snd_add, map_add] ring private noncomputable def charP2 (p : ℕ) [Fact p.Prime] (ξ : ZMod (p ^ 2) × ZMod p) : AddChar (ZMod (p ^ 2) × ZMod p) ℂ := haveI : NeZero (p ^ 2) := neZero_sq p (eN (p ^ 2)).compAddMonoidHom (dotHomP2 p ξ) private lemma charP2_apply (p : ℕ) [Fact p.Prime] (ξ u : ZMod (p ^ 2) × ZMod p) : haveI : NeZero (p ^ 2) := neZero_sq p charP2 p ξ u = eN (p ^ 2) (ξ.1 * u.1 + (ξ.2.val : ZMod (p ^ 2)) * mulPHom p u.2) := rfl private lemma charP2_injective (p : ℕ) [Fact p.Prime] : Function.Injective (charP2 p) := by have : NeZero (p ^ 2) := neZero_sq p intro ξ η h have h1 : ξ.1 = η.1 := by have := DFunLike.congr_fun h (1, 0) rw [charP2_apply, charP2_apply] at this simpa using eN_injective (p ^ 2) this have h2 : ξ.2 = η.2 := by have := DFunLike.congr_fun h (0, 1) rw [charP2_apply, charP2_apply] at this have heq := eN_injective (p ^ 2) this have hp : 1 < p := (Fact.out : p.Prime).one_lt have h1val : (1 : ZMod p).val = 1 := ZMod.val_one p simp only [mul_zero, zero_add, mulPHom, AddMonoidHom.coe_mk, ZeroHom.coe_mk, h1val, Nat.cast_one, mul_one] at heq have hcast : ((ξ.2.val * p : ℕ) : ZMod (p ^ 2)) = ((η.2.val * p : ℕ) : ZMod (p ^ 2)) := by push_cast; exact heq have hval_eq : (ξ.2.val * p : ℕ) % p ^ 2 = (η.2.val * p : ℕ) % p ^ 2 := by have hv := congr_arg ZMod.val hcast rw [ZMod.val_natCast, ZMod.val_natCast] at hv exact hv have hlt1 : ξ.2.val * p < p ^ 2 := by have := ξ.2.val_lt; nlinarith have hlt2 : η.2.val * p < p ^ 2 := by have := η.2.val_lt; nlinarith rw [Nat.mod_eq_of_lt hlt1, Nat.mod_eq_of_lt hlt2] at hval_eq have hv : ξ.2.val = η.2.val := Nat.eq_of_mul_eq_mul_right (by omega) hval_eq exact ZMod.val_injective p hv exact Prod.ext h1 h2 private lemma charP2_bijective (p : ℕ) [Fact p.Prime] : Function.Bijective (charP2 p) := by have : NeZero (p ^ 2) := neZero_sq p rw [Fintype.bijective_iff_injective_and_card, AddChar.card_eq] exact ⟨charP2_injective p, rfl⟩ /-- **Exact Upper Bound for `ZMod (p^2) × ZMod p`**: Every aperiodic support in `ZMod (p ^ 2) × ZMod p` has single-point insertion fiber cardinality at most `4`. -/ theorem zmod_p2_prod_p_fiber_card_le_four {p : ℕ} [Fact p.Prime] (C : Finset (ZMod (p ^ 2) × ZMod p)) (hC : IsAperiodic C) {x₀ : ZMod (p ^ 2) × ZMod p} (hx₀ : x₀ ∉ C) : haveI : NeZero (p ^ 2) := neZero_sq p (Fiber C x₀).card ≤ 4 := by let : NeZero (p ^ 2) := neZero_sq p have hp : p.Prime := Fact.out have hp0 : p ≠ 0 := hp.ne_zero -- Reduction mod `p` of a character index `ξ = (ξ₁, ξ₂) ∈ ZMod (p^2) × ZMod p`. let red : (ZMod (p ^ 2) × ZMod p) → ZMod p × ZMod p := fun ξ => ((ξ.1.val : ZMod p), ξ.2) let FP2 : (ZMod (p ^ 2) × ZMod p) → ℂ := fun ξ => fourierCoeff C (charP2 p ξ) -- Helper: if every active `ξ` satisfies `red ξ · v = 0` in `ZMod p`, then `v = 0`. have horthog_modp : ∀ v : ZMod p × ZMod p, (∀ ξ : ZMod (p ^ 2) × ZMod p, FP2 ξ ≠ 0 → (red ξ).1 * v.1 + (red ξ).2 * v.2 = 0) → v = 0 := by intro v hv let g : ZMod (p ^ 2) × ZMod p := (mulPHom p v.1, v.2) have hchar_g : ∀ ξ : ZMod (p ^ 2) × ZMod p, FP2 ξ ≠ 0 → charP2 p ξ g = 1 := by intro ξ hF rw [charP2_apply] have hmod0 : (ξ.1.val : ZMod p) * v.1 + ξ.2 * v.2 = 0 := hv ξ hF have hdvd_p : p ∣ ξ.1.val * v.1.val + ξ.2.val * v.2.val := by rw [← ZMod.natCast_eq_zero_iff] simpa [Nat.cast_add, Nat.cast_mul] using hmod0 obtain ⟨k, hk⟩ := hdvd_p have harg0 : ξ.1 * mulPHom p v.1 + (ξ.2.val : ZMod (p ^ 2)) * mulPHom p v.2 = 0 := by have hξ1 : ξ.1 = (ξ.1.val : ZMod (p ^ 2)) := (ZMod.natCast_zmod_val ξ.1).symm conv_lhs => rw [hξ1] simp only [mulPHom, AddMonoidHom.coe_mk, ZeroHom.coe_mk] have hnat : ((p * (ξ.1.val * v.1.val + ξ.2.val * v.2.val) : ℕ) : ZMod (p ^ 2)) = 0 := by rw [hk, ← mul_assoc, ← sq, Nat.cast_mul, ZMod.natCast_self, zero_mul] push_cast at hnat linear_combination hnat rw [harg0, AddChar.map_zero_eq_one] have hind : ∀ u : ZMod (p ^ 2) × ZMod p, indC C (u + g) = indC C u := by intro u have h1 := fourier_inversion_indC C (u + g) have h2 := fourier_inversion_indC C u have hsum : ∑ χ : AddChar (ZMod (p ^ 2) × ZMod p) ℂ, fourierCoeff C χ * χ (u + g) = ∑ χ : AddChar (ZMod (p ^ 2) × ZMod p) ℂ, fourierCoeff C χ * χ u := by rw [← Fintype.sum_bijective (charP2 p) (charP2_bijective p) (fun ξ => FP2 ξ * charP2 p ξ (u + g)) _ (fun _ => rfl), ← Fintype.sum_bijective (charP2 p) (charP2_bijective p) (fun ξ => FP2 ξ * charP2 p ξ u) _ (fun _ => rfl)] refine Finset.sum_congr rfl fun ξ _ => ?_ by_cases hF : FP2 ξ = 0 · simp [hF] · rw [AddChar.map_add_eq_mul, hchar_g ξ hF, mul_one] rw [h1, h2] at hsum have hcard : (Fintype.card (ZMod (p ^ 2) × ZMod p) : ℂ) ≠ 0 := Nat.cast_ne_zero.2 Fintype.card_ne_zero exact Nat.cast_injective (mul_left_cancel₀ hcard hsum) have himg : C.image (· + (-g)) = C := by ext u simp only [Finset.mem_image] constructor · rintro ⟨w, hw, rfl⟩ have h := hind (w + -g) have hsub : w + -g + g = w := by abel rw [hsub] at h unfold indC at h by_cases h1 : w ∈ C <;> by_cases h2 : w + -g ∈ C <;> simp_all · intro hu refine ⟨u + g, ?_, by abel⟩ have h := hind u unfold indC at h by_cases h1 : u + g ∈ C <;> by_cases h2 : u ∈ C <;> simp_all have hg0 : g = 0 := by have := hC (-g) himg simpa using congr_arg Neg.neg this have hv2 : v.2 = 0 := congr_arg Prod.snd hg0 have hv1 : v.1 = 0 := by have hfst : mulPHom p v.1 = 0 := congr_arg Prod.fst hg0 have hcast : ((p * v.1.val : ℕ) : ZMod (p ^ 2)) = 0 := by simpa [mulPHom, Nat.cast_mul] using hfst have hlt : p * v.1.val < p ^ 2 := by have := v.1.val_lt; nlinarith have hval := congr_arg ZMod.val hcast simp only [ZMod.val_natCast, Nat.mod_eq_of_lt hlt, ZMod.val_zero] at hval have hv1_0 : v.1.val = 0 := (mul_eq_zero.1 hval).resolve_left hp0 exact ZMod.val_injective p (by simpa using hv1_0) exact Prod.ext hv1 hv2 -- Pick two active characters `ξ, η` whose mod-`p` reductions are linearly independent. have hex1 : ∃ ξ : ZMod (p ^ 2) × ZMod p, FP2 ξ ≠ 0 ∧ red ξ ≠ 0 := by by_contra hall push Not at hall have h10 : ((1 : ZMod p), (0 : ZMod p)) = 0 := by apply horthog_modp intro ξ hF simp [hall ξ hF] exact one_ne_zero (congr_arg Prod.fst h10) obtain ⟨ξ, hFξ, hredξ⟩ := hex1 have hex2 : ∃ η : ZMod (p ^ 2) × ZMod p, FP2 η ≠ 0 ∧ (red ξ).1 * (red η).2 - (red ξ).2 * (red η).1 ≠ 0 := by by_contra hall push Not at hall have hv0 : (-(red ξ).2, (red ξ).1) = (0 : ZMod p × ZMod p) := by apply horthog_modp intro η hF have hdet := hall η hF linear_combination hdet apply hredξ ext · exact congr_arg Prod.snd hv0 · have := congr_arg Prod.fst hv0; simpa using this obtain ⟨η, hFη, hdet⟩ := hex2 -- Show `x ↦ (charP2 p ξ x, charP2 p η x)` is injective on `ZMod (p^2) × ZMod p`. let pair : (ZMod (p ^ 2) × ZMod p) → ℂ × ℂ := fun u => (charP2 p ξ u, charP2 p η u) have hpair_inj : Function.Injective pair := by intro u v huv have hfst : charP2 p ξ u = charP2 p ξ v := congr_arg Prod.fst huv have hsnd : charP2 p η u = charP2 p η v := congr_arg Prod.snd huv have h1 : charP2 p ξ (u - v) = 1 := by rw [AddChar.map_sub_eq_div, hfst, div_self (addChar_apply_ne_zero (charP2 p ξ) v)] have h2 : charP2 p η (u - v) = 1 := by rw [AddChar.map_sub_eq_div, hsnd, div_self (addChar_apply_ne_zero (charP2 p η) v)] let w := u - v have hw1 : ξ.1 * w.1 + (ξ.2.val : ZMod (p ^ 2)) * mulPHom p w.2 = 0 := by apply eN_injective (p ^ 2) simpa [charP2_apply, w] using h1 have hw2 : η.1 * w.1 + (η.2.val : ZMod (p ^ 2)) * mulPHom p w.2 = 0 := by apply eN_injective (p ^ 2) simpa [charP2_apply, w] using h2 -- Step A: `p ∣ w.1.val`! have hdiv_p : p ∣ w.1.val := by have hmod_eq : ∀ (ζ : ZMod (p ^ 2) × ZMod p), ζ.1 * w.1 + (ζ.2.val : ZMod (p ^ 2)) * mulPHom p w.2 = 0 → (red ζ).1 * (w.1.val : ZMod p) = 0 := by intro ζ hζ have hnat : p ^ 2 ∣ ζ.1.val * w.1.val + ζ.2.val * (p * w.2.val) := by rw [← ZMod.natCast_eq_zero_iff] simpa [mulPHom, Nat.cast_add, Nat.cast_mul, ZMod.natCast_zmod_val] using hζ have hp_dvd : p ∣ ζ.1.val * w.1.val + p * (ζ.2.val * w.2.val) := by have hsq : p ∣ p ^ 2 := ⟨p, sq p⟩ have hd := dvd_trans hsq hnat simpa [mul_left_comm, mul_assoc] using hd have hp_dvd1 : p ∣ ζ.1.val * w.1.val := (Nat.dvd_add_left ⟨ζ.2.val * w.2.val, rfl⟩).1 hp_dvd rw [← ZMod.natCast_eq_zero_iff] at hp_dvd1 simpa [red, Nat.cast_mul] using hp_dvd1 have hm1 := hmod_eq ξ hw1 have hm2 := hmod_eq η hw2 have hne_both : (red ξ).1 ≠ 0 ∨ (red η).1 ≠ 0 := by by_contra hboth push Not at hboth rw [hboth.1, hboth.2] at hdet simp at hdet have hw1p : (w.1.val : ZMod p) = 0 := by rcases hne_both with h | h · exact (mul_eq_zero.1 hm1).resolve_left h · exact (mul_eq_zero.1 hm2).resolve_left h exact (ZMod.natCast_eq_zero_iff w.1.val p).1 hw1p obtain ⟨q, hq⟩ := hdiv_p -- Step B: Divide by `p` to get `(red ξ) · (q, w.2) = 0` and `(red η) · (q, w.2) = 0` in `ZMod p`. have hq_lt : q < p := by have := w.1.val_lt; nlinarith have hlin : ∀ (ζ : ZMod (p ^ 2) × ZMod p), ζ.1 * w.1 + (ζ.2.val : ZMod (p ^ 2)) * mulPHom p w.2 = 0 → (red ζ).1 * (q : ZMod p) + (red ζ).2 * w.2 = 0 := by intro ζ hζ have hnat : p ^ 2 ∣ ζ.1.val * w.1.val + ζ.2.val * (p * w.2.val) := by rw [← ZMod.natCast_eq_zero_iff] simpa [mulPHom, Nat.cast_add, Nat.cast_mul, ZMod.natCast_zmod_val] using hζ rw [hq] at hnat have hfac : ζ.1.val * (p * q) + ζ.2.val * (p * w.2.val) = p * (ζ.1.val * q + ζ.2.val * w.2.val) := by ring rw [hfac] at hnat have hnat' : p * p ∣ p * (ζ.1.val * q + ζ.2.val * w.2.val) := by simpa only [sq] using hnat have hp_dvd : p ∣ ζ.1.val * q + ζ.2.val * w.2.val := (mul_dvd_mul_iff_left hp0).1 hnat' rw [← ZMod.natCast_eq_zero_iff] at hp_dvd simpa [red, Nat.cast_add, Nat.cast_mul, ZMod.natCast_zmod_val] using hp_dvd have hl1 := hlin ξ hw1 have hl2 := hlin η hw2 have hq0_mod : (q : ZMod p) = 0 := by have hmul : ((red ξ).1 * (red η).2 - (red ξ).2 * (red η).1) * (q : ZMod p) = 0 := by linear_combination (red η).2 * hl1 - (red ξ).2 * hl2 exact (mul_eq_zero.1 hmul).resolve_left hdet have hw2_0 : w.2 = 0 := by have hmul : ((red ξ).1 * (red η).2 - (red ξ).2 * (red η).1) * w.2 = 0 := by linear_combination -(red η).1 * hl1 + (red ξ).1 * hl2 exact (mul_eq_zero.1 hmul).resolve_left hdet have hq0 : q = 0 := by have hdvd := (ZMod.natCast_eq_zero_iff q p).1 hq0_mod rcases Nat.eq_zero_or_pos q with rfl | hpos · rfl · exact absurd (Nat.le_of_dvd hpos hdvd) (not_le_of_gt hq_lt) have hw1_0 : w.1 = 0 := by rw [hq0, mul_zero] at hq exact ZMod.val_injective (p ^ 2) (by simpa using hq) have hw0 : u - v = 0 := Prod.ext hw1_0 hw2_0 exact sub_eq_zero.1 hw0 -- Each of `charP2 p ξ` and `charP2 p η` takes at most 2 values on `Fiber C x₀`. let S₁ : Finset ℂ := (Fiber C x₀).image (charP2 p ξ) let S₂ : Finset ℂ := (Fiber C x₀).image (charP2 p η) have hS_le2 : ∀ (ζ : ZMod (p ^ 2) × ZMod p), FP2 ζ ≠ 0 → ((Fiber C x₀).image (charP2 p ζ)).card ≤ 2 := by intro ζ hF by_contra hgt have hge3 : 3 ≤ ((Fiber C x₀).image (charP2 p ζ)).card := by omega obtain ⟨t3, ht3_sub, ht3_card⟩ := Finset.exists_subset_card_eq hge3 obtain ⟨w₁, w₂, w₃, h12, h13, h23, ht3_eq⟩ := Finset.card_eq_three.1 ht3_card subst ht3_eq obtain ⟨u₁, hu₁, hu₁w⟩ := Finset.mem_image.1 (ht3_sub (by simp : w₁ ∈ ({w₁, w₂, w₃} : Finset ℂ))) obtain ⟨u₂, hu₂, hu₂w⟩ := Finset.mem_image.1 (ht3_sub (by simp : w₂ ∈ ({w₁, w₂, w₃} : Finset ℂ))) obtain ⟨u₃, hu₃, hu₃w⟩ := Finset.mem_image.1 (ht3_sub (by simp : w₃ ∈ ({w₁, w₂, w₃} : Finset ℂ))) have hr1 := mem_fiber_fourier hx₀ hu₁ (charP2 p ζ) have hr2 := mem_fiber_fourier hx₀ hu₂ (charP2 p ζ) have hr3 := mem_fiber_fourier hx₀ hu₃ (charP2 p ζ) have htri := unit_circle_re_eq_at_most_two hF ((charP2 p ζ).norm_apply u₁) ((charP2 p ζ).norm_apply u₂) ((charP2 p ζ).norm_apply u₃) (hr1.trans hr2.symm) (hr1.trans hr3.symm) rcases htri with h | h | h · exact h12 (hu₁w.symm.trans (h.trans hu₂w)) · exact h13 (hu₁w.symm.trans (h.trans hu₃w)) · exact h23 (hu₂w.symm.trans (h.trans hu₃w)) have hsub : (Fiber C x₀).image pair ⊆ S₁ ×ˢ S₂ := by intro w hw obtain ⟨u, hu, rfl⟩ := Finset.mem_image.1 hw exact Finset.mem_product.2 ⟨Finset.mem_image_of_mem _ hu, Finset.mem_image_of_mem _ hu⟩ calc (Fiber C x₀).card = ((Fiber C x₀).image pair).card := (Finset.card_image_of_injective _ hpair_inj).symm _ ≤ (S₁ ×ˢ S₂).card := Finset.card_le_card hsub _ = S₁.card * S₂.card := Finset.card_product S₁ S₂ _ ≤ 2 * 2 := Nat.mul_le_mul (hS_le2 ξ hFξ) (hS_le2 η hFη) _ = 4 := rfl end UpperBound section SharpAttainment variable {p : ℕ} [Fact p.Prime] /-- Reduction mod `p` from `ZMod (p^2)` to `ZMod p`. -/ private def modP (p : ℕ) [Fact p.Prime] (a : ZMod (p ^ 2)) : ZMod p := (a.val : ZMod p) private lemma modP_add (p : ℕ) [Fact p.Prime] (a b : ZMod (p ^ 2)) : modP p (a + b) = modP p a + modP p b := by have : NeZero (p ^ 2) := neZero_sq p unfold modP rw [ZMod.val_add] have hdiv : p ∣ p ^ 2 := ⟨p, sq p⟩ have hmod : (a.val + b.val) % p ^ 2 % p = (a.val + b.val) % p := Nat.mod_mod_of_dvd _ hdiv rw [← ZMod.natCast_mod, hmod, ZMod.natCast_mod, Nat.cast_add] private lemma modP_neg (p : ℕ) [Fact p.Prime] (a : ZMod (p ^ 2)) : modP p (-a) = -modP p a := by have h : modP p (a + -a) = modP p a + modP p (-a) := modP_add p a (-a) have h0 : modP p 0 = 0 := by simp [modP] rw [add_neg_cancel, h0] at h exact eq_neg_of_add_eq_zero_right h.symm private lemma modP_sub (p : ℕ) [Fact p.Prime] (a b : ZMod (p ^ 2)) : modP p (a - b) = modP p a - modP p b := by rw [sub_eq_add_neg, modP_add, modP_neg, ← sub_eq_add_neg] private lemma modP_mul_p (p : ℕ) [Fact p.Prime] (k : ZMod (p ^ 2)) : modP p ((p : ZMod (p ^ 2)) * k) = 0 := by have : NeZero (p ^ 2) := neZero_sq p unfold modP have hdiv : p ∣ ((p : ZMod (p ^ 2)) * k).val := by have hk : (p : ZMod (p ^ 2)) * k = ((p * k.val : ℕ) : ZMod (p ^ 2)) := by simp [Nat.cast_mul] rw [hk, ZMod.val_natCast] have h1 : p ∣ p * k.val := dvd_mul_right p k.val have h2 : p ∣ p ^ 2 := ⟨p, sq p⟩ exact (Nat.dvd_mod_iff h2).2 h1 exact (ZMod.natCast_eq_zero_iff _ p).2 hdiv /-- Explicit aperiodic core in `ZMod (p^2) × ZMod p` attaining fiber size `4` for every prime `p ≥ 5`. -/ def nonElemCore (p : ℕ) [Fact p.Prime] : Finset (ZMod (p ^ 2) × ZMod p) := haveI : NeZero (p ^ 2) := neZero_sq p Finset.univ.filter fun u => (u.1 = 0 ∨ u.1 = (p : ZMod (p ^ 2)) ∨ u.1 = -(p : ZMod (p ^ 2))) ∨ modP p u.1 = 2 ∨ ((modP p u.1 = 1 ∨ modP p u.1 = -1) ∧ u.2 = 0) /-- **Sharp Attainment Theorem (`ZMod (p^2) × ZMod p`)**: For every prime `p ≥ 5`, `nonElemCore p` is aperiodic, avoids `(2 * p, 1)`, and has exact fiber `{(2*p, 1), (2*p, -1), (-2*p, 1), (-2*p, -1)}` of cardinality `4 = 2^2`, strictly exceeding the elementary abelian rank-2 rigidity bound `2`. -/ theorem zmod_p2_prod_p_sharp_fiber_four {p : ℕ} [Fact p.Prime] (hp5 : 5 ≤ p) : haveI : NeZero (p ^ 2) := neZero_sq p let C := nonElemCore p let x₀ : ZMod (p ^ 2) × ZMod p := (2 * (p : ZMod (p ^ 2)), 1) IsAperiodic C ∧ x₀ ∉ C ∧ (Fiber C x₀).card = 4 := by let : NeZero (p ^ 2) := neZero_sq p have hp : p.Prime := Fact.out have h1p : (1 : ZMod p) ≠ 0 := one_ne_zero have h2p : (2 : ZMod p) ≠ 0 := by intro h have hdvd : p ∣ 2 := (ZMod.natCast_eq_zero_iff 2 p).1 (by simpa using h) have hle : p ≤ 2 := Nat.le_of_dvd (by omega) hdvd; omega have h3p : (3 : ZMod p) ≠ 0 := by intro h have hdvd : p ∣ 3 := (ZMod.natCast_eq_zero_iff 3 p).1 (by simpa using h) have hle : p ≤ 3 := Nat.le_of_dvd (by omega) hdvd; omega have h4p : (4 : ZMod p) ≠ 0 := by intro h have hdvd : p ∣ 4 := (ZMod.natCast_eq_zero_iff 4 p).1 (by simpa using h) have hle : p ≤ 4 := Nat.le_of_dvd (by omega) hdvd; omega have h2_ne_1 : (2 : ZMod p) ≠ 1 := fun h => h1p (by linear_combination h) have h2_ne_neg1 : (2 : ZMod p) ≠ -1 := fun h => h3p (by linear_combination h) have h1_ne_neg1 : (1 : ZMod p) ≠ -1 := fun h => h2p (by linear_combination h) have hneg1_ne_0 : (-1 : ZMod p) ≠ 0 := fun h => h1p (by linear_combination -h) -- Helper: `(k : ℕ) * p ≠ 0` in `ZMod (p^2)` for `0 < k < p`. have hkp_ne0 : ∀ k : ℕ, 0 < k → k < p → (k : ZMod (p ^ 2)) * (p : ZMod (p ^ 2)) ≠ 0 := by intro k hk0 hkp h have hcast : ((k * p : ℕ) : ZMod (p ^ 2)) = 0 := by simpa [Nat.cast_mul] using h have hdvd : p ^ 2 ∣ k * p := (ZMod.natCast_eq_zero_iff _ _).1 hcast rw [sq] at hdvd have hdvd' : p ∣ k := (mul_dvd_mul_iff_right hp.ne_zero).1 hdvd exact absurd (Nat.le_of_dvd hk0 hdvd') (not_le_of_gt hkp) have hp_ne0 : (p : ZMod (p ^ 2)) ≠ 0 := by simpa using hkp_ne0 1 (by omega) (by omega) have h2p_ne0 : (2 : ZMod (p ^ 2)) * (p : ZMod (p ^ 2)) ≠ 0 := hkp_ne0 2 (by omega) (by omega) have h3p_ne0 : (3 : ZMod (p ^ 2)) * (p : ZMod (p ^ 2)) ≠ 0 := hkp_ne0 3 (by omega) (by omega) have h4p_ne0 : (4 : ZMod (p ^ 2)) * (p : ZMod (p ^ 2)) ≠ 0 := hkp_ne0 4 (by omega) (by omega) have hmemC : ∀ u : ZMod (p ^ 2) × ZMod p, u ∈ nonElemCore p ↔ (u.1 = 0 ∨ u.1 = (p : ZMod (p ^ 2)) ∨ u.1 = -(p : ZMod (p ^ 2))) ∨ modP p u.1 = 2 ∨ ((modP p u.1 = 1 ∨ modP p u.1 = -1) ∧ u.2 = 0) := fun u => by simp [nonElemCore] -- 1. Show all 4 sites `(±2p, ±1)` avoid `nonElemCore p`. let s₁ : ZMod (p ^ 2) × ZMod p := (2 * (p : ZMod (p ^ 2)), 1) let s₂ : ZMod (p ^ 2) × ZMod p := (2 * (p : ZMod (p ^ 2)), -1) let s₃ : ZMod (p ^ 2) × ZMod p := (-(2 * (p : ZMod (p ^ 2))), 1) let s₄ : ZMod (p ^ 2) × ZMod p := (-(2 * (p : ZMod (p ^ 2))), -1) have hmod_2p : modP p (2 * (p : ZMod (p ^ 2))) = 0 := by rw [mul_comm]; exact modP_mul_p p 2 have hmod_n2p : modP p (-(2 * (p : ZMod (p ^ 2)))) = 0 := by rw [modP_neg, hmod_2p, neg_zero] have hsite_notC : ∀ x : ZMod (p ^ 2) × ZMod p, (x.1 = 2 * (p : ZMod (p ^ 2)) ∨ x.1 = -(2 * (p : ZMod (p ^ 2)))) → x ∉ nonElemCore p := by intro x hx hC rw [hmemC] at hC have hmx : modP p x.1 = 0 := by rcases hx with h | h <;> rw [h] <;> [exact hmod_2p; exact hmod_n2p] rcases hC with (h0 | hp1 | hnp1) | h2 | ⟨h1 | hn1, _⟩ · rcases hx with h | h · exact h2p_ne0 (h.symm.trans h0) · exact h2p_ne0 (by linear_combination -(h.symm.trans h0)) · rcases hx with h | h · exact hp_ne0 (by linear_combination h.symm.trans hp1) · exact h3p_ne0 (by linear_combination -(h.symm.trans hp1)) · rcases hx with h | h · exact h3p_ne0 (by linear_combination h.symm.trans hnp1) · exact hp_ne0 (by linear_combination -(h.symm.trans hnp1)) · exact h2p (hmx.symm.trans h2).symm · exact h1p (hmx.symm.trans h1).symm · exact hneg1_ne_0 (hmx.symm.trans hn1).symm have hs1_not : s₁ ∉ nonElemCore p := hsite_notC s₁ (Or.inl rfl) -- 2. Prove `IsAperiodic (nonElemCore p)`. have haper : IsAperiodic (nonElemCore p) := by intro g hg have hshift : ∀ u : ZMod (p ^ 2) × ZMod p, u ∈ nonElemCore p ↔ u + g ∈ nonElemCore p := by intro u constructor · intro hu; rw [← hg]; exact Finset.mem_image_of_mem _ hu · intro hug; rw [← hg] at hug obtain ⟨v, hv, hveq⟩ := Finset.mem_image.1 hug rwa [← add_right_cancel hveq] -- A coset `modP p a = c` is "full" (`∀ u, modP p u.1 = c → u ∈ C`) iff `c = 2`! have hfull_coset : ∀ c : ZMod p, (∀ u : ZMod (p ^ 2) × ZMod p, modP p u.1 = c → u ∈ nonElemCore p) ↔ c = 2 := by intro c constructor · intro hfull by_contra hc2 by_cases hc0 : c = 0 · exact hs1_not (hfull s₁ (by rw [hc0]; exact hmod_2p)) · let u : ZMod (p ^ 2) × ZMod p := ((c.val : ZMod (p ^ 2)), 1) have hmu : modP p u.1 = c := by unfold modP u have hlt : c.val < p ^ 2 := lt_trans c.val_lt (by nlinarith [hp.one_lt]) rw [ZMod.val_natCast, Nat.mod_eq_of_lt hlt, ZMod.natCast_zmod_val] have huC := (hmemC u).1 (hfull u hmu) rw [hmu] at huC rcases huC with (h0 | hp1 | hnp1) | h2 | ⟨_, hb0⟩ · exact hc0 (by rw [← hmu, h0]; simp [modP]) · exact hc0 (by rw [← hmu, hp1]; simpa using modP_mul_p p 1) · exact hc0 (by rw [← hmu, hnp1, modP_neg]; simpa using modP_mul_p p 1) · exact hc2 h2 · exact h1p hb0 · rintro rfl u hu rw [hmemC]; exact Or.inr (Or.inl hu) -- Therefore `g.1` preserves the unique full coset `modP = 2`, so `modP p g.1 = 0`! have hmg0 : modP p g.1 = 0 := by have h2g : modP p g.1 + 2 = 2 := by rw [← hfull_coset (modP p g.1 + 2)] intro u hu have hsub : modP p (u - g).1 = 2 := by simp only [Prod.fst_sub, modP_sub, hu]; ring have hmem : u - g ∈ nonElemCore p := (hfull_coset 2).2 rfl (u - g) hsub simpa [sub_add_cancel] using (hshift (u - g)).1 hmem linear_combination h2g -- Since `modP p g.1 = 0`, `g.1` preserves the slice `{a | modP p a = 0} ∩ C = {0, p, -p} × ZMod p`! have hg1_0 : g.1 = 0 := by have h0in : ((0 : ZMod (p ^ 2)), (0 : ZMod p)) ∈ nonElemCore p := by rw [hmemC]; left; left; rfl have hpin : ((p : ZMod (p ^ 2)), (0 : ZMod p)) ∈ nonElemCore p := by rw [hmemC]; left; right; left; rfl have hnpin : (-(p : ZMod (p ^ 2)), (0 : ZMod p)) ∈ nonElemCore p := by rw [hmemC]; left; right; right; rfl have hslice : ∀ (a : ZMod (p ^ 2)) (b : ZMod p), modP p a = 0 → ((a, b) ∈ nonElemCore p ↔ a = 0 ∨ a = p ∨ a = -p) := by intro a b hma rw [hmemC, hma] simp [h2p.symm, h1p.symm, hneg1_ne_0.symm] have h0' : g.1 = 0 ∨ g.1 = p ∨ g.1 = -p := by have hadd : ((0 : ZMod (p ^ 2)), (0 : ZMod p)) + g = (g.1, g.2) := Prod.ext (zero_add g.1) (zero_add g.2) have hmem : (g.1, g.2) ∈ nonElemCore p := by rw [← hadd]; exact (hshift (0, 0)).1 h0in exact (hslice g.1 g.2 hmg0).1 hmem have hp' : p + g.1 = 0 ∨ p + g.1 = p ∨ p + g.1 = -p := by have hm : modP p (p + g.1) = 0 := by rw [modP_add, hmg0, add_zero]; simpa using modP_mul_p p 1 have hadd : ((p : ZMod (p ^ 2)), (0 : ZMod p)) + g = (p + g.1, g.2) := Prod.ext rfl (zero_add g.2) have hmem : (p + g.1, g.2) ∈ nonElemCore p := by rw [← hadd]; exact (hshift (p, 0)).1 hpin exact (hslice (p + g.1) g.2 hm).1 hmem have hnp' : -p + g.1 = 0 ∨ -p + g.1 = p ∨ -p + g.1 = -p := by have hm : modP p (-p + g.1) = 0 := by rw [modP_add, modP_neg, hmg0, add_zero]; simpa using modP_mul_p p 1 have hadd : (-(p : ZMod (p ^ 2)), (0 : ZMod p)) + g = (-p + g.1, g.2) := Prod.ext rfl (zero_add g.2) have hmem : (-p + g.1, g.2) ∈ nonElemCore p := by rw [← hadd]; exact (hshift (-p, 0)).1 hnpin exact (hslice (-p + g.1) g.2 hm).1 hmem rcases h0' with h | h | h · exact h · rcases hp' with h1 | h1 | h1 · exact absurd (by linear_combination h1 - h : (2 : ZMod (p ^ 2)) * p = 0) h2p_ne0 · exact absurd (by linear_combination h1 - h : (p : ZMod (p ^ 2)) = 0) hp_ne0 · exact absurd (by linear_combination h1 - h : (3 : ZMod (p ^ 2)) * p = 0) h3p_ne0 · rcases hnp' with h1 | h1 | h1 · exact absurd (by linear_combination -(h1 - h) : (2 : ZMod (p ^ 2)) * p = 0) h2p_ne0 · exact absurd (by linear_combination -(h1 - h) : (3 : ZMod (p ^ 2)) * p = 0) h3p_ne0 · exact absurd (by linear_combination -h1 + h : (p : ZMod (p ^ 2)) = 0) hp_ne0 -- Finally, `g.1 = 0` and the mask `modP a = 1 ∧ b = 0` force `g.2 = 0`! have hg2_0 : g.2 = 0 := by have : Fact (1 < p ^ 2) := ⟨by nlinarith [hp.one_lt]⟩ have hm1 : modP p (1 : ZMod (p ^ 2)) = 1 := by unfold modP have hv : (1 : ZMod (p ^ 2)).val = 1 := ZMod.val_one (p ^ 2) rw [hv]; simp have hu1 : ((1 : ZMod (p ^ 2)), (0 : ZMod p)) ∈ nonElemCore p := by rw [hmemC]; right; right; exact ⟨Or.inl hm1, rfl⟩ have hug := (hmemC ((1, 0) + g)).1 ((hshift _).1 hu1) have hf : ((1, 0) + g).1 = 1 := by simp [hg1_0] have hs : ((1, 0) + g).2 = g.2 := by simp rw [hf, hs, hm1] at hug have hmp : modP p (p : ZMod (p ^ 2)) = 0 := by simpa using modP_mul_p p 1 rcases hug with (h0 | hp1 | hnp1) | h2 | ⟨_, hb⟩ · exact absurd (by rw [← hm1, h0]; simp [modP]) h1p · exact absurd (by rw [← hm1, hp1, hmp]) h1p · exact absurd (by rw [← hm1, hnp1, modP_neg, hmp, neg_zero]) h1p · exact absurd h2.symm h2_ne_1 · exact hb exact Prod.ext hg1_0 hg2_0 -- 3. Prove all 4 sites `s₁, s₂, s₃, s₄` belong to `Fiber (nonElemCore p) s₁`. have hsite_in_fiber : ∀ x : ZMod (p ^ 2) × ZMod p, (x.1 = 2 * (p : ZMod (p ^ 2)) ∨ x.1 = -(2 * (p : ZMod (p ^ 2)))) → (x.2 = 1 ∨ x.2 = -1) → x ∈ Fiber (nonElemCore p) s₁ := by intro x hx1 hx2 rw [mem_fiber_iff (nonElemCore p) hs1_not] refine ⟨hsite_notC x hx1, ?_⟩ have hmx : modP p x.1 = 0 := by rcases hx1 with h | h <;> rw [h] <;> [exact hmod_2p; exact hmod_n2p] intro t have hmp_x : modP p (x + t).1 = modP p t.1 := by simp [modP_add, hmx] have hmm_x : modP p (x - t).1 = -modP p t.1 := by simp [modP_sub, hmx] have hmp_0 : modP p (s₁ + t).1 = modP p t.1 := by simp [s₁, modP_add, hmod_2p] have hmm_0 : modP p (s₁ - t).1 = -modP p t.1 := by simp [s₁, modP_sub, hmod_2p] by_cases ht0 : modP p t.1 = 0 · -- In the `modP = 0` coset, `C` is `{0, p, -p} × ZMod p` (symmetric around `0`!). have hslice : ∀ u : ZMod (p ^ 2) × ZMod p, modP p u.1 = 0 → (u ∈ nonElemCore p ↔ u.1 = 0 ∨ u.1 = p ∨ u.1 = -p) := by intro u hmu; rw [hmemC, hmu]; simp [h2p.symm, h1p.symm, hneg1_ne_0.symm] have h1 := hslice (x + t) (by rw [hmp_x, ht0]) have h2 := hslice (x - t) (by rw [hmm_x, ht0, neg_zero]) have h3 := hslice (s₁ + t) (by rw [hmp_0, ht0]) have h4 := hslice (s₁ - t) (by rw [hmm_0, ht0, neg_zero]) unfold indC simp only [h1, h2, h3, h4, Prod.fst_add, Prod.fst_sub, s₁] rcases hx1 with hx | hx · rw [hx] · rw [hx] have e1 : (-(2 * (p : ZMod (p ^ 2))) + t.1 = 0 ∨ -(2 * (p : ZMod (p ^ 2))) + t.1 = p ∨ -(2 * (p : ZMod (p ^ 2))) + t.1 = -p) ↔ (2 * (p : ZMod (p ^ 2)) - t.1 = 0 ∨ 2 * (p : ZMod (p ^ 2)) - t.1 = p ∨ 2 * (p : ZMod (p ^ 2)) - t.1 = -p) := by constructor <;> rintro (h | h | h) · left; linear_combination -h · right; right; linear_combination -h · right; left; linear_combination -h · left; linear_combination -h · right; right; linear_combination -h · right; left; linear_combination -h have e2 : (-(2 * (p : ZMod (p ^ 2))) - t.1 = 0 ∨ -(2 * (p : ZMod (p ^ 2))) - t.1 = p ∨ -(2 * (p : ZMod (p ^ 2))) - t.1 = -p) ↔ (2 * (p : ZMod (p ^ 2)) + t.1 = 0 ∨ 2 * (p : ZMod (p ^ 2)) + t.1 = p ∨ 2 * (p : ZMod (p ^ 2)) + t.1 = -p) := by constructor <;> rintro (h | h | h) · left; linear_combination -h · right; right; linear_combination -h · right; left; linear_combination -h · left; linear_combination -h · right; right; linear_combination -h · right; left; linear_combination -h simp only [e1, e2]; omega · -- Outside `modP = 0`: `u ∈ C` depends ONLY on `modP p u.1` (and `u.2 = 0` when `modP = ±1`). have hnotin0 : ∀ u : ZMod (p ^ 2) × ZMod p, modP p u.1 ≠ 0 → (u ∈ nonElemCore p ↔ modP p u.1 = 2 ∨ ((modP p u.1 = 1 ∨ modP p u.1 = -1) ∧ u.2 = 0)) := by intro u hmu rw [hmemC] constructor · rintro ((h0 | hp1 | hnp1) | hrest) · exact absurd (by rw [h0]; simp [modP]) hmu · exact absurd (by rw [hp1]; simpa using modP_mul_p p 1) hmu · exact absurd (by rw [hnp1, modP_neg]; simpa using modP_mul_p p 1) hmu · exact hrest · exact Or.inr have hnt0 : -modP p t.1 ≠ 0 := neg_ne_zero.2 ht0 by_cases ht1 : modP p t.1 = 1 ∨ modP p t.1 = -1 · have hnt1 : -modP p t.1 = 1 ∨ -modP p t.1 = -1 := by rcases ht1 with h | h · right; rw [h] · left; rw [h, neg_neg] have hne2 : modP p t.1 ≠ 2 := by rcases ht1 with h | h <;> rw [h] · exact h2_ne_1.symm · exact h2_ne_neg1.symm have hnne2 : -modP p t.1 ≠ 2 := by rcases hnt1 with h | h <;> rw [h] · exact h2_ne_1.symm · exact h2_ne_neg1.symm have hnt1' : -modP p t.1 = 1 ∨ modP p t.1 = 1 := by rcases hnt1 with h | h · exact Or.inl h · exact Or.inr (neg_inj.1 h) have h1 : x + t ∈ nonElemCore p ↔ x.2 + t.2 = 0 := by rw [hnotin0 (x + t) (by rw [hmp_x]; exact ht0), hmp_x]; simp [hne2, ht1] have h2 : x - t ∈ nonElemCore p ↔ x.2 - t.2 = 0 := by rw [hnotin0 (x - t) (by rw [hmm_x]; exact hnt0), hmm_x]; simp [hnne2, hnt1'] have h3 : s₁ + t ∈ nonElemCore p ↔ 1 + t.2 = 0 := by rw [hnotin0 (s₁ + t) (by rw [hmp_0]; exact ht0), hmp_0]; simp [s₁, hne2, ht1] have h4 : s₁ - t ∈ nonElemCore p ↔ 1 - t.2 = 0 := by rw [hnotin0 (s₁ - t) (by rw [hmm_0]; exact hnt0), hmm_0]; simp [s₁, hnne2, hnt1'] unfold indC simp only [h1, h2, h3, h4] rcases hx2 with h | h · rw [h] · rw [h] have e1 : (-1 + t.2 = 0) ↔ (1 - t.2 = 0) := ⟨fun hh => by linear_combination -hh, fun hh => by linear_combination -hh⟩ have e2 : (-1 - t.2 = 0) ↔ (1 + t.2 = 0) := ⟨fun hh => by linear_combination -hh, fun hh => by linear_combination -hh⟩ simp only [e1, e2]; omega · push Not at ht1 have hnt1 : -modP p t.1 ≠ 1 ∧ -modP p t.1 ≠ -1 := ⟨fun h => ht1.2 (by linear_combination -h), fun h => ht1.1 (by linear_combination -h)⟩ have h1 : x + t ∈ nonElemCore p ↔ modP p t.1 = 2 := by rw [hnotin0 (x + t) (by rw [hmp_x]; exact ht0), hmp_x]; simp [ht1.1, ht1.2] have h2 : x - t ∈ nonElemCore p ↔ -modP p t.1 = 2 := by rw [hnotin0 (x - t) (by rw [hmm_x]; exact hnt0), hmm_x]; simp [hnt1.1, hnt1.2] have h3 : s₁ + t ∈ nonElemCore p ↔ modP p t.1 = 2 := by rw [hnotin0 (s₁ + t) (by rw [hmp_0]; exact ht0), hmp_0]; simp [ht1.1, ht1.2] have h4 : s₁ - t ∈ nonElemCore p ↔ -modP p t.1 = 2 := by rw [hnotin0 (s₁ - t) (by rw [hmm_0]; exact hnt0), hmm_0]; simp [hnt1.1, hnt1.2] unfold indC simp only [h1, h2, h3, h4] -- 4. Combine the 4 distinct sites in `Fiber` with the upper bound `≤ 4`! have hsub4 : ({s₁, s₂, s₃, s₄} : Finset (ZMod (p ^ 2) × ZMod p)) ⊆ Fiber (nonElemCore p) s₁ := by intro x hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl | rfl · exact hsite_in_fiber s₁ (Or.inl rfl) (Or.inl rfl) · exact hsite_in_fiber s₂ (Or.inl rfl) (Or.inr rfl) · exact hsite_in_fiber s₃ (Or.inr rfl) (Or.inl rfl) · exact hsite_in_fiber s₄ (Or.inr rfl) (Or.inr rfl) have h2p_ne_n2p : (2 : ZMod (p ^ 2)) * (p : ZMod (p ^ 2)) ≠ -(2 * (p : ZMod (p ^ 2))) := fun h => h4p_ne0 (by linear_combination h) have hcard4 : ({s₁, s₂, s₃, s₄} : Finset (ZMod (p ^ 2) × ZMod p)).card = 4 := by rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] · simp [s₃, s₄, h1_ne_neg1] · simp [s₂, s₃, s₄, h2p_ne_n2p] · simp [s₁, s₂, s₃, s₄, h1_ne_neg1, h2p_ne_n2p] have hge4 : 4 ≤ (Fiber (nonElemCore p) s₁).card := hcard4 ▸ Finset.card_le_card hsub4 have hle4 : (Fiber (nonElemCore p) s₁).card ≤ 4 := zmod_p2_prod_p_fiber_card_le_four (nonElemCore p) haper hs1_not exact ⟨haper, hs1_not, le_antisymm hle4 hge4⟩ end SharpAttainment #print axioms zmod_p2_prod_p_fiber_card_le_four #print axioms zmod_p2_prod_p_sharp_fiber_four end OpenAlgebraTopology.NonElemRank2