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 / ng / front / cases / nom_abstract_order.om
| 1 | note Nominal seal: the operand calls run in source order before the holds check, and a failing check |
| 2 | note traps 10 (exit 110) after both calls ran. The first constructor call passes (trace 21: hi32 then |
| 3 | note lo32); the boundary values 0 and 0xffffffff pass; one byte is written to stdout (so a check that fires |
| 4 | note early is visible); the second call breaks the invariant and traps. |
| 5 | om2 |
| 6 | abstract dup32 ulong ops xor |
| 7 | holds dup32 dup32 |
| 8 | global tr ulong 1 |
| 9 | global bump ulong 1 |
| 10 | fn hi32 x uint to ulong |
| 11 | put tr 0 add mul get tr 0 10 2 |
| 12 | ret ulong x |
| 13 | end |
| 14 | fn lo32 x uint to ulong |
| 15 | put tr 0 add mul get tr 0 10 1 |
| 16 | ret add ulong x get bump 0 |
| 17 | end |
| 18 | fn dup32mk x uint to dup32 |
| 19 | ret seal dup32 or shl hi32 x 32 lo32 x |
| 20 | end |
| 21 | fn main to int |
| 22 | a = dup32mk 7 |
| 23 | if ne get tr 0 21 |
| 24 | ret 1 |
| 25 | end |
| 26 | if ne open a 0x0000000700000007 |
| 27 | ret 2 |
| 28 | end |
| 29 | z = dup32mk 0 |
| 30 | m = dup32mk 0xffffffff |
| 31 | if ne open xor z m 0xffffffffffffffff |
| 32 | ret 3 |
| 33 | end |
| 34 | if ne open xor m m 0 |
| 35 | ret 4 |
| 36 | end |
| 37 | buf = new uchar 1 79 |
| 38 | w = write 1 buf 0 1 |
| 39 | put bump 0 1 |
| 40 | b = dup32mk 5 |
| 41 | ret 5 |
| 42 | end |