-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add arrayCopy, arraySet, and arrayRangeEqual primitives. #152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still working on understanding some of the tricker aspects of this, but I'd like to see a bit more documentation in a few places, and I wonder if there is anything preventing us from implementing ground evaluation on these new array constructs.
| Just (CopyArray w _a_repr _dest_arr dest_begin_idx src_arr src_begin_idx _len dest_end_idx _src_end_idx) <- asApp arr0 | ||
, Just (Empty :> (BVIndexLit _ lookup_idx_bv)) <- mcidx | ||
, lookup_idx_unsigned <- BV.asUnsigned lookup_idx_bv | ||
, Just dest_begin_idx_unsigned <- BV.asUnsigned <$> asBV dest_begin_idx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it is worth trying to do this, but you can sometimes get useful answers to range questions using the abstract domain computations even when the inputs you start with aren't fully concrete.
EDIT: the technique you use below where you construct, e.g., a Ule
term and test if it is concrete will do basically the same thing.
I'm now relatively convinced about the correctness of these new operations. The remaining issues I have are:
Otherwise, I feel pretty good about this. |
The implementation supports single-dimensional arrays with bitvector indices. The encoding in SMTLib uses universal quantification, with Z3 the recommended solver. The operations are undefined if any of the index ranges wraps around.