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 / seed / qualification / om2 / sec / s5s7 / README.txt
| 1 | OM-2 qualification lane s5s7 (#748, ledger L836, QualPhaseB.FixInvariants) |
| 2 | ========================================================================== |
| 3 | |
| 4 | Scope: contract spec/omegese-om2.md (frozen, sha256 245bb74e...0881) sections 5 (fresh, abstract |
| 5 | types and dup32, external layout), 6 (unsized views, part, out, multi-entry, ABI v2) and 7 (SHA |
| 6 | consumer semantics), with errata E1-E9 (omega om2/contract). Written from the contract, |
| 7 | the errata, OMEGESE.md section 9, main acb3f15 sources and omega-bridge origin/main docs/NATIVE-ABI.md |
| 8 | only. No candidate-compiler, generator or SHA-lane branch was read. |
| 9 | |
| 10 | Files |
| 11 | ----- |
| 12 | f5-*.om section 5 fresh scratch a5-*.om section 5 abstract / dup32 |
| 13 | l5-*.om section 5 external layout v6-*.om section 6 views, part, slots, out |
| 14 | m6-*.om section 6 multi-entry abi/*.om units for the ABI v2 driver (abi1.om is OM-1) |
| 15 | om1/*.om OM-1 twins and C1 controls pr.om putd/puth output helper (OM-1 words) |
| 16 | diag/*.has expected omc-check/omc-site lines for `om2 diag` (gate emit STDERR has:) |
| 17 | candidate.cases full list for a candidate OM-2 compiler (each row cites its contract line) |
| 18 | pinned.cases what runs now under 734f0a39 (96 cases) |
| 19 | mutant-side.cases predicted behaviour of compiler mutants (a)-(d); (e)/(f) are ABI level |
| 20 | ../../oracle/s5s7/ python3 + gcc oracles, expected outputs (exp/), C drivers, PROVENANCE.txt |
| 21 | |
| 22 | Every fixture starts with note lines naming its contract lines and property, then `om2` or |
| 23 | `om2 diag`. Program-mode fixtures are run as SRC = fixture + pr.om; function-mode fixtures (no |
| 24 | fn main) run alone, because pr.om's `text` is program-mode only and would become the entry. |
| 25 | |
| 26 | Results recorded |
| 27 | ---------------- |
| 28 | pinned.cases under the pinned omc: evidence/phaseB/s5s7-pinned.log |
| 29 | offsetof oracle (gcc, sha256.h): evidence/phaseB/s5s7-offsetof.log (layout matches; image == python) |
| 30 | SHA driver self-check vs current C: evidence/phaseB/s5s7-sha-selfcheck.log (validates the driver and |
| 31 | the python digests only; NOT OM-2 evidence) |
| 32 | |
| 33 | Assumptions where the contract is silent |
| 34 | ---------------------------------------- |
| 35 | A1 Refusal line: RESOLVED by erratum E8. 27/28/29 rows are exact `emit SRC - err:LINE:CODE CODE` |
| 36 | (27: get/call line; 28: seal line, holds line for a predicate; 29: field line, layout line for |
| 37 | SIZE, and for a layout after the first fn, E9). Other codes stay `refuse` (code only). |
| 38 | The E6 reserved-name rows name the declaring line (as OM-1 does for `fn break`), which also |
| 39 | separates them from the pinned compiler's om2-line refusal. |
| 40 | A2 `abstract` and `holds` are top-level lines before the first fn (placement unstated; follows the |
| 41 | layout rule, line 154, and struct, OMEGESE 9.7). `holds` follows its `abstract`. |
| 42 | A3 f5-inline: `fn ... to void inline` is valid (line 93 shows `to T inline`), and since only |
| 43 | NON-inline calls are 27 (line 127) and constants are taken "after unrolling and inlining" |
| 44 | (line 124), writes made by an inlined callee count as definite writes. |
| 45 | A4 RESOLVED by E8: an operation the `abstract` line does not list (and, rotl, add) is error 7. |
| 46 | A5 RESOLVED by E8/E9: rotr/rotl of an abstract over ulong rotate the 64-bit pattern (line 140), |
| 47 | n has the representation type T (E9), and n = 64 traps 7 (E8). |
| 48 | A6 (confirmed by E8) `omc-check 1 kept|erased line=N` names the constructor's `ret seal` line. A kept check is a runtime |
| 49 | trap-10 site, so `om2 diag` also writes `omc-site 1 line=N iter=-` for it (lines 114-116); the |
| 50 | order of omc-check and omc-site records is unstated, hence has: (order-free). The erased fixture |
| 51 | is function mode with no other trap site (constant in-range shifts carry no check in OM-1). |
| 52 | A7 Layout field types used: uchar, ushort, uint, ulong (unsigned only); `get` returns the field type, |
| 53 | `put` takes it; `get c F` (scalar) and `get c F i` (COUNT given) per erratum E5. |
| 54 | A8 (confirmed by E8) a constant field index outside COUNT is error 21; put through `c view NAME` |
| 55 | is error 20; a uchar array of another length (103 for SIZE 104) is error 7. |
| 56 | A9 Inside a callee, `len` of a part is k, and a sized array passed to an unsized parameter has |
| 57 | `len` = N (E2). |
| 58 | A10 ABI v2 C shape (driver.c): `uint32_t omega2_<export>(uint64_t *result, ...)` as v1; unsized view |
| 59 | = (ptr, uint64 len); layout and out = one pointer (line 157, E1); pointers declared void *. |
| 60 | A11 `omega2_ident_<unit>()` returns a NUL-terminated `const char *` that contains the source sha256 |
| 61 | (64 lowercase hex), the omc pin (64 hex) and the word OM-2. Its exact format is unstated (E1). |
| 62 | A12 A NULL layout or result pointer is refused 32 (v1 null-pointer and null-result rules kept, line 181). |
| 63 | A13 The bridge-generated SHA header's file name is passed to sha_driver.c as -DGENHDR; it declares |
| 64 | the type `sha256_ctx` and the four sha256_* names (line 214, E3 mapping to omega2_sha256_*). |
| 65 | A14 Multi-entry: how several exports appear in the function-mode artifact is unstated; only |
| 66 | acceptance is checked in candidate.cases, symbols at the ABI level (driver, nm). |
| 67 | A15 A `fresh` parameter may be declared on an internal program-mode function. |
| 68 | |
| 69 | Ambiguities, conflicts and proposed fixes |
| 70 | ----------------------------------------- |
| 71 | Q1 Line 14 "OM-1 refuses that line": observed false for most OM-2 units. The pinned omc's names |
| 72 | pass (OMEGESE 9.2) reads every `fn` signature before any other line, so a unit whose signature |
| 73 | uses OM-2 syntax (fresh, `view T *`, `edit shactx`, `p dup32`, `to dup32`) is refused |
| 74 | `error 16` at the FIRST such fn line, and `fn ... to void inline` gives `error 5` at that line |
| 75 | (a token after a complete signature; code not documented in OMEGESE, recorded in pinned.cases |
| 76 | as OBSERVED-REFERENCE). Only units with OM-1-valid signatures are refused at the om2 line |
| 77 | (of the 80 OM-2 fixtures here, 61 refuse at a signature line: 60 with error 16, f5-inline with |
| 78 | error 5; 19 at the om2 line; evidence: s5s7-pinned.log). Proposed fix: |
| 79 | "OM-1 refuses the unit with error 16 at the om2 line or at an earlier-read signature line." |
| 80 | Q2 RESOLVED by erratum E8: fresh N > 64 -> 14; abstract type at an entry or as an array element -> 7; |
| 81 | layout SIZE 0 / > 4096 and layout after the first fn -> 29; part outside a call argument -> 9. |
| 82 | The former NOT_RUN rows are now cases (f5-n65, a5-entry-param, a5-entry-ret, a5-array, |
| 83 | l5-size0, l5-size4097, l5-after-fn, v6-part-local). |
| 84 | Q3 RESOLVED by E8: a missing index on an array field -> 4 (l5-count1-noidx); an extra index on a |
| 85 | scalar field -> 5 (new l5-scalar-idx). |
| 86 | Q4 Line 179 "a part lives only for the call" has no observable fixture: no word can store a view, |
| 87 | and part outside a call is error 9 (v6-part-local). The property is structural (SOURCE/RULE only). |
| 88 | Q5 Line 189 (ptr not aligned -> 32) conflicts with line 194 (len 0 with ANY pointer is an empty view) |
| 89 | for a misaligned pointer with len 0 (abi-misaligned-len0, expectation not asserted). Proposal: |
| 90 | len == 0 is checked first and wins. |
| 91 | Q6 Line 191 "ptr + len*sizeof(T) wraps": an end address exactly 2^64 (last byte 2^64-1) is ambiguous; |
| 92 | the driver avoids it (abi-wrap-high uses an end of 2^64+8). Proposal: refuse when |
| 93 | ptr + bytes > 2^64 - 1 computed in 65 bits, or state the rule explicitly. |
| 94 | Q7 Line 173 with 175: whether `o <= len` is checked before k is evaluated is unstated (o out of range |
| 95 | and a trapping k expression). Fixtures avoid the combination; v6-part-order uses a trapping o. |
| 96 | Q8 `out` parameters are specified only at the ABI boundary (196-198); their meaning on an internal |
| 97 | call inside a unit (program mode) and whether an out may be read are unstated. Only exports with |
| 98 | out are compiled (v6-out) and run through the driver (abi-out-*). |
| 99 | Q9 `holds NAME dup32` requires T = ulong in practice (high32/low32); `abstract NAME uint` with |
| 100 | `holds ... dup32` is unspecified. Not tested. |
| 101 | Q10 Line 164's `field count ulong 1 at 32 little` is superseded by erratum E5 (scalar); fixtures use E5. |
| 102 | |
| 103 | ABI v2 driver: build and run (all ABI and SHA rows are NOT_RUN in candidate.cases until AbiLane's |
| 104 | v2 generator and ShaLane's unit exist). Steps, from the worktree root, with CAND = candidate omc: |
| 105 | 1. Compile units: CAND < sec/s5s7/abi/abiv.om > abiv.bin; same for abiw.om; abi1.om (OM-1) with |
| 106 | both the pinned omc and CAND (C2: identical bytes expected). |
| 107 | 2. Generate one binding for units abiv, abiw, abi1 with the v2 generator (input framing as v1 |
| 108 | tests/native/run.sh: source, 0 byte, 8-digit length, code); the harness supplies the omc pin. |
| 109 | 3. cc -std=gnu11 -O2 -Wall -Wextra -Werror -fPIC -shared -o libabi.so <binding>.c |
| 110 | cc -std=gnu11 -O2 -Wall -Wextra -Werror oracle/s5s7/abi/driver.c -L. -labi -Wl,-rpath,. -o driver |
| 111 | 4. ./driver $(/usr/bin/sha256sum < abiv.om | cut -c1-64) $(/usr/bin/sha256sum < abiw.om | cut -c1-64) \ |
| 112 | 734f0a39...6b61-or-the-candidate-pin -> one PASS/FAIL line per abi-* id, exit 0 iff all PASS |
| 113 | 5. abi-v1-absent: `nm -D --defined-only libabi.so` lists omega2_vsum and NOT omega_vsum, and |
| 114 | `cc oracle/s5s7/abi/v1link.c -L. -labi` FAILS with an undefined reference to omega_vsum. |
| 115 | abi-v1-kept: omega_madd1 present, omega2_ident_abi1 absent. m6-export2 bound alone: omega2_inc and |
| 116 | omega2_dbl present, no symbol for `helper`. |
| 117 | 6. Stale identity (om/units.sh --check, line 209, E1), in a scratch copy of the tree with the units |
| 118 | registered: (i) append one byte to a registered OM-2 unit after generation -> --check must exit 1; |
| 119 | (ii) run --check with an omc whose sha256 differs from the pin -> must not print PASS (exit != 0); |
| 120 | (iii) record profile OM-1 for an OM-2 unit -> must refuse. |
| 121 | 7. SHA (section 7): cc -DGENHDR='"<generated header>"' -I<dir> -Ioracle/s5s7/sha oracle/s5s7/sha/sha_driver.c |
| 122 | <SHA binding/library> -o sha_driver; ./sha_driver big -> 16 sha-* lines, exit 0 iff all PASS. |
| 123 | The 2^32+3-byte cases read 4 GiB from the shared zero page (mmap PROT_READ, no resident memory). |
| 124 | |
| 125 | Mutant kill specs |
| 126 | ----------------- |
| 127 | A kill pairs a PASS of the correct-side row (candidate.cases, candidate compiler) with a PASS of the |
| 128 | mutant-side row (mutant-side.cases, run with the mutant compiler as OMC) plus the mutant's control |
| 129 | rows (ctl-*). A signal, timeout or any other exit is never a kill. |
| 130 | (a) Weakened part check `o + k <= len` (wrapped). Correct: v6-part-wrap exit 103, empty stdout. |
| 131 | Mutant: (2^64-2)+4 mod 2^64 = 2 <= 10, the part is formed, the callee returns its len without |
| 132 | touching an element: stdout "4\n", exit 0 (mut-a-part-wrap, exp/v6-part-wrap.mutant). |
| 133 | Related: second check dropped -> v6-part-tail prints "4\n" (mut-a2); first check dropped -> |
| 134 | v6-part-o prints "0\n" (mut-a3); k evaluated before o -> v6-part-order exits 105, not 102 (mut-a4). |
| 135 | The literal in-unit golden (len 2^64-1) is NOT_RUN: unreachable without a 2^64-1-element view; at |
| 136 | the bridge the golden extent is abi-golden-wrap (status 32). |
| 137 | (b) Fresh analysis with UNION at joins. Correct: f5-join-diff refused `omc: line 12: error 27` and |
| 138 | f5-branch `omc: line 10: error 27` (E8 lines). |
| 139 | Mutant: f5-join-diff compiles and prints "99\n" exit 0 (else arm, element 0 keeps main's 99); |
| 140 | f5-branch prints "7\n" exit 0 (mut-b-join-diff, mut-b-branch). |
| 141 | (c) Constructor bypass allowed. Correct: a5-seal-main and a5-seal-other refused |
| 142 | `omc: line 11: error 28` (the seal line, E8). |
| 143 | Mutant: both compile, exit 0 (mut-c-seal-main, mut-c-seal-other: emit any any 0). |
| 144 | (d) dup32 check erased for a non-exact body. Correct: a5-kept exits 110 with empty stdout, and |
| 145 | a5-kept-diag reports `omc-check 1 kept line=8 rule=-`. Mutant: a5-kept prints |
| 146 | "0000000500000006\n" and exits 0 (mut-d-kept); diag says `erased line=8 rule=dup32` (mut-d-kept-diag). |
| 147 | (e) Stale generation/profile identity accepted. Correct: driver abi-ident-abiv/abiw PASS (the |
| 148 | ident text contains sha256 of the exact unit bytes, the pin and OM-2), and units.sh --check |
| 149 | refuses each of the three stale cases of step 6. Mutant generator embedding a stale digest (for |
| 150 | example of the previous source), the wrong pin or profile OM-1: driver prints |
| 151 | "FAIL abi-ident-abiv" and exits 1. Mutant --check that skips the identity comparison: exits 0 / |
| 152 | prints PASS on a stale unit, compiler or profile where the correct one exits non-zero. |
| 153 | (f) Bad ABI length accepted. Correct: status 32 with the result untouched. Mutant bridge without the |
| 154 | check: abi-null-len1 returns status 0, result 1 (bcnt never reads an element); abi-golden-wrap |
| 155 | returns 0, result 2^64-1; abi-size-overflow returns 0, result 2^61 and abi-misaligned 0, result 1 |
| 156 | (vcnt never reads an element); abi-edit-overlap returns 0, result 8 and modifies buf. Each |
| 157 | prints "FAIL abi-..." and the driver exits 1: a clean, signal-free kill. |
| 158 | |
| 159 | NOT_RUN in candidate.cases (never PASS) |
| 160 | -------------------------------------- |
| 161 | code unstated: none since erratum E8 (the 9 former rows are cases now) |
| 162 | ABI v2 generator missing (AbiLane L837): 31 abi-* rows |
| 163 | OM-2 SHA unit/header missing (ShaLane L838): 16 sha-* rows |
| 164 | in-unit part golden with len 2^64-1: unreachable without a 2^64-1-element view (coordinator) |