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 / fixtures / oracle / obligations.bc
| 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). */ |
| 5 | scale = 0 |
| 6 | t = 2^32 |
| 7 | m = 2^64 - 1 |
| 8 | define 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 | } |
| 17 | while (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 | } |
| 27 | z = s(m, m - 1, 4) |
| 28 | z = s(m, m - 1, 1) |
| 29 | z = s(m, m - 1, 2) |
| 30 | z = s(m, m, 0) |
| 31 | z = s(m, m, 1) |
| 32 | z = s(10, 11, 0) |
| 33 | z = s(10, m, 2) |
| 34 | z = s(10, 3, 0) |
| 35 | z = s(0, 0, 0) |
| 36 | z = s(0, 0, 1) |
| 37 | z = s(10, 10, 0) |
| 38 | z = s(10, 10, 1) |
| 39 | z = s(10, 3, 7) |
| 40 | z = s(10, 3, 8) |
| 41 | z = s(4096, 4095, 1) |
| 42 | z = s(4096, 4095, 2) |