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

branch main Branches Tags History

omega-mv / seed / qualification / om2 / sec / s3s4 / unroll-sum-rolled.om

38 lines · 1230 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note TWIN of unroll-sum.om with every unroll removed (contract section 4 line 91): OM-2
3note unit, same expected stdout. Line numbers are those of unroll-sum.om plus one.
4note Contract section 4 lines 87-92: for i T K unroll emits the body K times with i bound to 0..K-1,
5note and removing unroll leaves behaviour unchanged (twin unroll-sum-rolled.om, same expectation).
6note K = 1 (uint), 4 (uchar), 64 (ulong). Each loop folds i into an order-sensitive accumulator and
7note the K = 64 loop also writes a[i] of a 65-element array, so K-1 or K+1 copies, a wrong binding of i
8note or a reordering changes the printed lines (a K+1 copy writes a[64], read back below, never out of
9note range). Expected stdout: oracle/s3s4/exp/unroll-sum.out (python3, oracle/s3s4/oracle.py).
10om2
11fn main to int
12h = ulong 7
13for i uint 1
14h = add mul h 1000003 add ulong i 11
15end
16pu h
17s = ulong 0
18for i uchar 4
19s = add mul s 131 add ulong i 3
20end
21pu s
22a = new uchar 65 0
23t = ulong 0
24c = ulong 0
25for i ulong 64
26t = add mul t 6364136223846793005 add i 1442695040888963407
27c = add c 1
28put a i uchar and add mul i 37 5 255
29end
30pu t
31pu c
32q = ulong 0
33for k ulong 65
34q = add mul q 257 ulong get a k
35end
36pu q
37ret 0
38end