Skip to content
Snippets Groups Projects
Commit 8f5e5f76 authored by Viktor Kuncak's avatar Viktor Kuncak
Browse files

Church numeral benchmark for synthesis based on abstraction functions

parent e230f2b0
No related branches found
No related tags found
No related merge requests found
import leon.Utils._
object ChurchNumerals {
sealed abstract class Num
case class Zero() extends Num
case class Succ(pred:Num) extends Num
def value(n:Num) : Int = {
n match {
case Zero() => 0
case Succ(p) => 1 + value(p)
}
} ensuring (_ >= 0)
def succ(n:Num) : Num = Succ(n) ensuring(value(_) == value(n) + 1)
def add(x:Num, y:Num):Num = {
choose { (r : Num) =>
value(r) == value(x) + value(y)
}
}
}
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