Implementing PRISM

PRISM (Polymorphic Resolution and Isometric Symmetry Machine) is the reference implementation pattern for a UOR-compliant resolver.

Overview

A PRISM implementation must:

  1. Accept a Query
  2. Use a Resolver to factorize the input
  3. Produce a Partition
  4. Measure Observable properties
  5. Issue a Certificate
  6. Record a ComputationTrace

Step 1: Define the Context

// Establish the evaluation context at Witt level 8
let context = Context {
    witt_length: 8,
    capacity: 256,
};

The corresponding ontology individual:

<my:ctx>
    a               state:Context ;
    state:wittLength "8"^^xsd:nonNegativeInteger ;
    state:capacity  "256"^^xsd:nonNegativeInteger .

Step 2: Create a Query

Choose the appropriate query type:

<my:query>
    a               query:RepresentationQuery ;
    query:inputType <my:target-address> .

Step 3: Apply the Resolver

The DihedralFactorizationResolver performs the core computation:

<my:resolver>
    a                   resolver:DihedralFactorizationResolver ;
    resolver:inputType  <my:type-u8> ;
    resolver:strategy   "dihedral-factorization" .

Step 4: Inspect the Partition

The resolver produces a Partition:

<my:partition>
    a                   partition:Partition ;
    partition:irreducibles  <my:irred-set> ;
    partition:reducibles    <my:red-set> ;
    partition:units         <my:unit-set> ;
    partition:exterior      <my:ext-set> .

Step 5: Issue a Certificate

<my:cert>
    a               cert:Certificate ;
    cert:certifies  <my:partition> .

Certificate types available:

Step 6: Record the Trace

<my:trace>
    a                   trace:ComputationTrace ;
    trace:certifiedBy   <my:cert> .

Iterative Resolution (Amendment 11)

The single-pass pipeline above works when the type is fully determined. For partially-constrained types, PRISM supports an iterative resolution loop:

  1. Declare — create a ConstrainedType with initial constraints
  2. Resolve — run the resolver to produce a partition with a FreeRank
  3. Observe — check isClosed on the budget
  4. Refine — if not closed, apply a RefinementSuggestion to pin more sites
  5. Iterate — repeat until the budget closes or convergence stalls

The ResolutionState tracks iteration count, site deficit, and convergenceRate. Each iteration produces a RefinementStep recording the applied constraint and sites closed.

Completeness Certification (Amendment 25)

To certify that a type resolves in O(1), promote it to a CompletenessCandidate and run the ψ pipeline via a CompletenessResolver:

  1. Promote — associate the type with a ResolutionState and CechNerve via candidateNerve.
  2. Accumulate witnesses — each site-closing step produces a CompletenessWitness recording the applied constraint and sitesClosed.
  3. Check IT_7d — the resolver reads the cached nerveEulerCharacteristic. If χ(N(C)) = n and all β_k = 0, the kernel issues a CompletenessCertificate.
  4. Audit — the certificate's auditTrail links to a CompletenessAuditTrail with the full witness sequence and witnessCount.

W16 Resolver (Amendment 26)

To run any resolver at Witt level W16 instead of W8, use a WittLevelResolver with quantumLevel set to schema:W16. The W16 ring is W16Ring: Z/(2^16)Z with W16bitWidth = 16 and 65,536 elements.

Identities marked op:universallyValid true (such as the critical identity and all QL_ individuals) hold at W16 and every higher level without re-verification.

Session Lifecycle (Amendment 27)

Multi-turn Prism deployments use a SessionResolver that maintains a BindingAccumulator across queries:

  1. Open session — create a Session with an empty sessionBindings context.
  2. Submit queries — each SessionQuery declares sessionMembership; resolved bindings are appended to the accumulator.
  3. Monitor deficit — the aggregateSiteDeficit on the accumulator decreases monotonically (SR_1 invariant).
  4. Handle boundaries — when convergence stalls or a contradiction arises, a SessionBoundary resets the context. The boundaryType is one of state:ExplicitReset, state:ConvergenceBoundary, or state:ContradictionBoundary.

Composition (Amendment 12)

Transforms compose categorically via Composition. The critical composition law criticalComposition asserts that neg ∘ bnot = succ, connecting the two involutions to cyclic rotation.

Use Identity for identity transforms and composesWith to declare composability.

Complete Example

See SHACL test test7_end_to_end in conformance/src/tests/fixtures/test7_end_to_end.rs for a complete single-pass pipeline, and test12_factorization for a full PRISM pipeline with free rank and certification using certifies and certifiedBy.