Skip to content

Commit

Permalink
new algorithm to generate interesting tasks ... first try
Browse files Browse the repository at this point in the history
  • Loading branch information
pruemmer committed Feb 2, 2017
1 parent 451d676 commit ef0199c
Show file tree
Hide file tree
Showing 3 changed files with 353 additions and 85 deletions.
20 changes: 20 additions & 0 deletions src/lazabs/horn/bottomup/HornClauses.scala
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,26 @@ object HornClauses {
quanConsts(Quantifier.ALL, constants.toSeq, matrix)
}

def instantiatePredicates(mapping : Map[Predicate, IFormula]) : Clause = {
import IExpression._

val (headFor, newHead) = head.pred match {
case pred if (mapping contains pred) =>
(VariableSubstVisitor(mapping(pred), (head.args.toList, 0)),
FALSE())
case _ => (i(false), head)
}

val (substBodyLits, newBody) = body partition (mapping contains _.pred)
val substBody =
and(for (a <- substBodyLits)
yield VariableSubstVisitor(mapping(a.pred), (a.args.toList, 0)))

val newConstraint = (constraint &&& substBody) &&& ~headFor

Clause(newHead, newBody, newConstraint)
}

def toSMTString : String = SMTLineariser asString this.toFormula

def toPrettyString : String =
Expand Down
Loading

0 comments on commit ef0199c

Please sign in to comment.