Beispiel #1
0
        public void BeginCheck(string descriptiveName, VCExpr vc, ProverInterface.ErrorHandler handler, int timeout, int rlimit, int?randomSeed)
        {
            Contract.Requires(descriptiveName != null);
            Contract.Requires(vc != null);
            Contract.Requires(handler != null);
            Contract.Requires(IsReady);

            status       = CheckerStatus.Busy;
            hasOutput    = false;
            outputExn    = null;
            this.handler = handler;

            thmProver.Reset(gen);
            if (0 < rlimit)
            {
                timeout = 0;
            }
            SetTimeout(timeout);
            SetRlimit(rlimit);
            SetRandomSeed(randomSeed);
            proverStart = DateTime.UtcNow;
            thmProver.BeginCheck(descriptiveName, vc, handler);
            //  gen.ClearSharedFormulas();    PR: don't know yet what to do with this guy

            ProverTask = Task.Factory.StartNew(() => { WaitForOutput(null); }, TaskCreationOptions.LongRunning);
        }
Beispiel #2
0
 public void Retarget(Program prog, ProverContext ctx)
 {
     lock (this)
     {
         hasOutput = default(bool);
         outcome   = default(ProverInterface.Outcome);
         outputExn = default(UnexpectedProverOutputException);
         handler   = default(ProverInterface.ErrorHandler);
         TheoremProver.FullReset(gen);
         ctx.Reset();
         Setup(prog, ctx);
     }
 }
Beispiel #3
0
        public void BeginCheck(string descriptiveName, VCExpr vc, ProverInterface.ErrorHandler handler)
        {
            Contract.Requires(descriptiveName != null);
              Contract.Requires(vc != null);
              Contract.Requires(handler != null);
              Contract.Requires(IsReady);

              status = CheckerStatus.Busy;
              hasOutput = false;
              outputExn = null;
              this.handler = handler;

              thmProver.Reset(gen);
              SetTimeout();
              proverStart = DateTime.UtcNow;
              thmProver.BeginCheck(descriptiveName, vc, handler);
              //  gen.ClearSharedFormulas();    PR: don't know yet what to do with this guy

              ProverTask = Task.Factory.StartNew(() => { WaitForOutput(null); }, TaskCreationOptions.LongRunning);
        }
Beispiel #4
0
 public void Retarget(Program prog, ProverContext ctx, int timeout = 0)
 {
     lock (this)
       {
     hasOutput = default(bool);
     outcome = default(ProverInterface.Outcome);
     outputExn = default(UnexpectedProverOutputException);
     handler = default(ProverInterface.ErrorHandler);
     TheoremProver.FullReset(gen);
     ctx.Reset();
     Setup(prog, ctx);
     this.timeout = timeout;
     SetTimeout();
       }
 }
Beispiel #5
0
        public HoudiniSession(Houdini houdini, VCGen vcgen, ProverInterface proverInterface, Program program, Implementation impl, HoudiniStatistics stats, int taskID = -1)
        {
            this.descriptiveName = impl.Name;
              this.stats = stats;
              collector = new ConditionGeneration.CounterexampleCollector();
              collector.OnProgress("HdnVCGen", 0, 0, 0.0);

              vcgen.ConvertCFG2DAG(impl, taskID: taskID);
              ModelViewInfo mvInfo;
              var gotoCmdOrigins = vcgen.PassifyImpl(impl, out mvInfo);

              ExistentialConstantCollector ecollector;
              ExistentialConstantCollector.CollectHoudiniConstants(houdini, impl, out ecollector);
              this.houdiniAssertConstants = ecollector.houdiniAssertConstants;
              this.houdiniAssumeConstants = ecollector.houdiniAssumeConstants;
              this.explainConstantsNegative = ecollector.explainNegative;
              this.explainConstantsPositive = ecollector.explainPositive;
              this.constantToControl = ecollector.constToControl;

              houdiniConstants = new HashSet<Variable>();
              houdiniConstants.UnionWith(houdiniAssertConstants);
              houdiniConstants.UnionWith(houdiniAssumeConstants);

              var exprGen = proverInterface.Context.ExprGen;
              VCExpr controlFlowVariableExpr = CommandLineOptions.Clo.UseLabels ? null : exprGen.Integer(BigNum.ZERO);

              Dictionary<int, Absy> label2absy;
              conjecture = vcgen.GenerateVC(impl, controlFlowVariableExpr, out label2absy, proverInterface.Context);
              if (!CommandLineOptions.Clo.UseLabels) {
            VCExpr controlFlowFunctionAppl = exprGen.ControlFlowFunctionApplication(exprGen.Integer(BigNum.ZERO), exprGen.Integer(BigNum.ZERO));
            VCExpr eqExpr = exprGen.Eq(controlFlowFunctionAppl, exprGen.Integer(BigNum.FromInt(impl.Blocks[0].UniqueId)));
            conjecture = exprGen.Implies(eqExpr, conjecture);
              }

              Macro macro = new Macro(Token.NoToken, descriptiveName, new List<Variable>(), new Formal(Token.NoToken, new TypedIdent(Token.NoToken, "", Type.Bool), false));
              proverInterface.DefineMacro(macro, conjecture);
              conjecture = exprGen.Function(macro);

              if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Local) {
            handler = new VCGen.ErrorReporterLocal(gotoCmdOrigins, label2absy, impl.Blocks, vcgen.incarnationOriginMap, collector, mvInfo, proverInterface.Context, program);
              }
              else {
            handler = new VCGen.ErrorReporter(gotoCmdOrigins, label2absy, impl.Blocks, vcgen.incarnationOriginMap, collector, mvInfo, proverInterface.Context, program);
              }
        }