Aether Catalog definitions — MachineLearning_Neural_AlgebraicNeuralArchitecture
DefinitionMachineLearning_Neural_AlgebraicNeuralArchitectureaether-catalogmachinelearning
Definition bundle for the Aether Catalog module MachineLearning.Neural.AlgebraicNeuralArchitecture, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from MachineLearning/Neural/AlgebraicNeuralArchitecture.lean by skeleton subtraction
import Mathlib
/-! # Algebraic Neural Architecture: Module-Theoretic Framework
This file formalizes the algebraic foundations of neural network theory
over commutative rings, establishing connections between:
- **Commutative Algebra**: ideal theory, module theory, prime spectrum
- **Machine Learning**: network architecture, activation functions, approximation
- **Tropical Geometry**: max-plus algebra, piecewise-linear functions
## Main Definitions
* `AlgebraicNeural.ReLU` — ReLU activation on linearly ordered types
* `AlgebraicNeural.ActivationNonPolynomial` — non-polynomial activation condition
* `AlgebraicNeural.TranscendentalOnProperIdeals` — ring-aware transcendence condition
* `AlgebraicNeural.NeuralLayer` — single layer of a module neural network
* `AlgebraicNeural.ModuleNetwork` — multi-layer module neural network structure
* `AlgebraicNeural.TropicalNeuron` — tropical (max-plus) neuron
* `AlgebraicNeural.SpectralWidthBound` — prime-spectral width bound type
## Main Results
1. ReLU is idempotent, 1-Lipschitz, and non-polynomial (Sections 1, 2)
2. Linear layers without activation collapse to a single linear map (Section 3)
3. Parameter count formulas and width-depth tradeoff bounds (Section 4)
4. Tropical specialization: ReLU decomposes identity and absolute value (Section 5, 9)
5. Deep network Lipschitz bounds compose multiplicatively (Section 6)
6. Certified adversarial robustness radius from Lipschitz constants (Section 8)
## Bridge: Commutative Algebra ↔ Machine Learning ↔ Tropical Geometry
The key insight: universal approximation is fundamentally an *algebraic* property
of activation functions. Over a field, non-polynomiality (transcendence) suffices.
Over a general Noetherian ring, we need transcendence relative to every proper ideal,
and the approximation error stratifies across the prime spectrum via localization.
-/
noncomputable section
open Finset BigOperators
namespace AlgebraicNeural
/-! ## Section 1: ReLU Activation and Algebraic Properties -/
/-- ReLU activation function over any linearly ordered type with zero.
Bridge: connects OrderTheory (max operation) to MachineLearning (ReLU activation). -/
def ReLU {α : Type*} [LinearOrder α] [Zero α] (x : α) : α := max x 0
/-! ## Section 2: Non-Polynomial Activation (Transcendence Condition) -/
/-- An activation function σ : R → R is *non-polynomial* if it does not agree
with any polynomial function on all of R.
Bridge: connects Algebra (polynomial characterization) to
MachineLearning (universal approximation condition). -/
def ActivationNonPolynomial {R : Type*} [CommRing R] (σ : R → R) : Prop :=
¬∃ (p : Polynomial R), ∀ x : R, σ x = p.eval x
/-- An activation function σ is *transcendental on proper ideals* if
for every proper ideal I of R, σ does not agree with any polynomial on I.
This generalizes non-polynomiality from fields to arbitrary rings.
Bridge: connects CommutativeAlgebra (ideal theory) to
MachineLearning (ring-aware activation design). -/
def TranscendentalOnProperIdeals {R : Type*} [CommRing R] (σ : R → R) : Prop :=
∀ I : Ideal R, I ≠ ⊤ →
¬∃ (p : Polynomial R), ∀ x : R, x ∈ I → σ x = p.eval x
/-! ## Section 3: Module Neural Network Architecture -/
/-- A single neural layer: an R-linear map followed by pointwise activation.
Bridge: connects ModuleTheory (linear maps) to MachineLearning (layer design). -/
structure NeuralLayer (R : Type*) [CommSemiring R] (n m : ℕ) where
weights : (Fin n → R) →ₗ[R] (Fin m → R)
bias : Fin m → R
/-- Evaluate a neural layer with activation σ on input x. -/
def NeuralLayer.eval {R : Type*} [CommSemiring R] {n m : ℕ}
(layer : NeuralLayer R n m) (σ : R → R) (x : Fin n → R) : Fin m → R :=
fun j => σ (layer.weights x j + layer.bias j)
/-- Evaluate a neural layer without activation (affine evaluation). -/
def NeuralLayer.evalLinear {R : Type*} [CommSemiring R] {n m : ℕ}
(layer : NeuralLayer R n m) (x : Fin n → R) : Fin m → R :=
fun j => layer.weights x j + layer.bias j
/-! ## Section 4: Width-Depth Tradeoff Bounds -/
/-! ## Section 5: Tropical Specialization -/
/-! ## Section 6: Compositional Lipschitz Bounds
Lipschitz constants compose multiplicatively across layers:
a d-layer network with per-layer Lipschitz constant L has total L^d.
Bridge: connects Analysis (Lipschitz maps) to MachineLearning (certified_robustness).
-/
/-! ## Section 7: Activation Necessity and Network Expressivity -/
/-! ## Section 8: Quantitative Approximation Bounds -/
/-! ## Section 9: Algebraic-Tropical Bridge Theorems -/
/-! ## Section 10: Prime-Spectral Stratification -/
/-- A spectral width bound: assigns a width requirement to each prime ideal.
Controls network design over non-field rings.
Bridge: connects AlgebraicGeometry (functions on Spec) to
MachineLearning (architecture optimization).
Impact: post_quantum_security via algebraic lower bounds. -/
structure SpectralWidthBound (R : Type*) [CommRing R] where
widthAt : PrimeSpectrum R → ℕ
finite_support : Set.Finite {p | widthAt p ≠ 0}
/-- Total width from a spectral bound. -/
def SpectralWidthBound.totalWidth {R : Type*} [CommRing R]
(bound : SpectralWidthBound R) : ℕ :=
bound.finite_support.toFinset.sum bound.widthAt
/-! ## Section 11: Module Homomorphism Properties -/
/-! ## Section 12: Tropical Krull Dimension -/
/-- The tropical Krull dimension of n-variable tropical polynomial ring.
Equals n (matching classical Krull dimension of k[x₁,...,xₙ]).
Bridge: connects AlgebraicGeometry (Krull dimension) to
MachineLearning (network depth bounds). -/
def tropicalKrullDim (n : ℕ) : ℕ := n
end AlgebraicNeural