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

Kill Assert as we know it for now. Keep the trivial base case.

Assert may not be helping at all. It is trimming crucial information
from the formula, i.e.

[[ a,b ;  a = size(x) AND a+1 = size(b); x ]].

Applying assert will remove 'a+1 = size(b)' from phi and push it as
precondition when reconstructing a solution. The subproblem will become:

[[ a,b ; a = size(x) ; x]]

The input 'b' is then removed by applying Unused-Input.
parent e810f63d
Branches
Tags
No related merge requests found
...@@ -137,6 +137,8 @@ class Assert(synth: Synthesizer) extends Rule("Assert", synth, 20) { ...@@ -137,6 +137,8 @@ class Assert(synth: Synthesizer) extends Rule("Assert", synth, 20) {
if (others.isEmpty) { if (others.isEmpty) {
RuleSuccess(Solution(And(exprsA), Tuple(p.xs.map(id => simplestValue(Variable(id)))))) RuleSuccess(Solution(And(exprsA), Tuple(p.xs.map(id => simplestValue(Variable(id))))))
} else { } else {
/*
* Disable for now, it is not that useful anyway
val onSuccess: List[Solution] => Solution = { val onSuccess: List[Solution] => Solution = {
case List(s) => Solution(And(s.pre +: exprsA), s.term) case List(s) => Solution(And(s.pre +: exprsA), s.term)
case _ => Solution.none case _ => Solution.none
...@@ -145,6 +147,8 @@ class Assert(synth: Synthesizer) extends Rule("Assert", synth, 20) { ...@@ -145,6 +147,8 @@ class Assert(synth: Synthesizer) extends Rule("Assert", synth, 20) {
val sub = p.copy(phi = And(others)) val sub = p.copy(phi = And(others))
RuleDecomposed(List(sub), onSuccess) RuleDecomposed(List(sub), onSuccess)
*/
RuleInapplicable
} }
} else { } else {
RuleInapplicable RuleInapplicable
......
...@@ -55,11 +55,11 @@ class Synthesizer(val r: Reporter, ...@@ -55,11 +55,11 @@ class Synthesizer(val r: Reporter,
// current solution // current solution
if (task.minComplexity < bestSolutionSoFar().complexity) { if (task.minComplexity < bestSolutionSoFar().complexity) {
if (!subProblems.isEmpty) { if (!subProblems.isEmpty) {
val name = Option(task.rule).map(_.name).getOrElse("root") val prefix = "[%-20s] ".format(Option(task.rule).map(_.name).getOrElse("root"))
println("["+name+"] Got: "+task.problem) println(prefix+"Got: "+task.problem)
println("["+name+"] Decomposed into:") println(prefix+"Decomposed into:")
for(p <- subProblems) { for(p <- subProblems) {
println("["+name+"] - "+p) println(prefix+" - "+p)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment