Skip to content

SYNTHESIZER: Handle the case of violation in loop guards #7457

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

Conversation

qinheping
Copy link
Collaborator

In current loop-invariant synthesizer, we synthesize two kinds of clauses separately.

  1. in_clause that should hold when we enter the loop body---when the loop guard holds, that is loop_guard -> in_clause.
  2. pos_clause that should hold when we leave the loop---when the loop guard doesn't hold, that is !loop_guard -> pos_clause.

We synthesize in_clause when the violations happen in the loop body. We synthesize pos_clause when the violation happen after the loop.

This PR handles the case that the violations happen in the loop guard (loop_contracts_synthesis_06/main.c as an example). In the case, the new clause we synthesize should hold for both of the cases that loop guard holds and loop guards doesn't hold.

We introduce a new variable violation_location to indicate whether the violation happen in the loop, after the loop, or in the loop guard, and add the new synthesized clause as in_clause, pos_clause, or both, respectively.

  • 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.
  • n/a 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.

@qinheping qinheping self-assigned this Dec 24, 2022
@qinheping qinheping added aws Bugs or features of importance to AWS CBMC users aws-medium Synthesis Invariant synthesis labels Dec 24, 2022
@qinheping qinheping force-pushed the goto-synthesizer-violation-location branch from 9a392f4 to 96c5167 Compare December 24, 2022 07:51
@codecov
Copy link

codecov bot commented Dec 24, 2022

Codecov Report

Base: 78.48% // Head: 78.48% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (43f71f3) compared to base (531e768).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7457   +/-   ##
========================================
  Coverage    78.48%   78.48%           
========================================
  Files         1663     1663           
  Lines       191112   191136   +24     
========================================
+ Hits        149992   150017   +25     
+ Misses       41120    41119    -1     
Impacted Files Coverage Δ
src/goto-synthesizer/cegis_verifier.h 100.00% <ø> (ø)
src/goto-synthesizer/cegis_verifier.cpp 87.97% <100.00%> (+0.79%) ⬆️
...hesizer/enumerative_loop_contracts_synthesizer.cpp 93.75% <100.00%> (+1.31%) ⬆️
src/goto-programs/goto_inline.cpp 95.83% <0.00%> (-0.84%) ⬇️
src/goto-programs/link_to_library.cpp 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@qinheping qinheping force-pushed the goto-synthesizer-violation-location branch from 737848c to fad7616 Compare December 27, 2022 16:56
In current loop-invariant synthesizer, we synthesize two kinds of clauses separately.
1. `in_clause` that should hold when we enter the loop body---when the loop guard holds, that is ```loop_guard -> in_clause```.
2. `pos_clause` that should hold when we leave the loop---when the loop guard doesn't hold, that is ```!loop_guard -> pos_clause```.

We synthesize `in_clause` when the violations happen in the loop body. We synthesize `pos_clause` when the violation happen after the loop.

This PR handles the case that the violations happen in the loop guard. In the case, the new clause we synthesize should hold for both of the cases that loop guard holds and loop guards doesn't hold.

We introduce a new variable `violation_location` to indicate whether the violation happen in the loop, after the loop, or in the loop guard, and add the new synthesized clause as `in_clause`, `pos_clause`, or both, respectively.
@qinheping qinheping force-pushed the goto-synthesizer-violation-location branch from fad7616 to 43f71f3 Compare December 27, 2022 17:26
@qinheping qinheping merged commit 019952e into diffblue:develop Dec 27, 2022
@qinheping qinheping deleted the goto-synthesizer-violation-location branch January 18, 2023 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-medium Synthesis Invariant synthesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants