cvc5.git
5 years agoClause proof printing (#2779)
Alex Ozdemir [Wed, 9 Jan 2019 08:18:29 +0000 (09:18 +0100)]
Clause proof printing (#2779)

* Print LFSC proofs of CNF formulas

* Unit Test for clause printing

* Added SAT input proof printing unit test

* Fixed cnf_holds reference. Proofs of CMap_holds

There were references to clauses_hold, which should have been references
to cnf_holds.

Also added a function for printing a value of type CMap_holds, and a
test for this function.

5 years agoLFSC drat output (#2776)
Alex Ozdemir [Wed, 9 Jan 2019 07:29:12 +0000 (08:29 +0100)]
LFSC drat output (#2776)

* LFSC drat output

* Addressed Mathias' review

Addressing Mathias' review with the following changes:
* Added a few blank lines
* Added a unit test for LRAT output as LFSC

5 years agoNew C++ API: Add missing getType() calls to kick off type checking. (#2773)
Aina Niemetz [Mon, 7 Jan 2019 17:02:02 +0000 (09:02 -0800)]
New C++ API: Add missing getType() calls to kick off type checking. (#2773)

5 years ago[DRAT] DRAT data structure (#2767)
Alex Ozdemir [Sun, 6 Jan 2019 18:32:42 +0000 (19:32 +0100)]
[DRAT] DRAT data structure  (#2767)

* Copied old DRAT data-structure files.

Next step: clean up the code, and adapt them to our current usage plans.

* Polished the DRAT class.

Notably, removed the idea of lazy-parsing, this is now just a DRAT
wrapper class.

More explicit about whether methods handle binary or text.

Better constructor patterns

* Added implementation of textual DRAT output

* reordered the DratInstruction structure.
* removed the public modifier from the above struct
* removed the operator << implementation for DratInstruction

* use emplace_back

* Addressing Yoni's first review

* Extracted "write literal in DIMACS format" idea as a function
* Replaced some spurious Debug streams with `os`. (they were left over
from an earlier refactor)
* Improved some documentation

* Removed aside about std::string

* Addressed Mathias' comments

Specifically
* SCREAMING_SNAKE_CASED enum variants.
* Extracted some common logic from two branches of a conditional.
* Cleaned out some undefined behavior from bit manipulation.

* Unit tests for binary DRAT parsing

* Added text output test

* s/white/black/ derp

5 years agocmake: Disable unit tests for static builds. (#2775)
Mathias Preiner [Sat, 5 Jan 2019 04:21:10 +0000 (20:21 -0800)]
cmake: Disable unit tests for static builds. (#2775)

--static now implies --no-unit-testing.

Fixes #2672.

5 years agoC++ API: Fix OOB read in unit test (#2774)
Andres Noetzli [Fri, 4 Jan 2019 21:26:08 +0000 (13:26 -0800)]
C++ API: Fix OOB read in unit test (#2774)

There were two typos in the unit tests that caused OOB accesses. Instead
of doing `d_solver.mkConst(CONST_BITVECTOR, std::string("101"), 6)`, the
closing parenthesis was in the wrong place resulting in
`std::string("101", 6)`. The second argument to `std::string(const
char*, size_t)` says how many characters to copy and results in
undefined behavior if the number is greater than the length of the
string, thus the OOB access. The commit fixes the typo and removes one
of the tests because it should not actually fail (16 is an accepted
base).

5 years ago[LRAT] A C++ data structure for LRAT. (#2737)
Alex Ozdemir [Fri, 4 Jan 2019 08:57:27 +0000 (09:57 +0100)]
[LRAT] A C++ data structure for LRAT. (#2737)

* [LRAT] A C++ data structure for LRAT.

Added a data structure for storing (abstract) LRAT proofs.

The constructor will take a drat binary proof and convert it to LRAT
using drat-trim. However, this is unimplemented in this PR.

Subsequent PRs will add:
   * LFSC representation of LRAT
   * Bitvector Proofs based on LRAT
   * Enabled tests for those proofs

* Documenting LRAT constructors

* Apply suggestions from code review

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Responding to Andres' review

Consisting of
   * Naming nits
   * Closed fds
   * Better implementation of disjoint union for LratInstruction
   * DRAT -> LRAT conversion is no longer an LratProof constructor

* include reorder

* Update src/proof/lrat/lrat_proof.h

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Addressed Andres' comments

* ANonymous namespaces and name resolution?

* Remove inlines, fix i negation

Thanks Andres!

* Use `std::abs`

Credit to Andres

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Remove uneeded public

5 years agoNew C++ API: Add missing catch blocks for std::invalid_argument. (#2772)
Aina Niemetz [Fri, 4 Jan 2019 03:29:43 +0000 (19:29 -0800)]
New C++ API: Add missing catch blocks for std::invalid_argument. (#2772)

5 years agoAPI/Smt2 parser: refactor termAtomic (#2674)
Andres Noetzli [Thu, 3 Jan 2019 22:48:18 +0000 (14:48 -0800)]
API/Smt2 parser: refactor termAtomic (#2674)

5 years agoC++ API: Reintroduce zero-value mkBitVector method (#2770)
Andres Noetzli [Thu, 3 Jan 2019 16:55:45 +0000 (17:55 +0100)]
C++ API: Reintroduce zero-value mkBitVector method (#2770)

PR #2764 removed `Solver::mkBitVector(uint32_t)` (returns a bit-vector
of a given size with value zero), which made the build fail when SymFPU
was enabled because solver_black used it for SymFPU-enabled builds. This
commit simply adds a zero default argument to `mkBitVector(uint32_t,
uint64_t)` to allow users to create zero-valued bit-vectors without
explicitly specifying the value again. Additionally, the commit replaces
the use of the `CVC4_USE_SYMFPU` macro by a call to
`Configuration::isBuiltWithSymFPU()`, making sure that we can catch
compile-time errors regardless of configuration. Finally,
`Solver::mkConst(Kind, uint32_t, uint32_t, Term)` now checks whether
CVC4 has been compiled with SymFPU when creating a `CONST_FLOATINGPOINT`
and throws an exception otherwise (solver_black has been updated
correspondingly).

5 years ago[LRA proof] Recording & Printing LRA Proofs (#2758)
Alex Ozdemir [Thu, 3 Jan 2019 14:39:35 +0000 (15:39 +0100)]
[LRA proof] Recording & Printing LRA Proofs (#2758)

* [LRA proof] Recording & Printing LRA Proofs

Now we use the ArithProofRecorder to record and later print arithmetic
proofs.

If an LRA lemma can be proven by a single farkas proof, then that is
done. Otherwise, we `trust` the lemma.

I haven't **really** enabled LRA proofs yet, so `--check-proofs` still
is a no-op for LRA.

To test, do
```
lfsccvc4 <(./bin/cvc4 --dump-proofs ../test/regress/regress0/lemmas/mode_cntrl.induction.smt | tail -n +2)
```

where `lfsccvc4` is an alias invoking `lfscc` with all the necessary
signatures. On my machine that is:

```
alias lfsccvc4="/home/aozdemir/repos/LFSC/build/src/lfscc \
/home/aozdemir/repos/CVC4/proofs/signatures/sat.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/smt.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/lrat.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_base.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_bv.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_bv_bitblast.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_arrays.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_int.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_quant.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_real.plf \
/home/aozdemir/repos/CVC4/proofs/signatures/th_real.plf"

```

* Added guards to proof recording

Also reverted some small, unintentional changes.

Also had to add printing for STRING_SUBSTR??

* Responding to Yoni's review

* SimpleFarkasProof examples

* Respond to Aina's comments

* Reorder Constraint declarations

* fix build

* Moved friend declaration in Constraint

* Trichotomy example

* Lift getNumChildren invocation in PLUS case

Credits to aina for spotting it.

* Clang-format

5 years agoNew C++ API: Add tests for mk-functions in solver object. (#2764)
Aina Niemetz [Thu, 3 Jan 2019 04:07:43 +0000 (20:07 -0800)]
New C++ API: Add tests for mk-functions in solver object. (#2764)

5 years agoClean up BV kinds and type rules. (#2766)
Aina Niemetz [Thu, 20 Dec 2018 22:48:07 +0000 (14:48 -0800)]
Clean up BV kinds and type rules. (#2766)

5 years agoAdd missing type rules for parameterized operator kinds. (#2766)
Aina Niemetz [Thu, 20 Dec 2018 21:44:51 +0000 (13:44 -0800)]
Add missing type rules for parameterized operator kinds. (#2766)

5 years agoFix issues with REWRITE_DONE in floating point rewriter (#2762)
Andrew Reynolds [Wed, 19 Dec 2018 17:58:52 +0000 (11:58 -0600)]
Fix issues with REWRITE_DONE in floating point rewriter (#2762)

5 years agoRemove noop. (#2763)
Aina Niemetz [Tue, 18 Dec 2018 00:16:16 +0000 (16:16 -0800)]
Remove noop. (#2763)

5 years ago Configured for linking against drat2er (#2754)
Alex Ozdemir [Mon, 17 Dec 2018 23:01:23 +0000 (15:01 -0800)]
 Configured for linking against drat2er (#2754)

drat2er is a C/C++ project which includes support for
   * Checking DRAT proofs
   * Converting DRAT proofs to LRAT proofs
   * Converting DRAT proofs to ER proofs

It does the first 2 by using drat-trim under the hood.

I've modified our CMake configuration to allow drat2er to be linked into
CVC4, and I added a contrib script.

5 years agoNew C++ API: Add tests for term object. (#2755)
Aina Niemetz [Mon, 17 Dec 2018 22:11:37 +0000 (14:11 -0800)]
New C++ API: Add tests for term object. (#2755)

5 years agoDRAT Signature (#2757)
Alex Ozdemir [Mon, 17 Dec 2018 01:49:34 +0000 (17:49 -0800)]
DRAT Signature (#2757)

* DRAT signature

Added the DRAT signature to CVC4.

We'll need this in order to compare three BV proof pipelines:
   1. DRAT -> Resolution -> Check
   2. DRAT -> LRAT -> Check
   3. DRAT -> Check (this one!)

Tested the signature using the attached test file. i.e. running
```
lfscc sat.plf smt.plf lrat.plf drat.plf drat_test.plf
```

* Added type annotations for tests

* Respond to Yoni's review

* Apply Yoni's suggestions from code review

Documentation polish

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Whoops, missed a spot or two

5 years agoRevert "Move ss-combine rewrite to extended rewriter (#2703)" (#2759)
Andres Noetzli [Sat, 15 Dec 2018 16:40:03 +0000 (16:40 +0000)]
Revert "Move ss-combine rewrite to extended rewriter (#2703)" (#2759)

5 years ago [LRA Proof] Storage for LRA proofs (#2747)
Alex Ozdemir [Sat, 15 Dec 2018 01:44:39 +0000 (17:44 -0800)]
 [LRA Proof] Storage for LRA proofs  (#2747)

* [LRA Proof] Storage for LRA proofs

During LRA solving the `ConstraintDatabase` contains the reasoning
behind different constraints. Combinations of constraints are
periodically used to justify lemmas (conflict clauses, propegations, ...
?). `ConstraintDatabase` is SAT context-dependent.

ArithProofRecorder will be used to store concise representations of the
proof for each lemma raised by the (LR)A theory. The (LR)A theory will
write to it, and the ArithProof class will read from it to produce LFSC
proofs.

Right now, it's pretty simplistic -- it allows for only Farkas proofs.

In future PRs I'll:
   1. add logic that stores proofs therein
   2. add logic that retrieves and prints proofs
   3. enable LRA proof production, checking, and testing

* Document ArithProofRecorder use-sites

* Update src/proof/arith_proof_recorder.cpp

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Yoni's review

* clang-format

* Response to Mathias' review.

5 years agoFixed typos.
Aina Niemetz [Fri, 14 Dec 2018 23:12:27 +0000 (15:12 -0800)]
Fixed typos.

5 years agoNew C++ API: Add tests for opterm object. (#2756)
Aina Niemetz [Fri, 14 Dec 2018 18:25:15 +0000 (10:25 -0800)]
New C++ API: Add tests for opterm object. (#2756)

5 years ago Fix extended rewriter for binary associative operators. (#2751)
Andrew Reynolds [Fri, 14 Dec 2018 02:17:50 +0000 (20:17 -0600)]
 Fix extended rewriter for binary associative operators. (#2751)

This was causing assertion failures when using Sets + Sygus.

5 years agoMake single invocation and invariant pre/post condition templates independent (#2749)
Andrew Reynolds [Fri, 14 Dec 2018 00:39:26 +0000 (18:39 -0600)]
Make single invocation and invariant pre/post condition templates independent (#2749)

--cegqi-si=none previously disabled pre/post-condition templates for invariant synthesis. This PR eliminates this dependency.

There are no major code changes in this PR, unfortunately a large block of code changed indentation so I refactored it to be more up to date with the coding guidelines.

5 years agoNew C++ API: Add tests for sort functions of solver object. (#2752)
Aina Niemetz [Thu, 13 Dec 2018 21:17:22 +0000 (13:17 -0800)]
New C++ API: Add tests for sort functions of solver object. (#2752)

5 years agoRemove spurious map (#2750)
Andrew Reynolds [Thu, 13 Dec 2018 18:03:16 +0000 (12:03 -0600)]
Remove spurious map (#2750)

5 years agoFix compiler warnings. (#2748)
Aina Niemetz [Thu, 13 Dec 2018 00:37:59 +0000 (16:37 -0800)]
Fix compiler warnings. (#2748)

5 years agoAPI: Add simple empty/sigma regexp unit tests (#2746)
Andres Noetzli [Wed, 12 Dec 2018 23:19:30 +0000 (23:19 +0000)]
API: Add simple empty/sigma regexp unit tests (#2746)

5 years ago[LRA proof] More complete LRA example proofs. (#2722)
Alex Ozdemir [Wed, 12 Dec 2018 01:35:26 +0000 (17:35 -0800)]
[LRA proof] More complete LRA example proofs. (#2722)

* [LRA proof] Refine "poly" and "term Real" distinction

Short Version:

Refined the LRA signature and used the refined version to write two new
test proofs which are close to interface compatible with the LRA proofs
that CVC4 will produce.

Love Version:

LRA proofs have the following interface:
   * Given predicates between real terms
   * Prove bottom

However, even though the type of the interface does not express this,
the predicates are **linear bounds**, not arbitrary real bounds. Thus
LRA proofs have the following structure:

   1. Prove that the input predicates are equivalent to a set of linear
      bounds.
   2. Use the linear bounds to prove bottom using farkas coefficients.

Notice that the distinction between linear bounds (associated in the
signature with the string "poly") and real predicates (which relate
"term Real"s to one another) matters quite a bit. We have certain inds
of axioms for one, and other axioms for the other.

The signature used to muddy this distinction using a constructor called
"term_poly" which converted between them. I decided it was better to buy
into the distinction fully.

Now all of the axioms for step (2) use the linear bounds and axioms for
step (1) use both kinds of bounds, which makes sense because step (1) is
basically a conversion.

Also had to add an axiom or two, because some were missing.

* Update proofs/signatures/th_lra.plf

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Improved test readability, removed unused axioms

The LRA proof tests did not have appropriate documentation, and did not
specify **what** they proved. Now they each have a header comment
stating their premises and conclusion, and that conclusion is enforced
by a type annotation in the test.

The LRA signature included some unused axioms concerning `poly_term`.
Now they've been removed.

Credits to Yoni for noticing both problems.

5 years ago[LRAT] signature robust against duplicate literals (#2743)
Alex Ozdemir [Wed, 12 Dec 2018 01:19:07 +0000 (17:19 -0800)]
[LRAT] signature robust against duplicate literals (#2743)

* [LRAT] signature robust against duplicate literals

The LRAT signature previously had complex, surprising, and occasionally
incorrect behavior when given clauses with duplicate literals.

Now it does not. Now clauses have true set semantics, and clauses with
duplicate literals are treated identically to those without.

* Test with logically = but structurally != clauses.

5 years agoRemove alternate versions of mbqi (#2742)
Andrew Reynolds [Tue, 11 Dec 2018 22:38:00 +0000 (16:38 -0600)]
Remove alternate versions of mbqi (#2742)

5 years agoLRAT signature (#2731)
Alex Ozdemir [Tue, 11 Dec 2018 19:46:38 +0000 (11:46 -0800)]
LRAT signature (#2731)

* LRAT signature

Added an LRAT signature. It is almost entirely side-conditions, but it
works.

There is also a collection of tests for it. You can run them by invoking

```
lfscc smt.plf sat.plf lrat.plf lrat_test.plf
```

* Update proofs/signatures/lrat.plf per Yoni's suggestion.

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Responding to Yoni's comments.

* Removed unused varaibles

Some tests declared `var`s which were unused.
Now they don't.

5 years agoBoolToBV modes (off, ite, all) (#2530)
makaimann [Mon, 10 Dec 2018 16:37:11 +0000 (08:37 -0800)]
BoolToBV modes (off, ite, all) (#2530)

5 years agoStrings: Make EXTF_d inference more conservative (#2740)
Andres Noetzli [Fri, 7 Dec 2018 15:48:38 +0000 (07:48 -0800)]
Strings: Make EXTF_d inference more conservative (#2740)

5 years agoArith Constraint Proof Loggin (#2732)
Alex Ozdemir [Fri, 7 Dec 2018 04:00:03 +0000 (20:00 -0800)]
Arith Constraint Proof Loggin (#2732)

* Arith Constraint Proof Logging

Also a tiny documentation update.

* Debug.isOn check around iterated output

* reference iteratees

5 years agoEnable BV proofs when using an eager bitblaster (#2733)
Alex Ozdemir [Fri, 7 Dec 2018 02:56:56 +0000 (18:56 -0800)]
Enable BV proofs when using an eager bitblaster (#2733)

* Enable BV proofs when using and eager bitblaster

Specifically:
   * Removed assertions that blocked them.
   * Made sure that only bitvectors were stored in the BV const let-map
   * Prevented true/false from being bit-blasted by the eager bitblaster

Also:
   * uncommented "no-check-proofs" from relevant tests

* Option handler logic for BV proofs

BV eager proofs only work when minisat is the sat solver being used by
the BV theory.

Added logic to the --proof hanlder to  verify this or throw an option
exception.

* Bugfix for proof options handler

I forgot that proofEnabledBuild runs even if the --proof option is
negated. In my handler I now check that proofs are enabled.

* Clang-format

5 years agoFix use-after-free due to destruction order (#2739)
Andres Noetzli [Thu, 6 Dec 2018 23:23:00 +0000 (15:23 -0800)]
Fix use-after-free due to destruction order (#2739)

A test for PR #2737 was failing even though the PR only added dead code.
This PR fixes the issue by fixing two use-after-free bugs:

- `ResolutionBitVectorProof` has a `Context` and a
`std::unique_ptr<BVSatProof>` member. The `BVSatProof` depends on the
`Context` and tries to access it (indirectly) in its constructor but
because the context was declared after the proof, the context was
destroyed before the proof, leading to a use-after-free in a method
called from the proof's destructor. This commit reorders the two
members.
- `TLazyBitblaster` was destroyed before the `LFSCCnfProof` in
`BitVectorProof` because `SmtEngine`'s destructor first destroyed the
theory engine and then the proof manager. This lead to a use-after-free
because `LFSCCnfProof` was using the `d_nullContext` of
`TLazyBitblaster`, which got indirectly accessed in `LFSCCnfProof`'s
destructor. This commit moves the destruction of `ProofManager` above
the destruction of the theory engine.

The issues were likely introduced by #2599. They went undetected because
our nightlies' ASAN check does not use proofs due to known memory leaks
in the proof module of CVC4.

I have tested this PR up to regression level 2 with ASAN with leak
detection disabled.

5 years ago Take into account minimality and types for cached PBE solutions (#2738)
Andrew Reynolds [Thu, 6 Dec 2018 16:38:05 +0000 (10:38 -0600)]
 Take into account minimality and types for cached PBE solutions (#2738)

5 years agoApply extended rewriting on PBE static symmetry breaking. (#2735)
Andrew Reynolds [Tue, 4 Dec 2018 22:04:47 +0000 (16:04 -0600)]
Apply extended rewriting on PBE static symmetry breaking. (#2735)

5 years agoEnable regular expression elimination by default. (#2736)
Andrew Reynolds [Tue, 4 Dec 2018 19:52:17 +0000 (13:52 -0600)]
Enable regular expression elimination by default. (#2736)

Seems to have no impact on Norn, and is helpful for a number of applications.

5 years ago Skip non-cardinality types in sets min card inference (#2734)
Andrew Reynolds [Mon, 3 Dec 2018 23:00:58 +0000 (17:00 -0600)]
 Skip non-cardinality types in sets min card inference (#2734)

5 years agoBit vector proof superclass (#2599)
Alex Ozdemir [Mon, 3 Dec 2018 19:56:47 +0000 (11:56 -0800)]
Bit vector proof superclass (#2599)

* Split BitvectorProof into a sub/superclass

The superclass contains general printing knowledge.

The subclass contains CNF or Resolution-specific knowledge.

* Renames & code moves

* Nits cleaned in prep for PR

* Moved CNF-proof from ResolutionBitVectorProof to BitVectorProof

Since DRAT BV proofs will also contain a CNF-proof, the CNF proof should
be stored in `BitVectorProof`.

* Unique pointers, comments, and code movement.

Adjusted the distribution of code between BVP and RBVP.
  Notably, put the CNF proof in BVP because it isn't
  resolution-specific.
Added comments to the headers of both files -- mostly BVP.
Changed two owned pointers into unique_ptr.
  BVP's pointer to a CNF proof
  RBVP's pointer to a resolution proof

BVP: `BitVectorProof`
RBVP: `ResolutionBitVectorProof`

* clang-format

* Undo manual copyright modification

* s/superclass/base class/

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* make LFSCBitVectorProof::printOwnedSort public

* Andres's Comments

Mostly cleaning up (or trying to clean up) includes.

* Cleaned up one header cycle

However, this only allowed me to move the forward-decl, not eliminate
it, because there were actually two underlying include cycles that the
forward-decl solved.

* Added single _s to header gaurds

* Fix Class name in debug output

Credits to Andres

Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu>
* Reordered methods in BitVectorProof per original  ordering

5 years agoOptimizations for PBE strings (#2728)
Andrew Reynolds [Sun, 2 Dec 2018 14:49:17 +0000 (08:49 -0600)]
Optimizations for PBE strings (#2728)

5 years ago Infrastructure for sygus side conditions (#2729)
Andrew Reynolds [Thu, 29 Nov 2018 18:09:19 +0000 (12:09 -0600)]
 Infrastructure for sygus side conditions (#2729)

5 years agoCombine sygus stream with PBE (#2726)
Andrew Reynolds [Thu, 29 Nov 2018 06:17:14 +0000 (00:17 -0600)]
Combine sygus stream with PBE (#2726)

5 years agoImprove interface for sygus grammar cons (#2727)
Andrew Reynolds [Wed, 28 Nov 2018 23:57:18 +0000 (17:57 -0600)]
Improve interface for sygus grammar cons (#2727)

5 years agoInformation gain heuristic for PBE (#2719)
Andrew Reynolds [Wed, 28 Nov 2018 21:49:56 +0000 (15:49 -0600)]
Information gain heuristic for PBE (#2719)

5 years agoOptimize re-elim for re.allchar components (#2725)
Andrew Reynolds [Wed, 28 Nov 2018 20:58:33 +0000 (14:58 -0600)]
Optimize re-elim for re.allchar components (#2725)

5 years agoImprove skolem caching by normalizing skolem args (#2723)
Andres Noetzli [Wed, 28 Nov 2018 20:33:55 +0000 (12:33 -0800)]
Improve skolem caching by normalizing skolem args (#2723)

In certain cases, we can share skolems between similar reductions, e.g.
`(str.replace x y z)` and `(str.replace (str.substr x 0 n) y z)` because the
first occurrence of `y` in `x` has to be the first occurrence
of `y` in `(str.substr x 0 n)` (assuming that `y` appears in both, otherwise the value of
the skolems does not matter). This commit adds a helper function in the
skolem cache that does some of those simplifications.

5 years agoGeneralize sygus stream solution filtering to logical strength (#2697)
Andrew Reynolds [Wed, 28 Nov 2018 17:06:32 +0000 (11:06 -0600)]
Generalize sygus stream solution filtering to logical strength (#2697)

5 years agoImprove cegqi engine trace. (#2714)
Andrew Reynolds [Wed, 28 Nov 2018 01:27:57 +0000 (19:27 -0600)]
Improve cegqi engine trace. (#2714)

5 years agoMake (T)NodeTrie a general utility (#2489)
Andrew Reynolds [Tue, 27 Nov 2018 21:39:13 +0000 (15:39 -0600)]
Make (T)NodeTrie a general utility (#2489)

This moves quantifiers::TermArgTrie in src/theory/quantifiers/term_database to (T)NodeTrie in src/expr, and cleans up all references to it.

5 years agoFix coverity warnings in datatypes (#2553)
Andrew Reynolds [Tue, 27 Nov 2018 21:19:32 +0000 (15:19 -0600)]
Fix coverity warnings in datatypes (#2553)

This caches some information regarding tester applications and changes int -> size_t in a few places.

5 years agoLazy model construction in TheoryEngine (#2633)
Andrew Reynolds [Tue, 27 Nov 2018 16:56:27 +0000 (10:56 -0600)]
Lazy model construction in TheoryEngine (#2633)

5 years agoReduce lookahead when parsing string literals (#2721)
Andres Noetzli [Tue, 27 Nov 2018 16:10:36 +0000 (08:10 -0800)]
Reduce lookahead when parsing string literals (#2721)

5 years agoLRA proof signature fixes and a first proof for linear polynomials (#2713)
Alex Ozdemir [Tue, 27 Nov 2018 08:59:22 +0000 (00:59 -0800)]
LRA proof signature fixes and a first proof for linear polynomials (#2713)

* LRA proof signature fixes and a first proof

The existing LRA signature had a few problems (e.g. referencing symbols
that didn't exist, extra parentheses, etc). I patched it up and wrote an
first example LRA proof. load `th_lra_test.plf` last to run that test.

* Add dependency info to signatures

I chose to indicate shallow dependencies only.

5 years agoUse https for antlr3.org downloads (#2701)
Tom Smeding [Fri, 23 Nov 2018 07:31:21 +0000 (08:31 +0100)]
Use https for antlr3.org downloads (#2701)

This commit changes the two www,antlr3.org URL's in contrib/get-antlr-3.4 to use https instead of http, which is more secure.

5 years agoMove ss-combine rewrite to extended rewriter (#2703)
Andres Noetzli [Thu, 22 Nov 2018 01:44:50 +0000 (17:44 -0800)]
Move ss-combine rewrite to extended rewriter (#2703)

We found that the `ss-combine` rewrite hurts solving performance, so
this commit is moving it to the extended rewriter.

5 years agoAdd rewrite for (str.substr s x y) --> "" (#2695)
Andres Noetzli [Thu, 22 Nov 2018 00:47:57 +0000 (16:47 -0800)]
Add rewrite for (str.substr s x y) --> "" (#2695)

This commit adds the rewrite `(str.substr s x y) --> "" if x >= 0 |= 0
>= str.len(s)`.

5 years agoCache evaluations for PBE (#2699)
Andrew Reynolds [Wed, 21 Nov 2018 23:07:17 +0000 (17:07 -0600)]
Cache evaluations for PBE (#2699)

5 years agoQuickly recognize when PBE conjectures are infeasible (#2718)
Andrew Reynolds [Wed, 21 Nov 2018 22:24:16 +0000 (16:24 -0600)]
Quickly recognize when PBE conjectures are infeasible (#2718)

Recognizes when the conjecture has conflicting I/O pairs. Also includes a minor change to the default behavior of PBE.

This change broke a delicate regression array_search_2, which I fixed by adding some additional options to make it more robust.

After this PR, we immediately find 4/7 unsolved in PBE strings of sygusComp 2018 to be infeasible.

5 years agoObvious rewrites to floating-point < and <=. (#2706)
Martin [Wed, 21 Nov 2018 21:59:51 +0000 (21:59 +0000)]
Obvious rewrites to floating-point < and <=. (#2706)

5 years agoSupport string replace all (#2704)
Andrew Reynolds [Wed, 21 Nov 2018 20:44:44 +0000 (14:44 -0600)]
Support string replace all (#2704)

5 years ago Fix type enumerator for FP (#2717)
Andrew Reynolds [Wed, 21 Nov 2018 14:59:51 +0000 (08:59 -0600)]
 Fix type enumerator for FP (#2717)

5 years agoFix real2int regression. (#2716)
Andrew Reynolds [Tue, 20 Nov 2018 16:48:41 +0000 (10:48 -0600)]
Fix real2int regression. (#2716)

5 years agoChange lemma proof step storage & iterators (#2712)
Alex Ozdemir [Tue, 20 Nov 2018 05:46:29 +0000 (21:46 -0800)]
Change lemma proof step storage & iterators (#2712)

Proof steps were in a std::list, which is a linked list, but really, we
only needed a stack, so I changed it to a vector, because LL's are
usually slower.

Also added an iterator for the proof steps, and << implementations

5 years ago Clausify context-dependent simplifications in ext theory (#2711)
Andrew Reynolds [Tue, 20 Nov 2018 01:18:38 +0000 (19:18 -0600)]
 Clausify context-dependent simplifications in ext theory (#2711)

5 years agoFix E-matching for case where candidate generator is not properly initialized (#2708)
Andrew Reynolds [Mon, 19 Nov 2018 23:29:44 +0000 (17:29 -0600)]
Fix E-matching for case where candidate generator is not properly initialized (#2708)

5 years ago Expand definitions prior to model core computation (#2707)
Andrew Reynolds [Thu, 15 Nov 2018 22:40:37 +0000 (16:40 -0600)]
 Expand definitions prior to model core computation (#2707)

5 years agocmake: Require boost 1.50.0 for examples. (#2710)
Mathias Preiner [Wed, 14 Nov 2018 19:48:49 +0000 (11:48 -0800)]
cmake: Require boost 1.50.0 for examples. (#2710)

5 years agocmake: Add option to explicitely enable/disable static binaries. (#2698)
Mathias Preiner [Thu, 8 Nov 2018 19:10:16 +0000 (11:10 -0800)]
cmake: Add option to explicitely enable/disable static binaries. (#2698)

5 years agoEvaluator: add support for str.code (#2696)
Andres Noetzli [Thu, 8 Nov 2018 01:04:52 +0000 (17:04 -0800)]
Evaluator: add support for str.code (#2696)

5 years agoAdding default SyGuS grammar construction for arrays (#2685)
Haniel Barbosa [Wed, 7 Nov 2018 23:12:38 +0000 (17:12 -0600)]
Adding default SyGuS grammar construction for arrays (#2685)

5 years agoFix collectEmptyEqs in string rewriter (#2692)
Andres Noetzli [Wed, 7 Nov 2018 18:28:25 +0000 (10:28 -0800)]
Fix collectEmptyEqs in string rewriter (#2692)

5 years ago Fix for itos reduction (#2691)
Andrew Reynolds [Wed, 7 Nov 2018 16:52:51 +0000 (10:52 -0600)]
 Fix for itos reduction (#2691)

5 years agoIncorporate static PBE symmetry breaking lemmas into SygusEnumerator (#2690)
Andrew Reynolds [Tue, 6 Nov 2018 23:28:41 +0000 (17:28 -0600)]
Incorporate static PBE symmetry breaking lemmas into SygusEnumerator (#2690)

5 years agoChange default sygus enumeration mode to auto (#2689)
Andrew Reynolds [Mon, 5 Nov 2018 22:50:48 +0000 (16:50 -0600)]
Change default sygus enumeration mode to auto (#2689)

5 years agoFix coverity warnings in sygus enumerator (#2687)
Andrew Reynolds [Mon, 5 Nov 2018 22:16:31 +0000 (16:16 -0600)]
Fix coverity warnings in sygus enumerator (#2687)

5 years agoNew C++ API: Split unit tests. (#2688)
Aina Niemetz [Mon, 5 Nov 2018 17:43:29 +0000 (09:43 -0800)]
New C++ API: Split unit tests. (#2688)

5 years agoIncreasing coverage (#2683)
yoni206 [Mon, 5 Nov 2018 17:25:09 +0000 (09:25 -0800)]
Increasing coverage (#2683)

This PR adds/revises tests in order to increase coverage in some preprocessing passes and in proofs done with --fewer-preprocessing-holes flag.

5 years agoAPI: Fix assignment operators (#2680)
Andres Noetzli [Mon, 5 Nov 2018 17:01:03 +0000 (09:01 -0800)]
API: Fix assignment operators (#2680)

The assignment operators of `Term`, `OpTerm`, and `Sort` currently have
an issue. The operators dereference their `shared_ptr` member and assign
the corresponding member of the other object. This is problematic
because if we have for example two `Term`s pointing to the same `Expr`,
then the assignment changes both `Term`s even though we only assign to
one, which is not what we want (see the unit test in this commit for a
concrete example of the desired behavior). To fix the issue, the
assignment operator should just copy the pointer of the other object.
This happens to be the behavior of the default assignment operator, so
this commit simply removes the overloaded assignment operators.

Testing: I did `make check` with an ASAN build and no errors other than
the one fixed in #2607 were reported.

5 years agoconfigure.sh: Fix option parsing to match --help (#2611)
Andres Noetzli [Mon, 5 Nov 2018 16:42:21 +0000 (08:42 -0800)]
configure.sh: Fix option parsing to match --help (#2611)

5 years agoAllow partial models with optimized sygus enumeration (#2682)
Andrew Reynolds [Mon, 5 Nov 2018 15:25:33 +0000 (09:25 -0600)]
Allow partial models with optimized sygus enumeration (#2682)

5 years ago Implement option to turn off symmetry breaking for basic enumerators (#2686)
Andrew Reynolds [Mon, 5 Nov 2018 00:06:29 +0000 (18:06 -0600)]
 Implement option to turn off symmetry breaking for basic enumerators (#2686)

Improves the existing implementation for sygus-active-gen=basic.

5 years agoRefactor default grammars construction (#2681)
Haniel Barbosa [Sat, 3 Nov 2018 14:48:31 +0000 (09:48 -0500)]
Refactor default grammars construction (#2681)

5 years agofixes to regression docs (#2679)
yoni206 [Fri, 2 Nov 2018 02:06:06 +0000 (19:06 -0700)]
fixes to regression docs (#2679)

5 years agoAdd optimized sygus enumeration (#2677)
Andrew Reynolds [Wed, 31 Oct 2018 21:25:37 +0000 (16:25 -0500)]
Add optimized sygus enumeration (#2677)

5 years agoRecord assumption info in AssertionPipeline (#2678)
Andres Noetzli [Wed, 31 Oct 2018 14:23:09 +0000 (07:23 -0700)]
Record assumption info in AssertionPipeline (#2678)

5 years agoMinor improvement to sygus trace (#2675)
Andrew Reynolds [Wed, 24 Oct 2018 20:20:18 +0000 (15:20 -0500)]
Minor improvement to sygus trace (#2675)

5 years agoCMake: Set RPATH on installed binary (#2671)
Andres Noetzli [Wed, 24 Oct 2018 04:43:28 +0000 (21:43 -0700)]
CMake: Set RPATH on installed binary (#2671)

Currently, when installing CVC4 with a custom installation directory on
macOS, the resulting binary cannot be executed because the linker cannot
find the required libraries (e.g. our parser). This commit changes our
build system to use the `CMAKE_INSTALL_RPATH` variable to add the
installation directory to the RPATH list in the exectuable.

5 years agoDo not use lazy trie for sygus-rr-verify (#2668)
Andrew Reynolds [Tue, 23 Oct 2018 00:26:10 +0000 (19:26 -0500)]
Do not use lazy trie for sygus-rr-verify (#2668)

5 years agoFail for SWIG 3.0.8 (#2656)
makaimann [Mon, 22 Oct 2018 23:24:05 +0000 (16:24 -0700)]
Fail for SWIG 3.0.8 (#2656)

Ran into this bug when compiling with python3 bindings: https://github.com/swig/swig/issues/588

Instantiating any object crashes python. Since swig3.0.8 is currently the apt-get install for Ubuntu 16.04, I thought it'd be good to have a check for that. If python3 is preferred and the swig version is 3.0.8, it errors out and asks users to downgrade or upgrade SWIG.

5 years agoCMake: Set PORTFOLIO_BUILD when building pcvc4 (#2666)
Andres Noetzli [Mon, 22 Oct 2018 23:07:26 +0000 (16:07 -0700)]
CMake: Set PORTFOLIO_BUILD when building pcvc4 (#2666)

Back when we used Autotools, we set the PORTFOLIO_BUILD macro when
building pcvc4. Our CMake build system is currently not doing that, so
setting thread options when running pcvc4 results in an error message
saying that "thread options cannot be used with sequential CVC4."
This commit fixes that behavior by recompiling driver_unified.cpp with
different options for the cvc4 and the pcvc4 binary.

[0] https://github.com/CVC4/CVC4/blob/7de0540252b62080ee9f98617f5718cb1ae08579/src/main/Makefile.am#L36

5 years agoOnly build CryptoMiniSat library, no binary (#2657)
Andres Noetzli [Mon, 22 Oct 2018 22:16:00 +0000 (15:16 -0700)]
Only build CryptoMiniSat library, no binary (#2657)

This commit changes the contrib/get-cryptominisat script to only build
the CryptoMiniSat library instead of both the library and the binary.
The advantage of this is that we can compile a static version of the
CryptoMiniSat library without having a static version of glibc or
libstdc++ (this is fine as long as we do a shared library build of
CVC4). This is an issue on Fedora (tested on version 25) where the
contrib/get-cryptominisat script was failing when building the
CryptoMiniSat binary due to the static version of these libraries not
being available. Since we just want to build the library, the commit
also changes the script to not install CryptoMiniSat anymore and updates
the CMake find script to accomodate the new folder structure. Side note:
the folder structure generated after this commit is a bit more uniform
with, e.g. the CaDiCaL script: The source files are directly in the
cryptominisat5 folder, not in a subfolder.

5 years agoRecover from wrong use of get-info :reason-unknown (#2667)
Andres Noetzli [Mon, 22 Oct 2018 16:12:47 +0000 (09:12 -0700)]
Recover from wrong use of get-info :reason-unknown (#2667)

Fixes #2584. Currently, we are immediately terminating CVC4 if the user
issues a `(get-info :reason-unknown)` command if it didn't succeed a
`(check-sat)` call returning `unknown`. This commit changes the behavior
to return an `(error ...)` but continue executing afterwards. It turns
the `ModalException` thrown in this case into a
`RecoverableModalException` and adds a check in
`GetInfoCommand::invoke()` to turn it into a
`CommandRecoverableFailure`, which solves the issue.

5 years agoRemove antlr_undefines.h. (#2664)
Mathias Preiner [Sat, 20 Oct 2018 21:53:19 +0000 (14:53 -0700)]
Remove antlr_undefines.h. (#2664)

Is not required anymore since we don't use autotools anymore.

5 years agoAdd substr, contains and equality rewrites (#2665)
Andres Noetzli [Sat, 20 Oct 2018 14:20:12 +0000 (07:20 -0700)]
Add substr, contains and equality rewrites (#2665)

5 years agoDisable dumping test for non-dumping builds (#2662)
Andres Noetzli [Sat, 20 Oct 2018 14:02:16 +0000 (07:02 -0700)]
Disable dumping test for non-dumping builds (#2662)

5 years agoTravis: run examples and avoid building them twice (#2663)
Andres Noetzli [Sat, 20 Oct 2018 13:47:30 +0000 (06:47 -0700)]
Travis: run examples and avoid building them twice (#2663)

`make check` builds the examples but does not run them. This commit
changes our Travis script to run the examples after building them and
removes `makeExamples()` to avoid building them twice.