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

Update model documentation #759

Merged
merged 5 commits into from
Jul 28, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 111 additions & 17 deletions docs/sphinx_docs/Usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,116 @@ Alt-Ergo supports file extensions:
See the [Input section] for more information about the format of the input files

### Generating models
Since 2.5.0, Alt-Ergo also generates models in the case it concludes on the satisfiability of
the formula.
There is two ways to activate model generation:

- with the `--model` option;

- `with the --interpretation=VALUE`, where VALUE can be equal to:
* "none", and alt-ergo will not generate models (by default);
* "first", and alt-ergo will output the first model it finds;
* "every", alt alt-ergo will compute a model before each decision
* "last", and alt-ergo will output the last model it computes before returning 'unknown'.
Note that this mode only works with the option `--sat-solver tableaux`.

NB: the `--model` option is equivalent to `--interpretation every --sat-solver tableaux`.

The default model format is the SMT format.
Alt-Ergo can generates best-effort models in the case it cannot conclude the unsatisfiability of
the context. The model format is a SMT-LIB compatible format, even if you use the native input language.

#### Activation

Model generation is disabled by default. There are two recommended ways to enable it:
- with the native language and the `--dump-models` option, Alt-Ergo tries to produce
a model after each `check_sat` that returns `I don't known` or
a counter-example after each `goal` it cannot prove `valid`. Note that both
`goal` and `check_sat` statements are independent in the native language.

- with the SMT-LIB language and the `--produce-models` option, Alt-Ergo tries to
produce a model after each `(check-sat)` that returns `unknown`. Models are output
on demand using the statement `(get-model)`.

Alternatively, you can enable model generation using the statement
`(set-option :produce-models true)` and the options `--sat-solver tableaux`
and `--frontend dolmen`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`(set-option :produce-models true)` and the options `--sat-solver tableaux`
and `--frontend dolmen`.
`(set-option :produce-models true)`. This currently requires using the options `--sat-solver tableaux`
and `--frontend dolmen`.


#### Examples

Using the native language in the input file `INPUT.ae`:

```
logic a, b, c : int
axiom A : a <> c

check_sat c1: a = b + c
check_sat c2: a <> b
```
and the command `alt-ergo --dump-models INPUT.ae`, Alt-Ergo produces the
output models:

```
; Model for c1
(
(define-fun a () Int 2)
(define-fun b () Int 2)
(define-fun c () Int 0)
)
I don't known

; Model for c2
(
(define-fun a () Int 2)
(define-fun b () Int 0)
(define-fun c () Int 0)
)
I don't known
```
*Note*: In this example the model for the statement `check_sat c2` is not a
model for the statement `check_sat c1` since `check_sat` are independent in
the native language. The same goes for `goals`.

Using the SMT-LIB language in the input file `INPUT.smt2`:

```
(set-logic ALL)
(declare-fun a () Int)
(declare-fun b () Int)
(declare-fun c () Int)

(assert (= a (+ b c)))
(check-sat)
(get-model)

(assert (distinct a b))
(check-sat)

```
and the command `alt-ergo --produce-models INPUT.smt2` produces the output
```
unknown
(
(define-fun a () Int 0)
(define-fun b () Int 0)
(define-fun c () Int 0)
)

unknown
```
*Note*: There is no model printed after the second `(check-sat)` since we
don't demand it with the statement `(get-model)`.

Alternatively, using the statement `(set-option :produce-models true)`
```
(set-logic ALL)
(set-option :produce-models true)
(declare-fun a () Int)
(declare-fun b () Int)
(declare-fun c () Int)

(assert (= a (+ b c)))
(check-sat)
(get-model)

```
and the command `alt-ergo --frontend model --sat-solver tableaux INPUT.smt2` produces
the output model
```
unknown
(
(define-fun a () Int 0)
(define-fun b () Int 0)
(define-fun c () Int 0)
)
```
*Note*: you need to select the SAT solver Tableaux as the model generation is not
supported yet by the other SAT solvers. The options `--dump-models` and `--produce-models`
select the right SAT solver for you.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs --frontend dolmen (which --produce-models uses, but not --dump-models).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still relevant, the text should mention --frontend dolmen.


### Output
The results of an Alt-ergo's execution have the following form :
Expand Down Expand Up @@ -138,7 +232,7 @@ The worker also take a Json file that correspond to the options to set in Alt-Er
"steps_bound": 1000 }
```

#### Outpus
#### Outputs

At the end of solving it returns a Json file corresponding to results, debug informations, etc:

Expand Down