summaryrefslogtreecommitdiff
path: root/src/theory/builtin
AgeCommit message (Collapse)Author
2021-04-01Rename namespace CVC5 to cvc5. (#6258)Aina Niemetz
2021-03-31Rename namespace CVC4 to CVC5. (#6249)Aina Niemetz
2021-03-30Make SEXPR simply typed (#6160)Andrew Reynolds
Currently, SEXPR applications are given a parametric type SEXPR_TYPE applied to the types of its arguments. This means that SEXPR that are type checked consume roughly double the memory. This issue arises in practice when printing proofs in the internal calculus. There is no need to have SEXPR_TYPE as a parametric type, this PR makes SEXPR simply typed. Also moves some implementation of TypeNode methods to type_node.cpp.
2021-03-16ci: Enable checking of proofs + unsat cores. (#6088)Mathias Preiner
This commit refactors the run_regression.py script and adds options for enabling/disabling checking of proofs and unsat cores. Both options are enabled by default and disabled for each corresponding CI build.
2021-03-10(proof-new) Replace witness form by original form in the internal proof ↵Andrew Reynolds
calculus (#6051) This makes a simplification to the internal proof calculus. In particular, purification skolems are no longer are special case of witness skolems. They are now independent concepts. The concept of "witness form" is replaced in most places by "original form". This is required for fixing two issues: (1) variable shadowing issues in skolemization. (2) bookkeeping issues for bound variables introduced to construct witness terms. This made the LFSC proof conversion extremely cumbersome for e.g. string reductions. In this PR, the main changes: The internals of SkolemManager are changed to use original form vs witness form when necessary. This eliminates the need to do variable renaming in SkolemManager::skolemize. the rule WITNESS_INTRO is replaced by SKOLEM_INTRO MACRO_SR_* rules use original form Proof post processing is simplified These changes imply that ppRewrite should not return WITNESS terms. Followup PRs will modify arithmetic preprocessing so that its ppRewrite method returns skolems instead.
2021-03-09(proof-new) Minor fix and allow proof option (#6085)Andrew Reynolds
This is in preparation for enabling CI / proofs on master. This does not throw an option exception when proofs are enabled, it also makes a fix that was missing on master and needed for regressions to pass on master. This is partially taken from #5980.
2021-03-09Some more cleanup of includes (#6083)Gereon Kremer
This PR does some more cleanup of the includes.
2021-03-09Update copyright headers to 2021. (#6081)Aina Niemetz
2021-01-11Further simplifications in preparation for removing Expr layer (#5756)Andrew Reynolds
This deletes variable flags from NodeManager::mkVar and moves ExprManager sort flags to NodeManager. These flags are used for determining when a variable or sort should be printed via the old dump infrastructure. The old dump infrastructure is simplified in this PR accordingly. This PR should preserve behavior of the previous dumping with a minor exception that the internal trace "declarations" will also included symbols introduced from define-fun. This will be further refactored later. This is in preparation for removing the includes expr.h/expr_manager.h from node_manager.h.
2020-12-02Update copyright headers.Aina Niemetz
2020-12-02(proof-new) Proofs for expand definitions (#5562)Andrew Reynolds
2020-11-11Rewrite witness terms at prerewrite (#5419)Andrew Reynolds
Ensures (witness ((x Int)) (= x (+ 1 a)) is rewritten to (+ 1 a), instead of e.g. (witness ((x Int)) (= a (- x 1)). This is required for supporting purification skolems for arithmetic terms in the new proof architecture.
2020-11-10Make mkGroundTerm deterministic (#5347)Andrew Reynolds
This ensures mkGroundTerm is deterministic using attributes. This was uncovered by failures in the proof checker for datatypes.
2020-10-20(proof-new) Fixes for proofs in rewriter (#5307)Andrew Reynolds
This PR fixes proofs in the rewriter so that we use attributes for marking whether a node has been rewritten with proofs instead of consulting the provided TConvProofGenerator for hasRewriteStep. This additionally marks TRUST_REWRITE steps if a rewriter happens to be nondeterministic (e.g. quantifiers). It furthermore decouples rewriteWithProof from reconstruction for theory rewrite steps. The proof postprocessor is additionally updated so that extended equality REWRITE steps are converted to THEORY_REWRITE steps with identifier RW_REWRITE_EQ_EXT for consistency, since eliminating REWRITE should result in THEORY_REWRITE only. This required generalizing the argument to THEORY_REWRITE to be a MethodId instead of a Boolean.
2020-10-20Fix miscellaneous warnings (#5256)Andrew Reynolds
Mostly in cardinality extension, which was cleaned in the previous PR.
2020-10-18(proof-new) Implementation of trust substitution (#5276)Andrew Reynolds
Trust substitution is a data structure that is used throughout preprocessing for proofs. This adds its implementation.
2020-10-18(proof-new) More features for SMT proof post-processor (#5246)Andrew Reynolds
This updates the SMT proof postprocessor with additional stats. It also adds the feature to handle conjunctions as substitution, e.g. a child proof concluding (and (= x t) (= y s)) is interpreted as a substitution for x, y, whereas previously we insisted they must be provided separately.
2020-10-13(proof-new) Simplifications for proof rule checker interface (#5244)Andrew Reynolds
Some of the interfaces in the proof rule checker are unnecessary now and can be deleted. This also updates STRING_TRUST to have pedantic level 2.
2020-10-08(proof-new) Fixes and improvements for smt proof postprocessor (#5197)Andrew Reynolds
This includes several subtle issues encountered in the past month based on our regressions. It also improves the expansion forms of MACRO_ rules to use EQ_RESOLVE instead of a TRUE_INTRO/TRUE_ELIM scheme. This is both more compact and avoids cyclic proofs for some corner cases of proofs with Boolean constant equalites.
2020-09-22Update copyright header script to support CMake and Python files (#5067)Mathias Preiner
This PR updates the update-copyright.pl script to also update/add copyright headers to CMake specific files. It further fixes a small typo in the header.
2020-09-02(proof-new) Updates to builtin proof checker (#4962)Andrew Reynolds
This includes support for some trusted rules (whose use is to come). It also modifies THEORY_REWRITE so that it is a "trusted" rule, that is, it is not re-checked. The reason for this is that TheoryRewriter is not deterministic. An example of non-determinism in TheoryRewriter are rules that introduce bound variables (e.g. quantifiers rewriter) since these bound variables are fresh each time it is invoked. Non-deterministic theory rewriters cannot be rechecked, which was leading to failures on proof-new at proof check time. The other way to fix this would be to cache TheoryRewriter responses, but then the checker would only be verifying that the caching was being done properly. This is not worthwhile.
2020-08-18(proof-new) Theory preprocessor proof producing (#4807)Andrew Reynolds
This makes the theory preprocessor proof producing in the new infrastructure, which involves updating its interfaces to TrustNode in a few places.
2020-08-12(proof-new) Witness form proof generator (#4782)Andrew Reynolds
This class is responsible for the connection between terms and their witness form in the final proof.
2020-07-27(proof-new) Proof production for term formula removal (#4687)Andrew Reynolds
This adds proof support in the term formula removal pass. It also refactors this class heavily so that its interface is more intuitive and does not depend on AssertionPipeline.
2020-07-15Use TypeNode in UninterpretedConstant (#4748)Andres Noetzli
This commit changes UninterpretedConstant to use TypeNode instead of Type.
2020-07-14(proof-new) Skeleton proof support in the Rewriter (#4730)Andrew Reynolds
This adds support for skeleton proofs in the rewriter (REWRITE -> THEORY_REWRITE). It adds "extended equality rewrite" as a new method of the rewriter/theory rewriters. The unit test of this feature should be added on a followup PR. Co-authored-by: Andres Noetzli <andres.noetzli@gmail.com>
2020-07-13Use TypeNode/Node in ArrayStoreAll (#4728)Andres Noetzli
This commit changes ArrayStoreAll to use Node/TypeNode instead of Expr/Type.
2020-07-13 (proof-new) SMT Preprocess proof generator (#4708)Andrew Reynolds
This adds the proof generator for storing proofs of preprocessing. It stores assertions added via preprocessing passes and their rewrites. This utility will eventually live in SmtEngine. It also adds 2 new proof rules, and fixes an issue in ProofNodeUpdater.
2020-07-10(proof-new) Update Theory interface for proof-new (#4648)Andrew Reynolds
This includes 4 changes: Theory constructor takes a ProofNodeManager, Theory::explain returns a TrustNode (of kind PROP_EXP), Theory::expandDefinitions returns a TrustNode (of kind REWRITE), Theory::ppRewrite returns a TrustNode (of kind REWRITE). These are all currently planned updates to the interface of Theory. This PR also connects some of the existing proof rule checkers into the proof checker, if one is provided to the constructor. It updates TheoryEngine and other places to process TrustNode in trivial ways (converting them into Node). These calls will later be updated as needed for proof support. This PR is also contingent on the performance tests for proof-new on SMT-LIB.
2020-07-09Ensure legal elimination for witness rewrite (#4688)Andrew Reynolds
Fixes #4685. A recent commit #4661 added assertions for checking whether a witness rewrite corresponded to a legal elimination. #4685 demonstrates that these assertions can be violated and hence should be checked to ensure the rewrite is sound.
2020-07-02(proof-new) Proof rule checkers run on skolem forms (#4660)Andrew Reynolds
Previously, the proof rule checkers were run on witness form for convenience. However, it is more flexible for the sake of the internal calculus to run on Skolem forms. The main reason is that the conversion to/from witness form does not preserve terms that contain witness. Our preprocessing steps rely on using witness terms. This design change additionally simplifies a lot of the code of the builtin proof rule checker. Instead, witness forms can be queried on an as-needed basis, e.g. in MACRO_SR_PRED_TRANSFORM.
2020-06-30(proof-new) Improve rewriter for WITNESS (#4661)Andrew Reynolds
Proof checking failures revealed that we are not rewriting witness for Boolean variables (witness ((x Bool)) x) ---> true and (witness ((x Bool)) (not x)) ---> false. Also adds 2 assertions that are required for elimination (witness ((x T)) (= x t)) ---> t. These assertions should always hold due to the witness terms we construct.
2020-06-16Update copyright headers.Aina Niemetz
2020-06-15Support AND/OR definitions in lambda to array rewriting (#4615)Haniel Barbosa
This makes the conversion between lambdas and arrays, done in the theory builtin rewriter and used in higher-order model construction, robust to function definitions in terms of AND/OR. This also improves tracing and makes a few parts of the code adhere to code guidelines.
2020-06-10(proof-new) Theory proof step buffer utility (#4580)Andrew Reynolds
This is a common class for adding steps for theory-specific proof rules into a ProofStepBuffer.
2020-06-05(proof-new) Rename ProofSkolemCache to SkolemManager (#4556)Andrew Reynolds
This PR changes the design of ProofSkolemCache so that it has facilities for tracking proofs. This is required so that the term formula removal pass can be made proof-producing. This makes it so that ProofSkolemCache is renamed to SkolemManager, which lives in NodeManager. Creating (most) skolems must be accompanied by a corresponding ProofGenerator that can provide the proof for the existential corresponding to their witness form. Further updates will include refactoring the mkSkolemExists method of SkolemManager so that its contract wrt proofs is simpler. Once all calls to mkSkolem go through the standard interface, then NodeManager::mkSkolem will be moved to SkolemManager::mkSkolemInternal.
2020-06-03(proof-new) Add builtin proof checker (#4537)Andrew Reynolds
This adds the proof checker for TheoryBuiltin, which handles the core proof rules (SCOPE and ASSUME) and all proof rules corresponding to generic operations on Node objects. This includes proof rules for rewriting and substitution, which are added in this PR.
2020-05-19Do not eliminate variables that are equal to unevaluatable terms (#4267)Andrew Reynolds
When we eliminate a variable x -> v during simplification, it may be the case that v contains "unevaluated" operators like forall, choice, etc. Thus, we do not produce correct models for such inputs unless simplification is disabled. This PR ensures we only eliminate variables when v contains only evaluated operators. Additionally, the kinds registered as unevaluated were slightly modified so that when we are in a logic like QF_LIA, there are no registered unevaluated operators, hence the check above is unnecessary. This is to minimize the performance impact of this change. Fixes #4500.
2020-05-19Renamed operator CHOICE to WITNESS (#4207)mudathirmahgoub
Renamed operator CHOICE to WITNESS, and removed it from the front end
2020-04-03Update theory rewriter ownership, add stats to strings (#4202)Andres Noetzli
This commit adds statistics for string rewrites. This is work towards proof support in the string solver. At a high level, this commit adds a pointer to a `SequenceStatistics` in the rewriters and modifies `SequencesRewriter::returnRewrite()` to count the rewrites done. In practice, to make this work requires a couple of changes, some of them temporary: - We can't have a single `Rewriter` instance shared between different `SmtEngine` instances anymore. Thus the `Rewriter` is now owned by the `SmtEngine` and calling the rewriter retrieves the rewriter associated with the current `SmtEngine`. This is a temporary workaround before we get rid of singletons. - Methods in the `SequencesRewriter` and the `StringsRewriter` are made non-`static` because they need access to the statistics instance. - `StringsEntail` now has non-`static` methods because it needs a reference to the sequences rewriter that it can call. - The interaction between the `StringsRewriter` and the `SequencesRewriter` changed: the `StringsRewriter` is now a proper `TheoryRewriter` that inherits from `SequencesRewriter` and calls its `postRewrite()` before applying its own rewrites (this is essentially a reversal of roles from before: the `SequencesRewriter` used to call `static` methods in the `StringsRewriter`). - The theory rewriters are now owned by the individual theories. This design mirrors the `EqualityEngine`s owned by the individual theories.
2020-04-03Only rewrite lambdas via array representations when constant (#4203)Andrew Reynolds
Fixes #4170.
2020-04-01Initialize theory rewriters in theories (#4197)Andres Noetzli
Until now, the `Rewriter` was responsible for creating `TheoryRewriter` instances. This commit adds a method `mkTheoryRewriter()` that theories override to create an instance of their corresponding theory rewriter. The advantage is that the theories can pass additional information to their theory rewriter (e.g. a statistics object).
2020-03-30Frontend support for the choice operator (#4175)mudathirmahgoub
Added the operator choice to Smt2.g and Cvc.g. Removed the unused parameter hasBoundVars from TheoryModel::getModelValue
2020-03-03Standardize the interface for SMT engine subsolvers (#3836)Andrew Reynolds
This standardizes the interface for using SMT engines as subsolvers in various approaches. More refactoring is possible, but this is an initial cut at cleaning things up. This will make it easy to accommodate new feature request for SyGuS (timeouts for calls to verification steps). Notice this also required adding a missing function (mkGroundTerm/isWellFounded for functions) which was caught after standardizing due to an optimization (don't create SmtEngines to check satisfiability of constant Booleans).
2020-02-24Make lambda rewriter more robust (#3806)Andres Noetzli
The lambda rewriter was not robust to the case where the lambda of the array representation contained a disequality, e.g. `not(x = 1))`. It would process it as `ite(not(x = 1), true, false)` instead of `ite(x = 1, false, true)`, which meant that it wasn't able to turn it into an array representation when checking const-ness. Additionally, the rewriter had issues when the lambda was of the form `ite((= x c1), true, (= y c2))` (after turning it into an array and then into a lambda) because it is expecting the false branch of the `ite` to not contain `y` variables, making it non-constant despite the array being constant. This commit solves that issue by normalizing `ite(not(c), x, y) ---> ite(c, y, x)`.
2020-02-20Remove front-end support for Chain (#3767)Andrew Reynolds
2019-12-18Avoid calling rewriter from type checker (#3548)Andres Noetzli
Fixes #3536. The type checker for the chain operator was calling the rewriter. However, the floating-point rewriter was expecting `TheoryFp::expandDefinition()` to be applied before rewriting. If the chain operator had subterms that were supposed to be removed by `TheoryFp::expandDefinition()`, the FP rewriter was throwing an exception. This commit fixes the issue by not calling the full rewriter in the type checker but by just expanding the chain operator. This is a bit less efficient than before because the rewriter does not cache the result of expanding the chain operator anymore but assuming that there are no long chains, the performance impact should be negligible. It also seemed like a reasonable assumption that the rewriter can expect to run after `expandDefinition()` because otherwise the rewriter has to expand definitions, which may be too restrictive.
2019-12-09Make theory rewriters non-static (#3547)Andres Noetzli
This commit changes theory rewriters to be non-static. This refactoring is needed as a stepping stone to making our rewriter configurable: If we have multiple solver objects with different rewrite configurations, we cannot use `static` variables for the rewriter table in the BV rewriter for example. It is also in line with our goal of getting rid of singletons in general. Note that the `Rewriter` class is still a singleton, which will be changed in a future commit.
2019-10-30Unify CVC4_CHECK/CVC4_DCHECK/AlwaysAssert/Assert. (#3366)Mathias Preiner
2019-09-16 Fix HO model construction for functions having Boolean arguments (#3158)Andrew Reynolds
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback