Commit 3c6a3ab1 authored by Christian Müller's avatar Christian Müller
Browse files

rename examples, add metrics file per case

parent 86f84f77
......@@ -14,6 +14,7 @@ object FOLTL {
def in(name: String) = TermFunctions.annotate(this, name)
def in(name: String, ignore: Set[String]) = TermFunctions.annotate(this, name, ignore)
def collect[T](coll: PartialFunction[Term, List[T]]) = TermFunctions.collect(coll, this)
def opsize() = TermFunctions.opsize(this)
def bracketed(): String = this match {
case _: BinOp => "(" + this + ")"
......
......@@ -52,15 +52,14 @@ object TermFunctions extends LazyLogging {
// Equivalence
case Eq(t1, t2) if t1 == t2 => True
// Double Temporals
case Finally(Finally(t)) => Finally(t)
case Globally(Globally(t)) => Globally(t)
// Remove quantifiers if empty
case Quantifier(qmake, xs, t) if xs.isEmpty => t
case Quantifier(qmake, xs, True) => True
case Quantifier(qmake, xs, False) => False
case Quantifier(_, xs, t) if xs.isEmpty => t
case Quantifier(_, _, True) => True
case Quantifier(_, _, False) => False
// Remove variables from quantifiers if not used in the body
// case Quantifier(qmake, xs, t) if !(xs.toSet -- t.freeVars()).isEmpty =>
......@@ -90,7 +89,17 @@ object TermFunctions extends LazyLogging {
}
}
def collect[T](combine:(T*) => T, empty:T)(coll: PartialFunction[Term, T], t: Term): T = {
def opsize(t: Term): Int = {
t match {
// Extractors
case Quantifier(_, ps, t) => 1 + t.opsize()
case UnOp(_, t) => 1 + t.opsize()
case BinOp(_, t1, t2) => 1 + t1.opsize() + t2.opsize()
case x => 1
}
}
def collect[T](combine: (T*) => T, empty: T)(coll: PartialFunction[Term, T], t: Term): T = {
if (coll.isDefinedAt(t))
coll(t)
else
......@@ -128,7 +137,7 @@ object TermFunctions extends LazyLogging {
})
}
def annotate(t: Term, name: String, ignore:Set[String]) = {
def annotate(t: Term, name: String, ignore: Set[String]) = {
t.everywhere({
case Fun(f, None, xs) if (!(ignore contains f)) => Fun(f, Some(name), xs)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment