Aether Catalog definitions — MachineLearning_NumberTheory_ParityCensus
DefinitionMachineLearning_NumberTheory_ParityCensusaether-catalogmachinelearning
Definition bundle for the Aether Catalog module MachineLearning.NumberTheory.ParityCensus, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from MachineLearning/NumberTheory/ParityCensus.lean by skeleton subtraction import Mathlib /- Copyright (c) 2025. All rights reserved. The k-ary Parity Census Law for additive prime decompositions. -/ /-! # k-ary Parity Census Law In any additive decomposition of a natural number into primes, the count of 2s is governed by a universal parity constraint: `countTwos L ≡ L.sum + L.length (mod 2)` This is because every odd prime contributes 1 mod 2, so the sum mod 2 equals the number of odd primes mod 2 = (length - countTwos) mod 2. ## Main Results * `prime_mod2` — a prime satisfies `p % 2 = if p = 2 then 0 else 1` * `count_twos_parity_of_prime_sum` — the universal parity census law * `count_twos_parity_of_prime_decomposition` — target-sum version * `count_twos_parity_2` — specialization to Goldbach pairs * `count_twos_parity_4` — specialization to arity 4 -/ namespace PrimeDecomp /-- Count the number of 2s in a list of natural numbers. -/ def countTwos (L : List ℕ) : ℕ := L.count 2 /- A prime number satisfies `p % 2 = if p = 2 then 0 else 1`. -/ /- **The k-ary Parity Census Law.** For any list of primes, the count of 2s satisfies `countTwos L % 2 = (L.sum + L.length) % 2`. This is a universal conservation law: in any additive prime decomposition `a₁ + a₂ + ⋯ + aₖ = n`, the number of indices with `aᵢ = 2` has the same parity as `n + k`. -/ /- Parity census law with explicit target sum. -/ /- Specialization to arity 2 (Goldbach pairs). -/ /- Specialization to arity 4. -/ end PrimeDecomp