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.Phasor

Commercial 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.

The Pleroma map as a grid8 rungs by 3 faces, 24 cells, plus the lid on top. The full list is in the table below. Lid: Draw one value with probability count/totalLidRung 8, Syzygy: Winding number around a loopR8Rung 8, Monad: Steady-state current directionR8Rung 8, Ouroboros: Frustration: loop parityR88Rung 7, Syzygy: Spiral on the time circleR7Rung 7, Monad: Diffusion: Markov mixingR7Rung 7, Ouroboros: Shift-register cycles (Galois LFSR)R77Rung 6, Syzygy: Chinese remainder theorem pairingR6Rung 6, Monad: Independence testR6Rung 6, Ouroboros: Hamming syndromesR66Rung 5, Syzygy: Key permutation and gatherR5Rung 5, Monad: Conjugation of arrangementsR5Rung 5, Ouroboros: GF(2) Frobenius: bit squaringR55Rung 4, Syzygy: Table and Fourier shiftR4Rung 4, Monad: One-to-one map and balance checkR4Rung 4, Ouroboros: Boolean function and Walsh spectrumR44Rung 3, Syzygy: Multiset composition via bindingR3Rung 3, Monad: Arrangement compositionR3Rung 3, Ouroboros: Parity: odd-occurrence XORR33Rung 2, Syzygy: Key on the cycleR2Rung 2, Monad: One-hot categoryR2Rung 2, Ouroboros: Binary codes and Hamming retrievalR22Rung 1, Syzygy: Signed insertion and deletionR1Rung 1, Monad: Binary choiceR1Rung 1, Ouroboros: Flag toggle via XORR11SyzygyMonadOuroboros
All 25 cells as a table
The operation grid: 8 rungs by 3 faces, plus the lid
RungFaceCellWhat it doesAPIStatusEvidence
R1SyzygySigned insertion and deletion0 = (+1) + (-1): add any signed count to any key up to capacity K, remove exactly.Add(item, count), Remove, Subtract(other)COVEREDAdding then removing a count zeroes every cell, on the default field and on three primes.
R1MonadBinary choiceOne of two arrangements (S_2): stores read even vs odd exact counts.OrderSize = 2, Arrangements(), SignBalance()COVEREDCounts on two arrangements exact, held in superposition through the kernel identity and swap.
R1OuroborosFlag toggle via XORFlip any subset of flag bits via XOR mask.RelabelFlags(null, xorMask), PleromaKernel.Add(flagMask)COVEREDEach of 15 masks toggled once matches a rebuilt toggled store, and twice is the identity. A kernel composed twice is the identity.
R2SyzygyKey on the cyclePositional encoding: key = one position on a finite cycle. Identity encoding equivalent to sinusoidal and rotary.TryKeys, TryItems, KeySpace, ModuliCOVEREDKeys exact 30/30 at 16 keys, refused 30/30 at 17 and beyond.
R2MonadOne-hot categoryOne corner of the symmetric group (one arrangement picked out).ArrangementIndex, ArrangementCOVEREDArrangement index round-trips exactly, and a one-item store reads as one-hot.
R2OuroborosBinary codes and Hamming retrievalEvery flag word and its Hamming-distance neighbors.Flags(), Near(word, radius), Nearest(word)COVEREDFlag counts exact at any load. Hamming retrieval exact.
R3SyzygyMultiset composition via bindingKeys add (mod key space); counts multiply. One block product per representation.Bind(other), TryKeys counts, Attend(...) syzygy readCOVEREDBind 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.
R3MonadArrangement compositionBind composes arrangements as permutation product (left store on left).ComposeArrangements, InverseArrangement, RelabelArrangements(a^-1, c^-1)COVEREDArrangement unbinding exact 1,000/1,000 in the store. Reversing the order changes the result in 5,800 of 10,000 cases.
R3OuroborosParity: odd-occurrence XORBind XORs flags; reads parity of count via cos(pi n).Bind XORs, BitCounts(), FlagParity(), Attend(...) parityCOVEREDBit counts and parity exact 12/12 on 3 fields. 256 parity classes exact.
R4SyzygyTable and Fourier shiftStore IS the harmonic transform. Bind with one-item store = shift every key and value at once.ShiftKeys(k), Bind with one-item store, TryItems lookupCOVEREDBind with a one-item store is the whole-store shift: 20/20 (key shift, flag relabel, arrangement relabel and tick agree).
R4MonadOne-to-one map and balance checkEach key maps to one tick or a mix. Opt-in TimeSpectrum holds per-key tick histogram.TimeSpectrum(), TimeMap(), TryFindConflicts, MapTimes(g)COVEREDTime 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.
R4OuroborosBoolean function and Walsh spectrumFourier analysis of any Boolean predicate over Z_2^m.FlagPredicate.Compile, CountWhere, CountWhereByTime, CountWhereByArrangementCOVEREDPredicates exact 1,515/1,515. 1,024/1,024 parity functions read from one spectrum. Weighted predicates 30/30.
R5SyzygyKey permutation and gatherh -> u h (mod N): unit permutes, non-unit gathers. Requires CompleteKeys band.ScaleKeys(u) on CompleteKeys (KeyCycle N <= 4096)COVEREDEvery unit of 225 permutes (120/120 on two fields). Every non-unit gathers (113/113).
R5MonadConjugation of arrangementss -> sigma . s . sigma^-1 for any permutation sigma.RelabelArrangements(sigma, sigma^-1)COVEREDAll 24 x 24 left-right pairs on S_4 exact.
R5OuroborosGF(2) Frobenius: bit squaringb(x) -> b(x)^2 modulo an irreducible polynomial. Linear map on the flag cube.Frobenius(modulus, steps)COVEREDExact 18/18 (default field, continuous, 3 primes). The eighth power is the identity on x^8+x^4+x^3+x^2+1.
R6SyzygyChinese remainder theorem pairingJoin two coprime key cycles Na and Nb into Na*Nb via CRT residues.CombineCycles(a, b)COVEREDExact 12/12 (63 x 55 with a continuous part, and 9 x 25).
R6MonadIndependence testCheck whether joint counts equal the product of marginals (exact integer test).IsIndependent(faces)COVEREDIndependent stores report true 40/40, dependent ones false 40/40, and one added item breaks independence 40/40.
R6OuroborosHamming syndromesCount per Hamming syndrome (m = 3, 7, or 15 bits).Syndrome()COVEREDExact 15/15. All 112 single errors of Hamming(7,4) located.
R7SyzygySpiral on the time circleRotate every item by n ticks exactly, and fade by r^n (continuous part).Tick(n), ContinuousFadeCOVEREDAll 4,096 combinations of shift, diffusion and count modulo 16 exact.
R7MonadDiffusion: Markov mixingEach step, item stays with probability a/b or moves one tick. Composed via kernel powers.Diffuse(stayNum, stayDenom, steps), Apply(PleromaKernel powers)COVEREDExact expected counts over 600 diffusion steps.
R7OuroborosShift-register cycles (Galois LFSR)b(x) -> x b(x) mod polynomial. Linear recurrence over GF(2).ShiftRegister(polynomial, steps)COVEREDExact 9/9 on 3 primes. Period 255 for x^8+x^4+x^3+x^2+1.
R8SyzygyWinding number around a loopSum of offsets around a loop, modulo RelationModulus.RelationFace.Holonomy(loop, tag)COVEREDLoop reads exact 2,176/2,176. Merged and subtracted stores 1,804/1,804.
R8MonadSteady-state current directionSign of probability current around a loop (Kolmogorov reversibility test).RelationFace.AddRates, Current(loop, primes)COVEREDReversibility read exact 200/200. Perturbed loops detected 120/120.
R8OuroborosFrustration: loop parityParity of the integer sum around a loop (product = -1 or +1).RelationFace.Frustration(loop, tag)COVEREDEvery loop's frustration read exactly.
LidLidDraw one value with probability count/totalOne exact integer draw landing on its cumulative count.Sample(rng, faces)READ-TIMEEvery draw in [0, total) lands on its value. Shares uniform on 4/4 views.
Generated by running the published EvaluatedApplications.Phasor package (release 2.17.0). Every number is the package's own output.

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.
C#
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]}");
Output
1001: flags 5, time 0, count 3
2002: flags 129, time 5, count 2
3 3 3 2
scale 3: 3 6 2 4

This 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.

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%

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.