Skip to content

Commit 738284b

Browse files
committed
Add model extraction for #unspecified and seq.unit
1 parent b787367 commit 738284b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ libraryDependencies ++= Seq(
4545

4646
def ghProject(repo: String, version: String) = RootProject(uri(s"${repo}#${version}"))
4747
// lazy val smtlib = RootProject(file("../scala-smtlib"))
48-
lazy val smtlib = ghProject("https://github.com/epfl-lara/scala-smtlib.git", "5b9503e13d69c7116039a243025b2ce657c32c77")
48+
lazy val smtlib = ghProject("https://github.com/epfl-lara/scala-smtlib.git", "95b5d1ed2ee9c0c1ec5cabb3c0303d27a48131cd")
4949

5050
lazy val scriptName = settingKey[String]("Name of the generated 'inox' script")
5151

src/main/scala/inox/solvers/smtlib/SMTLIBParser.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ trait SMTLIBParser {
106106
case SString(value) =>
107107
StringLiteral(utils.StringUtils.decode(value))
108108

109+
case FunctionApplication(QualifiedIdentifier(SimpleIdentifier(SSymbol("seq.unit")), None), Seq(SHexadecimal(hex))) =>
110+
StringLiteral(utils.StringUtils.decode(hex.repr))
111+
109112
case FunctionApplication(QualifiedIdentifier(SimpleIdentifier(SSymbol("distinct")), None), args) =>
110113
val es = args.map(fromSMT(_))
111114
val tpEs = (if (es.exists(_.getType == Untyped) && es.exists(_.getType != Untyped)) {
@@ -224,7 +227,9 @@ trait SMTLIBParser {
224227
val MapType(from, to) = fromSMT(sort)
225228
FiniteMap(Seq.empty, d, from, to)
226229

227-
case _ => throw new MissformedSMTException(term, "Unknown SMT term")
230+
case _ => throw new MissformedSMTException(term,
231+
" Unknown SMT term of class: " + term.getClass
232+
)
228233
}
229234

230235
protected def fromSMT(sort: Sort)(implicit context: Context): Type = sort match {

src/main/scala/inox/solvers/smtlib/Z3Target.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ trait Z3Target extends SMTLIBTarget with SMTLIBDebugger {
144144
unsupported(t, "woot? tester for non-adt type")
145145
}
146146

147+
case (QualifiedIdentifier(SimpleIdentifier(SSymbol("#unspecified")), None), None) =>
148+
throw new MissformedSMTException(t, "Cannot extract #unspecified symbol when type is unknown")
149+
150+
case (QualifiedIdentifier(SimpleIdentifier(SSymbol("#unspecified")), None), Some(tpe)) =>
151+
Choose(ValDef.fresh("unspecified", tpe), BooleanLiteral(true))
152+
147153
case (QualifiedIdentifier(ExtendedIdentifier(SSymbol("as-array"), k: SSymbol), _), Some(tpe @ MapType(keyType, valueType))) =>
148154
val Some(Lambda(Seq(arg), body)) = context.getFunction(k, FunctionType(Seq(keyType), valueType))
149155

0 commit comments

Comments
 (0)