Duality, juxtaposition, complementarity. The substrate's native "opposite of" algebra.
import { opposite, vectorInverse, complement, difference,
symmetricDifference, juxtapose, polarity, antithesis, tension,
dualClosure, allDualPairs, hammingDistance,
SUBSTRATE_OPPOSITES, OPPOSITE_FAMILIES } from 'substrate-opposites';
opposite('witness'); // 'forget'
opposite('bind'); // 'fork'
opposite(opposite('x')); // 'x' (involution)
vectorInverse([1, -2, 3]); // [-1, 2, -3]
complement([1, 2, 3], [5, 5, 5]); // [9, 8, 7] — 2*ref - v
juxtapose('witness', 'forget'); // contrast: 'different'
juxtapose([1,0,0], [0,1,0]); // contrast: 'L2 difference = 1.4142'
tension('witness', 'forget'); // 1.0 (exact opposites)
tension('witness', 'remember'); // 0.5 (same family)
tension('witness', 'forge'); // 0.0 (unrelated)
dualClosure('witness'); // ['witness', 'forget']
allDualPairs(); // [{ a: 'witness', b: 'forget', tension: 1.0, family: 'memory' }, ...]Involution: opposite(opposite(x)) = x.
| Concept | Opposite |
|---|---|
| witness | forget |
| proof | gap |
| bind | fork |
| tick | break |
| link | sever |
| jev | jepa |
| forge | tarnish |
| brew | spoil |
| cell | dissolve |
| lattice | chaos |
| substrate | noise |
| scar | heal |
| order | disorder |
| remember | release |
| signal | silence |
| grow | prune |
| ask | deny |
| open | close |
| arrive | depart |
Full list in SUBSTRATE_OPPOSITES. Add to this list as the substrate grows — every new concept gets an opposite or it's not "substrate-native".
Concepts in the same family share a dimension of duality:
| Family | Members |
|---|---|
| memory | witness, forget, remember, release |
| truth | proof, gap, verify, speculate |
| composition | bind, fork, merge, split |
| time | tick, break, advance, interrupt |
| connection | link, sever, connect, disconnect |
| transformation | forge, tarnish, brew, spoil |
| form | cell, dissolve, form, unform |
| order | lattice, chaos, order, disorder |
| signal | substrate, noise, signal, silence |
| wound | scar, heal, wound, mend |
| growth | grow, prune, expand, contract |
| agency | ask, deny, request, refuse |
| boundary | open, close, enter, exit |
| movement | arrive, depart, come, go |
tension(a, b) returns:
1.0ifaandbare exact opposites0.5if they're in the same family (related along the same dimension)0.0if unrelated
The substrate's design doctrine: every concept should have its opposite. The opposite of a thing defines what the thing is. "WITNESS" means nothing without "FORGET" — memory has no meaning without forgetting.
This is also why the substrate is paired:
- JEV (validator, scores the past) ↔ JEPA (predictor, predicts the future)
- BIND (joins cells into a fabric) ↔ FORK (splits a fabric into pieces)
- TICK (advances the fabric) ↔ BREAK (interrupts it)
These aren't just opposites — they're the two faces of the same operation. Time has a forward direction (TICK) and an interrupt (BREAK). Composition has join (BIND) and split (FORK). Validation has check (JEV) and predict (JEPA).
| Operation | Math | Use |
|---|---|---|
opposite(s) |
lookup | concept inversion |
vectorInverse(v) |
-v | negation |
bitwiseNot(v) |
~v | mask flip |
complement(v, ref) |
2·ref - v | "what this is not" |
difference(a, b) |
a - b | highlight contrast |
symmetricDifference(A, B) |
A △ B | XOR for sets |
setComplement(A, U) |
U \ A | universal negation |
juxtapose(a, b) |
contrast | side-by-side |
polarity(v) |
sign vector | +/0/- per dim |
antithesis(text) |
lookup | "what this text is not" |
tension(a, b) |
0/0.5/1.0 | relatedness |
dualClosure(start) |
BFS | transitive duals |
hammingDistance(a, b) |
XOR + count | bit difference |
MIT.