コード例 #1
0
ファイル: Prover.java プロジェクト: RSRGDeveloper/RESOLVE
  private VCProver setUpOldProver(VerificationCondition vc) {
    BlindIterativeRuleChooser baseChooser =
        // new BlindIterativeRuleChooser(myTyper);
        new UpfrontFitnessSortRuleChooser(myTyper, new SimpleFitnessFunction(), 0);
    baseChooser.addRules(myTheoremNames, myTheorems);
    baseChooser.lock(vc);

    vc.simplify();

    MultiStrategyProver p = new MultiStrategyProver();

    SingleStrategyProver slaveProver =
        new SingleStrategyProver(
            new LengthLimitedProvider(baseChooser, 2),
            false,
            0,
            myImplications,
            myTyper,
            myInstanceEnvironment);
    p.addStrategy(slaveProver);

    slaveProver =
        new SingleStrategyProver(
            new LengthLimitedProvider(baseChooser, 3),
            false,
            3,
            myImplications,
            myTyper,
            myInstanceEnvironment);
    p.addStrategy(slaveProver);

    return p;
  }
コード例 #2
0
ファイル: Prover.java プロジェクト: RSRGDeveloper/RESOLVE
  private VCProver setUpOldProverDebug(VerificationCondition vc) {
    vc.simplify();

    GuidedRuleChooser chooser = new GuidedRuleChooser(myTyper);
    chooser.addRules(myTheoremNames, myTheorems);
    SingleStrategyProver slaveProver =
        new SingleStrategyProver(chooser, false, 0, myImplications, myTyper, myInstanceEnvironment);

    return slaveProver;
  }
コード例 #3
0
ファイル: Prover.java プロジェクト: RSRGDeveloper/RESOLVE
  /**
   * Attempts to prove a single VC. If this method returns without throwing an exception, then the
   * VC was proved.
   *
   * @param vC The verification condition to be proved. May not be <code>null</code>.
   * @param theorems A list of theorems that may be applied as part of the proof. May not be <code>
   *     null</code>.
   * @param maxDepth The maximum number of steps the prover should attempt before giving up on a
   *     proof.
   * @param metrics A reference to the metrics the prover should keep on the proof in progress. May
   *     not be <code>null</code>.
   * @param p The prover to be used if we're using the new prover, or <code>null</code> if we're
   *     supposed to use to legacy prover.
   * @throws UnableToProveException If the VC cannot be proved in a reasonable amount of time.
   * @throws VCInconsistentException If the VC can be proved inconsistent.
   * @throws NullPointerException If <code>vC</code>, <code>theorems</code>, or <code>metrics</code>
   *     is <code>null</code>.
   */
  private void proveVC(
      final VerificationCondition vC, final Metrics metrics, FileWriter proofFile, VCProver p)
      throws VCInconsistentException {

    if (myInstanceEnvironment.flags.isFlagSet(FLAG_VERBOSE)) {
      System.out.println("\n\n############################# VC " + "#############################");

      System.out.println(vC);
    }

    long startTime = System.currentTimeMillis();
    vC.propagateExpansionsInPlace();

    ProverException exitInformation = null;

    ActionCanceller c = new ActionCanceller();

    if (!myInstanceEnvironment.flags.isFlagSet(FLAG_NOGUI)) {
      myProgressWindow.setTitle("VC " + vC.getName());
      myProgressWindow.setActionCanceller(c);
    }

    if (p == null) {
      if (myInstanceEnvironment.flags.isFlagSet(FLAG_DEBUG)) {
        p = setUpOldProverDebug(vC);
      } else {
        p = setUpOldProver(vC);
      }
    }
    if (myInstanceEnvironment.flags.isFlagSet(ResolveCompiler.FLAG_WEB)) {
      output.append("<vcProve id=\"" + vC.getName() + "\">");
    } else {
      output.append(vC.getName() + " ");
    }
    // System.out.print(vC.getName() + " ");

    try {
      p.prove(vC.copy(), myProgressWindow, c, System.currentTimeMillis() + TIMEOUT);
    } catch (UnableToProveException e) {
      exitInformation = e;
      output.append("Skipped after ");
      // System.out.print("Skipped after ");
      allProved = false;

      if (proofFile != null) {
        try {
          proofFile.append(vC.getName() + " failed.\n\n");
        } catch (IOException ex) {
        }
      }
    } catch (VCProvedException e) {
      exitInformation = e;
      output.append("Proved in ");
      // System.out.print("Proved in ");

      if (proofFile != null) {
        try {
          proofFile.append(vC.getName() + " succeeded.\n\n");
          proofFile.append(e.toString());
        } catch (IOException ex) {
        }
      }
    }

    printExitReport(startTime, exitInformation);
    if (myInstanceEnvironment.flags.isFlagSet(ResolveCompiler.FLAG_WEB)) {
      output.append("</vcProve>");
      myInstanceEnvironment.getCompileReport().setProveVCs(output.toString());
    }
  }