-
Notifications
You must be signed in to change notification settings - Fork 139
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
Set measures generate erroneous constraints when applied to non-polymorphic datatypes #2272
Set measures generate erroneous constraints when applied to non-polymorphic datatypes #2272
Comments
hi @clayrat -- i have a new laptop and am still installing stuff, can you remind me what |
The problem is that the set elements as declared on SMT as Also, |
Not an optimization that I remember doing, but I could still be responsible :) |
It looks like this optimization was added in ucsd-progsys/liquid-fixpoint#641 |
hmm that is mysterious, we have to declare |
It is declared by fixpoint and I assume it is sent to the Z3. But, it is not printed at the .smt2 file (after the optimization). |
ah ... that's unfortunate, the .smt2 files are supposed to be "standalone"
i.e. you can just run `z3 blah.smt2` so it looks like the optimization
breaks that?
Anyways that is separate from your original point up at the top about set
elems
being declared as `int`; seems like we need multiple monomorphized
"versions"
of smt_set_* specialized to different sorts (like we do for `apply`) ?
…On Mon, Mar 4, 2024 at 6:45 AM Niki Vazou ***@***.***> wrote:
It is declared by fixpoint and I assume it is sent to the Z3. But, it is
not printed at the .smt2 file (after the optimization).
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/ucsd-progsys/liquidhaskell/issues/2272*issuecomment-1976745648__;Iw!!Mih3wA!G6QUXkb0n144Es03K71kf67Gs9vxXndI3ysyIsfpzX0tUcURaye0XpgqUOp0F1j2OoQDGaZ9EvkvH9wDwg9uiyDw$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AAMS4OABYHRP2GU4W5POUQLYWSCI3AVCNFSM6AAAAABEBVJHWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWG42DKNRUHA__;!!Mih3wA!G6QUXkb0n144Es03K71kf67Gs9vxXndI3ysyIsfpzX0tUcURaye0XpgqUOp0F1j2OoQDGaZ9EvkvH9wDwhOWb3iP$>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
- Ranjit.
|
I've created a LF PR to fix the preamble logging: ucsd-progsys/liquid-fixpoint#681 |
That is indeed a good idea! cvc5 seems to have "polymorphic" arrays that we could use to define sets.
|
Maybe we could test that the smt2 files produce no errors in CI. I don't know if there is an easy way to test if the answers provided by z3 match the answers provided by LF. |
Looks like CVC5 does have polymorphic sets out of the box though, we should definitely try it out! https://cvc5.github.io/docs/cvc5-1.0.0/theories/sets-and-relations.html#finite-sets |
@nikivazou -- I believe z3 also has polymorphic arrays? the problem if I recall correctly is that we define https://stackoverflow.com/questions/17706219/defining-a-theory-of-sets-with-z3-smt-lib2 |
Actually, it occurs to me that the "problem" with our encoding is we try to use the Z3 "function" declaration (e.g. If instead we just inlined the function definition, then we wouldn't need any sorts :-) |
Typechecking the following program:
crashes with the error:
crash: SMTLIB2 respSat = Error "line 3 column 25217: unknown constant smt_set_sng ((SngBug.Lst Int)) declared: (declare-fun smt_set_sng (Int) (Array Int Bool)) "
The error disappears if
lstHd
is declaredreflect
instead ofmeasure
. It triggers both with and without PLE.It looks like the internal
Lst l
type doesn't get converted toInt
which is what the encoding of sets asArray Int Bool
expects. We currently think there are two possible solutions for this:Int
(simpler solution, will turn a crash into a proper typechecking error)The text was updated successfully, but these errors were encountered: