Skip to content
Snippets Groups Projects
Commit d318d306 authored by Regis Blanc's avatar Regis Blanc
Browse files

fixpoint should not be in ExprOps

parent 9ee9be95
Branches
Tags
No related merge requests found
......@@ -9,7 +9,7 @@ import Definitions._
import Expressions._
import Extractors._
import Constructors._
import utils.Simplifiers
import utils._
import solvers._
/** Provides functions to manipulate [[purescala.Expressions]].
......@@ -189,19 +189,6 @@ object ExprOps {
}
def fixpoint[T](f: T => T, limit: Int = -1)(e: T): T = {
var v1 = e
var v2 = f(v1)
var lim = limit
while(v2 != v1 && lim != 0) {
v1 = v2
lim -= 1
v2 = f(v2)
}
v2
}
/*
* =============
* Auxiliary API
......
......@@ -32,7 +32,7 @@ object GraphOps {
graph.getOrElse(v, Set())
}))
}
leon.purescala.ExprOps.fixpoint(step, -1)(graph)
fixpoint(step, -1)(graph)
}
def sources[A](graph : Map[A,Set[A]]) = {
......
package leon
/** Various utilities used throughout the Leon system */
package object utils {
/** compute the fixpoint of a function.
*
* Apply the input function on an expression as long as until
* it stays the same (value equality) or until a set limit.
*
* @param f
* @param limit
* @param e
* @return
*/
def fixpoint[T](f: T => T, limit: Int = -1)(e: T): T = {
var v1 = e
var v2 = f(v1)
var lim = limit
while(v2 != v1 && lim != 0) {
v1 = v2
lim -= 1
v2 = f(v2)
}
v2
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment