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

Rename smt status enum #466

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
18 changes: 9 additions & 9 deletions doc/manual/manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4539,23 +4539,23 @@ \subsection*{Building a Context and Checking Satisfiability}
}

switch (yices_check_context(ctx, NULL)) {
case STATUS_SAT:
case SMT_STATUS_SAT:
printf("The formula is satisfiable\n");
...
break;

case STATUS_UNSAT:
case SMT_STATUS_UNSAT:
printf("The formula is not satisfiable\n");
break;

case STATUS_UNKNOWN:
case SMT_STATUS_UNKNOWN:
printf("The status is unknown\n");
break;

case STATUS_IDLE:
case STATUS_SEARCHING:
case STATUS_INTERRUPTED:
case STATUS_ERROR:
case SMT_STATUS_IDLE:
case SMT_STATUS_SEARCHING:
case SMT_STATUS_INTERRUPTED:
case SMT_STATUS_ERROR:
fprintf(stderr, "Error in check_context\n");
yices_print_error(stderr);
break;
Expand All @@ -4570,8 +4570,8 @@ \subsection*{Building a Context and Checking Satisfiability}

\subsection*{Building and Querying a Model}

If \texttt{yices\_check\_context} returns \texttt{STATUS\_SAT} (or
\texttt{STATUS\_UNKNOWN}), then we can construct a model of the
If \texttt{yices\_check\_context} returns \texttt{SMT\_STATUS\_SAT} (or
\texttt{SMT\_STATUS\_UNKNOWN}), then we can construct a model of the
asserted formulas as shown in Figure~\ref{model-query}. The code also
shows how to print the model and how to evaluate the value of terms in
a model.
Expand Down
14 changes: 7 additions & 7 deletions doc/sphinx/source/_static/example1.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void simple_test(void) {
}

switch (yices_check_context(ctx, NULL)) { // call check_context, NULL means 'use default heuristics'
case STATUS_SAT:
case SMT_STATUS_SAT:
printf("The formula is satisfiable\n");
model_t* model = yices_get_model(ctx, true); // get the model
if (model == NULL) {
Expand Down Expand Up @@ -117,18 +117,18 @@ static void simple_test(void) {
}
break;

case STATUS_UNSAT:
case SMT_STATUS_UNSAT:
printf("The formula is not satisfiable\n");
break;

case STATUS_UNKNOWN:
case SMT_STATUS_UNKNOWN:
printf("The status is unknown\n");
break;

case STATUS_IDLE:
case STATUS_SEARCHING:
case STATUS_INTERRUPTED:
case STATUS_ERROR:
case SMT_STATUS_IDLE:
case SMT_STATUS_SEARCHING:
case SMT_STATUS_INTERRUPTED:
case SMT_STATUS_ERROR:
fprintf(stderr, "Error in check_context\n");
yices_print_error(stderr);
break;
Expand Down
14 changes: 7 additions & 7 deletions doc/sphinx/source/_static/example1b.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void simple_test(void) {
}

switch (yices_check_context(ctx, NULL)) { // call check_context, NULL means 'use default heuristics'
case STATUS_SAT:
case SMT_STATUS_SAT:
printf("The formula is satisfiable\n");
model = yices_get_model(ctx, 1); // get the model
if (model == NULL) {
Expand Down Expand Up @@ -125,18 +125,18 @@ static void simple_test(void) {
}
break;

case STATUS_UNSAT:
case SMT_STATUS_UNSAT:
printf("The formula is not satisfiable\n");
break;

case STATUS_UNKNOWN:
case SMT_STATUS_UNKNOWN:
printf("The status is unknown\n");
break;

case STATUS_IDLE:
case STATUS_SEARCHING:
case STATUS_INTERRUPTED:
case STATUS_ERROR:
case SMT_STATUS_IDLE:
case SMT_STATUS_SEARCHING:
case SMT_STATUS_INTERRUPTED:
case SMT_STATUS_ERROR:
fprintf(stderr, "Error in check_context\n");
yices_print_error(stderr);
break;
Expand Down
36 changes: 18 additions & 18 deletions doc/sphinx/source/api-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -421,64 +421,64 @@ Contexts
Context state::

typedef enum smt_status {
STATUS_IDLE,
STATUS_SEARCHING,
STATUS_UNKNOWN,
STATUS_SAT,
STATUS_UNSAT,
STATUS_INTERRUPTED,
STATUS_ERROR
SMT_STATUS_IDLE,
SMT_STATUS_SEARCHING,
SMT_STATUS_UNKNOWN,
SMT_STATUS_SAT,
SMT_STATUS_UNSAT,
SMT_STATUS_INTERRUPTED,
SMT_STATUS_ERROR
} smt_status_t;

The type :c:type:`smt_status_t` enumerates the possible states of a
context. It is also the type returned by the function that checks
whether a context is satisfiable. The following codes are defined:

.. c:enum:: STATUS_IDLE
.. c:enum:: SMT_STATUS_IDLE

Initial context state.

In this state, it is possible to assert formulas in the context.
After assertions, the state may change to :c:enum:`STATUS_UNSAT` if
After assertions, the state may change to :c:enum:`SMT_STATUS_UNSAT` if
the assertions are trivially unsatisfiable. Otherwise, the state
remains :c:enum:`STATUS_IDLE`.
remains :c:enum:`SMT_STATUS_IDLE`.

.. c:enum:: STATUS_SEARCHING
.. c:enum:: SMT_STATUS_SEARCHING

State during search.

A context enters this state after a call function
:c:func:`yices_check_context`. It remains in this state until
either the solver completes or the search is interrupted.

.. c:enum:: STATUS_UNKNOWN
.. c:enum:: SMT_STATUS_UNKNOWN

State entered when the search terminates but is inconclusive.

This may happen if the context's solver is not complete for the specific
logic used. For example, the logic may have quantifiers.

.. c:enum:: STATUS_SAT
.. c:enum:: SMT_STATUS_SAT

State entered when the search terminates and the assertions are satisfiable.

.. c:enum:: STATUS_UNSAT
.. c:enum:: SMT_STATUS_UNSAT

State entered when the assertions are known to be unsatisfiable.

An unsatisfiability can be detected either when a formula is
asserted (if the inconsistency is detected by formula
simplification), or when the search terminates.

.. c:enum:: STATUS_INTERRUPTED
.. c:enum:: SMT_STATUS_INTERRUPTED

State entered when the search is interrupted.

When a context is in the state :c:enum:`STATUS_SEARCHING` then the search
When a context is in the state :c:enum:`SMT_STATUS_SEARCHING` then the search
can be interrupted through a call to :c:func:`yices_stop_search`. This
moves the context's state to :c:enum:`STATUS_INTERRUPTED`.
moves the context's state to :c:enum:`SMT_STATUS_INTERRUPTED`.

.. c:enum:: STATUS_ERROR
.. c:enum:: SMT_STATUS_ERROR

This is an error code. It is returned by functions that operate on a
context when the operation cannot be performed.
Expand Down
24 changes: 12 additions & 12 deletions doc/sphinx/source/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,23 @@ context, assert ``f`` in this context, then call function :c:func:`yices_check_c
}

switch (yices_check_context(ctx, NULL)) {
case STATUS_SAT:
case SMT_STATUS_SAT:
printf("The formula is satisfiable\n");
...
break;

case STATUS_UNSAT:
case SMT_STATUS_UNSAT:
printf("The formula is not satisfiable\n");
break;

case STATUS_UNKNOWN:
case SMT_STATUS_UNKNOWN:
printf("The status is unknown\n");
break;

case STATUS_IDLE:
case STATUS_SEARCHING:
case STATUS_INTERRUPTED:
case STATUS_ERROR:
case SMT_STATUS_IDLE:
case SMT_STATUS_SEARCHING:
case SMT_STATUS_INTERRUPTED:
case SMT_STATUS_ERROR:
fprintf(stderr, "Error in check_context\n");
yices_print_error(stderr);
break;
Expand All @@ -167,11 +167,11 @@ function :c:func:`yices_assert_formula` asserts a formula in the
context. Function :c:func:`yices_check_context` returns a code of type
:c:type:`smt_status_t`:

- :c:enum:`STATUS_SAT` means that the context is satisfiable.
- :c:enum:`SMT_STATUS_SAT` means that the context is satisfiable.

- :c:enum:`STATUS_UNSAT` means that the context is not satisfiable.
- :c:enum:`SMT_STATUS_UNSAT` means that the context is not satisfiable.

- :c:enum:`STATUS_UNKNOWN` means that the context's status could
- :c:enum:`SMT_STATUS_UNKNOWN` means that the context's status could
not be determined.

Other codes are error conditions.
Expand All @@ -183,8 +183,8 @@ Once the context ``ctx`` is no longer needed, we delete it using :c:func:`yices_
Building and Querying a Model
-----------------------------

If :c:func:`yices_check_context` returns :c:data:`STATUS_SAT` (or
:c:data:`STATUS_UNKNOWN`), we can construct a model of the asserted
If :c:func:`yices_check_context` returns :c:data:`SMT_STATUS_SAT` (or
:c:data:`SMT_STATUS_UNKNOWN`), we can construct a model of the asserted
formulas by calling :c:func:`yices_get_model`. We then display the
model using :c:func:`yices_pp_model`::

Expand Down
Loading