Skip to content
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

Support for explicit sliceable assumes #1668

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rafaelsamenezes
Copy link
Contributor

Closes #1634

This adds the concept of an sliceable assumption, which differs from the common assumptions as it is an invariant instead of a precondition. This mostly affects the Interval Analysis (specially the more aggressive instrumentation modes) as adding complex invariants made the program difficult to slice. This results in the invariant assumption affecting falsification of programs, leading us to use weaker instrumentations mode (i.e., guard local).

Master - 120s, Action 797

Statistics:           9537 Files
  correct:            4259
    correct true:     2657
    correct false:    1602
  incorrect:             6
    incorrect true:      6
    incorrect false:     0
  unknown:            5272
  Score:              6724 (max: 15923)

PR - 120s, Action 809

Statistics:           9537 Files
  correct:            4288
    correct true:     2669
    correct false:    1619
  incorrect:             6
    incorrect true:      6
    incorrect false:     0
  unknown:            5243
  Score:              6765 (max: 15923)

Copy link
Contributor

@lucasccordeiro lucasccordeiro left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@fbrausse fbrausse left a comment

Choose a reason for hiding this comment

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

In general looks fine, but I have a couple of comments.

  1. I think there is a discrepancy for the defaults assigned to sliceable.

    • instructiont::clear() sets it to false, same as the constructor of that class.
    • SSA_stept constructor sets it to false as well, so that's consistent.

    But:

    • do_function_call_symbol() sets the flag to true for only certain assumptions, in particular, assertions will get sliceable == false.
    • symex_target_equationt::assertion() sets the flag to true for ASSERT SSA-steps.

    As setting this flag to true is an opt-out of the default (--slice-assumes not given on the cmdline), I believe symex_target_equationt::assertion() should not set it to true.

  2. What does sliceable == false actually mean for both, instructiont and SSA_stept? For assumptions: nothing, use the default, which is that assumptions are not sliced. For any other kind of statement it has no influence on the operation. But this is not intuitive with the default value false: The slicer does operate on these other kinds of statements, so the default should be true.

  3. Also, I feel that instructiont::make_assumption() should get this new flag as a parameter.

@@ -139,6 +139,9 @@ class goto_programt

bool inductive_assertion;

// for slicer
bool sliceable;
Copy link
Member

Choose a reason for hiding this comment

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

The comment here should state that this flag is only relevant for assumptions.

@fbrausse
Copy link
Member

PS: I might have stated points 1. and 2. clearer, as they might read contradictory. What I meant: maybe this flag should be called unsliceable (or no_slice, in analogy to the --no-slice* options) and default to true for assumptions (except the new one) and to false for all other kinds of (sliceable) statements.

@rafaelsamenezes
Copy link
Contributor Author

PS: I might have stated points 1. and 2. clearer, as they might read contradictory. What I meant: maybe this flag should be called unsliceable (or no_slice, in analogy to the --no-slice* options) and default to true for assumptions (except the new one) and to false for all other kinds of (sliceable) statements.

I see your point. I think that the confusion will happen due to the flag not having an explicit relation with assumptions. I guess we could rename it to sliceable_assumption. IMO renaming it to unsliceable will lead to the same confusion, unless we extend this concept for all instructions (with everything except assume/assert being sliceable by default).

@fbrausse
Copy link
Member

due to the flag not having an explicit relation with assumptions

Should it? We could make it more general in the future, that's why the default should match the current semantics for all instruction/SSA-step types and a comment could mention that the implementation currently just supports ASSUME.

@rafaelsamenezes
Copy link
Contributor Author

We could make it more general in the future

Then I feel like the correct approach is to keep sliceable and set it to true for every instruction except asserts/assumes and then add a check for it in every step for the slicer. The slice assumes option should then just affect the initialization of the sliceable attribute.

@fbrausse
Copy link
Member

Then I feel like the correct approach is to keep sliceable and set it to true for every instruction except asserts/assumes and then add a check for it in every step for the slicer. The slice assumes option should then just affect the initialization of the sliceable attribute.

I agree.

@rafaelsamenezes rafaelsamenezes marked this pull request as draft February 12, 2024 22:21
@rafaelsamenezes
Copy link
Contributor Author

I moved to draft while I fix the latest changes

Statistics:           9537 Files
  correct:            4259
    correct true:     2655
    correct false:    1604
  incorrect:             7
    incorrect true:      6
    incorrect false:     1
  unknown:            5271
  Score:              6706 (max: 15923)

@rafaelsamenezes
Copy link
Contributor Author

Hm apparently, the issue is that this constructor is being used and manipulated without a proper call to make_assume:

    inline instructiont()
      : location(static_cast<const locationt &>(get_nil_irep())),
        type(NO_INSTRUCTION_TYPE),
        inductive_step_instruction(false),
        inductive_assertion(false),
        location_number(0),
        loop_number(unsigned(0)),
        target_number(unsigned(-1))
    {
      guard = gen_true_expr();
    }

@rafaelsamenezes
Copy link
Contributor Author

Latest version:

Statistics:           9537 Files
  correct:            4261
    correct true:     2656
    correct false:    1605
  incorrect:             6
    incorrect true:      6
    incorrect false:     0
  unknown:            5270
  Score:              6725 (max: 15923)

@fbrausse it seems that the instruction in ESBMC are quite inconsistent. May I revert back the latest changes?

@fbrausse
Copy link
Member

Latest version:

Statistics:           9537 Files
  correct:            4261
    correct true:     2656
    correct false:    1605
  incorrect:             6
    incorrect true:      6
    incorrect false:     0
  unknown:            5270
  Score:              6725 (max: 15923)

@fbrausse it seems that the instruction in ESBMC are quite inconsistent. May I revert back the latest changes?

The score changes aren't huge. Keep in mind that the current sv-comp runs are also less stable. Having said that, I would prefer to have consistent defaults. Appearently with the current modification patterns of instructions it's hard to do, so I'm fine with going back to "the inconsistent default", though maybe it's best to take a look at the actual diff of the sv-comp results before that - just so we know we're not chasing noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for sliceable assumptions
3 participants