Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
32685ad
start work on extended quantifiers
zafer-esen Jul 18, 2022
cfd14f7
Add extended quantifier ghost variable adder and instrumenter. Exampl…
zafer-esen Jul 22, 2022
15ce13a
Fix bug in instrumentation of array selects, simple example now works.
zafer-esen Jul 22, 2022
175d941
added support for Store
jesper-amilon Jul 27, 2022
c822789
added support for general reduce-operation
jesper-amilon Jul 28, 2022
82202dd
Update license. Update version temporarily to make TriCera pick this …
zafer-esen Aug 31, 2022
a050066
Add back-translators for extended quantifiers.
zafer-esen Sep 1, 2022
9acc912
Add support for extended quantifiers to HornPrinter and ASTree.
zafer-esen Sep 1, 2022
e02f0a6
Remove ghost variables from solutions.
zafer-esen Sep 1, 2022
6807f3d
fixed non-cancellative case
jesper-amilon Sep 13, 2022
59d8d02
fixed store case
jesper-amilon Sep 13, 2022
61a0565
Abstract analyser to collect related array terms and theories.
zafer-esen Sep 15, 2022
62a51f1
Fixes a few bugs in the ExtendedQuantifier theory collector.
zafer-esen Sep 15, 2022
c672130
Merge upstream.
zafer-esen Sep 20, 2022
81222cd
Fix incomplete merge.
zafer-esen Sep 20, 2022
5a2860e
Initial version for extended quantifier instrumenter with search.
zafer-esen Sep 27, 2022
4dbdeca
Move extendedquantifiers package out of preprocessors, add Instrument…
zafer-esen Sep 27, 2022
a6d0319
Add preambles. Add missing backtranslators for extended quantifier pr…
zafer-esen Sep 28, 2022
f121efd
Initial support for multiple sets of ghost variables (currently only …
zafer-esen Sep 30, 2022
ca01148
Fix incorrect rewriting of extended quantifiers when the number of gh…
zafer-esen Oct 3, 2022
a5bd5c0
Normalize entry clauses to not contain any instrumentation conjuncts …
zafer-esen Oct 3, 2022
0b3d398
Several improvements and bugfixes in handling two sets of ghost varia…
zafer-esen Oct 3, 2022
1b46fc7
Fix a bug in Normalizer backtranslator, add smarter search for extend…
zafer-esen Oct 4, 2022
076289a
Change how ext. quant. rewriting works, now they are also instrumenta…
zafer-esen Oct 5, 2022
8b74c58
Merge branch 'master' of https://github.com/uuverifiers/eldarica
zafer-esen Oct 5, 2022
ffb419b
Fix bug when tracking two ghost variable ranges.
zafer-esen Oct 5, 2022
097a379
Replace ite expressions with conjunctions of implications in rewritte…
zafer-esen Oct 5, 2022
e5505f0
Fix loop detector in the presence of substitutable predicates. Add su…
zafer-esen Oct 6, 2022
3d2225c
Adjust some preprocessor backtranslations to account for substitutabl…
zafer-esen Oct 6, 2022
f77ff18
Fix back-translation of aggegations (branch predicates were not being…
zafer-esen Oct 7, 2022
35dc004
Fix back-translation of counterexamples in presence of blocked predic…
zafer-esen Oct 7, 2022
61e27cf
Fix incorrect handling of multiple aggregation functions.
zafer-esen Oct 11, 2022
090f6b3
Remove nondeterminism from extended quantifier instrumentation loop
zafer-esen Dec 21, 2022
fefd4ea
Extended quantifiers: cleanup
zafer-esen Dec 21, 2022
8dd45f9
Relax some checks so that bit-vectors work, turn off some diagnostic …
zafer-esen Dec 22, 2022
4c0efa3
Revert changes to ClauseInliner
zafer-esen Dec 22, 2022
e730d80
Start changes for supporting general quantifiers in the theory.
zafer-esen Jan 23, 2023
3d5e150
Adds more support for general quantifiers into ExtendedQuantifier
zafer-esen Jan 25, 2023
d8cdbe1
Fixes instrumentation of general quantifiers.
zafer-esen Jan 26, 2023
a767304
Support for specifying index variables in general quantifier predicat…
zafer-esen Jan 26, 2023
f0e72f3
Fixes a bug introduced for extended quantifiers in previous commit (a…
zafer-esen Jan 30, 2023
9939f6c
Support for relaxing bounds in assertions with extended quantifiers
zafer-esen Jan 31, 2023
a48054d
Extended quantifiers: return zero element for empty ranges
zafer-esen Jan 31, 2023
734ca2a
Support for alien variables in extended quantifiers.
zafer-esen Feb 3, 2023
43a0f1e
Fixes a bug in range expressions in extended general quantifiers when…
zafer-esen Feb 3, 2023
441a971
Add a third instrumentation for extended quantifiers for store operat…
zafer-esen Feb 3, 2023
edca1a4
Adds some statistics related to extended quantifiers - search space s…
zafer-esen Feb 3, 2023
0a662af
Add timeout to instrumentation search for extended quantifiers.
zafer-esen Feb 3, 2023
2c120e5
Improvements related to extended quantifiers.
zafer-esen Mar 26, 2023
44a4326
Merge branch 'master' of https://github.com/uuverifiers/eldarica
zafer-esen Nov 14, 2023
ca7b21c
Updates version number.
zafer-esen Nov 14, 2023
301600b
Small improvements to eldEnv and build.sbt.
zafer-esen Nov 16, 2023
315e83e
Fixes a bug in back-translation with extended-quantfiers.
zafer-esen Nov 16, 2023
4ff3e3e
Make eldEnv POSIX compliant again.
zafer-esen Nov 16, 2023
23be694
Merge branch 'parser-jars' of https://github.com/uuverifiers/eldarica
zafer-esen Nov 17, 2023
9e8c6d4
Merge remote-tracking branch 'upstream/master'
zafer-esen Jan 3, 2024
830d10f
Renaming in extended quantifiers theory.
zafer-esen Jan 3, 2024
c1dd6c3
Add stubs for extended quantifier parser and lineariser.
zafer-esen Jan 3, 2024
bae040d
Start implementation for InstrumentationOperator.
zafer-esen Jan 4, 2024
2eca520
Clean up and documentation.
zafer-esen Jan 4, 2024
77fcf87
Renaming and fix bug in ruleAggregate
zafer-esen Jan 4, 2024
e2dc159
Update ghost variable adder and initializer.
zafer-esen Jan 4, 2024
39050d2
Update ClauseInstrumenter to use the new InstrumentationOperator.
zafer-esen Jan 5, 2024
1b5c16f
Update documentation.
zafer-esen Jan 5, 2024
d7298cc
Move instrumentation operators to their own package.
zafer-esen Jan 5, 2024
0fbac19
(WIP) More refactoring of extended quantifiers. Mostly refactored gho…
zafer-esen Jan 10, 2024
7a237a3
Fixes a few bugs and back-translation of solutions.
zafer-esen Jan 10, 2024
0f8137a
Merge branch 'uuverifiers:master' into ghost-vars-refactor
zafer-esen Feb 13, 2024
01156fd
Adds support for alien terms in predicates in extended quantifiers.
zafer-esen Feb 14, 2024
c4a38df
(WIP) Fixes bugs and splits instrumentation operators
zafer-esen Feb 15, 2024
0b8662d
refactored store,select instrumentation for readability
jesper-amilon Feb 20, 2024
9c110c1
added first version of productOperator
jesper-amilon Feb 20, 2024
63c27a4
Split ExtendedQuantifier theory into two.
zafer-esen Feb 25, 2024
4af2ff5
Make alien terms part of Boolean extended quantifier morphism.
zafer-esen Feb 26, 2024
3599f53
Fixes build error.
zafer-esen Feb 26, 2024
3e38781
Fix invalid comparison.
zafer-esen Feb 26, 2024
46a0ea9
Convert Scala if-then-else to ite.
zafer-esen Feb 26, 2024
21332ac
Merge branch 'master' of https://github.com/uuverifiers/eldarica
zafer-esen Feb 26, 2024
46c1a5c
Merge branch 'master' into ghost-vars-refactor
zafer-esen Feb 26, 2024
22a712e
Merge pull request #1 from zafer-esen/ghost-vars-refactor
zafer-esen Feb 26, 2024
0d21407
Cleanup
zafer-esen Feb 27, 2024
4ec2d78
some changes to BooleanInsrumenter
jesper-amilon Mar 2, 2024
818639a
minor syntax fix BooleanInstrumenter
jesper-amilon Mar 2, 2024
265f1c6
Merging cleanup in BooleanInstrOp Merge branch 'ghost-vars-refactor'
jesper-amilon Mar 11, 2024
11752df
changed BoolInstrOp so can be used for numof
jesper-amilon Mar 11, 2024
b056197
adding tests for numof and exists
jesper-amilon Mar 11, 2024
c092198
Restrict ghost var ranges to only 1
zafer-esen Mar 12, 2024
3b38e7c
Fix a bug in preprocessing, add test cases
zafer-esen Mar 13, 2024
4b40c9a
Another test
zafer-esen Mar 13, 2024
917a13b
Make Boolean inst op more precise when writing within range
zafer-esen Mar 13, 2024
0d12993
More improvements to extended quantifiers
zafer-esen Mar 14, 2024
4437466
Merge branch 'master' of https://github.com/uuverifiers/eldarica
zafer-esen Mar 4, 2025
6b76d78
Merge branch 'master' of https://github.com/uuverifiers/eldarica
zafer-esen Mar 6, 2025
9fd05ef
Revert "Update answers"
zafer-esen Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
lazy val commonSettings = Seq(
name := "Eldarica",
organization := "uuverifiers",
version := "2.1",
version := "2.1-ext",
homepage := Some(url("https://github.com/uuverifiers/eldarica")),
licenses := Seq("BSD License 2.0" -> url("https://github.com/uuverifiers/eldarica/blob/master/LICENSE")),
scmInfo := Some(ScmInfo(
Expand Down
36 changes: 24 additions & 12 deletions eldEnv
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,31 @@ LAZABS_HOME=`dirname "${SOURCE}"`;

export JAVA_OPTS="-Xmx8096m -Xss20000k";

if [ -f ${LAZABS_HOME}/dist/lazabs.jar ]; then

# binary distribution
export LAZABS_CMD="java ${JAVA_OPTS} -cp ${LAZABS_HOME}/dist/lazabs.jar"

else if [ -f ${LAZABS_HOME}/target/scala-2.*/Eldarica-assembly*.jar ]; then

# binary distribution from sbt
export LAZABS_CMD="java ${JAVA_OPTS} -cp ${LAZABS_HOME}/target/scala-2.*/Eldarica-assembly*.jar"
if [ -f "${LAZABS_HOME}/dist/lazabs.jar" ]; then

# binary distribution
export LAZABS_CMD="java ${JAVA_OPTS} -cp ${LAZABS_HOME}/dist/lazabs.jar"
else

ASSEMBLY_FILES=$(ls -1 ${LAZABS_HOME}/target/scala-2.*/Eldarica-assembly*.jar 2>/dev/null)
ASSEMBLY_COUNT=$(echo "$ASSEMBLY_FILES" | grep -c '^')

if [ "$ASSEMBLY_COUNT" -gt 0 ]; then
if [ "$ASSEMBLY_COUNT" -eq 1 ]; then
# binary distribution from sbt
export LAZABS_CMD="java ${JAVA_OPTS} -cp $ASSEMBLY_FILES"
else
# find latest assembly
latest=''
for file in $ASSEMBLY_FILES; do
if [ -z "$latest" ] || [ "$file" -nt "$latest" ]; then
latest=$file
fi
done
echo "Warning: multiple assembly files found in target directory, using $latest"
export LAZABS_CMD="java ${JAVA_OPTS} -cp $latest"
fi
else
echo "Could not find Eldarica jar" >&2
exit 1

fi; fi
fi
fi
4 changes: 2 additions & 2 deletions regression-tests/horn-arrays/Answers
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ splitting.smt2
unsat

0: FALSE -> 1
1: inv(store(const(4), 0, 1), store(const(3), 0, 2), 1, 2) -> 2
2: inv(store(const(4), 0, 1), store(const(3), 0, 2), 0, 0)
1: inv(store(const(3), 0, 1), store(const(4), 0, 2), 1, 2) -> 2
2: inv(store(const(3), 0, 1), store(const(4), 0, 2), 0, 0)

splitting2.smt2
sat
Expand Down
13 changes: 10 additions & 3 deletions src/main/scala/lazabs/ast/ASTree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
package lazabs.ast

import lazabs.types._
import ap.theories.{ADT, Heap, Theory, TheoryCollector, TheoryRegistry}
import ap.theories.{ADT, Heap}
import lazabs.horn.extendedquantifiers.theories.AbstractExtendedQuantifier


object ASTree {
Expand Down Expand Up @@ -109,6 +110,11 @@ object ASTree {
exprList: Seq[Expression]) extends Expression
case class HeapPred(heap: Heap, name: String,
exprList: Seq[Expression]) extends Expression

// Extended quantifiers
case class ExtQuantifierFun(extQuantifier: AbstractExtendedQuantifier,
exprList: Seq[Expression]) extends Expression

// Bit-vectors

case class BVconst(bits: Int, num : BigInt) extends Expression
Expand Down Expand Up @@ -157,10 +163,11 @@ object ASTree {
// ternary expressions
sealed abstract class TernaryOperator(val st: String)
case class IfThenElseOp() extends TernaryOperator ("if")
case class ArrayUpdateOp() extends TernaryOperator ("update")
case class ArrayUpdateOp() extends TernaryOperator ("update")
case class ExtendedQuantifierOp() extends TernaryOperator ("extquans")
case class TernaryExpression(op: TernaryOperator, e1: Expression, e2: Expression, e3: Expression) extends Expression

// binray expressions
// binary expressions
sealed abstract class BinaryOperator(val st: String)
case class IfThenOp() extends BinaryOperator ("if")
case class AssignmentOp() extends BinaryOperator ("=")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import lazabs.horn.concurrency.ReaderMain
import lazabs.horn.bottomup.HornPredAbs.predArgumentSorts

import ap.basetypes.IdealInt
import ap.parser.IExpression.Predicate
import ap.theories.nia.GroebnerMultiplication
import ap.theories.rationals.Rationals
import ap.theories.bitvectors.ModuloArithmetic.ModSort
Expand All @@ -56,13 +57,14 @@ object StaticAbstractionBuilder {
*/
class StaticAbstractionBuilder(
clauses : Seq[HornClauses.Clause],
abstractionType : StaticAbstractionBuilder.AbstractionType.Value) {
abstractionType : StaticAbstractionBuilder.AbstractionType.Value,
substitutablePredicates : Set[Predicate] = Set()) {

import IExpression._
import HornClauses.Clause
import VerificationHints._

val loopDetector = new LoopDetector(clauses)
val loopDetector = new LoopDetector(clauses, substitutablePredicates)

Console.err.println("Loop heads:")

Expand Down
25 changes: 17 additions & 8 deletions src/main/scala/lazabs/horn/abstractions/LoopDetector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import ap.terfor.equations.ReduceWithEqs
import ap.types.Sort
import ap.theories.ModuloArithmetic
import ap.parser._
import ap.parser.IExpression.Predicate
import ap.util.{LRUCache, Seqs}

import scala.collection.mutable.{LinkedHashSet, ArrayBuffer,
Expand All @@ -51,7 +52,8 @@ import scala.collection.mutable.{LinkedHashSet, ArrayBuffer,
* Compute loops and loop heads of the given set of clauses,
* using a generalised version of the dominator relation.
*/
class LoopDetector(clauses : Seq[HornClauses.Clause]) {
class LoopDetector(clauses : Seq[HornClauses.Clause],
substitutablePreds : Set[Predicate] = Set()) {

import IExpression._
import HornClauses.Clause
Expand All @@ -66,14 +68,16 @@ class LoopDetector(clauses : Seq[HornClauses.Clause]) {
while (oldSize != allPredicates.size) {
oldSize = allPredicates.size
for (Clause(IAtom(headP, _), body, _) <- clauses)
if (body forall { case IAtom(p, _) => allPredicates contains p })
if (body forall { case IAtom(p, _) =>
(allPredicates contains p) || (substitutablePreds contains p)})
allPredicates += headP
}
}

val reachableClauses =
for (clause@Clause(_, body, _) <- clauses;
if (body forall { case IAtom(p, _) => allPredicates contains p }))
if (body.filter(b => !(substitutablePreds contains b.pred)) forall {
case IAtom(p, _) => allPredicates contains p}))
yield clause

val clausesWithHead =
Expand All @@ -87,7 +91,8 @@ class LoopDetector(clauses : Seq[HornClauses.Clause]) {

val body2head =
((for (Clause(IAtom(head, _), body, _) <- reachableClauses;
IAtom(b, _) <- body)
IAtom(b, _) <- body.filter(b =>
!(substitutablePreds contains b.pred)))
yield (b, head)) groupBy (_._1)) mapValues (_ map (_._2))

val workqueue = new LinkedHashSet[Predicate]
Expand All @@ -105,7 +110,8 @@ class LoopDetector(clauses : Seq[HornClauses.Clause]) {
val oldSet = domCandidates(p)
val newSet =
(for (Clause(_, body, _) <- pClauses.iterator) yield {
(Set(p) /: (for (IAtom(q, _) <- body.iterator)
(Set(p) /: (for (IAtom(q, _) <- body.filter(b =>
!(substitutablePreds contains b.pred)).iterator)
yield domCandidates(q))) (_ ++ _)
}) reduce (_ & _)

Expand All @@ -122,7 +128,8 @@ class LoopDetector(clauses : Seq[HornClauses.Clause]) {

val loopHeads =
(for (clause@Clause(IAtom(p, _), body, _) <- reachableClauses.iterator;
if (body exists { case IAtom(q, _) => dominates(p, q) }))
if (body.filter(b => !(substitutablePreds contains b.pred)) exists {
case IAtom(q, _) => dominates(p, q) }))
yield p).toSet

val loopBodies =
Expand All @@ -135,15 +142,17 @@ class LoopDetector(clauses : Seq[HornClauses.Clause]) {
oldSize = bodyPreds.size
for (Clause(IAtom(p, _), body, _) <- reachableClauses.iterator;
if (bodyPreds contains p);
IAtom(q, _) <- body.iterator;
IAtom(q, _) <- body.filter(b =>
!(substitutablePreds contains b.pred)).iterator;
if (dominates(head, q)))
bodyPreds += q
}

(head,
for (clause@Clause(IAtom(p, _), body, _) <- reachableClauses;
if ((bodyPreds contains p) &&
(body exists { case IAtom(q, _) => bodyPreds contains q })))
(body.filter(b => !(substitutablePreds contains b.pred)) exists {
case IAtom(q, _) => bodyPreds contains q })))
yield clause)
}).toMap

Expand Down
Loading