/-Copyright (c) 2026 Carles MarΓn. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles MarΓn-/module public import Mathlib.FieldTheory.Finite.Basicpublic import Mathlib.Algebra.Polynomial.Derivativepublic import Mathlib.Tactic.Ring /-!# Iterating `X d/dX` over `ZMod p` Over `ZMod p`, the operator `D = X Β· d/dX` acts on `X^m` as multiplication by `m`. Iterating it`p β 1` times kills exactly the monomials whose exponent is divisible by `p` and fixes the others(Fermat's little theorem): `D^[pβ1]` is the identity minus the projection onto the `p`-divisibleexponents, the kernel of the Cartier operator. ## Main results * `ConjeturaC.D_iter_X_pow`: `D^[k] (X^m) = C (m^k) * X^m`.* `ConjeturaC.D_iter_card_sub_one`: `D^[pβ1] (X^m) = if p β£ m then 0 else X^m`.* `ConjeturaC.D_iter_cartier`: `D^[pβ1] f = f β β_{m β supp f, p β£ m} C (f.coeff m) * X^m`.-/ @[expose] public section open Polynomial Finset namespace ConjeturaC variable {p : β} [hp : Fact p.Prime] /-- The Euler operator `D f = X * f'` on `(ZMod p)[X]`. -/noncomputable def D (p : β) (f : Polynomial (ZMod p)) : Polynomial (ZMod p) := X * derivative f /-- `D` as a linear endomorphism. -/noncomputable def Dlin (p : β) : Module.End (ZMod p) (Polynomial (ZMod p)) := LinearMap.mulLeft (ZMod p) (X : Polynomial (ZMod p)) ββ derivative omit hp intheorem D_iter_eq (k : β) : (D p)^[k] = β(Dlin p ^ k) := by rw [Module.End.coe_pow]; rfl theorem D_C_mul_X_pow (a : ZMod p) (m : β) : D p (C a * X ^ m) = C (a * (m : ZMod p)) * X ^ m := by unfold D rw [derivative_C_mul_X_pow] rcases m with _ | m Β· simp Β· rw [Nat.add_sub_cancel, pow_succ]; ring theorem D_iter_C_mul_X_pow (a : ZMod p) (k m : β) : (D p)^[k] (C a * X ^ m) = C (a * (m : ZMod p) ^ k) * X ^ m := by induction k generalizing a with | zero => simp | succ k ih => rw [Function.iterate_succ_apply, D_C_mul_X_pow, ih, pow_succ]; ring_nf /-- (a) -/theorem D_iter_X_pow (k m : β) : (D p)^[k] (X ^ m) = C ((m : ZMod p) ^ k) * X ^ m := by simpa using D_iter_C_mul_X_pow (p := p) 1 k m theorem pow_card_sub_one_natCast (m : β) : (m : ZMod p) ^ (p - 1) = if p β£ m then 0 else 1 := by simp only [ZMod.pow_card_sub_one, ne_eq, ZMod.natCast_eq_zero_iff, ite_not] /-- (b) -/theorem D_iter_card_sub_one (m : β) : (D p)^[p - 1] (X ^ m) = if p β£ m then 0 else X ^ m := by rw [D_iter_X_pow, pow_card_sub_one_natCast] split_ifs <;> simp /-- (c) -/theorem D_iter_cartier (f : Polynomial (ZMod p)) : (D p)^[p - 1] f = f - β m β f.support with p β£ m, C (f.coeff m) * X ^ m := by conv_lhs => rw [f.as_sum_support_C_mul_X_pow] conv_rhs => arg 1; rw [f.as_sum_support_C_mul_X_pow] rw [D_iter_eq, map_sum, β D_iter_eq] simp_rw [D_iter_C_mul_X_pow, pow_card_sub_one_natCast] rw [Finset.sum_filter, β Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun m _ => ?_ split_ifs <;> simp end ConjeturaC