private void lookForUnitRefutation(OTTERAnswerHandler ansHandler, IndexedClauses idxdClauses, Clause clause, List <Clause> sos, List <Clause> usable) { List <Clause> toCheck = new List <Clause>(); if (ansHandler.isCheckForUnitRefutation(clause)) { foreach (Clause s in sos) { if (s.isUnitClause()) { toCheck.Add(s); } } foreach (Clause u in usable) { if (u.isUnitClause()) { toCheck.Add(u); } } } if (toCheck.Count > 0) { toCheck = infer(clause, toCheck); foreach (Clause t in toCheck) { // * clause <- SIMPLIFY(clause) Clause t2 = getClauseSimplifier().simplify(t); // * discard clause if it is a tautology if (t2.isTautology()) { continue; } // * if clause has no literals then a refutation has been found // or if it just contains the answer literal. if (!ansHandler.isAnswer(t2)) { // * sos <- [clause | sos] // This check ensure duplicate clauses are not // introduced which will cause the // LightestClauseHeuristic to loop continuously // on the same pair of objects. if (!sos.Contains(t2) && !usable.Contains(t2)) { idxdClauses.addClause(t2, sos, usable); } } if (ansHandler.isComplete()) { break; } } } }
// procedure PROCESS(clauses, sos) private void process(OTTERAnswerHandler ansHandler, IndexedClauses idxdClauses, List <Clause> clauses, List <Clause> sos, List <Clause> usable) { // * for each clause in clauses do foreach (Clause clause in clauses) { // * clause <- SIMPLIFY(clause) Clause clause2 = getClauseSimplifier().simplify(clause); // * merge identical literals // Note: Not required as handled by Clause Implementation // which keeps literals within a Set, so no duplicates // will exist. // * discard clause if it is a tautology if (clause2.isTautology()) { continue; } // * if clause has no literals then a refutation has been found // or if it just contains the answer literal. if (!ansHandler.isAnswer(clause2)) { // * sos <- [clause | sos] // This check ensure duplicate clauses are not // introduced which will cause the // LightestClauseHeuristic to loop continuously // on the same pair of objects. if (!sos.Contains(clause2) && !usable.Contains(clause2)) { foreach (Clause ac in clause2.getFactors()) { if (!sos.Contains(ac) && !usable.Contains(ac)) { idxdClauses.addClause(ac, sos, usable); // * if clause has one literal then look for unit // refutation lookForUnitRefutation(ansHandler, idxdClauses, ac, sos, usable); } } } } if (ansHandler.isComplete()) { break; } } }
private void lookForUnitRefutation(OTTERAnswerHandler ansHandler, IndexedClauses idxdClauses, Clause clause, List<Clause> sos, List<Clause> usable) { List<Clause> toCheck = new List<Clause>(); if (ansHandler.isCheckForUnitRefutation(clause)) { foreach (Clause s in sos) { if (s.isUnitClause()) { toCheck.Add(s); } } foreach (Clause u in usable) { if (u.isUnitClause()) { toCheck.Add(u); } } } if (toCheck.Count > 0) { toCheck = infer(clause, toCheck); foreach (Clause t in toCheck) { // * clause <- SIMPLIFY(clause) Clause t2 = getClauseSimplifier().simplify(t); // * discard clause if it is a tautology if (t2.isTautology()) { continue; } // * if clause has no literals then a refutation has been found // or if it just contains the answer literal. if (!ansHandler.isAnswer(t2)) { // * sos <- [clause | sos] // This check ensure duplicate clauses are not // introduced which will cause the // LightestClauseHeuristic to loop continuously // on the same pair of objects. if (!sos.Contains(t2) && !usable.Contains(t2)) { idxdClauses.addClause(t2, sos, usable); } } if (ansHandler.isComplete()) { break; } } } }
// procedure PROCESS(clauses, sos) private void process(OTTERAnswerHandler ansHandler, IndexedClauses idxdClauses, List<Clause> clauses, List<Clause> sos, List<Clause> usable) { // * for each clause in clauses do foreach (Clause clause in clauses) { // * clause <- SIMPLIFY(clause) Clause clause2 = getClauseSimplifier().simplify(clause); // * merge identical literals // Note: Not required as handled by Clause Implementation // which keeps literals within a Set, so no duplicates // will exist. // * discard clause if it is a tautology if (clause2.isTautology()) { continue; } // * if clause has no literals then a refutation has been found // or if it just contains the answer literal. if (!ansHandler.isAnswer(clause2)) { // * sos <- [clause | sos] // This check ensure duplicate clauses are not // introduced which will cause the // LightestClauseHeuristic to loop continuously // on the same pair of objects. if (!sos.Contains(clause2) && !usable.Contains(clause2)) { foreach (Clause ac in clause2.getFactors()) { if (!sos.Contains(ac) && !usable.Contains(ac)) { idxdClauses.addClause(ac, sos, usable); // * if clause has one literal then look for unit // refutation lookForUnitRefutation(ansHandler, idxdClauses, ac, sos, usable); } } } } if (ansHandler.isComplete()) { break; } } }