shivya 0.2.0

A first-principles non-dual distributed computing substrate pairing discrete exterior calculus with hierarchical active inference.
Documentation
# SHIVYA: The Non-Dual Substrate (NDS)

> *"Truth is not a static global variable; it is a harmonic flow traversing a causal manifold."*

---

## 1. The Homeostatic Shift: From Consensus to Flow

Classical distributed systems operate under a dualistic dogma: state is a static value, and replicas must compete to agree on a single global sequence of updates. This consensus-centric paradigm requires centralized logical clocks, lock-step validation, and high overhead (e.g., Raft, Paxos, or proof-of-work). It treats concurrent mutations as a zero-sum conflict—one branch must "win" and the other must be discarded.

**SHIVYA** takes a different path: rather than competing for total order, the substrate behaves as a **consensus-free localized resource balancer** that lets local edge-state deltas accumulate independently and then projects out the curl component when partitions heal. This is not equivalent to Paxos/Raft and does not provide linearizable global ordering; see [CITATIONS.md](../CITATIONS.md) for the underlying decomposition theorem and a discussion of which workloads this regime suits.

Homeostasis is how biological organisms maintain stability. A cell does not wait for a global consensus protocol to update its chemical gradients; it allows local energy flows to propagate, automatically dissipating localized pressures and conflicts through geometric constraints. 

In SHIVYA, state is modeled not as discrete numbers in a table, but as a continuous **state potential** defined on a directed simplicial complex:
- **0-simplices (Vertices)** represent local event mutations.
- **1-simplices (Edges)** represent directed causal transitions (flows).
- **2-simplices (Triangles)** represent concurrent, multi-dependency execution contexts.

Reconciliation is not a vote; it is a physical projection onto a geometric manifold.

---

## 2. The Hodge Decomposition of Causal Flow

To reconcile concurrent mutations, SHIVYA employs the **Hodge Decomposition Theorem** for graphs. Any discrete flow (1-cochain) $\Delta S$ on a simplicial complex can be uniquely decomposed into three orthogonal components:

$$\Delta S = d_0 \alpha + d_1^T \beta + \gamma$$

where:
1. **$d_0 \alpha$ (Exact/Gradient Flow):** The irrotational, conflict-free flow. This represents local, legitimate mutations that accumulate cleanly from the genesis state.
2. **$d_1^T \beta$ (Coexact/Curl Flow):** The rotational conflict component. This represents race conditions, double spends, or closed-loop cycles where concurrent updates contradict one another (such as the diamond topology).
3. **$\gamma$ (Harmonic Flow):** The divergence-free and curl-free component, representing global topological loops that cannot be contracted (non-trivial homology cycles).

### The Homeostatic Projection
When concurrent branches merge, the discrepancy appears as a non-zero curl ($d_1 \Delta S \neq 0$). The HodgeMesh engine isolates this curl by solving the coboundary Laplacian system:

$$L_2 \beta = d_1 \Delta S \quad \text{where} \quad L_2 = d_1 d_1^T$$

Once the curl potential $\beta$ is computed via our iterative Conjugate Gradient solver, the conflict is cleanly projected out:

$$\Delta S_{reconciled} = \Delta S - d_1^T \beta$$

The resulting flow is guaranteed to be curl-free, allowing all nodes to integrate the remaining flow and converge to the identical state balance without exchanging sequence numbers or halting execution.

---

## 3. The Non-Dual Synthesis

Under the Non-Dual Substrate, conflict is not a bug; it is simply curvature. In a flat manifold (where events are purely sequential), there is no curvature, and therefore no conflict. When concurrent branches diverge, the manifold curves. The reconciler acts as a geometric tension-reliever, smoothing out the local curvature to restore flat, harmonic synchronicity.

By replacing the arbitrary time-ordering of consensus with the intrinsic geometry of causal flows, SHIVYA enables high-speed, local mutation at the edge, converging naturally whenever paths meet.