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

GitHub aien-dev/omega-mv#896 (code only)

closed derived 09eec8eb3086ac70 #896

Imported from GitHub aien-dev/omega-mv#896 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base e5b32567a7aff3ce594e3254a622a846a6cd190b · Head 5ec758604f37c6e2ead96e8a06cf5062b50161d8

Apply it

git checkout -b patch-09eec8eb3086ac70 e5b32567a7aff3ce594e3254a622a846a6cd190b
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/09eec8eb3086ac70.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-mv
896
5ec758604f37c6e2ead96e8a06cf5062b50161d8
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":896,"url":"https://github.com/aien-dev/omega-mv/pull/896","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:13Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index f62f2f33c..102618ea9 100644
--- a/.crumb
+++ b/.crumb
@@ -47,7 +47,7 @@
           "purpose": "Directory calibration. Purpose not yet described by a human."
         },
         {
-          "digest": "26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42",
+          "digest": "2d5f7e0dc00574f1ee355d29f0b9f53c284aa3e01acfc3b361a0ea11aef8edbb",
           "last_commit": "943f5139f",
           "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:05ad810e6ad46afb4ef01fa869905f5b5ff4ae3716250acfa9993b0892afe1e2",
+      "compiled_at": "2026-10-27T11:53:55Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:fcb2fe9e59c8b7feeffedb41f1ae7cb713c34e33e1985e5aad1d473df75567f0",
+      "digest": "sha256:89421f8944542bfffa4c7b7af014eb7722b6edffc80ba122826b3f3d924a94d0",
       "evidence_files": 12477,
       "evidence_root": "sha256:9d96c8c22e5c574c4768d1eadd333b9750f73cd27be276a0f190c876960008a1",
       "files": 17302,
-      "generated_at_commit": "52eba8831aa0b8db9fa2f2e13289920be4fa85f6",
-      "source_tree": "sha256:cd64f35f93a5dbeb923558fcae52ddcc8b82be786c4ca2e84e4d0a61ec07dcd6"
+      "generated_at_commit": "e5b32567a7aff3ce594e3254a622a846a6cd190b",
+      "source_tree": "sha256:8074db13f03c8799ec9347c884cc7b6c3b97b96227e2c6615bbe876c0ff26580"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/.crumb b/docs/.crumb
index dcf015737..c07b70a77 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:53:55Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42",
+      "digest": "sha256:2d5f7e0dc00574f1ee355d29f0b9f53c284aa3e01acfc3b361a0ea11aef8edbb",
       "evidence_files": 34,
       "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc",
       "files": 135,
-      "generated_at_commit": "943f5139f3f91f586ca03e707332afb2048d59d2",
-      "source_tree": "sha256:e91c9c4dc91d9680759d217e532ccacbaceea2f0ae8acc0b1ee957e627f1381d"
+      "generated_at_commit": "e5b32567a7aff3ce594e3254a622a846a6cd190b",
+      "source_tree": "sha256:f3b4e43c193aedcee7742e2680bdc3f49d7bbf17bddc00a25f0084f8770be68e"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/one_layer/OMEGESE.md b/docs/one_layer/OMEGESE.md
index 119c55955..651220f7d 100644
--- a/docs/one_layer/OMEGESE.md
+++ b/docs/one_layer/OMEGESE.md
@@ -574,8 +574,12 @@ conversion is error 7.
   (gate8 intrinsics, neg_intr_*)
 - Conversions `<type> value` handle int<->float, f32<->f64 and float->int. Int to float is SCVTF/UCVTF
   (round to nearest even); float to int is FCVTZS/FCVTZU (truncate, saturate, NaN -> 0); f32<->f64 is
-  FCVT. `bitcast T value` reinterprets a value of the same width (f32/i32/u32, f64/i64/u64) without
-  changing its bits; any other width or a bool is error 7. (gate8 convert)
+  FCVT. `bitcast T value` reinterprets a value of the same width (f32/i32/u32, f64/i64/u64, and
+  i8/u8, i16/u16 between integers) without changing its bits; any other width or a bool is error 7.
+  The result is an ordinary value of T: `bitcast int uint 4294967295` equals -1 and
+  `bitcast uint int -1` equals 4294967295; an 8/16/32-bit integer or f32 is extended again for T into
+  a new register, so the source name keeps its value (omc 2c824805 kept the source's extension).
+  (gate8 convert, bitcast_int, neg_bitcast_width)
 - Floats are allowed in `global` pools, `new` arrays, parameters, returns and struct fields.
   Arrays are packed by element type: f32 occupies four bytes and f64 eight (`tlog` and `sa_arr`
   in `seed/omc/omc.om`). Struct fields retain eight-byte cells, including f32 in the low half.
diff --git a/seed/omc/gate8.sh b/seed/omc/gate8.sh
index 1d2a55e3f..e88582773 100755
--- a/seed/omc/gate8.sh
+++ b/seed/omc/gate8.sh
@@ -64,6 +64,7 @@ run_ok structs
 run_ok intrinsics
 run_ok f32_return
 run_ok convert_sat
+run_ok bitcast_int
 refuse neg_intr_int 7
 refuse neg_intr_mixed 7
 refuse neg_intr_ambig 11
@@ -79,6 +80,7 @@ refuse neg_overflow3 8
 refuse neg_ir 3
 refuse neg_void_value 7
 refuse neg_f32_fall 18
+refuse neg_bitcast_width 7
 
 say "PASS gate8 $n cases"
 exit 0
diff --git a/seed/omc/omc.om b/seed/omc/omc.om
index eed86971c..19f3972cb 100644
--- a/seed/omc/omc.om
+++ b/seed/omc/omc.om
@@ -2529,6 +2529,11 @@ end
 
 note canon: u8/u16/u32 UBFM Xr, Xr, #0, #w-1 (C6.2.487); i8/i16/i32 SBFM (C6.2.355); else nothing
 fn canon r ulong t ulong to void
+canonto r r t
+end
+
+note canonto: canon of Xn written to Xd (the same UBFM / SBFM with Rd = d, Rn = n)
+fn canonto d ulong n ulong t ulong to void
 if lt t 2
 ret
 end
@@ -2542,7 +2547,7 @@ base = ulong 3544186880
 if gt t 5
 base = ulong 2470445056
 end
-emit or or or base shl sub twid t 1 10 r shl r 5
+emit or or or base shl sub twid t 1 10 d shl n 5
 end
 
 note chkext: CMP Xr, Wr, SXTB/SXTH/SXTW (SUBS extended, C6.2.463), then B.NE trap code
@@ -6122,6 +6127,20 @@ if ne twid ft twid tt
 fail 7
 end
 r = matreg get rk 0 get rv 0 ft
+note A register holds an 8/16/32-bit unsigned value and an f32 zero-extended (canon, FMOV W) and a signed
+note one sign-extended, so a bitcast that changes the extension extends the bits again for tt, into a new
+note register (a name's register keeps its value). f32 takes the uint form.
+if ne twid tt 64
+if ne and ge ft 6 le ft 8 and ge tt 6 le tt 8
+ct = tt
+if eq tt 10
+ct = ulong 4
+end
+rd = destreg dst
+canonto rd r ct
+r = rd
+end
+end
 put rk 0 1
 put rv 0 r
 put rt 0 tt
diff --git a/seed/omc/tests/float/bitcast_int.om b/seed/omc/tests/float/bitcast_int.om
new file mode 100644
index 000000000..df38872b6
--- /dev/null
+++ b/seed/omc/tests/float/bitcast_int.om
@@ -0,0 +1,207 @@
+note bitcast between integer types of one width keeps the bits, and the result is a canonical value of the
+note new type: compare, add, signed shr, widening conversion, call argument and array store all see it, and
+note the source name keeps its own value. Each 8/16/32-bit signed/unsigned pair both ways, f32 to and from
+note int, and the 64-bit pair as the control that was already right. omc 2c824805 kept the old extension
+note (uint 4294967295 as int compared unequal to -1 and add 2 trapped 1). Expected values were computed with
+note Wolfram (two's complement of the bit patterns), never by this compiler. Exit 0 when every check passed.
+fn bi32 x uint to int
+ret bitcast int x
+end
+fn bu32 x int to uint
+ret bitcast uint x
+end
+fn bi16 x ushort to short
+ret bitcast short x
+end
+fn bu16 x short to ushort
+ret bitcast ushort x
+end
+fn bi8 x uchar to byte
+ret bitcast byte x
+end
+fn bu8 x byte to uchar
+ret bitcast uchar x
+end
+fn isneg1 x int to int
+if eq x -1
+ret 0
+end
+ret 1
+end
+fn u2i32 to int
+a = new int 1 0
+u = uint 4294967295
+v = bitcast int u
+if ne v -1
+ret 1
+end
+if ge v 0
+ret 2
+end
+if ne add v 2 1
+ret 3
+end
+if ne shr v 1 -1
+ret 4
+end
+if ne long v -1
+ret 5
+end
+if ne u 4294967295
+ret 6
+end
+if ne isneg1 v 0
+ret 7
+end
+put a 0 v
+if ne get a 0 -1
+ret 8
+end
+m = bitcast int uint 2147483648
+if ne add m 1 -2147483647
+ret 9
+end
+if ne bi32 2147483653 -2147483643
+ret 10
+end
+ret 0
+end
+fn i2u32 to int
+s = int -1
+v = bitcast uint s
+if ne v 4294967295
+ret 11
+end
+if ne ulong v 4294967295
+ret 12
+end
+if ne add v 1 0
+ret 13
+end
+if ne shr v 31 1
+ret 14
+end
+if ne s -1
+ret 15
+end
+if ne bu32 -2147483648 2147483648
+ret 16
+end
+ret 0
+end
+fn u2i16 to int
+u = ushort 65535
+v = bitcast short u
+if ne v -1
+ret 21
+end
+if ge v 0
+ret 22
+end
+if ne add v 2 1
+ret 23
+end
+if ne long v -1
+ret 24
+end
+if ne bi16 32768 -32768
+ret 25
+end
+s = short -1
+w = bitcast ushort s
+if ne ulong w 65535
+ret 26
+end
+if ne bu16 -32768 32768
+ret 27
+end
+ret 0
+end
+fn u2i8 to int
+u = uchar 255
+v = bitcast byte u
+if ne v -1
+ret 31
+end
+if ge v 0
+ret 32
+end
+if ne add v 2 1
+ret 33
+end
+if ne long v -1
+ret 34
+end
+if ne bi8 200 -56
+ret 35
+end
+s = byte -1
+w = bitcast uchar s
+if ne ulong w 255
+ret 36
+end
+if ne bu8 -128 128
+ret 37
+end
+ret 0
+end
+fn f32int to int
+f = bitcast f32 int -1
+g = bitcast uint f
+if ne g 4294967295
+ret 41
+end
+if ne ulong g 4294967295
+ret 42
+end
+h = bitcast int f32 -1.0
+if ne h -1082130432
+ret 43
+end
+if ge h 0
+ret 44
+end
+ret 0
+end
+fn w64pair to int
+u = ulong 18446744073709551615
+v = bitcast long u
+if ne v -1
+ret 51
+end
+if ne add v 2 1
+ret 52
+end
+w = bitcast ulong long -1
+if ne w 18446744073709551615
+ret 53
+end
+ret 0
+end
+fn main to int
+r = u2i32
+if ne r 0
+ret r
+end
+r = i2u32
+if ne r 0
+ret r
+end
+r = u2i16
+if ne r 0
+ret r
+end
+r = u2i8
+if ne r 0
+ret r
+end
+r = f32int
+if ne r 0
+ret r
+end
+r = w64pair
+if ne r 0
+ret r
+end
+ret 0
+end
diff --git a/seed/omc/tests/float/neg_bitcast_width.om b/seed/omc/tests/float/neg_bitcast_width.om
new file mode 100644
index 000000000..689bd7a30
--- /dev/null
+++ b/seed/omc/tests/float/neg_bitcast_width.om
@@ -0,0 +1,6 @@
+note bitcast keeps the width: ushort to int is error 7, so the re-extension never has to guess a width
+fn main to int
+u = ushort 65535
+v = bitcast int u
+ret v
+end