Skip to content
Snippets Groups Projects
Commit 14f3f94a authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Root label is tuple of xs, so DetupleOut does cause CEGIS to explode

parent 28b229eb
No related branches found
No related tags found
No related merge requests found
...@@ -67,9 +67,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -67,9 +67,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
val grammar = SizeBoundedGrammar(params.grammar) val grammar = SizeBoundedGrammar(params.grammar)
def rootLabel(tpe: TypeTree) = SizedLabel(params.rootLabel(tpe), termSize) def rootLabel = SizedLabel(params.rootLabel(tupleTypeWrap(p.xs.map(_.getType))), termSize)
def xLabels = p.xs.map(x => rootLabel(x.getType))
var nAltsCache = Map[SizedLabel[T], Int]() var nAltsCache = Map[SizedLabel[T], Int]()
...@@ -84,7 +82,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -84,7 +82,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
} }
def allProgramsCount(): Int = { def allProgramsCount(): Int = {
xLabels.map(countAlternatives).product countAlternatives(rootLabel)
} }
/** /**
...@@ -108,7 +106,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -108,7 +106,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
// C identifiers corresponding to p.xs // C identifiers corresponding to p.xs
private var rootCs: Seq[Identifier] = Seq() private var rootC: Identifier = _
private var bs: Set[Identifier] = Set() private var bs: Set[Identifier] = Set()
...@@ -179,9 +177,9 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -179,9 +177,9 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
val cGen = new CGenerator() val cGen = new CGenerator()
rootCs = for (l <- xLabels) yield { rootC = {
val c = cGen.getNext(l) val c = cGen.getNext(rootLabel)
defineCTreeFor(l, c) defineCTreeFor(rootLabel, c)
c c
} }
...@@ -244,7 +242,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -244,7 +242,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
} }
} }
allProgramsFor(rootCs) allProgramsFor(Seq(rootC))
} }
private def debugCTree(cTree: Map[Identifier, Seq[(Identifier, Seq[Expr] => Expr, Seq[Identifier])]], private def debugCTree(cTree: Map[Identifier, Seq[(Identifier, Seq[Expr] => Expr, Seq[Identifier])]],
...@@ -299,11 +297,11 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -299,11 +297,11 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
cToFd(c).fullBody = body cToFd(c).fullBody = body
} }
// Top-level expression for rootCs // Top-level expression for rootC
val expr = tupleWrap(rootCs.map { c => val expr = {
val fd = cToFd(c) val fd = cToFd(rootC)
FunctionInvocation(fd.typed, fd.params.map(_.toVariable)) FunctionInvocation(fd.typed, fd.params.map(_.toVariable))
}) }
(expr, cToFd.values.toSeq) (expr, cToFd.values.toSeq)
} }
...@@ -441,7 +439,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -441,7 +439,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
} }
} }
tupleWrap(rootCs.map(c => getCValue(c))) getCValue(rootC)
} }
/** /**
...@@ -521,7 +519,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) { ...@@ -521,7 +519,7 @@ abstract class CEGISLike[T <% Typed](name: String) extends Rule(name) {
val bvs = if (isMinimal) { val bvs = if (isMinimal) {
bs bs
} else { } else {
rootCs.flatMap(filterBTree).toSet filterBTree(rootC)
} }
excludedPrograms += bvs excludedPrograms += bvs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment