Skip to content

[RFC] Dynamic Cohomological Error Correction: semantic syndrome, sparse repair, and mincut containment #669

Description

@ruvnet

Objective

Implement Dynamic Cohomological Error Correction as a new RuVector mathematical primitive.

Dynamic mincut identifies a low cost graph boundary. This operator must identify which local observations cannot coexist under heterogeneous transformation rules, produce a canonical contradiction witness, and compute the least costly repair or quarantine action that restores global consistency.

This is intended as infrastructure, not a single RAG feature. The same operator should support agent coordination, memory validation, policy consistency, embedding migration, network telemetry reconciliation, and Byzantine cluster isolation.

Why this belongs in RuVector

RuVector already has the difficult adjacent components:

  1. prime-radiant implements cellular sheaf structures, restriction maps, cohomology types, obstruction detection, and Laplacian concepts.
  2. ruvector-mincut implements canonical mincut, Gomory Hu trees, dynamic updates, deterministic witness hashes, and sparsification.
  3. RuVector supports graph, vector, WASM, spectral, hyperbolic, and collective intelligence workloads in one Rust codebase.
  4. Ruflo and Cognitum provide immediate systems where contradiction localization and selective consensus create operational value.

The missing primitive is a mathematically correct affine syndrome and repair engine that operates over dynamic sheaves and couples its result to dynamic mincut.

Mathematical correction required

The current Prime Radiant ADR says that nontrivial (H^1) means the sheaf admits no global section. For a linear sheaf, the zero section is always global. The correct definitions are:

[
H^0(G;\mathcal F)=\ker\delta
]

which is the space of global sections, and on a graph:

[
H^1(G;\mathcal F)=C^1/\operatorname{im}\delta
]

which measures edge data that cannot be represented as the coboundary of a vertex assignment.

Production consistency is an affine problem. Given observed edge relationships (b), solve:

[
x^*=\arg\min_x|W^{1/2}(\delta x-b)|_2^2
]

The irreducible contradiction is the weighted syndrome:

[
s=\operatorname{Proj}^{W}_{(\operatorname{im}\delta)^{\perp_W}}(b)
]

or equivalently:

[
s=b-\delta(\delta^\top W\delta)^{\dagger}\delta^\top Wb
]

Interpretation:

  1. (|s|_W=0) means a globally coherent explanation exists.
  2. (|s|_W>0) means an irreducible contradiction exists.
  3. Syndrome support localizes responsible constraints.
  4. Harmonic coordinates provide a compact witness.
  5. Sparse decoding computes a low cost repair.

Existing implementation gaps

The current code provides useful scaffolding, but it is not yet a production syndrome engine.

  1. The Laplacian matrix path mostly applies identity differences between node states rather than assembling the full block operator from both endpoint restriction maps.
  2. The matrix path is dense.
  3. The current spectrum path uses dominant eigenvalue power iteration and then attempts to infer nullity and the spectral gap. Dominant power iteration is not a valid method for recovering the smallest eigenvalues required for cohomology.
  4. Restriction functions are represented as closures, which prevents deterministic serialization, transpose application, operator norm checking, and canonical hashing.
  5. The model lacks affine edge observations (b).
  6. The model lacks canonical syndrome witnesses.
  7. The model lacks sparse repair.
  8. The model lacks exact dynamic synchronization after deletions and map updates.

Proposed crate

crates/ruvector-cohomology/
  src/
    lib.rs
    operator.rs
    block_sparse.rs
    affine.rs
    syndrome.rs
    harmonic.rs
    repair.rs
    dynamic.rs
    partition.rs
    witness.rs
    transport.rs
    mincut_bridge.rs
    solvers/
      mod.rs
      cg.rs
      minres.rs
      lobpcg.rs
      sparse_qr.rs
      admm.rs
  benches/
    batch.rs
    dynamic_edits.rs
    planted_cycles.rs
    repair.rs
    mincut_coupling.rs
  tests/
    exact_small.rs
    property.rs
    determinism.rs
    drift.rs
    adversarial.rs

The crate should initially adapt existing Prime Radiant types. It should replace current implementations only after reference parity and performance gates pass.

Core types

pub trait LinearRestriction: Send + Sync {
    fn input_dim(&self) -> usize;
    fn output_dim(&self) -> usize;
    fn apply(&self, x: &[f64], y: &mut [f64]);
    fn apply_transpose(&self, y: &[f64], x: &mut [f64]);
    fn operator_norm_bound(&self) -> f64;
    fn canonical_hash(&self) -> [u8; 32];
}

