Interface BasicProverEnvironment<T>

    • Method Detail

      • push

        @CanIgnoreReturnValue
        default @Nullable T push​(BooleanFormula f)
                          throws InterruptedException
        Push a backtracking point and add a formula to the current stack, asserting it. The return value may be used to identify this formula later on in a query (this depends on the sub-type of the environment).
        Throws:
        InterruptedException
      • pop

        void pop()
        Remove one backtracking point/level from the current stack. This removes the latest level including all of its formulas, i.e., all formulas that were added for this backtracking point.
      • push

        void push()
           throws InterruptedException
        Create a new backtracking point, i.e., a new level on the assertion stack. Each level can hold several asserted formulas.

        If formulas are added before creating the first backtracking point, they can not be removed via a POP-operation.

        Throws:
        InterruptedException
      • size

        int size()
        Get the number of backtracking points/levels on the current stack.

        Caution: This is the number of PUSH-operations, and not necessarily equal to the number of asserted formulas. On any level there can be an arbitrary number of asserted formulas. Even with size of 0, formulas can already be asserted (at bottom level).

      • getModel

        Model getModel()
                throws SolverException
        Get a satisfying assignment. This method should be called only immediately after an isUnsat() call that returned false. The returned model is guaranteed to stay constant and valid as long as the solver context is available, even if constraints are added to, pushed or popped from the prover stack.

        A model might contain additional symbols with their evaluation, if a solver uses its own temporary symbols. There should be at least a value-assignment for each free symbol.

        Throws:
        SolverException
      • getEvaluator

        default Evaluator getEvaluator()
                                throws SolverException
        Get a temporary view on the current satisfying assignment. This should be called only immediately after an isUnsat() call that returned false. The evaluator should no longer be used as soon as any constraints are added to, pushed, or popped from the prover stack.
        Throws:
        SolverException
      • getModelAssignments

        default ImmutableList<Model.ValueAssignment> getModelAssignments()
                                                                  throws SolverException
        Get a list of satisfying assignments. This is equivalent to ImmutableList.copyOf(getModel()), but removes the need for calling Model.close().

        Note that if you need to iterate multiple times over the model it may be more efficient to use this method instead of getModel() (depending on the solver).

        Throws:
        SolverException
      • getUnsatCore

        List<BooleanFormula> getUnsatCore()
        Get an unsat core. This should be called only immediately after an isUnsat() call that returned false.
      • getStatistics

        default ImmutableMap<String,​String> getStatistics()
        Get statistics for a concrete ProverEnvironment in a solver. The returned mapping is intended to provide solver-internal statistics for only this instance. The keys can differ between individual solvers.

        Calling the statistics several times for the same ProverEnvironments returns accumulated number, i.e., we currently do not provide any possibility to reset the statistics. Calling the statistics for different ProverEnvironments returns independent statistics.

        We do not guarantee any specific key to be present, as this depends on the used solver. We might even return an empty mapping if the solver does not support calling this method or is in an invalid state.

        See Also:
        SolverContext.getStatistics()
      • close

        void close()
        Closes the prover environment. The object should be discarded, and should not be used after closing. The first call of this method will close the prover instance, further calls are ignored.
        Specified by:
        close in interface AutoCloseable
      • registerUserPropagator

        default boolean registerUserPropagator​(UserPropagator propagator)
        Registers a UserPropagator for this prover environment. Only a single user propagator can be registered at a time, and each user propagator shall only be registered once in its lifetime (see also UserPropagator.initializeWithBackend(org.sosy_lab.java_smt.api.PropagatorBackend)).
        Parameters:
        propagator - The (fresh) user propagator to register.
        Returns:
        true, if the user propagator was successfully registered. Most SMT solvers do not support user propagators and hence return false.