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

SMT assertion fails when given function output for tuple comparison #77

Open
alberdingk-thijm opened this issue Jan 5, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@alberdingk-thijm
Copy link
Collaborator

alberdingk-thijm commented Jan 5, 2022

Here's an odd bug that seems to occur when flattening and then encoding certain examples.
The below code leads to an assertion failure during execution of SmtUnboxed.encode_exp_z3_single:

type attribute = bool

symbolic failed : option[(int,int)]

let edge_to_int_pair e = match e with
  | 0~1 -> (0, 1)
  | 1~0 -> (1, 0)

let nodes = 2
let edges = {0=1;}

let init n = n = 0n

let trans e x = !(Some (edge_to_int_pair e) = failed) && x

let merge n x y = x || y

let sol = solution { init = init; trans = trans; merge = merge; }

assert foldNodes (fun u v acc -> acc && v) sol true

The source of the error seems to be that encode_exp_z3_single is given an expression ! ((true,0u32,1u32) = (symbolic-failed-proj-0~76,symbolic-failed-proj-1~77,symbolic-failed-proj-2~78)) && x~68, which it can't handle. Note that the tuple comparison in this expression should have been flattened into component comparisons, but for whatever reason, that has not happened here.

The error does not occur when the trans function is written out as:

let trans e x =
  let pair = edge_to_int_pair e in
  !(Some pair = failed) && x
@alberdingk-thijm alberdingk-thijm added bug Something isn't working help wanted Extra attention is needed labels Jan 5, 2022
alberdingk-thijm added a commit that referenced this issue Jan 5, 2022
Sidesteps #77 to get ft_trans to work correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant