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

recursion elim

parent 238ab28b
No related branches found
No related tags found
No related merge requests found
import leon.Utils._
object xplusone {
def f(n : Int) : Int = {
if (n > 0) {
f(n-1) + 1
} else 1
} ensuring (rec => rec == n + 1)
def Sf(n : Int, rec : Int) : Boolean = {
if (n > 0) {
val res = epsilon((x:Int) => true)
Sf(n - 1, res)
(rec == res + 1)
} else {
rec == 1
}
} ensuring (_ == (rec == n + 1))
}
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