omega-mcp
aien-dev/omega-mcp
Brought by drakestapleton
omega-mcp / data / examples / contracts.om
| 1 | om2 |
| 2 | note requires and ensures form a function's prefix; invariant forms a loop body's prefix; |
| 3 | note result is the returned value inside ensures |
| 4 | fn step x uint to uint |
| 5 | requires lt x 10 |
| 6 | ensures eq result add x 1 |
| 7 | ret add x 1 |
| 8 | end |
| 9 | fn main to int |
| 10 | i = uint 0 |
| 11 | while lt i 3 |
| 12 | invariant le i 3 |
| 13 | i = step i |
| 14 | end |
| 15 | ret int sub i 3 |
| 16 | end |