Skip to content

Quantifiers #6550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 31, 2021
Merged

Quantifiers #6550

merged 6 commits into from
Dec 31, 2021

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Dec 27, 2021

Codecov Report

Merging #6550 (e4c5999) into develop (544fdf9) will increase coverage by 0.00%.
The diff coverage is 89.88%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #6550   +/-   ##
========================================
  Coverage    75.98%   75.98%           
========================================
  Files         1578     1578           
  Lines       181044   181058   +14     
========================================
+ Hits        137563   137579   +16     
+ Misses       43481    43479    -2     
Impacted Files Coverage Δ
src/goto-programs/initialize_goto_model.cpp 83.13% <50.00%> (-0.78%) ⬇️
jbmc/src/java_bytecode/lazy_goto_model.cpp 82.17% <66.66%> (+2.75%) ⬆️
src/symtab2gb/symtab2gb_parse_options.cpp 63.38% <71.42%> (-1.84%) ⬇️
src/goto-programs/link_goto_model.cpp 85.50% <88.00%> (-1.16%) ⬇️
src/solvers/flattening/boolbv_quantifier.cpp 90.90% <97.05%> (-4.19%) ⬇️
src/goto-cc/compile.cpp 71.95% <100.00%> (-0.17%) ⬇️
src/goto-programs/read_goto_binary.cpp 54.71% <100.00%> (+7.05%) ⬆️
src/solvers/flattening/boolbv.h 62.50% <0.00%> (-12.50%) ⬇️
src/goto-programs/goto_functions.h 100.00% <0.00%> (+9.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73a1414...e4c5999. Read the comment docs.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there are multiple issues in the commit introducing support for multiple variables as detailed below.

new_variables.pop_back();
auto new_expression =
quantifier_exprt(expr.id(), expr.variables().back(), expr.where());
return eager_quantifier_instantiation(new_expression, ns);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't exist at the point of this commit (else line 142 should already say "eager_quantifier_instantiation").

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go way once rebased on #6551.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed with separate commit.

auto new_variables = expr.variables();
new_variables.pop_back();
auto new_expression =
quantifier_exprt(expr.id(), expr.variables().back(), expr.where());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what about all the other variables, don't they just get dropped? Shouldn't expr.where() be replaced by quantifier_exprt{expr.id(), new_variables, expr.where()}?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed

Comment on lines 191 to 192
else
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could reduce code churn by removing the else here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment on lines 2 to 13
;(define-fun q2 () Bool (exists ((b (_ BitVec 8))) (not (= b #x00))))

;(define-fun q3 () Bool (not (forall ((b (_ BitVec 8))) (= b #x00))))
;(define-fun q4 () Bool (not (forall ((b (_ BitVec 8))) (not (= b #x00)))))

;(define-fun q5 () Bool (exists ((a (_ BitVec 8)) (b (_ BitVec 8))) (= a b)))
;(define-fun q6 () Bool (not (forall ((a (_ BitVec 8)) (b (_ BitVec 8))) (= a b))))

;(define-fun q7 () Bool (forall ((a (_ BitVec 8))) (exists ((b (_ BitVec 8))) (= a b))))

; the above are all valid, and we assert one of them is not
;(assert (not (and q1 q2 q3 q4 q5 q6 q7)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are all of these commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now marked as a KNOWNBUG test.

This fixes a typo in the name of the directory of one of the tests.
Quantifier instantiation may happen eagerly, or incrementally, and renaming
this function clarifies that this function is doing eager instantiation.
This adds support for eager instantiation of forall or exists quantifier
expressions that have more than one symbol using the trivial rewrite.
This adds support for eager instantiation of quantifiers over booleans,
using George Boole's Proposition II.
The quantifier_exprt offers a convenient wrapper for doing the
instantiation.
The test currently fails, and will need an implementation.
Comment on lines +1 to +7
KNOWNBUG
bv-quantifier-valid.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful for either this file or the commit message to include an explanation what exactly is missing here.

@tautschnig tautschnig removed their assignment Dec 30, 2021
@kroening kroening merged commit 9b72a5c into develop Dec 31, 2021
@kroening kroening deleted the quantifiers branch December 31, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants