omega-harness
Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories
Brought by drakestapleton
omega-harness / examples / contracts_ok.om
| 1 | note contracts_ok: requires and ensures form a function's prefix; invariant opens a loop body |
| 2 | om2 |
| 3 | fn step x uint to uint |
| 4 | requires lt x 10 |
| 5 | ensures eq result add x 1 |
| 6 | ret add x 1 |
| 7 | end |
| 8 | fn main to int |
| 9 | i = uint 0 |
| 10 | while lt i 3 |
| 11 | invariant le i 3 |
| 12 | i = step i |
| 13 | end |
| 14 | ret int sub i 3 |
| 15 | end |