示例#1
0
  /** *************************************************************** */
  public static void testParseProofStep() {

    String ps1 = "fof(c_0_5, axiom, (s__subclass(s__Artifact,s__Object)), c_0_3).";
    String ps2 =
        "fof(c_0_2, negated_conjecture,(~(?[X1]:(s__subclass(X1,s__Object)&~$answer(esk1_1(X1))))),"
            + "inference(assume_negation,[status(cth)],[inference(add_answer_literal,[status(thm)],[c_0_0, theory(answers)])])).";
    String ps3 =
        "cnf(c_0_14,negated_conjecture,($false), "
            + "inference(eval_answer_literal,[status(thm)], [inference(spm,[status(thm)],[c_0_12, c_0_13, theory(equality)]), theory(answers)]), ['proof']).";
    TPTP3ProofProcessor tpp = new TPTP3ProofProcessor();
    tpp.idTable.put("c_0_0", new Integer(0));
    tpp.idTable.put("c_0_3", new Integer(1));
    tpp.idTable.put("c_0_12", new Integer(2));
    tpp.idTable.put("c_0_13", new Integer(3));
    System.out.println(tpp.parseProofStep(ps1));
    System.out.println();
    System.out.println(tpp.parseProofStep(ps1));
    System.out.println();
    System.out.println(tpp.parseProofStep(ps3));
  }
示例#2
0
  /**
   * *************************************************************** Compute binding and proof from
   * E's response
   */
  public static TPTP3ProofProcessor parseProofOutput(ArrayList<String> lines, KB kb) {

    TPTP3ProofProcessor tpp = new TPTP3ProofProcessor();
    try {
      boolean inProof = false;
      boolean finishAnswersTuple = false;
      String line;
      Iterator<String> it = lines.iterator();
      while (it.hasNext()) {
        line = it.next();
        if (line.indexOf("SZS output start") != -1) {
          inProof = true;
          line = it.next();
        }
        if (line.indexOf("SZS status") != -1) {
          tpp.status = line.substring(15);
        }
        if (line.indexOf("SZS answers") != -1) {
          if (!finishAnswersTuple) {
            tpp.processAnswers(line.substring(20).trim());
            finishAnswersTuple = true;
          }
        }
        if (inProof) {
          if (line.indexOf("SZS output end") != -1) {
            inProof = false;
          } else {
            ProofStep ps = tpp.parseProofStep(line);
            if (ps != null) {
              tpp.proof.add(ps);
            }
          }
        }
      }
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
    }
    // remove unnecessary steps, eg: conjectures, duplicate trues
    tpp.proof = ProofStep.removeUnnecessary(tpp.proof);
    tpp.proof = ProofStep.removeDuplicates(tpp.proof);

    // find types for skolem terms
    findTypesForSkolemTerms(tpp, kb);
    return tpp;
  }