Gbury / dolmen

Dolmen provides a library and a binary to parse, typecheck, and evaluate languages used in automated deduction
BSD 2-Clause "Simplified" License
80 stars 17 forks source link

Handling of `set-option :global-declarations` #186

Open Stevendeo opened 1 year ago

Stevendeo commented 1 year ago

The SMT standard states (https://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf#page=56) :

Popping that assertion level removes them. As an alternative, declarations and definitions can all be made global by running the solver with the option :global-declarations set to true. When running with this option set, all declarations and definitions become permanent. That is, they survive any pop operations on the assertion stack as well as invocations of reset-assertions and can only be removed by a global reset, achieved with the reset command.

The following example fails :

(set-logic ALL)
(set-option :global-declarations)
(push 1)
(declare-const x Int)
(pop 1)
(assert (= x x))

with the error Unbound identifier x. Same goes with the following example :

(set-logic ALL)
(set-option :global-declarations)
(declare-const x Int)
(reset-assertions)
(assert (= x x))