Foundation
Phasor: exact holograms and vector-symbolic computing for .NET
One exact hologram, many views.
- Release 2.17.0
- Pleroma API: experimental
- No dependencies
- AOT and trim compatible
- net8.0 and net10.0
dotnet add package EvaluatedApplications.PhasorCommercial licence for commercial use. Evaluation and non-commercial use are permitted.Licence terms
The map
The Pleroma's operations as a pyramid: three faces, eight rungs and a lid, 25 cells in all. Each cell is a public member with its status, API and evidence. Turn it, select a cell, or colour it by status.
Drag to turn. Select a cell. With the view focused: arrows move between cells, Shift and arrows turn it, space pauses, Escape clears.
All 25 cells as a table
| Rung | Face | Cell | What it does | API | Status | Evidence |
|---|---|---|---|---|---|---|
| R1 | Syzygy | Signed insertion and deletion | 0 = (+1) + (-1): add any signed count to any key up to capacity K, remove exactly. | Add(item, count), Remove, Subtract(other) | COVERED | Adding then removing a count zeroes every cell, on the default field and on three primes. |
| R1 | Monad | Binary choice | One of two arrangements (S_2): stores read even vs odd exact counts. | OrderSize = 2, Arrangements(), SignBalance() | COVERED | Counts on two arrangements exact, held in superposition through the kernel identity and swap. |
| R1 | Ouroboros | Flag toggle via XOR | Flip any subset of flag bits via XOR mask. | RelabelFlags(null, xorMask), PleromaKernel.Add(flagMask) | COVERED | Each of 15 masks toggled once matches a rebuilt toggled store, and twice is the identity. A kernel composed twice is the identity. |
| R2 | Syzygy | Key on the cycle | Positional encoding: key = one position on a finite cycle. Identity encoding equivalent to sinusoidal and rotary. | TryKeys, TryItems, KeySpace, Moduli | COVERED | Keys exact 30/30 at 16 keys, refused 30/30 at 17 and beyond. |
| R2 | Monad | One-hot category | One corner of the symmetric group (one arrangement picked out). | ArrangementIndex, Arrangement | COVERED | Arrangement index round-trips exactly, and a one-item store reads as one-hot. |
| R2 | Ouroboros | Binary codes and Hamming retrieval | Every flag word and its Hamming-distance neighbors. | Flags(), Near(word, radius), Nearest(word) | COVERED | Flag counts exact at any load. Hamming retrieval exact. |
| R3 | Syzygy | Multiset composition via binding | Keys add (mod key space); counts multiply. One block product per representation. | Bind(other), TryKeys counts, Attend(...) syzygy read | COVERED | Bind equals the store of all pairs, 35/35 across 5 shapes (including continuous and self-bind). 715 multisets of three bindings exact. The three-face read is exact 192/192 on 3 fields. |
| R3 | Monad | Arrangement composition | Bind composes arrangements as permutation product (left store on left). | ComposeArrangements, InverseArrangement, RelabelArrangements(a^-1, c^-1) | COVERED | Arrangement unbinding exact 1,000/1,000 in the store. Reversing the order changes the result in 5,800 of 10,000 cases. |
| R3 | Ouroboros | Parity: odd-occurrence XOR | Bind XORs flags; reads parity of count via cos(pi n). | Bind XORs, BitCounts(), FlagParity(), Attend(...) parity | COVERED | Bit counts and parity exact 12/12 on 3 fields. 256 parity classes exact. |
| R4 | Syzygy | Table and Fourier shift | Store IS the harmonic transform. Bind with one-item store = shift every key and value at once. | ShiftKeys(k), Bind with one-item store, TryItems lookup | COVERED | Bind with a one-item store is the whole-store shift: 20/20 (key shift, flag relabel, arrangement relabel and tick agree). |
| R4 | Monad | One-to-one map and balance check | Each key maps to one tick or a mix. Opt-in TimeSpectrum holds per-key tick histogram. | TimeSpectrum(), TimeMap(), TryFindConflicts, MapTimes(g) | COVERED | Time spectrum exact 37/37 (3 fields, signed). One-tick-per-key maps 60/60. Composed time maps 18/18, with bijections undone by their inverse. |
| R4 | Ouroboros | Boolean function and Walsh spectrum | Fourier analysis of any Boolean predicate over Z_2^m. | FlagPredicate.Compile, CountWhere, CountWhereByTime, CountWhereByArrangement | COVERED | Predicates exact 1,515/1,515. 1,024/1,024 parity functions read from one spectrum. Weighted predicates 30/30. |
| R5 | Syzygy | Key permutation and gather | h -> u h (mod N): unit permutes, non-unit gathers. Requires CompleteKeys band. | ScaleKeys(u) on CompleteKeys (KeyCycle N <= 4096) | COVERED | Every unit of 225 permutes (120/120 on two fields). Every non-unit gathers (113/113). |
| R5 | Monad | Conjugation of arrangements | s -> sigma . s . sigma^-1 for any permutation sigma. | RelabelArrangements(sigma, sigma^-1) | COVERED | All 24 x 24 left-right pairs on S_4 exact. |
| R5 | Ouroboros | GF(2) Frobenius: bit squaring | b(x) -> b(x)^2 modulo an irreducible polynomial. Linear map on the flag cube. | Frobenius(modulus, steps) | COVERED | Exact 18/18 (default field, continuous, 3 primes). The eighth power is the identity on x^8+x^4+x^3+x^2+1. |
| R6 | Syzygy | Chinese remainder theorem pairing | Join two coprime key cycles Na and Nb into Na*Nb via CRT residues. | CombineCycles(a, b) | COVERED | Exact 12/12 (63 x 55 with a continuous part, and 9 x 25). |
| R6 | Monad | Independence test | Check whether joint counts equal the product of marginals (exact integer test). | IsIndependent(faces) | COVERED | Independent stores report true 40/40, dependent ones false 40/40, and one added item breaks independence 40/40. |
| R6 | Ouroboros | Hamming syndromes | Count per Hamming syndrome (m = 3, 7, or 15 bits). | Syndrome() | COVERED | Exact 15/15. All 112 single errors of Hamming(7,4) located. |
| R7 | Syzygy | Spiral on the time circle | Rotate every item by n ticks exactly, and fade by r^n (continuous part). | Tick(n), ContinuousFade | COVERED | All 4,096 combinations of shift, diffusion and count modulo 16 exact. |
| R7 | Monad | Diffusion: Markov mixing | Each step, item stays with probability a/b or moves one tick. Composed via kernel powers. | Diffuse(stayNum, stayDenom, steps), Apply(PleromaKernel powers) | COVERED | Exact expected counts over 600 diffusion steps. |
| R7 | Ouroboros | Shift-register cycles (Galois LFSR) | b(x) -> x b(x) mod polynomial. Linear recurrence over GF(2). | ShiftRegister(polynomial, steps) | COVERED | Exact 9/9 on 3 primes. Period 255 for x^8+x^4+x^3+x^2+1. |
| R8 | Syzygy | Winding number around a loop | Sum of offsets around a loop, modulo RelationModulus. | RelationFace.Holonomy(loop, tag) | COVERED | Loop reads exact 2,176/2,176. Merged and subtracted stores 1,804/1,804. |
| R8 | Monad | Steady-state current direction | Sign of probability current around a loop (Kolmogorov reversibility test). | RelationFace.AddRates, Current(loop, primes) | COVERED | Reversibility read exact 200/200. Perturbed loops detected 120/120. |
| R8 | Ouroboros | Frustration: loop parity | Parity of the integer sum around a loop (product = -1 or +1). | RelationFace.Frustration(loop, tag) | COVERED | Every loop's frustration read exactly. |
| Lid | Lid | Draw one value with probability count/total | One exact integer draw landing on its cumulative count. | Sample(rng, faces) | READ-TIME | Every draw in [0, total) lands on its value. Shares uniform on 4/4 views. |
What Phasor is
Phasor's main object is the Pleroma. An item is a key plus, optionally, a flag word of up to 16 bits, an arrangement of up to 5 things and a tick on a clock. One array of finite-field harmonics answers exact counts per key and whole items (refusing past the key capacity), exact counts per flag word, how many items lie within r bits of a query and which stored words are nearest, counts per arrangement, counts per tick, and opt-in joint counts over flags, order and time. Everything except the key views stays exact at any load.
The whole store relabels, shifts keys, ages and diffuses over time in place with every view still exact, and a weighted superposition of flips, relabellings and time shifts applies to the whole store in one pass. Under the Pleroma is the phasor codec, a vector symbolic codec that encodes numbers and symbols as unit-complex faces and composes them with bind, unbind, bundle and correlate.
Exact where others approximate
At equal storage, the exact key view recovered 64 items with no errors where Plate's holographic reduced representations held 95% or better only up to 4. Past capacity it refuses, where the baseline answers wrongly every time.
One array, many questions
Counts per key, flag word, arrangement and tick, nearness, joint counts and any predicate are read from slices of one array, so adding a view does not add a second store.
Whole-store operations in one pass
A weighted superposition of flips, relabellings and time shifts applies to every item at once, at a cost that does not depend on how many elements the kernel holds.
Quick start
Build a store of items, read it back exactly, then age it.using Phasor;
var store = new Pleroma(new HologramShape
{
KeyCapacity = 16, // whole items come back for up to 16 distinct keys
FlagBits = 8, // an 8-bit flag word per item
TimePeriod = 63, // a 63-tick clock
JointFaces = HologramFaces.Flags | HologramFaces.Time, // also store flags x time joint counts
});
store.Add(new HologramItem(Key: 1001, Flags: 0b0000_0101, Time: 0), 3);
store.Add(new HologramItem(Key: 2002, Flags: 0b1000_0001, Time: 5), 2);
if (store.TryItems(out var items)) // refuses past 16 keys instead of answering wrongly
foreach (var (item, count) in items)
Console.WriteLine($"{item.Key}: flags {item.Flags}, time {item.Time}, count {count}");
long[] perFlagWord = store.Flags(); // exact at any load
long near = store.Near(0b0000_0100, radius: 1); // items whose flags differ from 0b100 in at most 1 bit
long[] joint = store.JointCounts(HologramFaces.Flags | HologramFaces.Time); // index = word * 63 + tick
Console.WriteLine($"{perFlagWord[5]} {near} {joint[5 * 63 + 0]} {joint[129 * 63 + 5]}");
store.Diffuse(stayNumerator: 1, stayDenominator: 3); // each item stays with probability 1/3, else moves one tick
long[] perTick = store.Times(); // TimeScale (3) times the exact expected counts
Console.WriteLine($"scale {store.TimeScale}: {perTick[0]} {perTick[1]} {perTick[5]} {perTick[6]}");1001: flags 5, time 0, count 3
2002: flags 129, time 5, count 2
3 3 3 2
scale 3: 3 6 2 4This is the complete program, compiled and run against the published package.
Capabilities
Views of one store
TryKeys and TryItems for exact counts per key and whole items, Flags, Near and Nearest for flag words and closeness, Arrangements and SignBalance for order, Times for ticks, and JointCounts over any set of faces.
Any predicate, one read
CountWhere counts the items whose flag word satisfies any predicate, linear or not, exactly and at any load, with one inner product. Attend returns exact counts, shares and parity from one read.
Whole-store operations
Tick and Diffuse age every item, RelabelFlags, RelabelArrangements and ShiftKeys relabel the store without reading items back, and a PleromaKernel applies a weighted sum of such moves in one pass.
Bind two stores
Bind adds keys, XORs flags, composes arrangements and adds ticks for every pair of items at once. Binding with a one-item store shifts the whole store on every face together.
Pages, sparse and dense
A dense page reads every one of up to 4,096 slots exactly in one transform, and joins two pages exactly in one read. A sparse page holds exact counts over a huge key set in memory proportional to the keys present.
Redundancy and repair
Reserved keys detect and repair lost harmonics, a mirror in a second prime detects corruption in either copy, and an exact-sum parity rebuilds any one lost store.
Keys only
CycleHologram is the Pleroma with keys only. It returns every stored symbol and count exactly up to its capacity, refuses past it, and adds and subtracts exactly, so two replicas can find what differs by exchanging one small hologram.
The phasor codec
PhasorCodec, HoloCodec and Hologram encode numbers and symbols as faces and compose them with bind, unbind, bundle and correlate. One operator set works on numbers, text and their mixtures.
Limits
What Phasor does not do, and where to be careful- There is no key-addressed attention. The key view returns exact whole items up to capacity. It is not a similarity search on keys.
- A store of key capacity K holds 2K+1 harmonics per key line and decodes up to K distinct keys. Past that it refuses.
- Counts must stay within the field's range. On a small prime field, weighted queries scale counts by the weight, so keep totals times the weight below half the field.
- The Pleroma runs on the CPU. There is no GPU kernel.
- It is a data structure and a set of operations, not a trainable embedding engine. The continuous phasor bundle is the approximate store; the Pleroma is the exact one.
- Exact arithmetic is not faster in general. A Pleroma read costs one or more transforms, while a float bundle read is one correlation. At equal bits float reads are often faster, and at large loads the two converge.
- The two codec layouts do not mix. Hologram and PhasorCodec use the interleaved layout, HoloCodec the planar one.
- PhasorCodec needs an even dimension of at least 128.
Every public type is documented with a worked example in the package readme on NuGet. Open the NuGet page.
Evidence
Method and every number- items recovered exactly, against the baseline's 95 percent point, at equal storage
- 64 against 4
- queries refused past capacity, none answered wrongly
- 12,800 of 12,800
- exact recall up to 32 stored pairs, against 21.9% for the float bundle
- 100%
Related
Licence
Proprietary. Every package ships as a compiled library. Evaluation and non-commercial development or testing are permitted; commercial, production or revenue-generating use needs a commercial licence from the owner. Read the licence terms.