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

Tweak the term model to avoid a panic situation #1368

Merged
merged 2 commits into from
Jul 6, 2021
Merged

Conversation

robdockins
Copy link
Contributor

This would occur when concrete nat values were round-tripped
via a bitvector type in the term model, and into a sequence
indexing primitive.

This tweak fixes a particular instance of this problem, but
highlights the fact that we need much more robust handing of the
sequencing primitives and natural numbers.

@robdockins robdockins requested a review from atomb July 2, 2021 19:43
This would occur when concrete nat values were round-tripped
via a bitvector type in the term model, and into a sequence
indexing primitive.

This tweak fixes a particular instance of this problem, but
highlights the fact that we need much more robust handing of the
sequencing primitives and natural numbers.
Also, add a switch that controls if the evalutor will be have in
a "symbolic" way.

Adding a new `PrimExcept` constructor that allows primitives to
cause fallback behavior after examining all their arguments.
As with the existing `PrimFilterFun`, this causes term reconstruction
in the term model evaluator, and raises an error in the other evaluators.
We use this new type of primitive to remove cases that would otherwise
panic.

In addition, we add a flag to the `BasePrims` record that controls
if we do symbolic muxing for sequence operations and `ite`. For the
term model, we disable this behavior and fall back earlier on term
reconstruction. This avoids constructing large mux trees in some cases.
@robdockins
Copy link
Contributor Author

The term model is now more robust against panic situations, and fixes #1367

Copy link
Contributor

@atomb atomb left a comment

Choose a reason for hiding this comment

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

This looks pretty reasonable to me. I appreciate the improvements to error handling. And I agree: I'd be entirely in favor of a thorough audit of how all of our symbolic backends handle each of the primitives. In particular, it would be nice to have open issues for any primitive that could be handled by a specific backend but currently isn't. That would take some work to identify, though.

@robdockins robdockins merged commit 988a026 into master Jul 6, 2021
@mergify mergify bot deleted the term-model-fix branch July 6, 2021 18:26
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.

2 participants