Aether Catalog definitions — Evergreen_ArchitectureOfMathematicalReality_IdempotentCounting
DefinitionEvergreen_ArchitectureOfMathematicalReality_IdempotentCountingaether-catalogevergreen
Definition bundle for the Aether Catalog module Evergreen.ArchitectureOfMathematicalReality.IdempotentCounting, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from Evergreen/ArchitectureOfMathematicalReality/IdempotentCounting.lean by skeleton subtraction
import Mathlib
/-
# Idempotent Counting: The 2^ω(n) Formula
The number of idempotent elements in ℤ/nℤ is exactly 2^ω(n),
where ω(n) counts the distinct prime factors of n.
-/
open Finset BigOperators
noncomputable section
namespace IdempotentCounting
/-- An element e is idempotent iff e * e = e -/
def IsIdem {R : Type*} [Mul R] (e : R) : Prop := e * e = e
/-- The set of idempotents in ℤ/nℤ -/
def idemSet (n : ℕ) [NeZero n] : Finset (ZMod n) :=
Finset.univ.filter (fun e => e * e = e)
/-- Count of idempotents in ℤ/nℤ -/
def idemCount (n : ℕ) [NeZero n] : ℕ := (idemSet n).card
/-! ## Computational verification of 2^ω(n) -/
/-! ## Algebraic structure of idempotents -/
/-! ## The Master Equation: Im(O) = Fix(O) -/
/-! ## Gaussian binomial coefficients -/
/-- Gaussian binomial coefficient [n choose k]_q -/
def gaussBinom : ℕ → ℕ → ℕ → ℕ
| _, 0, _ => 1
| 0, _ + 1, _ => 0
| n + 1, k + 1, q => q^(k+1) * gaussBinom n k q + gaussBinom n (k+1) q
/-- Total idempotent-analog count for matrix rings: Σ [n choose k]_q -/
def totalProjections (n q : ℕ) : ℕ :=
∑ r ∈ Finset.range (n + 1), gaussBinom n r q
/-
Boolean ring theorem: if every element is idempotent, the ring is commutative.
Proof: (a+b)² = a+b implies ab + ba = 0. Also x² = x implies 2x = 0
(from (x+x)² = x+x). So ab = -ba = ba.
-/
end IdempotentCounting