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

Improve documentation for WordMap #267

Open
langston-barrett opened this issue Jun 5, 2024 · 0 comments
Open

Improve documentation for WordMap #267

langston-barrett opened this issue Jun 5, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@langston-barrett
Copy link
Contributor

The constructor of WordMap has two fields, and at first glance, it's not at all clear how, together, they implement the functionality described in the Haddock:

-- | A @WordMap@ represents a finite partial map from bitvectors of width @w@
-- to elements of type @tp@.
data WordMap sym w tp =
SimpleWordMap !(SymExpr sym
(BaseArrayType (EmptyCtx ::> BaseBVType w) BaseBoolType))
!(SymExpr sym
(BaseArrayType (EmptyCtx ::> BaseBVType w) tp))

After a bit of reading, it appears that the first field consists of a map from bitvectors to predicates which indicates when a given index is defined, and the second is a mapping from bitvectors to values (which, presumably, are only "valid" when the corresponding Pred is true?). This should be described in the Haddock, along with any potential invariants (e.g., is it the case that lookupWordMap should succeed after insertWordMap? Likely, such invariants couldn't be enforced at the moment, as the constructor is exported).

@langston-barrett langston-barrett added the documentation Improvements or additions to documentation label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant