-
-
Save jad-hamza/3301e30a36f9c84107897007e9fb9926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stainless.annotation._ | |
object Demo { | |
def f(x: BigInt, y: BigInt): BigInt = { | |
require(x >= 0 && y >= 1) | |
x * y | |
}.ensuring(res => | |
res >= x | |
) | |
def g(z: BigInt): Unit = { | |
require(z >= 10) | |
val r1 = f(z, z) | |
val r2 = f(10, 5) | |
val r3 = f(z, 3) | |
assert(r3 >= 3) | |
assert(r2 == 50) | |
} | |
@extern | |
def main(args: Array[String]): Unit = { | |
println(f(100, 20)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment