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 / fixtures / oracle / obligations.bc

42 lines · 1030 bytes Raw Blame History
1/* EXTERNAL ORACLE RECIPE (outside the delivered closure). GNU bc exact integers.
2 dup32: for each x read from stdin (terminated by -1), d = (2^32+1)*x, low32(d), high32(d),
3 and ok = 1 when d < 2^64 and low32(d) = high32(d) = x.
4 slice: n o k, wrapped = ((o+k) mod 2^64 <= n), exact = (o <= n and k <= n-o). */
5scale = 0
6t = 2^32
7m = 2^64 - 1
8define s(n, o, k) {
9 auto w, e
10 w = 0
11 if ((o + k) % (m + 1) <= n) w = 1
12 e = 0
13 if (o <= n) { if (k <= n - o) e = 1 }
14 print "slice ", n, " ", o, " ", k, " ", w, " ", e, "\n"
15 return (0)
16}
17while (1) {
18 x = read()
19 if (x < 0) break
20 d = (t + 1) * x
21 l = d % t
22 h = d / t
23 ok = 0
24 if (d <= m) { if (l == x) { if (h == x) ok = 1 } }
25 print "dup32 ", x, " ", d, " ", l, " ", h, " ", ok, "\n"
26}
27z = s(m, m - 1, 4)
28z = s(m, m - 1, 1)
29z = s(m, m - 1, 2)
30z = s(m, m, 0)
31z = s(m, m, 1)
32z = s(10, 11, 0)
33z = s(10, m, 2)
34z = s(10, 3, 0)
35z = s(0, 0, 0)
36z = s(0, 0, 1)
37z = s(10, 10, 0)
38z = s(10, 10, 1)
39z = s(10, 3, 7)
40z = s(10, 3, 8)
41z = s(4096, 4095, 1)
42z = s(4096, 4095, 2)