-
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
Clean up documentation of the SAT API #1020
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 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
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
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
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
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 |
---|---|---|
|
@@ -72,58 +72,78 @@ module type S = sig | |
exception Unsat of Explanation.t | ||
exception I_dont_know | ||
|
||
(* the empty sat-solver context *) | ||
val empty : unit -> t | ||
val empty_with_inst : (Expr.t -> bool) -> t | ||
|
||
(** [push env n] add n new assertion levels. | ||
A guard g is added for every expression e assumed at the current | ||
assertion level. | ||
Ie. assuming e after the push will become g -> e, | ||
a g will be forced to be true (but not propagated at level 0) *) | ||
val empty : ?selector:(Expr.t -> bool) -> unit -> t | ||
(** [empty ~selector ()] creates an empty environment. | ||
|
||
The optional argument [selector] is used to filter ground facts | ||
discovered by the instantiation engine. *) | ||
|
||
val push : t -> int -> unit | ||
(** [push env n] adds [n] new assertion levels in [env]. | ||
|
||
Internally, for each new assertion level, a fresh guard [g] is created | ||
and all formulas [f] assumed at this assertion level is replaced by | ||
[g ==> f]. | ||
|
||
The guard [g] is forced to be [true] but not propagated at level [0]. *) | ||
|
||
(** [pop env n] remove an assertion level. | ||
Internally, the guard g introduced in the push correponsding to this pop | ||
will be propagated to false (at level 0) *) | ||
val pop : t -> int -> unit | ||
(** [pop env n] removes [n] assertion levels in [env]. | ||
|
||
Internally, the guard [g] introduced in [push] corresponding to this pop | ||
is propagated to [false] at level [0]. *) | ||
|
||
(* [assume env f] assume a new formula [f] in [env]. Raises Unsat if | ||
[f] is unsatisfiable in [env] *) | ||
val assume : t -> Expr.gformula -> Explanation.t -> unit | ||
(** [assume env f dep] assumes the ground formula [f] in [env]. | ||
The [dep] argument can be used to generate an unsat core. | ||
|
||
@raise Unsat if [f] is unsatisfiable in [env]. *) | ||
|
||
val assume_th_elt : t -> Expr.th_elt -> Explanation.t -> unit | ||
(** [assume env f exp] assumes a new formula [f] with the explanation [exp] | ||
in the theory environment of [env]. *) | ||
|
||
(* [pred_def env f] assume a new predicate definition [f] in [env]. *) | ||
val pred_def : t -> Expr.t -> string -> Explanation.t -> Loc.t -> unit | ||
(** [pred_def env f] assumes a new predicate definition [f] in [env]. *) | ||
|
||
(** [optimize env ~is_max o] registers the expression [o] | ||
as an objective function. *) | ||
val optimize : t -> is_max:bool -> Expr.t -> unit | ||
(** [optimize env ~is_max o] registers the expression [o] as an objective | ||
function. | ||
|
||
After optimization, the value of this objective is returned by | ||
[get_objectives]. *) | ||
|
||
(* [unsat env f size] checks the unsatisfiability of [f] in | ||
[env]. Raises I_dont_know when the proof tree's height reaches | ||
[size]. Raises Sat if [f] is satisfiable in [env] *) | ||
val unsat : t -> Expr.gformula -> Explanation.t | ||
(** [unsat env f size] checks the unsatisfiability of [f] in [env]. | ||
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. There is no |
||
|
||
@raise I_dont_know when the proof tree's height reaches [size]. | ||
@raise Sat if [f] is satisfiable in [env]. *) | ||
|
||
val reset_refs : unit -> unit | ||
|
||
(** [reinit_ctx ()] reinitializes the solving context. *) | ||
val reinit_ctx : unit -> unit | ||
(** [reinit_ctx ()] reinitializes the solving context. *) | ||
|
||
(** [get_model t] produces the current model. *) | ||
val get_model: t -> Models.t option | ||
(** [get_model t] produces the current first-order model. | ||
Notice that this model is a best-effort. | ||
|
||
@return [None] if the model generation is not enabled or the | ||
environment is unsatisfiable. *) | ||
|
||
(** [get_unknown_reason t] returns the reason Alt-Ergo raised | ||
[I_dont_know] if it did. If it did not, returns None. *) | ||
val get_unknown_reason : t -> unknown_reason option | ||
(** [get_unknown_reason t] returns the reason Alt-Ergo raised | ||
[I_dont_know] if it did. If it did not, returns [None]. *) | ||
|
||
val get_value : t -> Expr.t -> Expr.t option | ||
(** [get_value t e] returns the value of [e] as a constant expression | ||
in the current model generated. Returns [None] if can't decide. *) | ||
val get_value : t -> Expr.t -> Expr.t option | ||
|
||
(** [get_objectives t] produces the current objectives. *) | ||
val get_objectives : t -> Objective.Model.t option | ||
(** [get_objectives t] returns the current objective values. | ||
|
||
@return [None] if there is no objective or the environment is | ||
unsatisfiable. *) | ||
end | ||
|
||
|
||
|
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
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
Oops, something went wrong.
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.
Should briefly mention the meaning of
is_max
(maximize vs minimize).