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
GitHub aien-dev/omega-mv#897 (code only)
Apply it
git checkout -b patch-e13e21ed0eab4157 e5b32567a7aff3ce594e3254a622a846a6cd190b curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/e13e21ed0eab4157.patch | git am
Provenance
github-import 1
aien-dev/omega-mv
897
fd147179860c27aa3a30634b46267379caf4951d
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":897,"url":"https://github.com/aien-dev/omega-mv/pull/897","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:13Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index f62f2f33c..d86fcae3b 100644 --- a/.crumb +++ b/.crumb @@ -47,8 +47,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42", - "last_commit": "943f5139f", + "digest": "3a73608db65bef5d9011817d5f78eb3a3bf488f5c77ef3b82cd59b51ba8a3999", + "last_commit": "2f6832615", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:534f796d8e0fc81c75e714b05cf9bf36f60f0b5d31d5430fdea52d8bf179e6ea", - "compiled_at": "2026-10-27T00:45:25Z", + "children_root": "sha256:bade080cd98f695d6fbcbcc7a91140fa4ae2ce9e5b16dcdfc7b31344669bbe0b", + "compiled_at": "2026-10-27T11:46:58Z", "compiler": "crumb-compile/1", - "digest": "sha256:fcb2fe9e59c8b7feeffedb41f1ae7cb713c34e33e1985e5aad1d473df75567f0", + "digest": "sha256:3d79e6012b8268e68a58d5db851b40419254ba0db162f700c8277cdfea7733be", "evidence_files": 12477, "evidence_root": "sha256:9d96c8c22e5c574c4768d1eadd333b9750f73cd27be276a0f190c876960008a1", - "files": 17302, - "generated_at_commit": "52eba8831aa0b8db9fa2f2e13289920be4fa85f6", - "source_tree": "sha256:cd64f35f93a5dbeb923558fcae52ddcc8b82be786c4ca2e84e4d0a61ec07dcd6" + "files": 17310, + "generated_at_commit": "2f6832615390c80a7af8eb3f056de6ed5bf702e7", + "source_tree": "sha256:d79a534e45a6dde2c32be7ce16db6e50f7a6ff7ec8cc04dedc0068481cb984ed" }, "owner_lane": "", "provenance": { diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fb8cb6227..ce53b6398 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -32,3 +32,4 @@ This table starts with the numeric work on this branch. Earlier work in this rep Update this table in the same commit as the work it credits. | Claude Opus 5.5 | Seed-chain bootstrap challenge: `seed/challenge/run.sh` rebuilds omc from the 408-byte seed out of a pinned `git archive` and checks every input and rung against a table read from committed files, with tampered-rung and wrong-value negative controls | +| Claude Opus 5.5 | Seeded compiler: an empty `text e ""` (length 0) kept sized instead of read as an unsized view (`unsz` at the element, view-argument, `part`, read/write and `len` sites; #775), s4 regression rows, a reintroducing mutant and the 2c824805 negative control | diff --git a/docs/.crumb b/docs/.crumb index dcf015737..d0f914ee2 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -46,92 +46,92 @@ "children": [ { "digest": "640f6b7b818c769ab0dcd91437d58dd3251044084d2ae3785f000d30d2bb768a", - "last_commit": "a927bd6c", + "last_commit": "a927bd6c2", "name": "adr", "purpose": "Directory docs/adr. Purpose not yet described by a human." }, { "digest": "e7ac2460455a35b96b01dab649dcdc2cdf5bb4657bf230b91272c64fe1bf82cf", - "last_commit": "d48ab89e", + "last_commit": "d48ab89e5", "name": "autodiff", "purpose": "M21 OMEGA_AUTODIFF scope, op and error-contract table, status (not qualified)" }, { "digest": "7506b1a8659e6de84e1be31a281c8d046e4946de6ed29451155bb56cda5cb365", - "last_commit": "6637b32b", + "last_commit": "6637b32b6", "name": "brownian", "purpose": "Directory docs/brownian. Purpose not yet described by a human." }, { "digest": "1b01542d91e3b1c7c5263d6b393338a3d9d40e138a12ec833ce7852d83887ce2", - "last_commit": "5901baa5", + "last_commit": "5901baa51", "name": "crumbs", "purpose": "Directory docs/crumbs. Purpose not yet described by a human." }, { "digest": "e9baaaeec04be41a57c4a2d6a540b01a682c70d4db96cb4af4e1a9912a133aa9", - "last_commit": "55d05d6a", + "last_commit": "55d05d6a5", "name": "dual", "purpose": "DUAL (ARCH-0031) documents in omega: applicability experiment method and findings (APPLICABILITY" }, { "digest": "56a5a999ce726e90d89c1c88b9e20c81857c8e6ee82af8d651ac80ea70e2c46d", - "last_commit": "38a6a569", + "last_commit": "38a6a569b", "name": "estimation", "purpose": "Directory docs/estimation. Purpose not yet described by a human." }, { "digest": "8b926a045985692f116d9469af5aaa06d778bca78cf5d7e891e68c2486ed789e", - "last_commit": "8ec82485", + "last_commit": "8ec82485d", "name": "numeric", "purpose": "Directory docs/numeric. Purpose not yet described by a human." }, { "digest": "1a26b15f795aa3581a03400a21d5635e85c71f3f544fcc3676fa58064402c7ad", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "osc", "purpose": "Directory docs/osc. Purpose not yet described by a human." }, { "digest": "645b6abb9d46a13dff6c9091d79acf0318fcfdc447a2dc50a3b70cd0dcfaa548", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "polyglot", "purpose": "Directory docs/polyglot. Purpose not yet described by a human." }, { "digest": "46d3e2d59a468271e044ccd2398eb32345df6436c15eb6d8c703953c838023a9", - "last_commit": "dd67f6bd", + "last_commit": "dd67f6bd7", "name": "reservoir", "purpose": "Reservoir reference and contracts (omega#440): RESERVOIR_REFERENCE.md pins the authors' paper an" }, { "digest": "2ab37838f8694e5060a3789f08a16146996050af949fba329ed805429d85f695", - "last_commit": "f633e343", + "last_commit": "f633e3430", "name": "tensor", "purpose": "M20 OMEGA_TENSOR spec and qualification checklist" }, { "digest": "41ab5cf8617e9583dcda75292e1e851e1ec4187b69d5d00b5eb354f1ee55c9d5", - "last_commit": "54826a37", + "last_commit": "54826a37f", "name": "train", "purpose": "Directory docs/train. Purpose not yet described by a human." }, { "digest": "5db2869ff0b78866ad0ce38f77b262e81fdbc89408e94968491c4e6548177278", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "turing", "purpose": "Directory docs/turing. Purpose not yet described by a human." } ], "children_root": "sha256:c81d43c0c392dfec2b6ed5b38ba95ea7c592782b283950e32b777e7b9cfd9d61", - "compiled_at": "2026-10-26T17:56:57Z", + "compiled_at": "2026-10-27T11:41:59Z", "compiler": "crumb-compile/1", - "digest": "sha256:26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42", + "digest": "sha256:3a73608db65bef5d9011817d5f78eb3a3bf488f5c77ef3b82cd59b51ba8a3999", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 135, - "generated_at_commit": "943f5139f3f91f586ca03e707332afb2048d59d2", - "source_tree": "sha256:e91c9c4dc91d9680759d217e532ccacbaceea2f0ae8acc0b1ee957e627f1381d" + "generated_at_commit": "3a2ac15cc4ddc7c441d7798dccd8050e3fd92d56", + "source_tree": "sha256:d181e8ed81138a00b6a5574ddde26364db821709e867ade629e26f4caf0ccc0f" }, "owner_lane": "", "provenance": { diff --git a/docs/one_layer/OMEGESE.md b/docs/one_layer/OMEGESE.md index 119c55955..5ebfccf4a 100644 --- a/docs/one_layer/OMEGESE.md +++ b/docs/one_layer/OMEGESE.md @@ -456,7 +456,9 @@ gate that tests it (`seed/rung4/gate4.sh`, section numbers of that script). Deci Program mode only (error 9). (s.6 echo, bytecopy, s.7) - `text NAME "bytes"`: a read-only array of uchar holding the bytes between the quotes, with its length; `\n` is 10, `\t` is 9, `\\` is 92, `\"` is 34; any other escape, or a quote missing its end, - is error 22. Program mode only. (s.7) + is error 22. An empty text `""` is a sized array of length 0: `len` is 0, a number index is error 21, + a run-time index or `part`/`write` past 0 traps 3, and as a `view` argument its count is 0. Program + mode only. (s.7) - `NAME = new T N v`: a local array of N elements, each v, on the stack, given back when the function returns. Only in a function's outermost block (error 9); at most 4 MiB of local arrays (error 23). There is no `free`: nothing is given back by hand (decision 24), and the word is refused (error 9). diff --git a/seed/omc/om2/s4/mut/textlen.from b/seed/omc/om2/s4/mut/textlen.from new file mode 100644 index 000000000..78107c26e --- /dev/null +++ b/seed/omc/om2/s4/mut/textlen.from @@ -0,0 +1 @@ +if and eq get nm_len i 0 ne get nm_kind i 5 diff --git a/seed/omc/om2/s4/mut/textlen.to b/seed/omc/om2/s4/mut/textlen.to new file mode 100644 index 000000000..9d15801dc --- /dev/null +++ b/seed/omc/om2/s4/mut/textlen.to @@ -0,0 +1 @@ +if eq get nm_len i 0 diff --git a/seed/omc/om2/s4/p-text-empty.om b/seed/omc/om2/s4/p-text-empty.om new file mode 100644 index 000000000..aa8f0be74 --- /dev/null +++ b/seed/omc/om2/s4/p-text-empty.om @@ -0,0 +1,11 @@ +note S4 part on an empty text: part e 0 1 on count 0: o <= len holds, k <= len - o fails, trap 3 (exit +note 103). x = 7 is live in the register the old lowering read as the count. +om2 +text e "" +fn plen v view uchar * to ulong +ret len v +end +fn main to int +x = ulong 7 +ret int add plen part e 0 1 x +end diff --git a/seed/omc/om2/s4/s4-mutants.cases b/seed/omc/om2/s4/s4-mutants.cases index 164a29b23..1081ac946 100644 --- a/seed/omc/om2/s4/s4-mutants.cases +++ b/seed/omc/om2/s4/s4-mutants.cases @@ -8,6 +8,7 @@ ctl-p-wrap run seed/omc/om2/s4/p-wrap.om - - - 103 ctl-p-o run seed/omc/om2/s4/p-o.om - - - 103 ctl-x-two emit seed/omc/om2/s4/x-two.om sha:52cbef323079618c5e9b7911c9b3dbb4a222e851d9522b97f8b52b4c354a178e - 0 ctl-p-bad-base refuse seed/omc/om2/s4/p-bad-base.om 19 +ctl-v-text-empty run seed/omc/om2/s4/v-text-empty.om - - - 0 # unsized view: a number index left unchecked (check elimination on an unsized view) subst seed/omc/om2/s4/mut/uce.from seed/omc/om2/s4/mut/uce.to cc seed/omc/omc.om @@ -32,3 +33,7 @@ m-p19 refuse seed/omc/om2/s4/p-bad-base.om 19 subst seed/omc/om2/s4/mut/tramp.from seed/omc/om2/s4/mut/tramp.to cc seed/omc/omc.om m-tramp emit seed/omc/om2/s4/x-two.om sha:52cbef323079618c5e9b7911c9b3dbb4a222e851d9522b97f8b52b4c354a178e - 0 +# empty text: a text of length 0 taken as unsized (its count read from register nm_lr, never set) +subst seed/omc/om2/s4/mut/textlen.from seed/omc/om2/s4/mut/textlen.to +cc seed/omc/omc.om +m-textlen run seed/omc/om2/s4/v-text-empty.om - - - 0 diff --git a/seed/omc/om2/s4/s4.cases b/seed/omc/om2/s4/s4.cases index d59475d03..ddeaf2458 100644 --- a/seed/omc/om2/s4/s4.cases +++ b/seed/omc/om2/s4/s4.cases @@ -21,6 +21,13 @@ s4-v-bad-fresh refuse seed/omc/om2/s4/v-bad-fresh.om 16 s4-v-bad-local refuse seed/omc/om2/s4/v-bad-local.om 16 s4-v-bad-global refuse seed/omc/om2/s4/v-bad-global.om 19 s4-v-om1 refuse seed/omc/om2/s4/v-om1.om 16 +## an empty text (length 0) is sized: count 0, never a count register +s4-v-text-empty run seed/omc/om2/s4/v-text-empty.om - - - 0 +s4-v-text-empty-loop run seed/omc/om2/s4/v-text-empty-loop.om - - - 0 +s4-v-text-empty-get run seed/omc/om2/s4/v-text-empty-get.om - - - 103 +s4-v-text-empty-write run seed/omc/om2/s4/v-text-empty-write.om - - - 103 +s4-p-text-empty run seed/omc/om2/s4/p-text-empty.om - - - 103 +s4-v-bad-text-empty refuse seed/omc/om2/s4/v-bad-text-empty.om 21 ## part (spec 6, erratum E8) s4-p-ok run seed/omc/om2/s4/p-ok.om - - - 0 s4-p-wrap run seed/omc/om2/s4/p-wrap.om - - - 103 diff --git a/seed/omc/om2/s4/v-bad-text-empty.om b/seed/omc/om2/s4/v-bad-text-empty.om new file mode 100644 index 000000000..29d2a8ff4 --- /dev/null +++ b/seed/omc/om2/s4/v-bad-text-empty.om @@ -0,0 +1,6 @@ +note S4 empty text: a constant index into `text e ""` (length 0) is out of range at compile time, error 21. +om2 +text e "" +fn main to int +ret int get e 0 +end diff --git a/seed/omc/om2/s4/v-text-empty-get.om b/seed/omc/om2/s4/v-text-empty-get.om new file mode 100644 index 000000000..69723819f --- /dev/null +++ b/seed/omc/om2/s4/v-text-empty-get.om @@ -0,0 +1,9 @@ +note S4 empty text: a run-time index into `text e ""` is checked against the count 0, so index 0 traps 3 +note (exit 103); it is not compared with whatever register x0 holds (x = 7 is live there). +om2 +text e "" +fn main to int +x = ulong 7 +i = ulong 0 +ret int add ulong get e i x +end diff --git a/seed/omc/om2/s4/v-text-empty-loop.om b/seed/omc/om2/s4/v-text-empty-loop.om new file mode 100644 index 000000000..a6e95efc4 --- /dev/null +++ b/seed/omc/om2/s4/v-text-empty-loop.om @@ -0,0 +1,19 @@ +note S4 empty text: a callee that walks its view (for i ulong len s, get s i) reads no byte of `text e ""`. +note x = 100000000 is live in the register the old lowering read as the count, so the old loop ran off the +note image (SIGSEGV). Exit 0 when the sum is 0, else 1. +om2 +text e "" +fn sum s view uchar * to ulong +t = ulong 0 +for i ulong len s +t = add t ulong get s i +end +ret t +end +fn main to int +x = ulong 100000000 +if ne sum e 0 +ret 1 +end +ret int sub x 100000000 +end diff --git a/seed/omc/om2/s4/v-text-empty-write.om b/seed/omc/om2/s4/v-text-empty-write.om new file mode 100644 index 000000000..527efd2cd --- /dev/null +++ b/seed/omc/om2/s4/v-text-empty-write.om @@ -0,0 +1,9 @@ +note S4 empty text: write 1 e 0 1 asks for one byte of `text e ""`; n <= len fails, trap 3 before the +note call (exit 103, nothing written). x = 7 is live in the register the old lowering read as the count. +om2 +text e "" +fn main to int +x = ulong 7 +n = write int 1 e ulong 0 ulong 1 +ret int x +end diff --git a/seed/omc/om2/s4/v-text-empty.om b/seed/omc/om2/s4/v-text-empty.om new file mode 100644 index 000000000..669e3b2d4 --- /dev/null +++ b/seed/omc/om2/s4/v-text-empty.om @@ -0,0 +1,32 @@ +note S4 empty text (`text e ""`, length 0) as a `view uchar *` argument (spec 6, erratum E2): its count is +note the number 0, never a count register. x = 7 is live in the register the old lowering read as the +note count. Checks: len through a parameter, through an inline parameter, len e itself, part e 0 0 and a +note 0-byte write. Exit 0 when every check holds, else the failing check's number. +om2 +text e "" +fn plen v view uchar * to ulong +ret len v +end +fn ilen v view uchar * to ulong inline +ret len v +end +fn main to int +x = ulong 7 +if ne plen e 0 +ret 1 +end +if ne ilen e 0 +ret 2 +end +if ne len e 0 +ret 3 +end +if ne plen part e 0 0 0 +ret 4 +end +n = write int 1 e ulong 0 ulong 0 +if ne n 0 +ret 5 +end +ret int sub x 7 +end diff --git a/seed/omc/omc.om b/seed/omc/omc.om index eed86971c..9ebe95150 100644 --- a/seed/omc/omc.om +++ b/seed/omc/omc.om @@ -249,6 +249,15 @@ end ret 1 end +note unsz: 1 when name entry i is an unsized array (nm_len 0, its count in register nm_lr), else 0. A text +note (kind 5) of length 0 (`text e ""`) is sized: its count is the number 0 and it has no count register. +fn unsz i ulong to ulong +if and eq get nm_len i 0 ne get nm_kind i 5 +ret 1 +end +ret 0 +end + note pslot: the first slot (register) of parameter i of function f (index) fn pslot f ulong i ulong to ulong s = ulong 0 @@ -3668,7 +3677,7 @@ note elemaddr: array name e (index + 1), index value (kind, number or register, note be inside the array (error 21) and needs no check; a register index: CMP Xi, #len (C6.2.96) or CMP Xi, note Xt (C6.2.97), B.HS trap 3 (unsigned, so a negative signed index traps too). Out: ea_b base register note (the array's register, or a new one holding its address), ea_i index register. om4 ELEMADDR. -note OM-2 unsized array (nm_len 0): every index, a number too, is checked against its count register nm_lr +note OM-2 unsized array (unsz): every index, a number too, is checked against its count register nm_lr note (CMP Xi, Xn; B.HS trap 3); none is eliminated (spec 4, 6). fn elemaddr e ulong k ulong v ulong t ulong to void if or eq t 1 ge t 10 @@ -3677,7 +3686,7 @@ end i = sub e 1 ln = get nm_len i x = v -if eq ln 0 +if ne unsz i 0 x = matreg k v t emit or or 3942645791 shl ulong get nm_lr i 16 shl x 5 trapc 2 3 @@ -3789,7 +3798,7 @@ fail 7 end ux = add mul get depth 0 6 pi if eq get fn_pl p 0 -if eq get nm_len i 0 +if ne unsz i 0 put ul_k ux 1 put ul_v ux ulong get nm_lr i else @@ -3869,7 +3878,7 @@ end note partck: the two checks of part (name index i, o in ro, k in rn), then the part's base register fn partck i ulong ro ulong rn ulong to ulong rl = ulong get nm_lr i -if ne get nm_len i 0 +if eq unsz i 0 rl = alloc matconst rl get nm_len i end @@ -4052,7 +4061,7 @@ fail 7 end t = alloc l = ulong get nm_lr sub e 1 -if ne get nm_len sub e 1 0 +if eq unsz sub e 1 0 l = t matconst t get nm_len sub e 1 end @@ -6217,7 +6226,7 @@ e = arrname if ge get nm_kind sub e 1 6 fail 7 end -if eq get nm_len sub e 1 0 +if ne unsz sub e 1 0 vdone 1 ulong get nm_lr sub e 1 5 ret end