Skip to main content

Module frame_layout

Module frame_layout 

Source
Expand description

FrameLayout — the single canonical registry for the ~6 computational-support bytes of the 48-byte NQuin Frame.

A Frame is 6 × u64 = 48 bytes: roughly 42 bytes of semantics (the subject / property-path / object / context hashes and packed literals) plus ~6 bytes of computational support (opcode, flags, datatype tags, a clock, ECC parity) — which is what makes a Frame both data and executable code in one cell. Every modality reads and writes those computational bytes through here, so the primitive stays universal and no two conventions silently collide (enforced by the tests below).

§predicate — opcode | property-path | defeater (co-resident; MUST NOT overlap)

[0..7] deontic/epistemic opcode · [8..62] property-path hash · [63] defeater. “Proposition-mode” modalities (LTL/CTL/modal/abductive/causal/…) use the WHOLE predicate as a plain q_hash (no opcode) — a documented mode, not a collision.

§object — MSB pointer flag | inline datatype tag | value (co-resident)

[63] set ⇒ the value is a lexicon/embedded pointer. When [63] is clear, [60..62] is an inline datatype tag and [0..59] is the value. Canonical tags (from resolver): INTEGER 001 · DECIMAL 010 · BOOLEAN 011 · BLOB 100 · FLOAT 101 (new — raw f32 bits; resolves the prior clash where f32 squatted on the INTEGER tag).

§Tag policy — closed datatypes inline, open identifier kinds in the graph

The object inline-tag region is reserved STRICTLY for the small, CLOSED set of structural datatypes the GPU/SIMD hot path must read in-register (the tags above: INTEGER/DECIMAL/BOOLEAN/BLOB/FLOAT + the embedded-triple / pointer flags). Open, extensible identifier kinds / namespaces (Webizen, did:q42, DID, content-hash, instrument-language, cluster-node, …) are NOT inline tags — they are scoped by modal predicates in the graph (<X> <has-modality-kind> <…>), resolved at the logic layer via indexing::QuinIndex point lookups, with the lexicon as the collision backstop (the u64 is a handle to a full value, so a handle collision is detectable + resolvable, never silent corruption). Rationale: datatypes are a fixed vocabulary that belongs in the bit-budget; identifier kinds are an open fabric that belongs in the relations (identifiers-not-identity). This is why a dictionary identity is 60-bit (top nibble = the datatype overlay) while identifier-kind breadth lives in predicates, not in more inline tag bits.

§metadata — a ROLE-KEYED OVERLAY field (read this carefully)

Unlike predicate/object, the 32 high bits of metadata are NOT a flat set of independently-addressable sub-fields. They are a union of overlays, each valid only for a particular quin role, several of which share bit positions. Two overlays sharing bits is safe iff their roles are mutually exclusive (a quin is never both at once). The ONE invariant that always holds — and is enforced below — is that the low-32 payload is disjoint from every high overlay, so a degree/expiry/timestamp can never silently corrupt a type/flag.

  • [0..31] low payload (any quin): exactly ONE of expiry / f32 truth-degree / 32-bit timestamp / packed (alpha,mu,sigma) — selected by role.
  • [32..59] tensor-bake t clock — ONLY on Tensor10D ground-truth nodes (tensor::bake_pipeline).
  • [50..59] per-modality flag bits — ONLY on that modality’s quins (each flag is a single distinct bit; see the pairwise-distinct test).
  • [56..59] ODRL sensitivity tier — ONLY on access-controlled quins.
  • [60..63] quin-type nibble — general typing; [61..62] of it doubles as the permissive-routing lane (cbor_compiler, daemon_swarm). Typed vs routed are treated as exclusive roles. quin_type was deliberately NOT relocated lower: every lower slot lands inside the [32..59] bake clock, which would be a worse (cross-role) collision than the documented [61..62] overlap.

Re-exports§

pub use crate::resolver::INLINE_TAG_BOOLEAN;
pub use crate::resolver::INLINE_TAG_DECIMAL;
pub use crate::resolver::INLINE_TAG_FLOAT;
pub use crate::resolver::INLINE_TAG_INTEGER;
pub use crate::resolver::INLINE_TAG_MASK;
pub use crate::resolver::INLINE_VALUE_MASK;
pub use crate::resolver::MSB_FLAG;

Constants§

ARGUMENT_BIT
ATTACK_BIT
BAKE_CLOCK_MASK
Tensor-bake t clock (only on Tensor10D ground-truth nodes). Matches bake_pipeline’s (metadata >> 32) & 0x1FFF_FFFF, i.e. bits [32..60] — it even grazes quin_type’s bit 60, an existing tensor-only quirk. Documentary only; never asserted disjoint (its role excludes the others).
CONSUMED_BIT
CONTROL_BIT
COUNTERFACTUAL_BIT
DEFEATER_BIT
DEFENSE_BIT
DO_INTERVENTION_BIT
FEEDBACK_BIT
INLINE_TAG_BLOB
Blob/byte-offset pointer tag (canonical in dicom).
LOW32_MASK
Low-32 payload mask: expiry | f32 truth-degree | 32-bit timestamp (typed).
OPCODE_MASK
PATH_MASK
QUIN_TYPE_MASK
QUIN_TYPE_SHIFT
quin-type nibble [60..63] (general typing). Its low two bits [61..62] are reused as the permissive-routing lane on routed quins — typed vs routed are exclusive roles. NOT relocated lower: every lower slot collides with the [32..59] tensor-bake clock (a worse, cross-role collision).
ROUTING_LANE_MASK
ROUTING_LANE_SHIFT
Permissive-routing lane [61..62] (only on routed quins; shares bits with the quin-type nibble by role-exclusivity).
SENSITIVITY_MASK
SENSITIVITY_SHIFT
ODRL sensitivity tier [56..59] (only on access-controlled quins).
STABILIZATION_BIT
SYNTHESIZED_BIT

Functions§

expiry
is_defeater
object_tag
The 3-bit inline datatype tag of an object value (only meaningful when MSB clear).
opcode
pack_float_object
Pack an f32 into an object field with the canonical FLOAT tag.
pack_predicate
Canonical norm-predicate packing — MUST equal deontic::compile_norm_quin.
parity
parity_valid
path_bits
quin_type
sealed
timestamp
truth_degree
CANONICAL truth/belief/confidence/fuzzy degree (IEEE-754 f32 in the low 32 bits).
unpack_float_object
Recover an f32 from a FLOAT-tagged object field.
with_quin_type
with_truth_degree