Add min heap public test case #189
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This test case first defines a min-heap spec in terms of multisets, with Size, Insert, Top, and Pop. It then defines an implementation of that spec using a binary tree data structure. Each method ensures that it matches the spec, thus making sure that the implementation is fully correct. The one missing piece of the whole thing is the Heap Invariant, which is left as an exercise in the proofs/min_heap.dfy file and shouldn't be too difficult.
Overall, while it's a lot of code, I think it's a good example of how to prove that an implementation fully satisfies a spec for a fairly basic data structure, and there's a fairly small part you actually have to fill in so it shouldn't be awful.