-
Notifications
You must be signed in to change notification settings - Fork 33
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
Halbaroth
merged 5 commits into
OCamlPro:next
from
Halbaroth:update-model-documentation
Jul 28, 2023
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`. | ||
|
||
#### 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also needs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still relevant, the text should mention |
||
|
||
### Output | ||
The results of an Alt-ergo's execution have the following form : | ||
|
@@ -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: | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.