interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / spec / program-identity.md

404 lines · 26074 bytes Raw Blame History Rendered
1# Specification: Omega Program Identity v2 (`OMEGA_PROGRAM_ID_*`)
2
3```text
4Document ID: SPEC-OMEGA-PROGRAM-ID-V2
5Amends: SPEC-OMEGA-M8 (spec/program.md), spec/omega-language-v0.md identity law 6,
6 spec/visor.md section 6a (program id finding)
7Status: IMPLEMENTED (branch fix/program-id-body)
8Domain tag: "omega.program.v2"
9```
10
11## 1. The defect this fixes
12
13`omega_program_compute_id` (v1) hashed `"PROG"`, the program name, the contract type
14tags and the low byte of each width, the two contract constraint ids, and the low byte of
15`cost.insn_count` and `cost.latency_cycles`. It did **not** hash the body. Two programs
16with different meaning therefore shared an id whenever they shared a name, a contract
17and (by accident) a cost low byte. Reproduced in Visor: after `clear`,
18`fn t(x: u64) -> u64 { x + 1 }` and `fn t(x: u64) -> u64 { x + 2 }` got the same
19`program_id` (reproduced on origin/main 8e7a445: both `87a9e0e1...`). Discovery gives every
20machine-code slice candidate the same name and contract, so equal-length slices would also
21have shared one id. That breaks content addressing: one id named two meanings.
22
23## 2. Identity law (v2)
24
25```
26program_id = SHA256( "omega.program.v2" || 0x00
27 || body_root_id (32 bytes)
28 || input_type_id (32 bytes)
29 || output_type_id (32 bytes)
30 || contract.precondition_id (32 bytes)
31 || contract.postcondition_id ) (32 bytes)
32```
33
34Every 32-byte component is an existing canonical `SemanticId` computed by
35`omega_compute_semantic_id` (spec/canonical-encoding.md). No second canonical encoder
36exists: the body is lowered into a scratch `OmegaGraph` with the existing builders and
37only the root object's id is taken. The 17-byte domain tag is the version boundary: a
38v1 preimage began with `"PROG"` and a name, so a v1 id and a v2 id can never come from
39the same preimage, and a reader that sees the tag knows which law produced the id.
40
41### 2.1 The canonical semantic body
42
43A program body is the ordered step list `OmegaProgramBody` (innermost step first):
44`f(x) = op_n( ... op_2( op_1(x, c_1), c_2) ..., c_n)`, each step one of
45`OP_ADD OP_SUB OP_MUL OP_AND OP_OR` with one constant. It is lowered as:
46
47| object | builder | notes |
48|---|---|---|
49| `T` | `omega_build_type_uint(w)` (or `_signed_int` / `_bitvector` for those tags) | `w` = contract input width; the operation type |
50| `P` | `omega_build_param(T, 0)` | the program's parameter (section 2.2) |
51| `C_i` | `omega_build_val_uint(T, w, c_i)` | step constant, big-endian `ceil(w/8)` bytes |
52| `O_i` | `omega_build_op_binary(op_i, OVERFLOW_WRAP, T)` | the step's operation; wrap is what the AArch64 realization does |
53| `A_i` | `omega_build_apply(O_i, A_{i-1}, C_i)` with `A_0 = P` | running value is operand 0, constant operand 1 |
54
55`body_root_id = id(A_n)` (and `id(P)` for an empty body, the identity function). These are
56the same object shapes the Visor language already builds for expressions (`x + y` lowers
57to `omega_build_apply(omega_build_op_binary(OP_ADD, OVERFLOW_WRAP, u64), x, y)`).
58
59`input_type_id` / `output_type_id` are the ids of the contract's TYPE objects built the same
60way from `(tag, width)`, so a width change changes the id through a canonical type object,
61not through a raw byte.
62
63### 2.2 The parameter object (new canonical shape)
64
65The object model had no free variable. `omega_build_param(type_id, index)` builds:
66
67- kind `KIND_VALUE`
68- one attribute `omega.param` whose value is `index` as a big-endian u16 (V0: always 0)
69- payload: the existing `ValuePayload` layout with `type_id` set and `byte_len = 0`
70
71A literal value always has `byte_len >= 1` and no attributes, so a parameter can never
72equal a literal. The parameter carries its **position**, never its source name, so
73`fn f(x)` and `fn f(n)` with the same body are the same program (alpha-equivalence).
74
75### 2.3 Programs without a body
76
77`has_body = false` means the program's meaning is unknown to Omega (for example a raw
78machine-code slice nothing could lift). Such a program has **no identity**:
79`omega_program_compute_id` returns -1 and sets `program_id` to all zero bytes, and
80`omega_library_insert` refuses an all-zero id. Two unknown programs never share an id.
81
82### 2.4 The composed postcondition (semantic rule: composition is associative)
83
84Composition is sequencing, and sequencing is associative, so the contract of a composition
85must not depend on how the chain was bracketed. `omega_program_compose(a, b)` therefore does
86**not** derive a postcondition text (the old `"(B)o(A)"` text was non-associative:
87`(a;b);c` and `a;(b;c)` got different postcondition ids and so different program ids).
88Instead:
89
90- Every contract has a **leaf list** (`OmegaContract.post_leaves`, `post_leaf_count`). A
91 program whose postcondition was stated directly (builder, Visor `ensures`, any explicit
92 replacement) is one leaf: its own `postcondition_id`.
93- `compose(a, b)` takes the flattened list `leaves(a) ++ leaves(b)` (application order; nested
94 compositions are flattened, never nested), at most 64 entries.
95- The composed `postcondition_id` is the canonical sequence constraint over that list,
96 `omega_contract_post_seq_id`: the right fold `Seq(l1, Seq(l2, ... ln))`, each `Seq` a
97 `KIND_CONSTRAINT` object with attribute `omega.compose = "seq"` and one
98 `CONST_POSTCONDITION` constraint whose payload is `head_id || tail_id`, id by
99 `omega_compute_semantic_id`. A `Seq` can never equal a text leaf (it carries the attribute).
100- The precondition of a composition is `a`'s (already associative).
101- A leaf list that no longer folds to the stored `postcondition_id` (the postcondition was
102 replaced without clearing it) is ignored and the contract counts as one leaf.
103- The postcondition **text** of a composition (`"A ; B"`, truncated) is display only.
104
105Hence `(a;b);c`, `a;(b;c)` and every other bracketing of one chain have one program id,
106while `a;b` and `b;a` differ whenever the bodies differ (different body, different leaf order).
107
108## 3. Field classification
109
110| field | class | in the id? | reason |
111|---|---|---|---|
112| `body` (step list) | **semantic** | yes, as `body_root_id` | what the program computes |
113| `contract.input_type`, `input_width` | **semantic** | yes, as `input_type_id` | the domain |
114| `contract.output_type`, `output_width` | **semantic** | yes, as `output_type_id` | the codomain |
115| `contract.precondition_id`, `postcondition_id` | **semantic** | yes | the promise the program makes; the text strings are the source of these ids and enter only through them |
116| `name` | metadata | **no (removed in v2)** | a human label; renaming does not change meaning. Two names for one body now share one id (dedupe), exactly as `let a = 7` / `let b = 7` share one VALUE id |
117| `cost.insn_count`, `reg_pressure`, `memory_bytes` | metadata | **no (removed in v2)** | properties of one realization (the same body realized differently has a different count) |
118| `cost.latency_cycles` | metadata | **no (removed in v2)** | a model or measurement of one realization on one machine |
119| `contract.post_leaves` (compositions) | **semantic** | yes, through `postcondition_id` (section 2.4) | the ordered component postconditions |
120| `contract.postcondition` text of a composition | metadata | no | display only; the id comes from the leaf list |
121| `realization` (code bytes, realization id, target) | metadata | no | a realization of the meaning, identified separately by `realization_id` and the (program, machine, realization) triple id |
122| `graph` pointer | metadata | no | not used for identity; pointer values never enter an id |
123| `is_realized`, `is_verified` | state | no | lifecycle, not meaning |
124| source whitespace, comments, literal spelling, parameter name, commutative operand side | not stored | no | normalized away by the parser/lowering before the body exists |
125| parser node allocation order, builder call order | not stored | no | the body is an ordered step list; the scratch graph is rebuilt from it in one fixed order |
126
127## 4. Where bodies come from
128
129- `omega_program_build_unary_op` records one step. It now refuses a constant above
130 `0xFFFFFFFF` (fail closed): it loads immediates with MOVZ + one MOVK, so a wider
131 constant used to be silently truncated in the code while the body claimed the full value.
132 (V0 realization, spec/program-realization.md, now loads full 64-bit constants; the builder
133 and Language V0 keep the 32-bit limit, which the identity gates lock.)
134- `omega_program_compose(a, b)` concatenates `a`'s steps then `b`'s (capacity 64 steps;
135 refuses beyond). Composition therefore gives the same body as the equivalent directly
136 written chain. Its realization is compiled from that body (`omega_program_realize`,
137 spec/program-realization.md), no longer spliced from the parts' code.
138- Visor Language V0 lowering (`omega_language_lower_program`) builds through the two above.
139- `omega_discover_abstractions` builds an abstraction from a machine-code slice. It now
140 **lifts** the slice back to a body (`omega_program_lift_body`: decode the rigid
141 `movz x1[, movk x1 lsl 16|32|48 ...]; op x0, x0, x1` template, then re-emit the steps and require
142 byte equality). A slice that does not lift has no body, no id, and is not verified, so it
143 cannot be selected or admitted.
144- `omega_refactor_program` copies the original's body: a refactoring that preserves meaning
145 keeps the original's identity (its cost differs; cost is metadata).
146- Programs assembled by hand (tests) must set a body or they have no identity.
147
148## 5. Consequences for consumers
149
150- **Library** (`omega_library_insert` duplicate refusal, `find_by_id`, dependency DAG): keyed
151 by the v2 id. Two programs with one body and one contract but different names are now one
152 program: the second insert is refused as a duplicate. `find_by_name` is unchanged.
153 An all-zero (no body) id is refused.
154- **Synthesis**: candidate ids now separate different bodies; the equivalence pruning uses
155 behaviour signatures and is unchanged.
156- **Realization synthesis**: `(program_id, machine_id, realization)` triple ids change
157 because the program id changed; the law is unchanged.
158- **Discovery**: candidates with different slices no longer share an id.
159- **Crumbline** (`cl_steps_build_program`): ids change; a step constant above 32 bits now
160 fails the build instead of producing a program whose code disagrees with its steps.
161- **MetaSkills / workflow fusion, plan cache, action graph**: they identify by action-graph
162 digests (`rx_graph_identify`, `rx_fusion`), never by `program_id`. Unaffected.
163- **Visor**: `fn` redefinition with a different body now yields a distinct id and simply
164 rebinds the name (section 6). The session's collision guard stays as an internal invariant
165 check (same id but different realization code means a builder bug), with a new message.
166
167## 6. Visor behaviour change
168
169Before: `fn t(x: u64) -> u64 { x + 1 }` then `fn t(x: u64) -> u64 { x + 2 }` failed with
170"identity collision ... the program id does not cover the body".
171Now: both succeed, the ids differ, the second definition is added to the program table and
172`t` is rebound to it. `fn other` with `transform`'s exact body and contract returns
173`transform`'s id and reuses its table entry (the entry keeps its first name).
174
175## 7. Changed golden ids (old v1 -> new v2)
176
177Every program id changes (new preimage). The ids pinned in tests, and why:
178
179| where | program | old (v1) | new (v2) |
180|---|---|---|---|
181| `tests/language/golden/v0.txt` P rows 1-3, `tests/visor/sessions/e2e.expected` (2 lines) | `fn transform(x: u64) -> u64 requires true ensures result >= 1 { x * 2 + 1 }` (and its two respellings) | `beedf7f6fc3853c0aed82e0b35e165b14878a82b0ebac64aa5bd9430800a8c4f` | `83bd39597742d3bb83e5140c662532c0a2ecb59e5f868e38be16276981644543` |
182| `tests/language/golden/v0.txt` P row 4 | `fn mask(x: u64) -> u64 { x & 0xff }` | `7f6104b6cbf7b1e87055458fa9de9794067893186a84991b35b2a435c06ee244` | `e180baf4807d890dc1ba22472e847da76e877ee04d59b0762f6dfc26b2af62ff` |
183
184Reason for all: v2 hashes the domain tag, the canonical body root and the contract type
185object ids, and no longer hashes the name or cost. The realization code bytes in the same
186rows (and every `E` row) are unchanged. Behaviour changes in tests:
187
188- `tests/language/test_language_v0.c`: "different fn name -> different id" became "same id,
189 table entry reused"; the table count after the name/ensures cases is 2 (was 3); the
190 "different body is refused as a collision" case became "distinct id, name rebound"; the
191 table-full probe uses `x + 1000` (the old probe `x + 1` now equals `fill1` and is reused).
192- `tests/visor/qualification/run_qualification.sh`: `program-id-collision-refused` became
193 `program-id[body-bound: x+1 != x+2 after clear]` and `program-id-redefine-distinct`.
194- Discovery demo (`make test-m11`): the selected abstraction is unchanged (mul2;add1,
195 f(50) = 101); its id changed `c1971e4a...` -> `52b6059b...`.
196
197The omegatool M4-M14 gate suites needed no change.
198
199**Composition postcondition rule (section 2.4) changes every composed program's id** again
200(its postcondition id is now the sequence constraint over the flattened leaf list, not the
201hash of the `"(B)o(A)"` text). No pinned golden changes: Visor `fn` programs carry their own
202`ensures` leaf, so the language golden P rows and `e2e.expected` keep the v2 ids above.
203Examples (M11 benchmark corpus, `make test-m11` demo, first 16 hex; text-derived -> leaf-list):
204
205| program | before 2.4 | after 2.4 |
206|---|---|---|
207| mul2;add1;add5 | `bdca70b9e99a31cb` | `abdda5bc4c0d1300` |
208| mul2;add1;mul3 | `e678c0ba6f3e1236` | `db28207b80a5f6ed` |
209| mul2;add1;sub4 | `451f56e9b4c8564d` | `f9d39c98a66da1ec` |
210| mul2;add1;add10 | `c1a07f6c9dfa754c` | `b1ccbc58e3eb04c3` |
211
212The discovered abstraction (lifted, not composed) keeps `52b6059b...`.
213
214## 8. Non-claims and deferred defects
215
216- `SEMANTIC_ID` / `program_id` is **intensional**: it names the canonical body, not the
217 mathematical function. `x + 1 + 1` and `x + 2` compute the same function and have different
218 program ids, and that stays so. The extensional identity is a separate, versioned id,
219 `FUNCTION_ID` (section 9): canonical inside the polynomial fragment only. Equality of
220 arbitrary programs is undecidable, so no id is extensional for every program.
221- Contract clauses are identified by their canonical **text** (`omega_build_constraint_id`);
222 two logically equivalent clauses with different text differ.
223- Historical receipts under `evidence/` carry v1 ids and are append-only; they are not
224 rewritten. The `omega.program.v2` tag is what keeps them from being confused with v2 ids.
225- The body model is the V0 unary step chain (u64 -> u64, five ops, one constant each). Richer
226 bodies need a richer `OmegaProgramBody`; the identity law (root of the canonical body
227 graph + contract) does not change.
228- Payload bytes are the existing host-struct canonical payloads (spec/omega-language-v0.md),
229 so ids are pinned to the LP64 / 4-byte-enum ABI, as before.
230
231## 9. FUNCTION_ID (`omega.function.v1`)
232
233```text
234Status: IMPLEMENTED and EXERCISED on the host (om/meaning/meaning.om, om/meaning/test/run.sh);
235 not wired into the C library, Visor or any receipt; program ids are unchanged
236Domain tag: "omega.function.v1"
237```
238
239`FUNCTION_ID` names the function a program computes, where that can be decided cheaply. It
240lives beside `omega.program.v2`; it never replaces a program id, never enters a program id
241preimage and never rewrites a receipt.
242
243### 9.1 Programs and the polynomial fragment
244
245A program is a width `w` (1..64) and a postfix list over `x`, constants below `2^w`, `add`,
246`sub`, `mul`, `and`, `or`, with arithmetic modulo `2^w`. The V0 body chain of section 2
247(`x c1 op1 c2 op2 ...`) is one such list. The **polynomial fragment** is decided by an abstract
248evaluation that gives each stack entry the class constant, polynomial or outside:
249
250- `add`, `sub`, `mul` of constants and polynomials are polynomials; `mul` by the constant 0 is the
251 constant 0 (even if the other side is outside).
252- `and`/`or` with a constant side use only exact identities modulo `2^w`: `and` all-ones = the
253 other side, `and 0` = 0, `or 0` = the other side, `or` all-ones = all-ones.
254- Everything else is outside. (So `x and 0xff` at w 64 is outside; `x and 0xff` at w 8 is `x`.)
255
256A program in the fragment computes a polynomial function `Z/2^w -> Z/2^w`.
257
258### 9.2 Canonical form
259
260Every polynomial function `f` modulo `2^w` has exactly one representation
261
262`f(x) = sum_{k<K} a_k x(x-1)...(x-k+1) (mod 2^w)`, with `0 <= a_k < 2^(w - v2(k!))`,
263
264where `v2` is the 2-adic valuation and `K = K(w)` is the least `k` with `v2(k!) >= w` (the
265falling factorial of degree `>= K` is divisible by `K!`, hence zero modulo `2^w`). This is the
266falling-factorial normal form of Keller and Olson (Counting polynomial functions (mod p^n),
267Duke Math. J. 35, 1968) and Singmaster (On polynomial functions (mod m), J. Number Theory 6,
2681974, 345-352). The coefficients come from the values `f(0..K-1)` alone: the forward
269differences are `d_k = Delta^k f(0) = k! a_k (mod 2^w)`; with `k! = 2^v u`, `u` odd,
270`a_k = (d_k / 2^v) u^-1 mod 2^(w-v)` (Newton inverse modulo `2^64`, five steps from `u`).
271`meaning.om` traps (code 9) if a `d_k` is not divisible by `2^v`, which the fragment check makes
272unreachable.
273
274Wolfram evaluations behind the constants (WolframLanguageEvaluator):
275
276- `K(w)` for `w = 1..64` = `{2,4,4,6,8,8,8,10,12,12,14,16,16,16,16,18,20,20,22,24,24,24,26,28,28,30,32,32,32,32,32,34,36,36,38,40,40,40,42,44,44,46,48,48,48,48,50,52,52,54,56,56,56,58,60,60,62,64,64,64,64,64,64,66}`
277 (least `k` with `IntegerExponent[k!, 2] >= w`; `K(8) = 10`, `K(64) = 66`). The suite checks
278 all 64 values against `mg_kof` (`W` records).
279- The number of polynomial functions is `prod_{k<K} 2^(w - v2(k!))`: `log2` = 50 (w 8), 170
280 (w 16), 2274 (w 64). At w 3, a brute force over all coefficient tuples gives 1024 distinct
281 functions, equal to the product of the bounds, and every canonical tuple round-trips.
282- `canon[x(x+1), 64] = {0, 2, 1, 0, ...}`, `canon[x^2, 64] = {0, 1, 1, 0, ...}`,
283 `canon[3x^3 + 5x + 7, 8] = {7, 8, 9, 3, 0, 0, 0, 0, 0, 0}`,
284 `canon[7x^5 + 200x^2 + 13, 16] = {13, 207, 305, 175, 70, 7, 0, ...}`,
285 `canon[255x^2 + 254, 8] = {254, 255, 127, 0, ...}`; `2^63 x(x-1) = 0 (mod 2^64)` for
286 `x = 0..999`. These are the `K` records of `om/meaning/test/vectors`.
287
288The falling-factorial form is not the only canonical choice: any injective function of
289`f(0..K-1)` would serve. It is used because it is readable and because it gives an independent
290check: the suite rebuilds `sum a_k x^(k)` and compares it with `f` on 4096 inputs.
291
292### 9.3 Preimage
293
294- Inside the fragment (class 1): `SHA256("omega.function.v1" 0x00 || 0x01 || w u16 || K u16 ||
295 a_0 .. a_{K-1} u64)`, all big-endian.
296- Outside (class 2, intensional fallback): `SHA256("omega.function.v1" 0x00 || 0x02 || w u16 ||
297 body SEMANTIC_ID)`.
298
299The class byte is in the preimage, so a fallback id never equals a canonical id except by a
300SHA-256 collision, and the id records which kind it is.
301
302### 9.4 What is claimed
303
304- Two programs of the same width in the fragment get the same `FUNCTION_ID` **if and only if**
305 they compute the same function (up to SHA-256 collisions). Programs of different widths
306 always differ.
307- Outside the fragment, equal ids imply equal functions (same body), **not** conversely:
308 `x and 0x7fffffffffffffff` written two ways gets two ids.
309- Not claimed: anything about contracts (a program's contract does not enter its
310 `FUNCTION_ID`), division, shifts, comparisons, multi-parameter or effectful programs.
311
312## 10. The graph of meaning (`omega.meaning.graph.v1`)
313
314```text
315Status: IMPLEMENTED and EXERCISED on the host (om/meaning/meaning.om); in-memory library
316 plus a canonical byte format; no service, no persistence path, no consumer yet
317Domain tags: "omega.meaning.graph.v1", "omega.meaning.receipt.v1"
318```
319
320A graph whose nodes are content-addressed meanings and whose edges are typed relations, each
321equivalence backed by a receipt that a reader can recheck without trusting the writer.
322
323### 10.1 Nodes and edges
324
325| node kind | id | content |
326|---|---|---|
327| 1 PROGRAM | program_id v2 (section 2) | body id, w u16, pre length u16, pre, post length u16, post |
328| 2 BODY | body `SEMANTIC_ID` | w u16, token count u16, tokens (op u8; for a constant also u64) |
329| 3 FUNCTION | `FUNCTION_ID` | the section 9.3 preimage |
330
331Edges use the `RelationKind` codes of `src/omega_types.h`:
332
333| rel | edge | receipt |
334|---|---|---|
335| 4 CONTAINS | PROGRAM -> BODY | none (recomputed) |
336| 7 DERIVED_FROM | FUNCTION -> BODY | none (recomputed) |
337| 9 EQUIVALENT_TO | BODY lo -> BODY hi | kind 1 CANON or kind 2 EXHAUSTIVE |
338| 2 NOT_EQUAL | BODY lo -> BODY hi | kind 3 WITNESS |
339
340`lo`/`hi` order the endpoints by id. Adding a program adds its PROGRAM, BODY and FUNCTION nodes
341(deduplicated by id) and, for a canonical FUNCTION, a CANON equivalence to every other body of
342that FUNCTION.
343
344### 10.2 Receipts
345
346Receipt id = `SHA256("omega.meaning.receipt.v1" 0x00 || content)`.
347
348- kind 1 CANON (99 bytes): `01 || lo || hi || w u16 || FUNCTION_ID`. Checked by recomputing both
349 bodies' `FUNCTION_ID`s from the stored body content: both class 1 and both equal to the one
350 recorded.
351- kind 2 EXHAUSTIVE (75 bytes, w <= 32): `02 || lo || hi || w u16 || 2^w u64`. Checked by
352 evaluating both bodies on all `2^w` inputs.
353- kind 3 WITNESS (91 bytes): `03 || lo || hi || w u16 || x u64 || f_lo(x) u64 || f_hi(x) u64`.
354 Checked by evaluating both bodies at `x`.
355
356`mg_verify` recomputes every node id from its content, every receipt id, and every edge's
357receipt; a witness search that finds nothing adds nothing (no witness is not a proof).
358
359### 10.3 Storage
360
361`"omega.meaning.graph.v1" 0x00 || u32 N || N x (id, kind u8, u32 len, content) || u32 R ||
362R x (id, u32 len, content) || u32 E || E x (src id, rel u16, dst id, receipt id or 32 zero
363bytes)`, big-endian, each list strictly increasing (nodes and receipts by id, edges by
364src, rel, dst, receipt). The bytes depend only on the set of nodes, receipts and edges, not on
365insertion order; the graph digest is SHA-256 of these bytes. `mg_load` refuses truncated or
366trailing bytes, a wrong tag, non-increasing order (so duplicates), malformed bodies, dangling
367edges and unknown node kinds.
368
369### 10.4 Queries (OM-2 words)
370
371`mg_nbr n rel` (neighbours over one relation, or any with rel 0), `mg_class n` (closure over
372EQUIVALENT_TO, n first), `mg_prov n` (every edge touching n; its receipts are the provenance).
373
374## 11. Qualification
375
376`make test-program-id` (tests/program/test_program_id.c, physics-free, runs in the CI AArch64
377job) prints five gates:
378
379| gate | what it proves |
380|---|---|
381| `OMEGA_PROGRAM_ID_BODY_BOUND_PASS` | `x + 1` vs `x + 2` differ through `omega_program_build_unary_op`, through Visor lowering, and under an identical name + contract + cost (the v1 collision); composition order separates; a body-less program gets no id; a 33-bit constant is refused; the v2 id differs from the v1 recipe |
382| `OMEGA_PROGRAM_ID_REPRESENTATION_INVARIANT_PASS` | name, cost, realization bytes and pointer values do not move the id; six Visor spellings (whitespace, comments, parameter name, operand side, literal spelling, fn name) share one id; library composition equals Visor lowering when both state the same contract; 400 seeded chains (3-8 parts, some with user-stated leaf postconditions) x 4 random bracketings all equal the left fold, with the leaf list flattened; a;b != b;a for 400 pairs with different bodies; a stale leaf list is ignored; a hand-built body graph in 8 scrambled allocation orders has the same root; lift(realization) == body |
383| `OMEGA_PROGRAM_ID_MUTATION_SEPARATION_PASS` | seeded differential over 3000 random programs (every pair, ~4.5M comparisons): id equal iff a hash-free structural oracle says body + contract equal; 2000 programs x 8 single mutations (op, constant, width, output width, pre, post, step added, step removed) always separate |
384| `OMEGA_PROGRAM_ID_LIBRARY_REGRESSION_PASS` | library duplicate / admission / no-body refusal / DAG, discovery lift to mul2;add1 and admission, refactor keeps identity, realization triple id follows the program id, 64-step capacity |
385| `OMEGA_PROGRAM_ID_VISOR_REGRESSION_PASS` | Visor session: distinct ids after `clear`, redefinition rebinds, aliases and respellings reuse the entry, stored realization == emit(body) |
386
387`tools/program_id_receipt.sh` (shell only) runs these plus the Visor suites, the Visor V1
388qualification campaign, the omegatool M8-M14 and Crumbline consumers and the non-energy host
389regression suites on the committed clean tree, and writes a content-addressed receipt under
390`evidence/PROGRAM_ID/`.
391
392`sh om/meaning/test/run.sh seed/out/omc` (host only, no C) builds `om/meaning/meaning.om` with
393the pinned compiler and checks sections 9 and 10: must-collapse pairs (`x + 1 + 1` / `x + 2` /
394`2 + x`, `x(x+1)` / `x*x + x` / `x(x+1) + 2^63 x(x-1)`, the 66-factor falling factorial / 0,
395reassociation, commutation, distribution, `x and 255` / `x` at w 8), must-not-collapse pairs
396(constants one bit apart, the 65-factor product / 0 at w 64, the 9-factor product / 0 at w 8),
397Wolfram coefficient vectors, `FUNCTION_ID` goldens that `run.sh` recomputes with `sha256sum`
398from the 9.3 preimage, the two program_id goldens of `tests/language/golden/v0.txt`, the `K(w)`
399table, refused programs, exhaustive and witness proofs, queries, a randomized differential at
400w 1, 3, 8, 16, 64 (ids equal iff value signatures equal for fragment pairs; equal ids imply
401equal signatures otherwise; reconstruction of every canonical form), graph verification,
402store/load/store byte identity, reverse-insertion digest equality and tamper detection, then
403source and expectation mutants that must each go red. Final line: `MEANING PASS checks=N
404mutants=M/M`.