Aether Catalog definitions — Bridges_FunctorialDecoding
DefinitionBridges_FunctorialDecodingaether-catalogbridges
Definition bundle for the Aether Catalog module Bridges.FunctorialDecoding, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from Bridges/FunctorialDecoding.lean by skeleton subtraction
import Mathlib
import Definitions.Def_Bridges_HammingMetric
import Definitions.Def_Bridges_OperadicCodingTheory_OperadAlgebraCode
/-!
# Functorial Decoding Certification for Operadic Codes
Bridge: connects **category theory** (functors) to **cryptography**
(certified decoding) and **ML** (neural network robustness verification).
## Main definitions
- `CodeFamily`: Parameterized families of codes
- `IteratedComposite`: Multi-level code composition
- `PostQuantumParams`: Parameter constraints for post-quantum security
- `BoundedWeightChannel`: Error channel model
- `TropicalCodeParams`: Tropical semiring codes
- `NeuralLayerSpec`: Neural network layer as code
## Main results
- `iterated_composite_length`: Length is exponential in levels
- `iterated_composite_dimension`: Dimension is exponential
- `security_requires_length`: Post-quantum security needs long codes
- `mds_optimal_correction`: MDS codes maximize correction radius
- `correction_contracts`: Error correction contracts distances
-/
noncomputable section
/-! ## Section 1: Code Family Theory -/
/-- A family of codes parameterized by a security parameter.
Bridge: connects parameterized complexity to coding theory.
Application: post_quantum_security code families for lattice_crypto. -/
structure CodeFamily where
/-- The code at security level s -/
code : ℕ → LinearCodeParams
/-- Lengths grow with security parameter -/
length_mono : ∀ s₁ s₂, s₁ ≤ s₂ → (code s₁).length ≤ (code s₂).length
/-- Distances grow with security parameter -/
dist_mono : ∀ s₁ s₂, s₁ ≤ s₂ → (code s₁).minDist ≤ (code s₂).minDist
/-- A code family achieves asymptotic MDS.
Bridge: connects asymptotic analysis to coding theory. -/
def CodeFamily.asymptoticMDS (F : CodeFamily) : Prop :=
∃ s₀, ∀ s, s₀ ≤ s →
(F.code s).minDist + (F.code s).dimension ≥ (F.code s).length
/-- Constant code family: same code at every level. -/
def constCodeFamily (C : LinearCodeParams) : CodeFamily where
code _ := C
length_mono _ _ _ := le_refl _
dist_mono _ _ _ := le_refl _
/-! ## Section 2: Iterated Code Composition -/
/-- Iterated operadic composition: compose a code with itself k times.
Bridge: connects iteration to operadic composition.
Application: multi-level post_quantum_security code towers. -/
def IteratedComposite : ℕ → LinearCodeParams → LinearCodeParams
| 0, C => C
| n + 1, C => OperadicCodeComposite (IteratedComposite n C) C
/-! ## Section 3: Post-Quantum Security Parameters -/
/-- Parameter constraints for post-quantum security.
Bridge: connects coding theory to lattice_crypto.
Application: certified post_quantum_security parameter selection. -/
structure PostQuantumParams where
codeParams : LinearCodeParams
securityLevel : ℕ
security_margin : codeParams.minDist ≥ securityLevel / 8
rate_bound : 4 * codeParams.dimension ≥ codeParams.length
/-! ## Section 4: Error Model Theory -/
/-! ## Section 5: Decoder Complexity Certificates -/
/-! ## Section 6: Lipschitz Bounds for Decoding -/
/-! ## Section 7: Tropical Operad Connection -/
/-- A tropical semiring code: codes over the min-plus algebra.
Bridge: connects tropical geometry to coding theory.
Application: tropical_hash_collision resistance bounds. -/
structure TropicalCodeParams where
length : ℕ
tropicalDist : ℕ
dist_pos : 0 < tropicalDist
tropical_singleton : tropicalDist ≤ length
/-! ## Section 8: Neural Network Coding Bridge -/
/-- A neural network layer with error coding interpretation.
Bridge: connects neural_network architecture to coding theory.
Application: certified_robustness via error-correcting code analogy. -/
structure NeuralLayerSpec where
inputDim : ℕ
outputDim : ℕ
marginDist : ℕ
margin_pos : 0 < marginDist
output_le_input : outputDim ≤ inputDim
/-- Convert a neural layer spec to code parameters.
Bridge: connects neural_network layers to error-correcting codes. -/
def NeuralLayerSpec.toCodeParams (L : NeuralLayerSpec) : LinearCodeParams where
length := L.inputDim
dimension := L.outputDim
minDist := min L.marginDist (L.inputDim - L.outputDim + 1)
fieldSize := 2
dim_le_length := L.output_le_input
dist_pos := by
simp only [lt_min_iff]; exact ⟨L.margin_pos, by have := L.output_le_input; omega⟩
field_ge_two := le_refl _
singleton := by have h := L.output_le_input; simp only [Nat.min_def]; split <;> omega
end