Beispiel #1
0
 public PField addReduc(PField base, Collection<Clause> clauses) throws ParseException {
   List<PLiteral> knownLits = base.getPLiterals();
   List<PLiteral> unknownLits = new ArrayList<PLiteral>();
   for (Clause cl : clauses) {
     for (Literal lit : IndepClause.getVocabulary(getEnv(), cl)) {
       // TODO : use contains or subsumption ? check on free literals ?
       PLiteral plit = IndepPField.toPLiteral(lit);
       if (knownLits.contains(plit) || knownLits.contains(IndepPField.negate(plit))) continue;
       else if (!unknownLits.contains(plit)) unknownLits.add(plit);
     }
   }
   PField newpf = IndepPField.copyPField(getEnv(), getOptions(), base);
   IndepPField.addPLiterals(newpf, unknownLits);
   return newpf;
 }
Beispiel #2
0
 public boolean isPossibleOutput(Clause cl) {
   boolean out = false;
   try {
     out = IndepPField.belongsTo(getEnv(), theory.getPField(), cl);
   } catch (ParseException e) {
     // Never happens
     e.printStackTrace();
   }
   return out;
 }
Beispiel #3
0
 public boolean canResolve(CanalComm target, Clause cl) {
   PField pf = inputLanguages.get(target);
   boolean out = false;
   try {
     out = IndepPField.partlyBelongsTo(getEnv(), pf, cl);
   } catch (ParseException e) {
     // Never happens
     e.printStackTrace();
   }
   return out;
 }
Beispiel #4
0
 public Collection<Clause> computeNewCons(Collection<Clause> newCl) throws ParseException {
   if (Thread.currentThread().isInterrupted()) return null;
   CNF result = new CNF();
   // prune(newCl);
   CNF axioms = new CNF(theory.getAxioms());
   if (newConsAsAxiom) axioms.addAll(listCsq);
   else axioms.addAll(receivedCl);
   CNF prunedTC = pruneWith(newCl, axioms);
   if (newConsAsAxiom) prunedTC = pruneWith(prunedTC, receivedCl);
   else prunedTC = pruneWith(prunedTC, listCsq);
   if (verbose) {
     System.out.println(this + " receives " + newCl);
     System.out.println("After pruning " + prunedTC);
     System.out.println("Input Languages : " + inputLanguages);
   }
   if (prunedTC.isEmpty()) return result;
   // determine pField as LP, Output Language and reduc(newCl, OutputL)
   PField originalPField = theory.getPField();
   PField computationPField = addReduc(outputLanguage, newCl);
   computationPField =
       IndepPField.mergeWith(
           getEnv(),
           getOptions(),
           computationPField,
           originalPField,
           IndepPField.MRG_UNION_INITFIT);
   if (Thread.currentThread().isInterrupted()) return null;
   // compute newcarc
   SolProblem pb = new SolProblem(getEnv(), getOptions(), axioms, prunedTC, computationPField);
   pb.setDepthLimit(theory.getDepthLimit());
   boolean incremental = false;
   boolean trueNC = false;
   CFSolver.solveToClause(pb, -1, stats.getSolarCtrList(), result, incremental, trueNC);
   if (Thread.currentThread().isInterrupted()) return null;
   // update receivedCl (after computation in case so that original state is used during it)
   receivedCl = pruneWith(receivedCl, prunedTC);
   receivedCl.addAll(prunedTC);
   return result;
 }