You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That could improve performance as we would avoid a big unravelled next formula, as it would unravelled on demand. An idea for that is adding an abstract method def nextFormula : NextFormula[T] to the trait Formula. This way each Formula object can act as a thunk () => NextFormula[T], for NextFormula defined as
caseclassNow[T, R<%Result](p : T=>R) extendsFormula[T] withNextFormula[T] {
...
overridedefnextFormula=NextNow(p)
}
caseclassNot[T](phi : Formula[T]) extendsFormula[T] {
...
overridedefnextFormula=NextNot(phi)
}
caseclassOr[T](phi1 : Formula[T], phi2 : Formula[T]) extendsFormula[T] {
...
overridedefnextFormula=NextOr(phi1, phi2)
}
caseclassAnd[T](phi1 : Formula[T], phi2 : Formula[T]) extendsFormula[T] {
...
overridedefnextFormula=NextAnd(phi1, phi2)
}
caseclassImplies[T](phi1 : Formula[T], phi2 : Formula[T]) extendsFormula[T] {
... overridedefnextFormula=NextImplies(phi1, phi2)
}
caseclassNext[T](phi : Formula[T]) extendsFormula[T] {
...
overridedefnextFormula=NextNext(phi)
}
caseclassEventually[T](phi : Formula[T], t : Timeout) extendsFormula[T] {
...
overridedefnextFormula= {
if (t.instants >1)
// consider which should be used to get lazy progress in the evaluation// I think this is already ok because NextOr and the constructors of// NextFormual are the progressing constructorsNextOr(phi, Eventually(Next(phi), t-1))
//NextOr(phi, Next(Eventually(phi, t-1)))elseif (t.instants >0)
phi.nextFormula // note this is what the lazy val of NextOr does with its first argumentelseNextNow((x : T) =>StandardResults.pending) // timeout: this should not happen by invariant
}
The only problem is that this code doesn't map so directly to the original definition as the obvious code, and that care must me taken to ensure lazy evaluation is really exploited. So this is a modest optimization that could be performed with the help of some regression tests. A ScalaCheck property using the old definition of next form could be very useful here, it requires a generator for Formula
The text was updated successfully, but these errors were encountered:
use new nested next form definition that generates an equivalent next formula that is deeper and has NextNext as much the outer part of the formula as possible, thus postponing the creation of the next form to when we are able to evaluate it. See details in paper to come
That could improve performance as we would avoid a big unravelled next formula, as it would unravelled on demand. An idea for that is adding an abstract method
def nextFormula : NextFormula[T]
to the traitFormula
. This way eachFormula
object can act as a thunk() => NextFormula[T]
, forNextFormula
defined asAnd we would have
The only problem is that this code doesn't map so directly to the original definition as the obvious code, and that care must me taken to ensure lazy evaluation is really exploited. So this is a modest optimization that could be performed with the help of some regression tests. A ScalaCheck property using the old definition of next form could be very useful here, it requires a generator for
Formula
The text was updated successfully, but these errors were encountered: