omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / spec / semantic-communication.md
| 1 | # Semantic communication pruning (OMEGA_SEMANTIC_COMMUNICATION) |
| 2 | |
| 3 | Code: `src/runtime/rx_semcomm.{c,h}`. Test: `tests/runtime/rx_semantic_comm.c`, |
| 4 | `make test-semantic-comm`. Receipt: `evidence/SEMANTIC_COMM/`. |
| 5 | |
| 6 | ## Purpose |
| 7 | |
| 8 | Branches and cognitive workers exchange only the state the receiver needs. |
| 9 | Nobody broadcasts an internal history or the whole J-space World. A receiver |
| 10 | declares what it is about to do; Omega answers with the part of the World |
| 11 | that operation needs, checked against the receiver's own authority; after the |
| 12 | first delivery only what changed travels. |
| 13 | |
| 14 | ## Boundaries |
| 15 | |
| 16 | | Party | Role here | |
| 17 | |---|---| |
| 18 | | Receiver (branch, worker) | declares an `InformationNeed`; holds its own capabilities | |
| 19 | | Omega | computes the `SemanticProjection`, its encoding and deltas. No admin handle. Reads the World only. | |
| 20 | | World (J-space) | objects, fields, per-field versions, writer crumbs (rx_world) | |
| 21 | | Aienux | the only minter (native C capability authority) | |
| 22 | |
| 23 | `rx_semcomm.o` is linked alone first. The build fails if it references any |
| 24 | `aienos_cap_*` admin operation, `rx_caproot_mint`/`revoke`, or a World write |
| 25 | (`rx_world_publish*`, `create`, `retire`, `add_reaction`). |
| 26 | |
| 27 | ## InformationNeed |
| 28 | |
| 29 | ``` |
| 30 | RxInformationNeed { |
| 31 | receiver principal (capability subject) |
| 32 | operation INSPECT(field mask) | SUM(field) | MAX(field) |
| 33 | required_types[] 0 = any type |
| 34 | relevant_objects[] object references (id + generation); 0 = every object of the types |
| 35 | relevant_time_range [from_crumb, to_crumb] on each field's writer crumb; to 0 = open |
| 36 | evidence_requirement NONE | WRITER (crumb id) | DIGEST (crumb id + content digest) |
| 37 | uncertainty_requirement max ppm (0 = any) and whether to deliver the value |
| 38 | } |
| 39 | ``` |
| 40 | |
| 41 | Time is causal: a field's time is the id of the crumb that last wrote it |
| 42 | (`rx_world_explain`). Crumb ids are dense and monotonic in one world. |
| 43 | |
| 44 | Uncertainty is declared, not estimated. A type may name one field as its |
| 45 | producer's uncertainty in parts per million (`RxSemType.uncertainty_field`). |
| 46 | Objects above the bound are left out; `deliver` adds that field. |
| 47 | |
| 48 | ## SemanticProjection |
| 49 | |
| 50 | ``` |
| 51 | RxSemanticProjection { |
| 52 | object_refs[] reference, type, resource, delivered field mask, conclusion flag |
| 53 | fields[] (object, field, value, version) |
| 54 | derived_values[] SUM or MAX computed by Omega (omega_eval_pure_binary_uint) instead of the inputs |
| 55 | evidence_refs[] (object, field, writer crumb [, crumb digest]) |
| 56 | } |
| 57 | ``` |
| 58 | |
| 59 | Selection per live object, in id order: |
| 60 | |
| 61 | 1. type in `required_types`, reference in `relevant_objects`; |
| 62 | 2. the fields the operation needs whose writer crumb is inside the time range; |
| 63 | none left means the object is out of scope; |
| 64 | 3. READ on the object's resource, validated through the world's authority |
| 65 | view for the receiver's principal; otherwise withheld; |
| 66 | 4. uncertainty bound; |
| 67 | 5. fields the type marks private need READ on the private resource |
| 68 | (`resource | 1<<62`); otherwise those fields are withheld. |
| 69 | |
| 70 | INSPECT delivers the selected fields. SUM and MAX deliver the object |
| 71 | references (provenance) and one derived value; the inputs do not travel. |
| 72 | Evidence, when required, covers every field the operation used, delivered or |
| 73 | folded into a derived value. |
| 74 | |
| 75 | ## Authority |
| 76 | |
| 77 | A projection carries values and references. It carries no capability. A |
| 78 | receiver that wants to write still needs its own WRITE capability, which the |
| 79 | engine validates when the reaction starts and again at publication. The test |
| 80 | tries three writes with nothing but a projection and a READ capability: an |
| 81 | outside publication, a reaction that claims WRITE on the READ capability, and |
| 82 | a reaction that declares READ honestly. All three are refused; a principal |
| 83 | that really holds WRITE commits (control). |
| 84 | |
| 85 | Revocation is seen on the next delivery: the next projection no longer |
| 86 | contains the object, so the delta carries an invalidation. |
| 87 | |
| 88 | ## Encoding |
| 89 | |
| 90 | One canonical little-endian format for every mode, so byte counts compare. |
| 91 | Header 21 bytes (magic `SCM1`, kind, receiver, sequence, record count). |
| 92 | |
| 93 | | Record | Bytes | Content | |
| 94 | |---|---|---| |
| 95 | | O object | 20 | id, generation, type, resource, conclusion flag | |
| 96 | | F field | 20 | id, field, version, value | |
| 97 | | E evidence | 12 | id, field, writer crumb | |
| 98 | | D evidence + digest | 44 | as E, plus the crumb's SHA-256 | |
| 99 | | V derived | 22 | slot, op, field, value, argument reference, input count | |
| 100 | | X drop object | 8 | id, generation, reason | |
| 101 | | Y drop field | 5 | id, field, reason | |
| 102 | |
| 103 | Kinds: FULL_STATE (broadcast baseline), PROJECTION (replaces the receiver's |
| 104 | view), DELTA (edits it). |
| 105 | |
| 106 | ## Delta delivery |
| 107 | |
| 108 | The sender keeps one cursor per receiver: which objects, generations, field |
| 109 | versions and evidence crumbs it last delivered, and the derived values. A |
| 110 | delta carries, in order: |
| 111 | |
| 112 | - invalidations: objects that left (reason RETIRED, AUTHORITY, UNCERTAIN or SCOPE); |
| 113 | a slot reused by a new generation drops the old one first; |
| 114 | - new objects with all their fields and evidence; objects of a conclusion type |
| 115 | are new conclusions; |
| 116 | - for objects already held: fields that left, fields whose version changed, |
| 117 | evidence whose writer crumb changed; |
| 118 | - derived values that changed. |
| 119 | |
| 120 | Unchanged state never travels. With nothing changed a delta is a bare header. |
| 121 | |
| 122 | ## Test (swarm simulation) |
| 123 | |
| 124 | World: 180 objects in 6 types over 12 capability domains, 16 teams (each READ |
| 125 | on 4 domains, even teams also on one private resource), 24 rounds. Each round: |
| 126 | 12 objects get 1–3 field writes; every 4th round an object is retired and |
| 127 | replaced (new generation); every 3rd round a new conclusion object appears; |
| 128 | round 12 revokes team 3's READ on its home domain; round 18 grants it again. |
| 129 | |
| 130 | Workers: 32, 100 and 500, with partially overlapping tasks. Nine in ten draw an |
| 131 | operation, one or two types, a window of 12–48 objects from one of 24 task |
| 132 | groups (or all objects of the types), sometimes a time range, an evidence mode |
| 133 | and an uncertainty bound. One in ten is a coordinator: every type, every |
| 134 | object, every data field, writer evidence. |
| 135 | |
| 136 | Every round, from the same World at the same moment: |
| 137 | |
| 138 | | Mode | What each worker gets | |
| 139 | |---|---| |
| 140 | | full-state broadcast | every live object, every field, its version and writer crumb id | |
| 141 | | semantic projection | its projection, fresh | |
| 142 | | projection + delta | its first projection, then deltas | |
| 143 | |
| 144 | The broadcast baseline carries no crumb digests; that makes it smaller than a |
| 145 | true full state, and DIGEST workers in broadcast mode are not charged for |
| 146 | missing digests. Both choices favour the baseline. |
| 147 | |
| 148 | Each worker then performs its operation. A reference evaluator, written apart |
| 149 | from `rx_sem_project`, applies the same need to a copy taken straight from the |
| 150 | World under the worker's authority; that is the truth. Broadcast workers run |
| 151 | the same evaluator on what they decoded (they filter, and check authority, |
| 152 | themselves). |
| 153 | |
| 154 | Measured per size and mode: encoded bytes, sender and receiver thread CPU |
| 155 | time, per-round latency (sender + all receivers, one thread), receiver held |
| 156 | bytes and sender state bytes (broadcast buffer or delta cursors), authority |
| 157 | validations, task success, missing-required-information failures, and fields |
| 158 | delivered without authority. Energy: the Spark's `aien_spbm` hardware counters |
| 159 | (pkg, cpu_p, microjoules) over whole scenario runs, four interleaved blocks of |
| 160 | at least 1.5 s per mode (world-only, broadcast, delta), medians, raw. |
| 161 | |
| 162 | Also checked: a view rebuilt from deltas hashes the same as a view built from |
| 163 | the fresh projection (every worker, every round); the same need on the same |
| 164 | World gives identical bytes whatever order capabilities are held in; after a |
| 165 | round with no change every delta is empty; every worker that held revoked |
| 166 | state is told; a deliberately under-declared need (one type left out) is caught |
| 167 | as missing information (negative control). |
| 168 | |
| 169 | ## Gate |
| 170 | |
| 171 | `OMEGA_SEMANTIC_COMMUNICATION_PASS` iff every check passes and, at every size: |
| 172 | projection bytes < broadcast bytes and delta bytes < projection bytes; |
| 173 | missing-required-information 0 in every mode; fields delivered without |
| 174 | authority 0 for projection and delta; task success 100% in every mode; |
| 175 | delta/fresh equivalence 0 mismatches; determinism 0 mismatches; quiet deltas |
| 176 | empty; revocation delivered to every holder; the negative control detects |
| 177 | missing information; no write through a projection. Energy is measured and |
| 178 | reported, not gated. |
| 179 | |
| 180 | ## Not claimed |
| 181 | |
| 182 | - Transport over a network or between processes: delivery is in-process |
| 183 | decode of the real encoded bytes. |
| 184 | - Graphics-processor senders or receivers. |
| 185 | - The Aienux kernel: the authority runs as a host library. |
| 186 | - Learned or inferred needs: needs are declared. |
| 187 | - Uncertainty estimation: Omega carries the producer's declared value. |
| 188 | - Worlds above 256 objects (`RX_MAX_OBJECTS`). |
| 189 | - Sender cost: projection spends sender CPU and a cursor per receiver that |
| 190 | broadcast does not; the receipt reports both. |