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

smtlib parser: Unknown logic UF #19

Closed
quicquid opened this issue Feb 18, 2020 · 20 comments
Closed

smtlib parser: Unknown logic UF #19

quicquid opened this issue Feb 18, 2020 · 20 comments

Comments

@quicquid
Copy link
Contributor

Hello! Please consider the following smtlib script:

(set-logic UF)

(declare-const x Bool)

(assert (and x (not x)))
(check-sat)

Calling dolmen aua.smt2 leads to:

Error Unhandled exception: Dolmen_type.Base.Unknown_logic("UF")

I assume there are two issues here: dolmen exits due to the exception but the error message is hard to read. Also, UF is a valid smtlib logic. Using QF_UF instead works (but is only the quantifier-free fragment) and UFX gives the same exception. Could you have a look?

cheers, Martin

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

You're absolutely right: there are some smtlib logics which are missing from this list :

| "AUFLIA" -> merge [core; ints; arrays]

I wrote the list using the smtlib website as reference, mainly:

Dolmen exits because it cannot set the correct typing environment when trying to typecheck the assert, due to the logic missing from the list of known logics, but clearly the error message can and will be improved. That being said, I think this is the right behaviour (i.e. failing if the logic is not known), compared to setting no theory at all, or setting all (which is quite not possible because the three arithmetic theories are mutually exclusive).

@c-cube
Copy link
Collaborator

c-cube commented Feb 18, 2020

do you mean LIA and LRA are exclusive? or the nonlinear ones?

I think issuing a warning and defaulting to "all logics supported" would be best.

@quicquid
Copy link
Contributor Author

There's also (set-logic ALL) which selects all supported logics. Unfortunately, this depends on the solver.

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

do you mean LIA and LRA are exclusive? or the nonlinear ones?

Smtlib makes a difference between logics (e.g. UF, etc..), and theories (e.g. Arrays, Core, FixedSixeBitVectors, etc...). Basically, logics describe a set of theories (+ some extensions and restrictions).

In the case of arithmetics, there are three logics:

Unfortunately, these three logics cannot be used concurrently because they overlap and define different syntactic sugar. Which is a problem for choosing a "default" theory, :/

@c-cube
Copy link
Collaborator

c-cube commented Feb 18, 2020

Where is the sugar different between Ints and RealsInts, for example?

My intuition would be that RealsInts is the right default.

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

There's also (set-logic ALL) which selects all supported logics. Unfortunately, this depends on the solver.

Oh, I forgot that one. In that case I guess the default could be to use the RealsInts theory which is bigger than Ints or Reals.

@quicquid
Copy link
Contributor Author

Wouldn't it require something like merge [core; reals_ints; arrays; bv] (and depending on what other theories are supported)?

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

Where is the sugar different between Ints and RealsInts, for example?

Well, that's the annoying part about the spec of the SMTLIB, a lot of things are hidden in the :extensions descriptions of the logics rather than the theories, but you can for isntance look at the extension of AUFLIRA for some of the syntactic sugar of RealsInts : http://smtlib.cs.uiowa.edu/logics-all.shtml#AUFLIRA

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

Wouldn't it require something like merge [core; reals_ints; arrays; bv] (and depending on what other theories are supported)?

Yes, the default case could look like this rather than throwing an exception, though it would probably be done on the side of the caller to better emit a warning.

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

Also, does anyone have access to an exhasutive list of the smtlib logics somewhere ? that would be useful to avoid similar problems, :)

@quicquid
Copy link
Contributor Author

Unfortunately not - moreover, the logic declaration is supposed to change significantly with smtlib 3.0 (which is still a while away).

@c-cube
Copy link
Collaborator

c-cube commented Feb 18, 2020

SMTLIB 3.0 is not there yet, and dolmen is versioned anyway. A lot of smt2 files will stay there for a long time imho.

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

Well, the parser are now versioned (as soon as I merge the relevant PR), but I haven't yet versioned the typechecker theories.

@c-cube
Copy link
Collaborator

c-cube commented Feb 18, 2020

If there's still a unique typechecker that is configured depending on the input format, I imagine it'd be more about mappings from (smt2.set-logic …) and (smt3.set-logic …) to a set of theories to be merged, than actual versioning?

@Gbury
Copy link
Owner

Gbury commented Feb 18, 2020

Yes, the core of the typechecker is unlikely to change (after all, it basically type-checks first order which will not change), only the theories need to be versioned, which should be doable reasonably.

@quicquid
Copy link
Contributor Author

quicquid commented Feb 19, 2020

I ran dolmen on some of my hand-written files and saw that other logics are also missing: ALIA, UFDT, AUFDTLIA. They do not occur in Cesare's all logics lists though - I'm mostly composing features from QF_, A, UF, DT, LIA, LRA, NIA, NRA and BV where the order in the string is the order given here (I'm not sure about BV though).

@Gbury
Copy link
Owner

Gbury commented Feb 19, 2020

I'm not seing instances of the DT theory ina any logic described on the smtlib website (excluding that one, what is missing is mainly some combination I just hadn't seen on the list), is it an official theory/logic component, or just a convenient way to activate datatype reasoning (according to the standard the typechecking of datatypes seems to always be mandatory) ?

@c-cube
Copy link
Collaborator

c-cube commented Feb 19, 2020

I think the combinatorial explosion of logics has been made too clear with the addition of DT, so no one tried to name all the combinations of old logics with DT 🤷‍♂️

@Gbury
Copy link
Owner

Gbury commented Feb 19, 2020

Right... would there be a nice enough algorithm for splitting a logic into a list of theories ?

@Gbury Gbury closed this as completed in 81f6977 Feb 19, 2020
@Gbury
Copy link
Owner

Gbury commented Feb 19, 2020

The last commit should have closed this issue, ^^

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

3 participants