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

Simple loop invariants #1022

Merged
merged 7 commits into from
Aug 29, 2022
Merged

Simple loop invariants #1022

merged 7 commits into from
Aug 29, 2022

Conversation

robdockins
Copy link
Contributor

This PR reworks the "simple loop fixpoint" feature to be based more directly on user-provided loop invariants instead.

broadly-applicable feature based directly on loop invariants.
@robdockins
Copy link
Contributor Author

This feature still needs some error checking, but I think the basics are ready for review.

In particular, we still need to check that the indicated loop is single-entry/single-exit, and we need to implement checking that the memory footprint is acceptable (i.e., reaches fixpoint).

Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

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

I feel very underqualified to review this, but I've done a quick pass and left some comments on things that stood out to me.

Comment on lines +849 to +860
Set.difference
(foldMap
(\ (MapF.Pair _ e) ->
-- filter out the special "noSatisfyingWrite" boolean constants
-- that are generated as part of the LLVM memory model
Set.filter ( \ (C.Some x) ->
not (List.isPrefixOf "cnoSatisfyingWrite"
(show $ W4.printSymExpr x))) $
Set.map (\ (C.Some x) -> C.Some (W4.varExpr sym x)) $
(W4.exprUninterpConstants sym (bodyValue e)))
(MapF.toList (varSubst normal_substitution)))
(Set.fromList (MapF.keys (varSubst normal_substitution)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good candidate for factoring out with a bit of explanation

robdockins and others added 4 commits August 23, 2022 10:15
Typos and such

Co-authored-by: Langston Barrett <[email protected]>
Co-authored-by: Ryan Scott <[email protected]>
Co-authored-by: Tristan Ravitch <[email protected]>
the loop in question.

We now check the critical properties required for the fixpoint-finding
procedure to work: the loop must be single-entry and have a single backedge.
We don't need the widening varaibles to line up, just the shapes.
@robdockins robdockins marked this pull request as ready for review August 26, 2022 22:56
@robdockins robdockins merged commit 7501d6b into master Aug 29, 2022
@robdockins robdockins deleted the rwd/simple-loop-invariant branch August 29, 2022 10:19
RyanGlScott added a commit that referenced this pull request Jun 22, 2023
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.

None yet

4 participants