pub struct AffineSheafSystem {
    pub topology_epoch: u64,
    pub operator: BlockCoboundary,
    pub observations: EdgeField,
    pub weights: EdgeWeights,
    pub gauge: GaugePolicy,
}

pub struct SyndromeResult {
    pub energy: f64,
    pub residual: EdgeField,
    pub harmonic_coordinates: Vec<f64>,
    pub ranked_support: Vec<EdgeContribution>,
    pub witness: CohomologyWitness,
}

pub trait DynamicCohomology {
    fn apply_edit(&mut self, edit: CohomologyEdit) -> EditReceipt;
    fn estimate(&self) -> SyndromeEstimate;
    fn flush(&mut self) -> Result<SyndromeResult, CohomologyError>;
    fn propose_repair(&mut self, policy: RepairPolicy) -> Result<RepairPlan, CohomologyError>;
}

Sparse repair

Compute a correction field (q) with a group sparse penalty:

[
q^*=\arg\min_{x,q}
\frac{1}{2}|W^{1/2}(b-q-\delta x)|_2^2
+\lambda\sum_ec_e|q_e|_2
]

The per edge cost should support business impact, security severity, reversibility, and disruption cost:

[
c_e=\alpha C_{business,e}+\beta C_{security,e}+\gamma C_{latency,e}+\eta C_{reversal,e}
]

Protected edges must be immutable unless an explicit authorization policy allows modification.

Dynamic mincut integration

For each edge, derive contradiction tension from:

  1. Syndrome magnitude.
  2. Statistical leverage.
  3. Restriction map uncertainty.
  4. Policy severity.
  5. Temporal drift.

Use ruvector-mincut to compute the lowest cost quarantine boundary. Then run sparse repair inside the isolated component and verify the post repair syndrome.

Required control loop:

  1. Detect contradiction.
  2. Localize syndrome support.
  3. Isolate with dynamic mincut when containment is required.
  4. Repair using group sparse decoding.
  5. Reconcile shared projections using Sheaf ADMM where appropriate.
  6. Recompute and verify.
  7. Sign the intervention receipt.

Solver policy

Do not use dominant eigenvalue power iteration to estimate nullity.

Required solver paths:

  1. Matrix free conjugate gradient for gauged positive semidefinite normal equations.
  2. MINRES for indefinite saddle point formulations.
  3. LOBPCG or shift invert Lanczos for smallest eigenpairs.
  4. Sparse QR or rank revealing QR as the exact reference path.
  5. Group sparse ADMM for repair.
  6. Residual certificates for every approximate result.

Dynamic architecture

Partition the cellular complex into bounded cells. Each cell maintains:

  1. Local block coboundary rows.
  2. Local rank revealing factorization.
  3. Boundary interface variables.
  4. Cached syndrome contribution.
  5. Epoch and dirty state.

Supported edits must include:

  1. Vertex insertion and deletion.
  2. Edge insertion and deletion.
  3. Restriction map updates.
  4. Observation updates.
  5. Weight updates.
  6. Basis and orthogonal frame updates.

Local edits should update only incident cells and interfaces. flush() must produce a result equivalent to fresh batch assembly within tolerance.

Orthogonal transport

The main false positive risk is treating coordinate drift as semantic contradiction.

Initial restriction map families should be limited to identity, projection, orthogonal, and contractive operators. Orthogonal frame changes must transport stored state exactly:

[
x_v^{new}=Q_v^{new}(Q_v^{old})^\top x_v^{old}
]

Learned maps remain advisory until they pass held out path consistency, negative control, and drift stability tests.

Canonical witness

Every result must include:

  1. Graph and observation epochs.
  2. Canonically sorted identifiers.
  3. Restriction map, weight, and observation hashes.
  4. Gauge and solver configuration.
  5. Quantized syndrome coordinates.
  6. Canonical harmonic basis metadata.
  7. Ranked support.
  8. Proposed repair.
  9. Pre and post repair energy.
  10. SHA 256 witness hash.

Degenerate eigenspaces must be canonicalized deterministically. Parallel execution order must not change the witness hash.

Delivery phases

Phase 0: reference oracle and mathematical correction

  1. Correct the ADR definitions.
  2. Add a dense reference solver for small graphs.
  3. Add symbolic and planted contradiction fixtures.
  4. Verify exact behavior for coherent and inconsistent cycles.

Phase 1: block sparse operator

  1. Implement explicit serializable restriction operators.
  2. Add matrix free apply and apply_transpose.
  3. Assemble the true weighted block sheaf Laplacian.
  4. Add deterministic indexing and orientation.

Phase 2: affine syndrome

  1. Add observations and weights.
  2. Solve weighted least squares.
  3. Compute canonical residual and syndrome energy.
  4. Rank edge contributions.
  5. Produce signed witnesses.

Phase 3: sparse repair

  1. Implement group sparse ADMM.
  2. Add protected constraints and cost policies.
  3. Verify against exhaustive small graph optima.

Phase 4: dynamic updates

  1. Implement bounded cell partitions.
  2. Cache local operators and factorizations.
  3. Support every edit class.
  4. Add lazy update, exact flush, drift bounds, and rebuild triggers.

Phase 5: mincut coupling

  1. Add syndrome to tension conversion.
  2. Add containment boundary computation.
  3. Compare isolate first and repair first policies.
  4. Produce combined intervention receipts.

Phase 6: integrations

  1. Ruflo agent memory contradiction detection.
  2. Tool authorization consistency.
  3. Multi agent selective consensus.
  4. CSI, BLE, and network telemetry reconciliation.
  5. Embedding epoch migration.

Benchmark matrix

Dimension Required coverage
Graphs Cycles, stochastic blocks, Barabasi Albert, temporal streams
Stalks Scalar, mixed dimensions, dimensions 4, 8, 32
Maps Identity, projection, orthogonal, contractive, near singular
Faults Single cycle, overlapping cycles, Byzantine cluster, map drift
Updates Insertions, deletions, map changes, weight changes, bursts
Baselines Batch QR, robust least squares, belief propagation, mincut alone
Outputs Localization, repair, latency, memory, drift, determinism

Acceptance criteria

Correctness

  1. Exact dense oracle agreement within (10^{-10}) on all small fixtures.
  2. Zero false contradiction certificates on generated coherent systems.
  3. At least 95 percent precision and 95 percent recall on planted contradiction localization.
  4. Repair objective within 10 percent of exhaustive optimum on tractable graphs.
  5. Dynamic flush() energy agrees with batch within (10^{-8}).
  6. Harmonic subspace principal angle error remains below the configured tolerance.

Performance

On 100,000 vertices, 1,000,000 edges, and stalk dimension eight:

  1. Median local edit below one millisecond.
  2. P99 local edit below ten milliseconds.
  3. Approximate syndrome query below 50 milliseconds.
  4. Exact flush below five seconds on the reference target.
  5. No unbounded growth under a ten million edit stream.

Determinism

  1. One hundred repeated runs produce the same witness hash.
  2. Parallel execution order does not change support ordering.
  3. Randomized algorithms use committed seeds and residual certificates.

Strategic value

Compared with dynamic mincut alone, the combined system must improve localization by at least 20 percentage points on failures caused by latent coordinate drift, inconsistent transforms, and cyclic obligations.

Security requirements

  1. Authenticate map, observation, and weight updates.
  2. Validate dimensions, norms, sparsity, and numerical conditioning before allocation.
  3. Prevent private stalk state from leaking into witnesses.
  4. Sign repairs and retain rollback state.
  5. Require explicit approval for protected policy and high value business edges.
  6. Keep diagnosis separate from authorization to act.

Principal uncertainty

The main failure mode is incorrect restriction maps. A bad transport can manufacture contradictions that do not exist.

Mitigation:

  1. Ship constrained operators first.
  2. Require cycle consistency tests.
  3. Maintain coherent negative controls.
  4. Measure false contradiction rate under basis drift.
  5. Gate learned maps behind evidence and rollback.

Research basis

  1. Hansen and Ghrist, Toward a Spectral Theory of Cellular Sheaves: https://arxiv.org/abs/1808.01513
  2. Volk, Incremental Sheaf Cohomology on Cellular Complexes: https://arxiv.org/abs/2606.04227
  3. Seely, Cupiał, and Jones, Learning Multi Agent Coordination via Sheaf ADMM: https://arxiv.org/abs/2605.31005
  4. Asif, Khan, and Khan, Temporal Sheaf Neural Networks with Dynamic Orthogonal Transport: https://arxiv.org/abs/2606.10071
  5. Goranci, Henzinger, Kiss, Momeni, and Zöcklein, Dynamic Hierarchical j Tree Decomposition and Its Applications: https://arxiv.org/abs/2601.09139

Definition of done

The issue is complete when RuVector can ingest a dynamic heterogeneous constraint graph, identify irreducible contradictions, return a deterministic signed witness, propose a cost aware repair or quarantine boundary, apply or simulate that intervention, and prove that post intervention syndrome energy satisfies the configured threshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions