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

SBV error: Prelude.foldr1: empty list #563

Closed
msaaltink opened this issue Jan 18, 2019 · 1 comment
Closed

SBV error: Prelude.foldr1: empty list #563

msaaltink opened this issue Jan 18, 2019 · 1 comment

Comments

@msaaltink
Copy link
Contributor

With these definitions:

choose: {n} (fin n) =>  [n] -> Maybe Integer
choose s = if s == zero then nothing else just 0

type Maybe a = (Bool, a)

nothing: {a} (Zero a) => Maybe a
nothing = (False, zero)

just: {a} a -> Maybe a
just x = (True, x)

member: {n, ix} (fin ix, fin n) => [ix] -> [n] -> Bit
member e s = (wide_s @ e) where
  wide_s = s # (zero:[2^^ix]) // so that too-large indexes are not in the set

property choose_just_member i s = (choose`{4} s == just i) ==>
     member (fromInteger`{[0]} i) s

the :prove command fails with

SBV error:
Prelude.foldr1: empty list

This seems to be related to the 0-bit integer value.

@brianhuffman
Copy link
Contributor

Here's a minimized example:

property foo i (s : [1]) = s @ (fromInteger i : [0])

The fromInteger is essential to trigger the bug. This could probably be fixed either within SBV or on the Cryptol side. I think we just need to ensure that fromInteger at type [0] always returns a concrete (rather than symbolic) value.

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

No branches or pull requests

2 participants