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 / omegese-om2-errata.md

218 lines · 14464 bytes Raw Blame History Rendered
1# OM-2 errata (coordinator L835)
2
3Clarifications to the frozen `spec/omegese-om2.md` (sha256 `245bb74e…0881`) that resolve conflicts
4inside it. No erratum changes the meaning of a construct that a lane has already built on. Each
5erratum names who raised it.
6
7## E1 (AbiLane L837, 2026-10-25): which units are v2, and where identities live
8
9§6 "Symbol versioning" and "Module boundary" conflicted with C2-style byte identity for v1 bindings.
10Resolution:
11- Every OM-2 unit (first non-note line `om2`) is bound ABI v2 (`omega2_<export>`), whatever its
12 parameter kinds. This replaces "a unit with any unsized view or layout parameter".
13- A v2 binding embeds the unit source sha256 (computed by the generator from the exact bytes), the omc
14 pin (supplied by the harness, per C3) and profile `OM-2`, readable via `omega2_ident_<unit>()`.
15- OM-1 units stay ABI v1 with byte-identical binding output and no embedded identity. Their identity
16 (source sha256, omc pin, profile `OM-1`) is recorded by the harness, and `om/units.sh --check` refuses
17 a stale OM-1 unit.
18- An `out` parameter is passed as one pointer with no count, like a layout.
19
20## E2 (QualPhaseB L836, 2026-10-25): sized arrays to unsized parameters
21
22A sized array (length N) may be passed to an unsized `view T *` / `edit T *` parameter of a function
23in either mode; `len` is N inside the callee. Writability rules are unchanged (a view never reaches an
24edit). Unsized parameters are allowed on internal functions, not only on exported entries.
25
26## E3 (ShaLane L838, 2026-10-25): context copies and the C API names
27
28- A byte copy of a context between `init` and `final` is an equivalent context: all hashing state lives
29 in the 104 layout bytes (no hidden state, no self-pointers). Receipt required: copy after k updates,
30 continue both copies with the same data, equal digests. Callers relying on this:
31 `src/fabric/fab_loopback.c:107`, `src/fabric/fabric.c:496`, `src/osh/host/osh_journal.c:81/104`.
32- Digest overlapping data is used by `omega_program.c:777` and `tests/runtime/rx_sem_incremental.c:183`;
33 §6 `out` semantics cover it (receipt required).
34- C API names: the SHA unit exports `omega2_sha256_init` etc. The bridge-generated header maps the
35 `sha256_*` names to them (generated, not handwritten). The freestanding nm allow-list
36 (`Makefile:657`, `RX_CX_FS_ALLOWED`) changes from `sha256_*` to the `omega2_sha256_*` symbols. That
37 one Makefile rule is changed by the SHA lane (L838) in the cutover commit.
38
39## E4 (QualPhaseB L836, 2026-10-25): diagnostic record fields and the fmt input
40
41- `col` is the 1-based byte column of A on its line.
42- The span `A-B` is the offending lexer token; at end of input it is the empty span `len-len`.
43- `found` is the hex of the span bytes, or `-` when the span is empty.
44- `expect` is the token class the parser wanted next.
45- `om2 fmt`: "the rest" is the bytes after the first LF; the output does not contain the `om2 fmt` line.
46
47## E5 (ShaLane L838, 2026-10-25): scalar layout fields; cutover build rules
48
49- In `field F T [COUNT] at OFF little|big`, an omitted COUNT is a scalar field (`get c F`,
50 `put c F v`). A COUNT (1..4096) is an array field (`get c F i`), even when COUNT is 1. In the §5
51 SHA example, `field count ulong 1 at 32 little` reads `field count ulong at 32 little` (scalar).
52- Cutover: `src/omega_om_units.inc` is today included only by `src/sha256.c`, and BLAKE3 links through
53 it. The generated bindings move to a generated `src/omega_om_units.c`, and every build rule that
54 names `src/sha256.c` (Makefile, mk/*.mk, scripts) is switched to it in the cutover commit. The SHA
55 lane (L838) is the single writer of exactly those build-rule lines in that commit.
56
57## E6 (QualPhaseB L836, 2026-10-25): reserved names, diag fields, formatter edge cases
58
59- **Q1:** declaring an OM-2 reserved word as a name inside an OM-2 unit (for example `fn rotr`) is
60 error 16, as OM-1 does for `fn break`.
61- **Q2, `expect` and spans:**
62 - A lexically bad literal (error 6) or an out-of-range literal (error 8) reports `expect=number`.
63 - A missing `end` at end of input reports `expect=end`, with `sev=incomplete`.
64 - An unknown name reports `expect=name`.
65 - A line that ends before its operand when more input follows reports the LF byte as the offending
66 token (span covers the LF), with `sev=error`.
67 - An incomplete call to a function whose signature is not yet read reports the callee name token
68 as the span, with `sev=unknown`.
69- **Q3:** line numbers always count every line of the whole input, the `om2 fmt` line included.
70- **Q4, formatter:**
71 - (f) Formatter mode applies iff the input's first line, at byte 0, is exactly `om2 fmt`. A line
72 `om2 fmt` anywhere else is error 16.
73 - (c, d) A note line is any line whose first token is `note`, indented or not. It is kept byte for
74 byte, including its indentation and any trailing spaces. `text` literal bytes are kept byte for
75 byte. These two rules take precedence over every other formatting rule.
76 - (b) A whitespace-only line becomes an empty line.
77 - (a) Blank lines at the end of the input are error 6, so the formatter never removes lines and the
78 output always ends with exactly one LF after the last non-blank line.
79 - (e) The spacing next to `(` and `)` is kept as written. Grouping is never respaced.
80 - (g) CR is error 6 anywhere, including inside a `text` literal.
81 - (h) The rest may be an OM-1 unit. The formatter is lexical, and compile(fmt(x)) == compile(x)
82 applies whatever x's profile is.
83
84## E7 (QualPhaseB L836, 2026-10-25): unroll and inline limits, site records
85
86- `for i T K unroll`: K = 0 or K > 64 is error 8. A K that is not a number is error 16.
87- The limit of 64 copies applies per unrolled loop. Nested unrolls multiply, and their total is bounded
88 only by the 65536-word limit (error 14, `obligation=growth`).
89- Inline depth: a call site in a function that is not being inlined is depth 1. A chain of 4 inlined
90 calls is accepted; a 5th level is error 14 (`obligation=growth`).
91- `break`/`continue` inside a rolled loop nested within an unrolled body is allowed; it leaves the
92 rolled loop. Only a `break`/`continue` whose innermost loop is the unrolled one is error 9.
93- `omc-site 1 line=N iter=P` records appear in emission order. P is the 0-based value of each enclosing
94 unrolled loop's counter, from outer to inner and joined by `.` (for example `iter=3.15`), or `-`.
95- OM-1 shifts accept a shift amount of a different type. OM-2 `rotr`/`rotl` require the same type;
96 this stricter rule applies to OM-2 words only.
97
98## E8 (QualPhaseB L836, 2026-10-25): codes and lines for §5/§6 refusals
99
100- A `fresh` with N > 64 is error 14 (`obligation=init`).
101- An abstract type used as an entry parameter or return, or as an array element type, is error 7.
102- An operation on an abstract value that its `abstract` line does not list is error 7.
103- A field access with the wrong arity: a missing index on an array field (any COUNT) is error 4; an
104 extra index on a scalar field is error 5.
105- Layout SIZE 0 or > 4096, and a `layout` after the first `fn`, are error 29 (`obligation=layout`).
106- `part` anywhere other than as a call argument is error 9.
107- Which line each error names:
108 - error 27: the offending `get` or call line;
109 - error 28: the `seal` line, or the `holds` line for a bad predicate;
110 - error 29: the offending `field` line, or the `layout` line for a SIZE error.
111- Confirmed as written:
112 - `rotr` of a dup32 value with n = 64 traps 7;
113 - `omc-check` records name the constructor's `ret seal` line;
114 - for layout fields, a constant out-of-range index is error 21, a `put` through a view is error 20,
115 and an array of the wrong size is error 7.
116
117## E9 (QualPhaseB L836, 2026-10-25): rotate count of an abstract value; late layout line
118
119- For `rotr`/`rotl` on an abstract value, `n` has the abstract type's representation type T (ulong
120 for dup32), so a bare number takes T.
121- Error 29 for a `layout` after the first `fn` names the `layout` line.
122
123## E10 (QualPhaseB L836 D3, 2026-10-25): blank lines before `om2`
124
125A unit is OM-2 iff its first line that is neither a `note` line nor blank (empty, or only spaces) is
126exactly `om2` (or `om2 diag`). OM-1 refuses such a unit at the `om2` line whether or not blank lines
127precede it, so C1 and C3 hold. The fmt mode rule (E6 Q4 f, the first line at byte 0) is unchanged.
128
129## E11 (QualPhaseB L836, 2026-10-25): leakage scan wording and public memory
130
131- §8 evidence (a): a static scan cannot show that a branch is never taken. The requirement reads
132 instead: "a data-dependent conditional branch must branch only to a trap stub (a check such as the
133 uint conversion range check after `and x 0xffffffff`), and is listed."
134- The context's `count` field (bytes 32..39) encodes the number of bytes absorbed so far, which the
135 leakage model treats as public (a length). The scanner takes an explicit, reviewable public-memory
136 declaration `pub:SLOT:OFF:LEN` (for SHA: the context slot, bytes 32..39). Items derived only from
137 declared public memory are classified as length-dependent. Every declaration is listed in the
138 evidence.
139
140## E12 (advisor review, 2026-10-25): supersedes the first bullet of E11
141
142A trap destination alone does not establish trace equivalence: a reachable trap whose condition
143depends on secret data changes the trace (`fn f a view ulong 4 to uint / ret uint get a 0 / end`
144exits 0 for input 0 and 105 for input 2^32). A data-dependent conditional branch counts as
145length-dependent only when its trap edge is shown unreachable by a stated static rule. In OM-2 that
146is only the known-bits rule: the operand of a conversion range check is the result of `and x M`, with
147M a constant that fits the target type. Every other data-dependent branch, trap stub or not, is
148reported `MANUAL`. A unit with any `MANUAL` item gets the verdict NOT_RUN for trace equivalence, never
149PASS. The counterexample above is a required negative control (expected: MANUAL / NOT_RUN). E11's
150public-memory declaration stands.
151
152## E13 (advisor review, 2026-10-25): a public-memory declaration needs public stores
153
154A `pub:SLOT:OFF:LEN` declaration makes a load length-dependent only if every store the unit can make
155into that range stores a value that is itself length-dependent (derived from lengths, counts, the op
156code, constants or declared-public loads). A store into a declared-public range of a data-dependent or
157unclassified value makes every later load from that range data-dependent, or `MANUAL` when the
158scanner cannot order the store and the load. Required negative control:
159`fn f c edit uchar 104 a view uchar 1 to ulong / put c 32 get a 0 / if eq get c 32 0 / ret 0 / else /
160ret 1 / end / end` with `pub:0:32:8`. Expected: MANUAL or data-dependent, NOT_RUN; natively, message
161bytes 0 and 1 give exits 0 and 1.
162
163## E14 (advisor review, 2026-10-25): expansion work fuel
164
165The emitted-word cap alone does not bound compiler work. Nested unrolls of a body that emits nothing
166(`for a ulong 64 unroll` four deep around `note empty`) emit an identical 212-byte artifact at every
167depth, yet re-parse 64^4 bodies (1.58 s with omc c23b3376 against about 1 ms at depth 1). The §4
168sentence "each bound limits compiler work and memory linearly in the output" is withdrawn and
169replaced by:
170- Every function has an expansion fuel of 65536. Each copy of an unrolled body and each inline
171 expansion costs 1, at every nesting depth, so nested unrolls multiply their cost. Exhausting the fuel
172 is error 14 (`obligation=growth`) at the line of the loop or call that exhausted it.
173- With fuel F, compiler work is then bounded by O(F x the source length of the function) re-parsed
174 tokens, plus the OM-1 capacities.
175- Required controls:
176 - depth 2 of 64-copy empty unrolls (4096 copies) compiles;
177 - depth 3 (262144 copies) is error 14;
178 - the compile time of the largest accepted case is reported.
179
180## E15 (CompilerS3 L834, 2026-10-25): S3 points the contract did not settle (accepted)
181
1821. `abstract` and `holds` lines are accepted only before the first `fn`; after it they are error 9.
1832. `holds X dup32` with X of base type uint is error 28 (dup32 needs ulong).
1843. A bad base type in `abstract` is error 7; an unknown word after `ops` is error 16.
1854. Layout fields accept every integer type; signed fields are sign-extended on read.
1865. A layout parameter is also a plain `uchar` array of SIZE bytes (`get c i`, `len c`) when the word
187 after it is not one of its fields. A field name therefore shadows a local of the same name in that
188 position.
1896. A `note` line inside a constructor body makes the body not exact, so the runtime check is kept.
1907. A missing index or value is error 4 reported on the next line (OM-1 behaviour). E8 fixes the lines
191 only for errors 27, 28 and 29.
192
193## E16 (QualPhaseB L836, 2026-10-25): when fuel is charged
194
195Fuel (E14) is charged in source/emission order. An unrolled loop is charged K units when it starts, at
196its own line, before any copy is expanded. An inline expansion is charged 1 when it starts, at the call
197line. Error 14 names the line of the construct whose charge exceeds the fuel.
198
199## E17 (CompilerS4 L834, 2026-10-25): S4 points the contract did not settle (accepted)
200
2011. `export` together with `fn main` is error 9.
2022. A 33rd export is error 14.
2033. `export` not followed by `fn`, or inside a function body, is error 16.
2044. An `out T N` parameter is an `edit T N` in every function, internal ones included. `out T *` and
205 `out … fresh` are error 16.
2065. A part may be passed only to an unsized parameter; passing it to a sized one is error 7.
2076. The base of a part must be a name, so a part of a part is error 9.
2087. The six-slot limit (§4) also applies in program mode.
2098. Inline functions are also compiled standalone, in source order, each with its own fuel (E14/E16).
210 The fuel error therefore reports the first function in source order that runs out.
211
212## E18 (advisor review, 2026-10-25): no gate widening at cutover (supersedes E3 item 3)
213
214The compatibility wrappers `sha256_*` (status ≠ 0 → abort) are generated as out-of-line definitions in
215`src/omega_om_units.c` (bridge output `apic`). `src/omega_api_decl.h` (output `apih`) carries
216prototypes only. The freestanding `rx_cortex.o` therefore keeps exactly main's undefined symbols, and
217Makefile `RX_CX_FS_ALLOWED` is not changed. Adding `abort` or `omega2_*` to that list is refused,
218because it would weaken the freestanding gate.