Skip to content
Snippets Groups Projects
Commit 06b11bd6 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Add some simple examples of synthesis from examples, with holes

parent d55013f8
No related branches found
No related tags found
No related merge requests found
import leon.lang._
import leon.lang.synthesis._
object Math {
def fib(a: Int): Int = {
require(a >= 0)
if (a > 1) {
fib(a-1) + fib(a-2)
} else {
???[Int]
}
} ensuring {
passes(a, _)(Map(
0 -> 0,
1 -> 1,
2 -> 1,
3 -> 2,
4 -> 3,
5 -> 5,
18 -> 2584
))
}
def abs(a: Int): Int = {
if (?(a >= 0, a <= 0, a == 0, a != 0)) {
a
} else {
-a
}
} ensuring { _ >= 0 }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment