summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers
AgeCommit message (Collapse)Author
2020-06-19Convert more uses of strings to words (#4584)Andrew Reynolds
Towards theory of sequences. This PR also adds support for sequences in default sygus grammars. Also removes an interface for mkEmptyWord which doesn't have an equivalent for sequences.
2020-06-17Do not traverse WITNESS for partial substitutions in extended rewriter (#4630)Andrew Reynolds
Fixes #4620. The extended rewrite (and A B) ---> (and A (B * { A -> true } ) triggers an unsoundness when B contains witness terms. More generally, contextual substitution into witness terms is unsound since the skolemization of witness terms is added globally whereas the substitution corresponds to a fact that holds locally. This means that A -> true above may be added as a global constraint indirectly through witness skolemization. A general example of this unsoundness: (or (and (>= x 0) (P (witness ((z Int)) (=> (>= x 0) (= (* z z) x))))) F) rewrites to (or (and (>= x 0) (P (witness ((z Int)) (= (* z z) x)))) F) preprocesses to (and (or (and (>= x 0) (P k)) F) (= (* k k) x)) which now implies that (>= x 0) by the last conjunct, whereas this was not implied in the original formula This PR limits the kinds that can be traversed when applying substitutions in the extended rewriter, including from the rewrite above. In particular, the fix ensures that the partialSubstitute method is used in the extended rewriter when applicable, which now explicitly disallows recursion on WITNESS. Notice that this fixes contextual substitutions in the extended rewriter, but does not fix the more general issue. In particular, we still should be careful to check if contextual substitutions are applied by any other preprocessing passes.
2020-06-17Improve polynomial anyterm grammar (#3566)Haniel Barbosa
This changes the grammar construction in the case of anyterm + polynomial grammar so that the binary predicates EQUAL and LEQ are changed to unary predicates lambda x : ANYTERM. P(x, ZERO) rather than lambda xy. P(ANYTERM, ANYTERM), in which ZERO is a 0 constant of the respective type. Currently integer and bit-vectors are supported for this transformation. This avoid enumerating spurious terms and can lead to significant improvements in enumeration (although not necessarily in solving speed given the current unstable nature of ANYTERM usage).
2020-06-16Update copyright headers.Aina Niemetz
2020-06-15(proof-new) Add quantifiers proof checker (#4593)Andrew Reynolds
Adds core rules for quantifiers, some of which also will be used as a general way for introducing and skolemizing witness terms. This PR also changes the order of other rules in proof_rule.h/cpp which was in an abnormal order from previous merges.
2020-06-12Move sygus datatype utility functions to their own file (#4595)Andrew Reynolds
Separates them from the core datatype utilities. Code move only.
2020-06-04Add sygus datatype substitution utility method (#4390)Andrew Reynolds
This makes the method for substiutiton and generalization of sygus datatypes a generic utility method. It updates the abduction method to use it. Interpolation is another target user of this utility.
2020-06-04Fix abduction with datatypes (#4566)Andrew Reynolds
Previously we were treating constructor/selector/tester symbols as arguments to the abduct-to-synthesize.
2020-06-03Update CEGQI to use lemma status instead of forcing preprocess (#4551)Andrew Reynolds
This PR removes a hack in counterexample-guided quantifier instantiation. The issue is the CEGQI needs to know the form of certain lemmas, after theory preprocessing. CEGQI needs to know this since it must construct solutions (e.g. solved form of equalities) for free variables in these lemmas, which includes fresh variables in the lemma after postprocess like ITE skolems. Previously, CEGQI was hacked so that it applied the preprocessing eagerly so that it had full knowledge of the postprocessed lemma. This PR updates CEGQI so that it uses the returned LemmaStatus as the way of getting the lemma after postprocess. It also fixes the lemma status returned by TheoryEngine so that all lemmas not just the "main lemma" are returned as a conjunction. This PR is in preparation for major refactoring to theory preprocessing for the sake of proofs.
2020-06-02Use prenex normal form when using cegqi-nested-qe (#4522)Andrew Reynolds
Previously, we used a specialized variant of prenex normal form that allowed top level disjunctions. However, the method to put quantifiers into this form led to variable shadowing on some benchmarks in SMT-LIB LRA. This simplifies the code so that we use standard prenex normal form when cegqi-nested-qe is used and deletes the old variant (DISJ_NORMAL).
2020-06-02Fix scope issue with pulling ITEs in extended rewriter. (#4547)Andrew Reynolds
Fixes #4476.
2020-06-02Do not handle universal quantification on functions in model-based FMF (#4226)Andrew Reynolds
Fixes #4225, fixes CVC4/cvc4-projects#159, fixes CVC4/cvc4-projects#157, fixes #4289, fixes #4483. This makes it so that the main model-based instantiation algorithm is not applied to quantified formulas with universally quantified functions. Identation changed in a FMF function, this was refactored to conform to guidelines, and further cleaned.
2020-05-20CegqiBv: Clean up after renaming options. (#4487)Aina Niemetz
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-19Fix cached free variable identifiers in sygus term database (#4394)Andrew Reynolds
Fixes an issue with over-pruning in SyGuS where using multiple sygus types that map to the same builtin type. Our mapping sygusToBuiltin did not ensure that free variables were unique. Fixes #4383.
2020-05-19Renamed operator CHOICE to WITNESS (#4207)mudathirmahgoub
Renamed operator CHOICE to WITNESS, and removed it from the front end
2020-05-19Use fresh variables when miniscoping (#4296)Andrew Reynolds
Fixes #4288. When applying miniscoping, we previously were reusing variables across quantified formulas in the resulting conjunction. This ensures our miniscoping ensures fresh variables.
2020-04-20Make option names related to CEGQI consistent (#4316)Andrew Reynolds
This updates option names to be consistent across uses of counterexample-guided quantifier instantiation (ceqgi), which was previously called "counterexample-based quantifier instantiation" (cbqi), and sygus. Notably, the trace "cegqi-engine" is changed to "sygus-engine" by this commit. The changes were done by these commands in the given directories: src/: for f in $(find -name '.'); do sed -i 's/options::cbqi/options::cegqi/g' $f;sed -i 's/cegqi-engine/sygus-engine/g' $f; done;sed -i 's/"cbqi/"cegqi/g' $f; done test/regress/: for f in $(find -name '.'); do sed -i 's/--cbqi/--cegqi/g' $f; done src/: and test/regress/: for f in $(find -name '.'); do sed -i 's/cegqi-si/sygus-si/g' $f; done test/regress/: for f in $(find -name '.'); do sed -i 's/no-cbqi/no-cegqi/g' $f; done test/regress/: for f in $(find -name '.'); do sed -i 's/:cbqi/:cegqi/g' $f; done And a few minor fixes afterwards. This should be merged close to the time of the next stable release.
2020-04-16SyGuS instantiation quantifiers module (#3910)Mathias Preiner
2020-04-15Fix assertion in enumerative instantiation (#4313)Andrew Reynolds
Fixes regress1.
2020-04-15Convert more cases of strings to words (#4206)Andrew Reynolds
2020-04-15Abort if in conflict in enumerative instantiation (#4298)Andrew Reynolds
In very rare cases, quantifiers engine can be the first to detect a quantifier-free conflict while constructing term indices. When this occurs, instantiation modules can quit immediately. This was not happening in a case of enumerative instantiation. Fixes #4293.
2020-04-15Do not normalize to representatives for variable equalities in ↵Andrew Reynolds
conflict-based instantiation (#4280) Conflict-based instantiation would sometimes initialize a match x -> getRepresentative(t) when a quantified formula contained x = t. This leads to issues where getRepresentative(t) is an illegal term (say, in combination with CEGQI). This makes it so the representative is accessed when necessary instead of being set as part of the match. Fixes #4275.
2020-04-14Fix combinations of cegqi and non-standard triggers (#4271)Andrew Reynolds
Counterexample-guided instantiation may produce quantified formulas with INST_CONSTANT nodes, which are also used as patterns for non-standard triggers for E-matching. This fixes a few combinations that were problematic. Fixes #4250, fixes #4254, fixes #4269 and fixes #4281.
2020-04-14Fix relevant domain computation for nested quantifiers coming from CEGQI (#4235)Andrew Reynolds
Fixes #4228. That benchmark now times out.
2020-04-14Remove a few options (#4295)Andrew Reynolds
These options are not robust and are not used. Fixes #4282 and fixes #4291.
2020-04-14Remove a few spurious assertions (#4294)Andrew Reynolds
Fixes #4290 and fixes #4292.
2020-04-12Fixes for extended rewriter (#4278)Andrew Reynolds
Fixes #4273 and fixes #4274 . This also removes a spurious assertion from the Node::substitute method that the result node is not equal to the domain. This is violated for f(f(x)) { f(x) -> x }.
2020-04-10Ensure exported sygus solutions match grammar (#4270)Andrew Reynolds
Previously we were doing rewriting/expand definitions during grammar normalization, which overwrote the original sygus operators. The connection to the original grammar was maintained via the SygusPrintCallback utility, which ensured that a sygus term printed in a way that matched the grammar. We now have several use cases where solutions from SyGuS will be directly exported to the user, including the current use of get-abduct. This means that the terms must match the grammar, and we cannot simply rely on the print callback. This moves the code to normalize sygus operators to datatypes utils, where the conversion between sygus and builtin terms takes place. This allows a version of this function where isExternal = true, which constructs terms matching the original grammar. This PR enables the SyGuS API to have an accurate getSynthSolution method. It also will eliminate the need for SygusPrintCallback altogether, once the v1 parser is deleted.
2020-04-06Cleanup deprecated quantifiers attribute features (#4215)Andrew Reynolds
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-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-27Support unicode internal representation and escape sequences (#3852)Andrew Reynolds
Work towards support for the strings standard. This updates the string solver and parser such that: The internal representation of strings is vectors of code points, Generation of the previous internal representation of strings has been relegated to the type enumerator. This is the code that ensures that "A" is the first character chosen for values of strings in models, The previous ad-hoc escape sequence handling is moved from the String class to the parser. It will live there for at least one version of CVC4, until we no longer support non-smt-lib complaint escape sequences or non-printable characters in strings, Handle unicode escape sequences according to the SMT-LIB standard in String, Simplify a number of calls to String utility functions, since the conversion between the previous internal format and code points is now unnecessary, Fixed a bug in the handling of TO_CODE: it should be based on the alphabet cardinality, not the number of internal code points.
2020-03-25 Generalize more uses of string-specific functions (#4145)Andrew Reynolds
Towards theory of sequences.
2020-03-24Restrict partial triggers to standard quantified formulas (#4144)Andrew Reynolds
Fixes #4143.
2020-03-23Restrict cases of sygus grammar reduction based on argument variants (#4131)Andrew Reynolds
An assertion is triggered for some V2 versions of SyGuS V1 benchmarks during sygus grammar reduction. This PR updates this technique so that it only applies to sygus constructors whose sygus operators are lambdas of the form lambda x1 ... xn. f( x1 ... xn ). FYI @abdoo8080 .
2020-03-23Infer when sygus operators are equivalent to builtin kinds (#4140)Andrew Reynolds
The V2 parser always turns sygus operators into lambdas for consistency. This PR ensures that we nevertheless infer when a sygus operator is equivalent to a builtin operator, e.g. (lambda x y. (+ x y)) is equivalent to +. The main reason this is required is to ensure that solution reconstruction heuristics work optimally when we make the switch SyGuS V1 -> V2 (see 5 failing benchmarks due to --cegqi-si=all on #4136).
2020-03-23Simplify auxiliary variable handling in CEGQI (#4141)Andrew Reynolds
Fixes #3849 and fixes #4062. Overall, the effect of this PR is that CEGQI will generate better instantiations more frequently for quantified formulas that involve the introduction of auxiliary variables. In CEGQI, auxiliary variables introduced in CEX lemmas must be given special treatment (since the instantiations should not involve them, thus they must be solved for as well). Previously, auxiliary variables that are introduced as parts of CEX lemmas were currently assumed to be: (1) Only occurring from ITE removal, e.g. s[(ite C t1 t2]) ---> s[k] ^ ite( C, k = t1, k = t2 ) (2) Always trivially solvable by looking at which literal was asserted (k = t1 or k = t2). Both of these assumption do not hold in general (aux variables can come from other kinds of terms e.g. choice functions, and the user can force options that rewrite arithmetic equalities to inequalities). This makes auxiliary variable handling in CEGQI more robust by treating auxiliary variables as standard variables. Effectively, this means that the entire procedure for determining instantiations is run for auxiliary variables. This PR removes the specific hacks that were used previously that were based on the assumptions above. Additionally, #3849 triggered a second issue: SyGuS solution reconstruction that involves auxiliary variables that are introduced as part of instantiation lemmas should not be considered valid solutions. Previously, only a warning was given.
2020-03-23Throw exception for non-well-founded unimplemented SyGuS types. (#4125)Andrew Reynolds
Fixes #3931. Currently we print a warning for unimplemented types when constructing default SyGuS grammars. We should additionally throw an exception when the unimplemented type would lead to a non-well-founded datatype.
2020-03-20Generalize mkConcat for types (#4123)Andrew Reynolds
Towards theory of sequences. The utility function mkConcat needs a type to know what to construct in the empty string case.
2020-03-20Fix sort comparison within assertion in cegis (#4113)Andrew Reynolds
2020-03-20Split string-specific operators from TheoryStringsRewriter (#3920)Andrew Reynolds
Organization towards theory of sequences. The motivation of this PR is to ensure that string-specific operators in the rewriter are in their own file; thus the use of mkConst<String> / getConst<String> is allowable in rewriter_str.cpp.
2020-03-20Handle failures for sygus QE preprocess (#4072)Andrew Reynolds
If the user explicitly disabled the QE algorithm and asked for QE, then we should resort to normal methods. Fixes #4064 and fixes #4109.
2020-03-20Make handling of illegal internal representatives in quantifiers engine more ↵Andrew Reynolds
robust (#4034) Fixes #4002 (that benchmark is now unknown). The experimental option --cbqi-all previously had some issues when combined with finite model finding. When these two options are used simultaneously, it may be the case that certain equivalence classes are "illegal" since they contain only terms that are ineligible for instantiation. The previous code threw a warning when this occurred which in extreme cases allowed for potentially ineligible terms for instantiation. The new code is more conservative: we never choose illegal internal representatives and instead set the incomplete flag in finite model finding when this occurs. A block of code changed indentation in this PR, which was updated to the new standards.
2020-03-19Remove spurious assertion (#4117)Andrew Reynolds
Fixes #4106. The assertion was the wrong polarity (should have been Assert(options::cbqiAll()); but regardless is no longer an invariant of CEGQI).
2020-03-18Always enable cbqi literal dependency (#4116)Andrew Reynolds
Fixes #4105. It appears that the two (experimental) options in that issue were incompatible. A block of code changed indentation in this PR and was updated to guidelines.
2020-03-18Fix issue with multiple infinities in CEGQI for LIRA (#4114)Andrew Reynolds
Fixes #4086. Quantifier instantiation involves two symbolic representations of infinities for real and int and was not handled correctly previously.
2020-03-15Handle cases in --sygus-rr where evaluation is not constant (#4100)Andrew Reynolds
Throws warning instead of error if two terms with the same rewritten form evaluate differently, but the evaluation is non-constant. Fixes #4096 and fixes #4089.
2020-03-13Removing a few deprecated options (#4052)Andrew Reynolds
2020-03-13Fix case of non-constant value for sygus sampling (#4051)Andrew Reynolds
Fixes #4050.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback