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 / s3s4 / fold-guard-om1.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note OM-1 TWIN of fold-guard.om (unroll and inline removed, om2 line made a note) for the pinned |
| 3 | note compiler 734f0a39: same expectations, cross-checking the oracle with OM-1 semantics now. |
| 4 | note Contract section 4 lines 102-104: inside unrolled or inlined bodies only, all-constant operations |
| 5 | note fold with OM-1 arithmetic; an operation that would trap is not folded, so a guarded |
| 6 | note if ne i 0 / div 100 i compiles and behaves as before (no compile error at the i = 0 copy). |
| 7 | note Lines: unsigned div, unsigned rem, signed long div under the guard, and an inlined guard q. |
| 8 | note Twin fold-guard-rolled.om (unroll and inline removed) has the same expected stdout: |
| 9 | note oracle/s3s4/exp/fold-guard.out (python3, oracle/s3s4/oracle.py). |
| 10 | note OM-1 unit: this line replaces the om2 line |
| 11 | fn q a ulong b ulong to ulong |
| 12 | if eq b 0 |
| 13 | ret 0 |
| 14 | end |
| 15 | ret div a b |
| 16 | end |
| 17 | fn main to int |
| 18 | s = ulong 0 |
| 19 | for i ulong 4 |
| 20 | if ne i 0 |
| 21 | s = add s div 100 i |
| 22 | end |
| 23 | end |
| 24 | pu s |
| 25 | r = ulong 0 |
| 26 | for i ulong 4 |
| 27 | if ne i 0 |
| 28 | r = add r rem 101 i |
| 29 | end |
| 30 | end |
| 31 | pu r |
| 32 | t = long 0 |
| 33 | for i long 4 |
| 34 | if ne i 0 |
| 35 | t = add t div 1000000 i |
| 36 | end |
| 37 | end |
| 38 | pu ulong t |
| 39 | pu q 100 0 |
| 40 | pu q 100 7 |
| 41 | ret 0 |
| 42 | end |