Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Implement intToNat #8

Merged
merged 1 commit into from
Jul 23, 2020
Merged

Implement intToNat #8

merged 1 commit into from
Jul 23, 2020

Conversation

robdockins
Copy link
Contributor

Fixes #7

Nothing ->
let z = svInteger KUnbounded 0
i' = svIte (svLessThan i z) z i
in pure (VToNat (VInt i'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Up to now the VToNat has been used only to represent the bvToNat function, which converts a bitvector to a symbolic natural; so the argument to VToNat would always have a bitvector type. This change would apply VToNat to a VInt value, which none of the existing implementations of saw-core primitives can handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true. Unfortunately, not all of the primitives are prepared to handle bitvectors coerced in this way either.

CF https://github.com/GaloisInc/saw-core/issues/58

We could panic here on non-concrete integers, but that doesn't really seem better.

Copy link
Contributor

@brianhuffman brianhuffman left a comment

Choose a reason for hiding this comment

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

The VToNat/VInt combination introduces an issue that we'll have to deal with at some point. But that can wait for another PR.

@robdockins robdockins merged commit e0492a7 into master Jul 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

intToNat operation unimplemented
2 participants