Aether Catalog definitions — MachineLearning_NeuralCoding_CechDecisionBoundaryObstructions
DefinitionMachineLearning_NeuralCoding_CechDecisionBoundaryObstructionsaether-catalogmachinelearning
Definition bundle for the Aether Catalog module MachineLearning.NeuralCoding.CechDecisionBoundaryObstructions, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from MachineLearning/NeuralCoding/CechDecisionBoundaryObstructions.lean by skeleton subtraction
import Mathlib
/-
Copyright (c) 2025. All rights reserved.
Released under Apache 2.0 license.
# Čech Obstruction Theory for Adversarial Robustness
This module formalizes an explicit **cohomological obstruction calculus** for
certified adversarial robustness of piecewise-linear (ReLU) classifiers.
## Mathematical Framework
A ReLU network partitions input space into finitely many linear activation regions.
On each region, the classifier is affine-linear, so local robustness margins are
computable. The key question: when do local certificates **glue** to a global one?
We model this via finite Čech cohomology:
- **1-cocycles** capture pairwise discrepancies between local margin assignments.
- **1-coboundaries** are discrepancies that can be "gauged away."
- **Vanishing H¹** means every cocycle is a coboundary — local data glues globally.
- **Nontrivial H¹** produces explicit incompatibility witnesses.
## Main Results
### Theorem A: `finite_cover_vanishing_H1_implies_global_radius`
Local-to-global sheaf robustness certificate.
### Theorem B: `nontrivial_cocycle_yields_incompatible_local_sections`
Obstruction yields vulnerability witness.
### Theorem C: `sheaf_per_chart_lipschitz_radius`
Comparison with Lipschitz certification.
## Cross-Domain Connections
- **Distributed Consensus**: Cocycles = inconsistency fields; coboundaries = gauge fixes.
- **Gauge Theory**: Coboundary potential = gauge transformation; non-coboundary = curvature.
- **Error-Correcting Codes**: Nontrivial cocycle = syndrome.
-/
open Finset BigOperators Set
noncomputable section
/-! ## §1. Čech Cocycle and Coboundary Definitions -/
/-- A **Čech 1-cocycle**: `c(i,k) = c(i,j) + c(j,k)` for all triples. -/
def CechOneCocycle {ι : Type*} (c : ι → ι → ℝ) : Prop :=
∀ i j k, c i k = c i j + c j k
/-- A **Čech 1-coboundary**: `c(i,j) = f(j) - f(i)` for some potential `f`. -/
def IsCoboundary {ι : Type*} (c : ι → ι → ℝ) : Prop :=
∃ f : ι → ℝ, ∀ i j, c i j = f j - f i
/-- **Vanishing first Čech cohomology**: every 1-cocycle is a 1-coboundary. -/
def VanishingH1OnCover (ι : Type*) : Prop :=
∀ c : ι → ι → ℝ, CechOneCocycle c → IsCoboundary c
/-! ## §2. Cocycle Algebra -/
/-! ## §3. H¹ Vanishes for Finite Types (Nerve Lemma) -/
/-! ## §4. Robustness Predicates -/
/-- A **certified robust L∞ radius** for a score-gap function on a metric space. -/
structure CertifiedRobustRadiusLinf {X : Type*} [PseudoMetricSpace X]
(scoreGap : X → ℝ) (S : Set X) (r : ℝ) : Prop where
pos : 0 < r
robust : ∀ x ∈ S, ∀ y : X, dist y x < r → 0 < scoreGap y
/-- **Local Lipschitz data** on a finite cover: margin and Lipschitz constant per chart. -/
structure LocalLipschitzData (ι : Type*) where
margin : ι → ℝ
lipschitz : ι → ℝ
margin_pos : ∀ i, 0 < margin i
lipschitz_pos : ∀ i, 0 < lipschitz i
/-- Local certified radius: `margin(i) / lipschitz(i)`. -/
def LocalLipschitzData.localRadius {ι : Type*} (D : LocalLipschitzData ι) (i : ι) : ℝ :=
D.margin i / D.lipschitz i
/-! ## §5. Discrepancy Cocycle -/
/-- The **discrepancy cocycle**: `c(i,j) = m(j) - m(i)`. -/
def discrepancyCocycle {ι : Type*} (m : ι → ℝ) : ι → ι → ℝ :=
fun i j => m j - m i
/-! ## §6. Minimum Margin Lemmas -/
/-! ## §7. Theorem A: Local-to-Global Sheaf Robustness Certificate -/
/-
**Theorem A (Local-to-Global Sheaf Robustness Certificate).**
For a finite cover with positive local margins, if the first Čech cohomology
vanishes and the score-gap is `L`-Lipschitz with margin at least `m(i)` on each
region, then local margins glue to a global certified L∞ radius
`r = min_i(m_i/L) > 0`.
-/
/-! ## §8. Theorem B: Obstruction Yields Vulnerability Witness -/
/-- Two charts have **incompatible margin sections** if their discrepancy is nonzero. -/
def IncompatibleOnOverlap {ι : Type*} (c : ι → ι → ℝ) (i j : ι) : Prop :=
c i j ≠ 0
/-! ## §9. Theorem C: Comparison with Lipschitz Certification -/
/-
**Theorem C (Per-chart Lipschitz version).**
With per-chart Lipschitz constants `L_i`, the sheaf radius is `min_i(m_i / L_i)`.
-/
/-! ## §10. Bridge to Existing Catalog -/
/-! ## §11. Consensus / Graph Cohomology Connection -/
/-- A **graph consistency field**: discrepancy values on directed edges. -/
def GraphConsistencyField (ι : Type*) := ι → ι → ℝ
/-- Cycle-consistent: satisfies the cocycle condition on all triangles. -/
def CycleConsistent {ι : Type*} (φ : GraphConsistencyField ι) : Prop :=
CechOneCocycle φ
/-- Gauge-trivial: resolvable by local corrections (coboundary). -/
def GaugeTrivial {ι : Type*} (φ : GraphConsistencyField ι) : Prop :=
IsCoboundary φ
/-! ## §12. Axiom Verification -/
end