Skip to content
Snippets Groups Projects
Commit 74deb895 authored by Nicolas Voirol's avatar Nicolas Voirol
Browse files

Added quantification template instantiation

parent a82db9cd
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,8 @@ class QuantificationTemplate[T]( ...@@ -26,8 +26,8 @@ class QuantificationTemplate[T](
val applications: Map[T, Set[App[T]]], val applications: Map[T, Set[App[T]]],
val lambdas: Map[T, LambdaTemplate[T]]) { val lambdas: Map[T, LambdaTemplate[T]]) {
def instantiate(blocker: T): Instantiation[T] = { def instantiate(substMap: Map[T, T]): Instantiation[T] = {
quantificationManager.instantiateQuantification(blocker, this) quantificationManager.instantiateQuantification(this, substMap)
} }
} }
...@@ -234,7 +234,7 @@ trait QuantificationManager[T] { self : LambdaManager[T] => ...@@ -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 quantification: Quantification = {
val quantified = template.quantifiers.map(_._2).toSet val quantified = template.quantifiers.map(_._2).toSet
...@@ -260,9 +260,9 @@ trait QuantificationManager[T] { self : LambdaManager[T] => ...@@ -260,9 +260,9 @@ trait QuantificationManager[T] { self : LambdaManager[T] =>
bindingApps bindingApps
) )
val tpeCounts = template.quantifiers.groupBy(_._1.getType).mapValues(_.map(_._2).toSeq) 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 val qSubst = tpeCounts.flatMap { case (tpe, idTs) => idTs zip standardQuantifiers(tpe, idTs.size) }.toMap
q.substitute(substMap + (template.start -> blocker)) q.substitute(substMap ++ qSubst)
} }
val quantifierSubst: Map[T,T] = freshQuantifierSubst val quantifierSubst: Map[T,T] = freshQuantifierSubst
......
...@@ -96,6 +96,10 @@ trait Template[T] { self => ...@@ -96,6 +96,10 @@ trait Template[T] { self =>
instantiation ++= lambdaManager.instantiateApp(b, app) instantiation ++= lambdaManager.instantiateApp(b, app)
} }
for (q <- quantifications) {
instantiation ++= q.instantiate(substMap)
}
instantiation instantiation
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment