Module logicng

Class FormulaOnSolverFunction

  • All Implemented Interfaces:
    SolverFunction<Set<Formula>>

    public final class FormulaOnSolverFunction
    extends Object
    implements SolverFunction<Set<Formula>>
    A solver function for getting the current formula on the solver.

    Note that this formula is usually syntactically different to the formulas which were actually added to the solver, since the formulas are added as CNF and may be simplified or even removed depending on the state of the solver. Furthermore, the solver might add learnt clauses or propagate literals.

    If the formula on the solver is known to be unsatisfiable, this function will add falsum to the returned set of formulas. However, as long as SATSolver.sat() was not called on the current solver state, the absence of falsum does not imply that the formula is satisfiable.

    Also note that formulas are not added to the solver as soon as the solver is known be unsatisfiable.

    Since:
    2.0.0
    Version:
    2.0.0
    • Method Detail

      • get

        public static FormulaOnSolverFunction get()
        Returns the singleton of the function.
        Returns:
        the function instance
      • apply

        public Set<Formula> apply​(MiniSat solver,
                                  Consumer<Tristate> resultSetter)
        Description copied from interface: SolverFunction
        Applies this function to the given solver.
        Specified by:
        apply in interface SolverFunction<Set<Formula>>
        Parameters:
        solver - the solver on which the function should work on
        resultSetter - a setter for the result of the solver
        Returns:
        the result of the function application