Class Solver

  • Direct Known Subclasses:
    UnitResolutionSolver

    public abstract class Solver
    extends java.lang.Object
    This solver tries to solver PL1 formulas in CNF where all variables are existentially quantified
    • Constructor Detail

      • Solver

        public Solver()
    • Method Detail

      • getFormulas

        public java.util.Set<CNFFormula> getFormulas()
      • getInternalRepresentationOfFormulas

        public java.util.Map<CNFFormula,​CNFFormula> getInternalRepresentationOfFormulas()
      • addFormula

        public void addFormula​(CNFFormula formula)
      • removeFormula

        public void removeFormula​(CNFFormula formula)
      • isSatisfiable

        public boolean isSatisfiable​(CNFFormula formula)
                              throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • isSatisfiable

        public boolean isSatisfiable​(CNFFormula formula,
                                     CNFFormula formulaToChooseAtLeastOneLiteralFrom)
                              throws java.lang.InterruptedException
        is f & g satisfiable if resolution must take in each step at least one clause from g (and resolvents produced)?
        Parameters:
        formula -
        formulaToChooseAtLeastOneLiteralFrom -
        Returns:
        Throws:
        java.lang.InterruptedException
      • isSatisfiable

        public boolean isSatisfiable()
                              throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • performResolutionUntilEmptyClauseIsFound

        protected CNFFormula performResolutionUntilEmptyClauseIsFound​(CNFFormula formula,
                                                                      CNFFormula formulaToChooseAtLeastOneLiteralFrom)
                                                               throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • getPossibleResolutionPairs

        protected java.util.List<ResolutionPair> getPossibleResolutionPairs​(CNFFormula formula)
      • getClausesWithSamePredicates

        protected java.util.Set<Clause> getClausesWithSamePredicates​(CNFFormula formula,
                                                                     Clause c2)
      • isClauseAlreadyContainedInFormula

        protected boolean isClauseAlreadyContainedInFormula​(CNFFormula formula,
                                                            Clause c)
                                                     throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • getPossibleResolutionsPairsOfClauses

        protected java.util.List<ResolutionPair> getPossibleResolutionsPairsOfClauses​(Clause c1,
                                                                                      Clause c2)
        Parameters:
        c1 - Note that c1 MUST be the smaller clause by convention
        c2 -
        Returns:
      • getUnificatorForLiterals

        protected java.util.Map<VariableParam,​LiteralParam> getUnificatorForLiterals​(Literal l1,
                                                                                           Literal l2)
        Performs Robinsons's unification
        Parameters:
        l1 -
        l2 -
        Returns: