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

Strange "z3 exception" #1

Open
steinwaywhw opened this issue Mar 22, 2016 · 1 comment
Open

Strange "z3 exception" #1

steinwaywhw opened this issue Mar 22, 2016 · 1 comment

Comments

@steinwaywhw
Copy link
Collaborator

Suppose we have the following definitions and test files,

sortdef elt = int

stacst elt_eq: (elt, elt) -> bool 
stadef == = elt_eq 

praxi lemma_eq_elt {e:elt} (): [e == e] unit_p

datasort seq = 
| seq_empty of ()
| seq_more of (elt, seq)

stadef nil = seq_empty
stadef :: = seq_more

stacst seq_head: seq -> elt 
stacst seq_tail: seq -> seq
stacst seq_eq: (seq, seq) -> bool

stadef head = seq_head
stadef tail = seq_tail
stadef ==  = seq_eq

praxi lemma_eq_seq_id {g:seq} (): [g == g] unit_p
praxi lemma_eq_seq_sym {g1,g2:seq|g1 == g2} (): [g2 == g1] unit_p
praxi lemma_eq_seq_trans {g1,g2,g3:seq|g1 == g2 && g2 == g3} (): [g1 == g3] unit_p

praxi lemma_head {e:elt} {g:seq} (): [head(e \seq_more g) == e] unit_p
//praxi lemma_tail {e:elt} {g:seq} (): [tail(e::g) == g] unit_p

And this,

local 


val _ = $solver_assert (lemma_eq_elt)

val _ = $solver_assert (lemma_eq_seq_id)
val _ = $solver_assert (lemma_eq_seq_sym)
val _ = $solver_assert (lemma_eq_seq_trans)

val _ = $solver_assert (lemma_head)
//val _ = $solver_assert (lemma_tail)

abstype seq (seq)

extern fun test1 (): seq (1 :: 2 :: nil)
extern fun test2 (): seq (1 :: 2 :: nil)
extern fun require_eq {g1,g2:seq|head(g1) == 1} (seq g1, seq g2): void 

in 


val a = test1()
val b = test2()
val _ = require_eq (a, b)

end

It will throw z3_exception, but this is indeed very similar to ilist defined by Hongwei.

@steinwaywhw
Copy link
Collaborator Author

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

1 participant