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

Loading preludes after statements that must be processed in start mode #1290

Open
Halbaroth opened this issue Feb 10, 2025 · 1 comment
Open
Assignees

Comments

@Halbaroth
Copy link
Collaborator

The preludes are loaded at the very beginning of the file. For instance, consider the file

<--- preludes here
(set-option :sat-solver tableaux)
(set-logic ALL)
(declare-const x Int)
(assert (= x 0))
(check-sat)

dune exec -- alt-ergo test.smt2 gives

(error "test.smt2:1.0:
error setting ':sat-solver', option value cannot be modified after initialization")

It makes sense because the preludes have been loaded using the default SAT solver, so we cannot switch the SAT solver after loading preludes.
There are actually three bugs:

  1. We do not change the state to assert after asserting axiom. So the following file
<-- preludes here
(set-logic ALL)
...

is accepted even if the set-logic statement must be processed in start mode.
2. We do not reload the preludes after reset.
3. We do not process start mode statements before loading the preludes.

All the bugs are triggered in #1288.

A simple solution consists in processing start mode statements first at the begin of the file and after each reset statements. For instance:

(set-option :sat-solver tableaux)
(set-logic ALL)
....
(reset)
(set-option :sat-solver cdcl)
....

must be translated into

(set-option :sat-solver tableaux)
(set-logic ALL)
<--- preludes 
...
(reset)
(set-option :sat-solver cdcl)
<-- preludes
...
@bclement-ocp
Copy link
Collaborator

Ah, that's a good point. I guess that more specifically we should process preludes immediately after the start -> assert transition — I don't remember if we have a mechanism to do things on a specific transition though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants