Skip to content

Commit

Permalink
handle quantifiers in templates/initial predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
pruemmer committed Jan 26, 2017
1 parent 483a5ab commit e3db957
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Binary file modified lib/princess.jar
Binary file not shown.
23 changes: 20 additions & 3 deletions src/lazabs/horn/abstractions/AbsReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ package lazabs.horn.abstractions
import ap.parser._
import ap.parameters.ParserSettings
import ap.parser.Parser2InputAbsy.CRRemover2
import ap.SimpleAPI

import TplSpec._
import TplSpec.Absyn._
Expand All @@ -50,7 +51,9 @@ class AbsReader(input : java.io.Reader) {

//////////////////////////////////////////////////////////////////////////////

val (initialPredicates, allHints, predArities) = {
val (initialPredicates, allHints, predArities) =
SimpleAPI.withProver(enableAssert =
lazabs.GlobalParameters.get.assertions) { prover =>
Console.err.println("Loading CEGAR hints ...")

val l = new Yylex(new CRRemover2 (input))
Expand Down Expand Up @@ -85,6 +88,20 @@ class AbsReader(input : java.io.Reader) {
(predName, arity)
}

def parseExpr(str : String) : IExpression =
(smtParser parseExpression str) match {
case f : IFormula =>
// check whether the formula contains quantifiers, which
// we would have to eliminate
if (QuantifierCountVisitor(f) > 0) prover.scope {
prover simplify f
} else {
f
}
case t : ITerm =>
t
}

////////////////////////////////////////////////////////////////////////////

val initialPredicates : List[(String, Seq[IFormula])] =
Expand All @@ -95,7 +112,7 @@ class AbsReader(input : java.io.Reader) {
val (predName, varNum) = translatePredRef(initPreds.predrefc_)

val preds = (for (term <- initPreds.listterm_.iterator) yield {
smtParser.parseExpression(printer print term).asInstanceOf[IFormula]
parseExpr(printer print term).asInstanceOf[IFormula]
}).toList

for (_ <- 0 until varNum)
Expand Down Expand Up @@ -125,7 +142,7 @@ class AbsReader(input : java.io.Reader) {
for (templatec <- templates.listtemplatec_)
templatec match {
case template : TermTemplate => {
val expr = smtParser.parseExpression(printer print template.term_)
val expr = parseExpr(printer print template.term_)
val cost = template.numeral_.toInt

(template.templatetype_, expr) match {
Expand Down

0 comments on commit e3db957

Please sign in to comment.