diff --git a/src/main/scala/leon/solvers/templates/QuantificationManager.scala b/src/main/scala/leon/solvers/templates/QuantificationManager.scala index 1bd5e3b51805f7735a97543272e8ee3642a7b450..a8c4f96c9726bbf945171341c37f80c1ccf7af7b 100644 --- a/src/main/scala/leon/solvers/templates/QuantificationManager.scala +++ b/src/main/scala/leon/solvers/templates/QuantificationManager.scala @@ -26,8 +26,8 @@ class QuantificationTemplate[T]( val applications: Map[T, Set[App[T]]], val lambdas: Map[T, LambdaTemplate[T]]) { - def instantiate(blocker: T): Instantiation[T] = { - quantificationManager.instantiateQuantification(blocker, this) + def instantiate(substMap: Map[T, T]): Instantiation[T] = { + quantificationManager.instantiateQuantification(this, substMap) } } @@ -234,7 +234,7 @@ trait QuantificationManager[T] { self : LambdaManager[T] => } } - def instantiateQuantification(blocker: T, template: QuantificationTemplate[T]): Instantiation[T] = { + def instantiateQuantification(template: QuantificationTemplate[T], substMap: Map[T, T]): Instantiation[T] = { val quantification: Quantification = { val quantified = template.quantifiers.map(_._2).toSet @@ -260,9 +260,9 @@ trait QuantificationManager[T] { self : LambdaManager[T] => bindingApps ) - val tpeCounts = template.quantifiers.groupBy(_._1.getType).mapValues(_.map(_._2).toSeq) - val substMap = tpeCounts.flatMap { case (tpe, idTs) => idTs zip standardQuantifiers(tpe, idTs.size) }.toMap - q.substitute(substMap + (template.start -> blocker)) + val tpeCounts = template.quantifiers.groupBy(_._1.getType).mapValues(_.map(_._2).toSeq) + val qSubst = tpeCounts.flatMap { case (tpe, idTs) => idTs zip standardQuantifiers(tpe, idTs.size) }.toMap + q.substitute(substMap ++ qSubst) } val quantifierSubst: Map[T,T] = freshQuantifierSubst diff --git a/src/main/scala/leon/solvers/templates/Templates.scala b/src/main/scala/leon/solvers/templates/Templates.scala index cd0fe0e07e3eed85e96bca0df4196ab0ff054f7e..ae9e4e3e03b4504682d15993960600e6db377146 100644 --- a/src/main/scala/leon/solvers/templates/Templates.scala +++ b/src/main/scala/leon/solvers/templates/Templates.scala @@ -96,6 +96,10 @@ trait Template[T] { self => instantiation ++= lambdaManager.instantiateApp(b, app) } + for (q <- quantifications) { + instantiation ++= q.instantiate(substMap) + } + instantiation }