예제 #1
0
파일: Wlp.cs 프로젝트: qunyanm/boogie
 public VCContext(Dictionary<int, Absy> label2absy, ProverContext ctxt, bool isPositiveContext = true)
 {
   Contract.Requires(ctxt != null);
   this.Label2absy = label2absy;
   this.Ctxt = ctxt;
   this.isPositiveContext = isPositiveContext;
 }
예제 #2
0
파일: Wlp.cs 프로젝트: qunyanm/boogie
 public VCContext(Dictionary<int, Absy> label2absy, ProverContext ctxt, VCExpr controlFlowVariableExpr, bool isPositiveContext = true)
 {
   Contract.Requires(ctxt != null);
   this.Label2absy = label2absy;
   this.Ctxt = ctxt;
   this.ControlFlowVariableExpr = controlFlowVariableExpr;
   this.isPositiveContext = isPositiveContext;
 }
예제 #3
0
파일: Check.cs 프로젝트: Guoanshisb/boogie
        /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Constructor.  Initialize a checker with the program and log file.
        /// Optionally, use prover context provided by parameter "ctx". 
        /// </summary>
        public Checker(VC.ConditionGeneration vcgen, Program prog, string/*?*/ logFilePath, bool appendLogFile, int timeout, ProverContext ctx = null)
        {
            Contract.Requires(vcgen != null);
              Contract.Requires(prog != null);
              this.timeout = timeout;
              this.Program = prog;

              ProverOptions options = cce.NonNull(CommandLineOptions.Clo.TheProverFactory).BlankProverOptions();

              if (logFilePath != null) {
            options.LogFilename = logFilePath;
            if (appendLogFile)
              options.AppendLogFile = appendLogFile;
              }

              if (timeout > 0) {
            options.TimeLimit = timeout * 1000;
              }

              options.Parse(CommandLineOptions.Clo.ProverOptions);

              ContextCacheKey key = new ContextCacheKey(prog);
              ProverInterface prover;

              if (vcgen.CheckerCommonState == null) {
            vcgen.CheckerCommonState = new Dictionary<ContextCacheKey, ProverContext>();
              }
              IDictionary<ContextCacheKey, ProverContext>/*!>!*/ cachedContexts = (IDictionary<ContextCacheKey, ProverContext/*!*/>)vcgen.CheckerCommonState;

              if (ctx == null && cachedContexts.TryGetValue(key, out ctx))
              {
            ctx = (ProverContext)cce.NonNull(ctx).Clone();
            prover = (ProverInterface)
              CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx);
              } else {
            if (ctx == null) ctx = (ProverContext)CommandLineOptions.Clo.TheProverFactory.NewProverContext(options);

            Setup(prog, ctx);

            // we first generate the prover and then store a clone of the
            // context in the cache, so that the prover can setup stuff in
            // the context to be cached
            prover = (ProverInterface)
              CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx);
            cachedContexts.Add(key, cce.NonNull((ProverContext)ctx.Clone()));
              }

              this.thmProver = prover;
              this.gen = prover.VCExprGen;
        }
예제 #4
0
        public static ProverInterface CreateProver(Program prog, string /*?*/ logFilePath, bool appendLogFile, int timeout, int taskID = -1)
        {
            Contract.Requires(prog != null);

            ProverOptions options = cce.NonNull(CommandLineOptions.Clo.TheProverFactory).BlankProverOptions();

            if (logFilePath != null)
            {
                options.LogFilename = logFilePath;
                if (appendLogFile)
                {
                    options.AppendLogFile = appendLogFile;
                }
            }

            if (timeout > 0)
            {
                options.TimeLimit = timeout * 1000;
            }

            if (taskID >= 0)
            {
                options.Parse(CommandLineOptions.Clo.Cho[taskID].ProverOptions);
            }
            else
            {
                options.Parse(CommandLineOptions.Clo.ProverOptions);
            }

            ProverContext ctx = (ProverContext)CommandLineOptions.Clo.TheProverFactory.NewProverContext(options);

            // set up the context
            foreach (Declaration decl in prog.TopLevelDeclarations)
            {
                Contract.Assert(decl != null);
                TypeCtorDecl t = decl as TypeCtorDecl;
                if (t != null)
                {
                    ctx.DeclareType(t, null);
                }
            }
            foreach (Declaration decl in prog.TopLevelDeclarations)
            {
                Contract.Assert(decl != null);
                Constant c = decl as Constant;
                if (c != null)
                {
                    ctx.DeclareConstant(c, c.Unique, null);
                }
                else
                {
                    Function f = decl as Function;
                    if (f != null)
                    {
                        ctx.DeclareFunction(f, null);
                    }
                }
            }
            foreach (var ax in prog.Axioms)
            {
                ctx.AddAxiom(ax, null);
            }
            foreach (Declaration decl in prog.TopLevelDeclarations)
            {
                Contract.Assert(decl != null);
                GlobalVariable v = decl as GlobalVariable;
                if (v != null)
                {
                    ctx.DeclareGlobalVariable(v, null);
                }
            }

            return((ProverInterface)CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx));
        }
예제 #5
0
 internal Counterexample(List <Block> trace, List <object> augmentedTrace, Model model, VC.ModelViewInfo mvInfo, ProverContext context)
 {
     Contract.Requires(trace != null);
     Contract.Requires(context != null);
     this.Trace   = trace;
     this.Model   = model;
     this.MvInfo  = mvInfo;
     this.Context = context;
     this.calleeCounterexamples = new Dictionary <TraceLocation, CalleeCounterexampleInfo>();
     // the call to instance method GetModelValue in the following code requires the fields Model and Context to be initialized
     this.AugmentedTrace = augmentedTrace
                           .Select(elem => elem is IdentifierExpr identifierExpr ? GetModelValue(identifierExpr.Decl) : elem).ToList();
 }
예제 #6
0
 internal Counterexample(List <Block> trace, Model model, VC.ModelViewInfo mvInfo, ProverContext context)
 {
     Contract.Requires(trace != null);
     Contract.Requires(context != null);
     this.Trace                 = trace;
     this.Model                 = model;
     this.MvInfo                = mvInfo;
     this.Context               = context;
     this.relatedInformation    = new List <string>();
     this.calleeCounterexamples = new Dictionary <TraceLocation, CalleeCounterexampleInfo>();
 }
예제 #7
0
        VCExpr LetVC(Block block,
                     Dictionary<int, Absy> label2absy,
                     Hashtable/*<Block, VCExprVar!>*/ blockVariables,
                     List<VCExprLetBinding> bindings,
                     ProverContext proverCtxt,
                     out int assertionCount)
        {
          Contract.Requires(label2absy != null);
          Contract.Requires(blockVariables != null);
          Contract.Requires(proverCtxt != null);
          Contract.Requires(cce.NonNullElements(bindings));
          Contract.Ensures(Contract.Result<VCExpr>() != null);

          assertionCount = 0;
          VCExpressionGenerator gen = proverCtxt.ExprGen;
          Contract.Assert(gen != null);
          VCExprVar v = (VCExprVar)blockVariables[block];
          if (v == null) {
            /*
             * For block A (= block), generate:
             *   LET_binding A_correct = wp(A_body, (/\ S \in Successors(A) :: S_correct))
             * with the side effect of adding the let bindings to "bindings" for any
             * successor not yet visited.
             */
            VCExpr SuccCorrect;
            GotoCmd gotocmd = block.TransferCmd as GotoCmd;
            if (gotocmd == null) {
                if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed) {
                    SuccCorrect = VCExpressionGenerator.False;
                } else {
                    SuccCorrect = VCExpressionGenerator.True;
                }
            } else {
              Contract.Assert( gotocmd.labelTargets != null);
              List<VCExpr> SuccCorrectVars = new List<VCExpr>(gotocmd.labelTargets.Count);
              foreach (Block successor in gotocmd.labelTargets) {
                Contract.Assert(successor != null);
                int ac;
                VCExpr s = LetVC(successor, label2absy, blockVariables, bindings, proverCtxt, out ac);
                assertionCount += ac;
                SuccCorrectVars.Add(s);
              }
              SuccCorrect = gen.NAry(VCExpressionGenerator.AndOp, SuccCorrectVars);
            }

            VCContext context = new VCContext(label2absy, proverCtxt);
            //        m_Context = context;

            VCExpr vc = Wlp.Block(block, SuccCorrect, context);
            assertionCount += context.AssertionCount;
            v = gen.Variable(block.Label + "_correct", Microsoft.Boogie.Type.Bool);
            
            bindings.Add(gen.LetBinding(v, vc));
            blockVariables.Add(block, v);
          }
          return v;
        }
예제 #8
0
파일: Check.cs 프로젝트: Guoanshisb/boogie
 /// <summary>
 /// Set up the context.
 /// </summary>
 private void Setup(Program prog, ProverContext ctx)
 {
     Program = prog;
       // TODO(wuestholz): Is this lock necessary?
       lock (Program.TopLevelDeclarations)
       {
     foreach (Declaration decl in Program.TopLevelDeclarations)
     {
       Contract.Assert(decl != null);
       var typeDecl = decl as TypeCtorDecl;
       var constDecl = decl as Constant;
       var funDecl = decl as Function;
       var axiomDecl = decl as Axiom;
       var glVarDecl = decl as GlobalVariable;
       if (typeDecl != null)
       {
     ctx.DeclareType(typeDecl, null);
       }
       else if (constDecl != null)
       {
     ctx.DeclareConstant(constDecl, constDecl.Unique, null);
       }
       else if (funDecl != null)
       {
     ctx.DeclareFunction(funDecl, null);
       }
       else if (axiomDecl != null)
       {
     ctx.AddAxiom(axiomDecl, null);
       }
       else if (glVarDecl != null)
       {
     ctx.DeclareGlobalVariable(glVarDecl, null);
       }
     }
       }
 }
예제 #9
0
파일: Check.cs 프로젝트: Guoanshisb/boogie
 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();
       }
 }
예제 #10
0
        private void AnnotateBlock(Implementation impl, ProverContext ctxt, Block header)
        {
            Contract.Assert(header != null);

            string name = impl.Name + "_" + header.Label + "_invar";
            if (annotationInfo.ContainsKey(name))
                return;

            // collect the variables needed in the invariant
            List<Expr> exprs = new List<Expr>();
            List<Variable> vars = new List<Variable>();
            List<string> names = new List<string>();

            if (style == AnnotationStyle.Flat)
            {
                // in flat mode, all live globals should be in live set
            #if false
                foreach (Variable v in program.GlobalVariables())
                {
                    vars.Add(v);
                    names.Add(v.ToString());
                    exprs.Add(new IdentifierExpr(Token.NoToken, v));
                }
            #endif
                foreach (Variable v in /* impl.LocVars */ header.liveVarsBefore)
                {
                    if (!(v is BoundVariable))
                    {
                        vars.Add(v);
                        names.Add(v.ToString());
                        exprs.Add(new IdentifierExpr(Token.NoToken, v));
                    }
                }
            }
            else
            {
                foreach (Variable v in program.GlobalVariables())
                {
                    vars.Add(v);
                    names.Add("@old_" + v.ToString());
                    exprs.Add(new OldExpr(Token.NoToken, new IdentifierExpr(Token.NoToken, v)));
                }
                foreach (IdentifierExpr ie in impl.Proc.Modifies)
                {
                    if (ie.Decl == null)
                        continue;
                    vars.Add(ie.Decl);
                    names.Add(ie.Decl.ToString());
                    exprs.Add(ie);
                }
                foreach (Variable v in impl.Proc.InParams)
                {
                    Contract.Assert(v != null);
                    vars.Add(v);
                    names.Add("@old_" + v.ToString());
                    exprs.Add(new OldExpr(Token.NoToken, new IdentifierExpr(Token.NoToken, v)));
                }
                foreach (Variable v in impl.LocVars)
                {
                    vars.Add(v);
                    names.Add(v.ToString());
                    exprs.Add(new IdentifierExpr(Token.NoToken, v));
                }
            }

            TypedIdent ti = new TypedIdent(Token.NoToken, "", Microsoft.Boogie.Type.Bool);
            Contract.Assert(ti != null);
            Formal returnVar = new Formal(Token.NoToken, ti, false);
            Contract.Assert(returnVar != null);
            var function = new Function(Token.NoToken, name, vars, returnVar);
            ctxt.DeclareFunction(function, "");

            Expr invarExpr = new NAryExpr(Token.NoToken, new FunctionCall(function), exprs);
            var invarAssertion = new AssertCmd(Token.NoToken, invarExpr);
            List<Cmd> newCmds = new List<Cmd>();
            newCmds.Add(invarAssertion);

            // make a record in annotationInfo;
            var info = new AnnotationInfo();
            info.filename = header.tok.filename;
            info.lineno = header.Line;
            info.argnames = names.ToArray();
            info.type = AnnotationInfo.AnnotationType.LoopInvariant;
            annotationInfo.Add(name, info);
            // get file and line info from havoc, if there is...
            if (header.Cmds.Count > 0)
            {
                PredicateCmd bif = header.Cmds[0] as PredicateCmd;
                if (bif != null)
                {
                    string foo = QKeyValue.FindStringAttribute(bif.Attributes, "sourcefile");
                    if (foo != null)
                        info.filename = foo;
                    int bar = QKeyValue.FindIntAttribute(bif.Attributes, "sourceline", -1);
                    if (bar != -1)
                        info.lineno = bar;
                }
            }
            var thing = header;
            foreach (Cmd c in header.Cmds)
            {
                newCmds.Add(c);
            }
            header.Cmds = newCmds;
        }
예제 #11
0
        public void AnnotateProcEnsures(Procedure proc, Implementation impl, ProverContext ctxt)
        {
            Contract.Requires(impl != null);

            CurrentLocalVariables = impl.LocVars;

            // collect the variables needed in the invariant
            List<Expr> exprs = new List<Expr>();
            List<Variable> vars = new List<Variable>();
            List<string> names = new List<string>();

                foreach (Variable v in program.GlobalVariables())
                {
                    vars.Add(v);
                    exprs.Add(new OldExpr(Token.NoToken,new IdentifierExpr(Token.NoToken, v)));
                    names.Add(v.Name);
                }
                foreach (IdentifierExpr ie in proc.Modifies)
                        {
                            if (ie.Decl == null)
                                continue;
                            vars.Add(ie.Decl);
                            exprs.Add(ie);
                            names.Add(ie.Decl.Name + "_out");
                        }
                foreach (Variable v in proc.InParams)
                {
                            Contract.Assert(v != null);
                            vars.Add(v);
                            exprs.Add(new OldExpr(Token.NoToken, new IdentifierExpr(Token.NoToken, v)));
                            names.Add(v.Name);
                }
                foreach (Variable v in proc.OutParams)
                {
                            Contract.Assert(v != null);
                            vars.Add(v);
                            exprs.Add(new IdentifierExpr(Token.NoToken, v));
                            names.Add(v.Name);
                }
                string name = impl.Name + "_summary";
                summaries.Add(name, true);
                TypedIdent ti = new TypedIdent(Token.NoToken, "", Microsoft.Boogie.Type.Bool);
                Contract.Assert(ti != null);
                Formal returnVar = new Formal(Token.NoToken, ti, false);
                Contract.Assert(returnVar != null);
                var function = new Function(Token.NoToken, name, vars, returnVar);
                ctxt.DeclareFunction(function, "");

                Expr invarExpr = new NAryExpr(Token.NoToken, new FunctionCall(function), exprs);

            proc.Ensures.Add(new Ensures(Token.NoToken, false, invarExpr, "", null));

            var info = new AnnotationInfo();
            info.filename = proc.tok.filename;
            info.lineno = proc.Line;
            info.argnames = names.ToArray();
            info.type = AnnotationInfo.AnnotationType.ProcedureSummary;
            annotationInfo.Add(name, info);
        }
예제 #12
0
 public StratifiedInliningInfo(Implementation _impl, Program _program, ProverContext _ctxt, int _uniqueid)
     : base(_impl,_program,_ctxt,_uniqueid,null)
 {
     Contract.Requires(_impl != null);
     Contract.Requires(_program != null);
     privateVars = new List<VCExprVar>();
     interfaceExprVars = new List<VCExprVar>();
     ctxt = _ctxt;
 }
예제 #13
0
            public LazyInliningInfo(Implementation impl, Program program, ProverContext ctxt, int uniqueId, GlobalVariable errorVariable)
            {
                Contract.Requires(impl != null);
                Contract.Requires(program != null);
                Procedure proc = cce.NonNull(impl.Proc);

                this.impl = impl;
                this.uniqueId = uniqueId;
                this.controlFlowVariable = new LocalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "cfc", Microsoft.Boogie.Type.Int));
                impl.LocVars.Add(controlFlowVariable);

                List<Variable> interfaceVars = new List<Variable>();
                Expr assertExpr = new LiteralExpr(Token.NoToken, true);
                Contract.Assert(assertExpr != null);
                foreach (Variable v in program.GlobalVariables())
                {
                    Contract.Assert(v != null);
                    interfaceVars.Add(v);
                    if (v.Name == "error")
                        inputErrorVariable = v;
                }
                // InParams must be obtained from impl and not proc
                foreach (Variable v in impl.InParams)
                {
                    Contract.Assert(v != null);
                    interfaceVars.Add(v);
                }
                // OutParams must be obtained from impl and not proc
                foreach (Variable v in impl.OutParams)
                {
                    Contract.Assert(v != null);
                    Constant c = new Constant(Token.NoToken,
                                              new TypedIdent(Token.NoToken, impl.Name + "_" + v.Name, v.TypedIdent.Type));
                    interfaceVars.Add(c);
                    Expr eqExpr = Expr.Eq(new IdentifierExpr(Token.NoToken, c), new IdentifierExpr(Token.NoToken, v));
                    assertExpr = Expr.And(assertExpr, eqExpr);
                }
                if (errorVariable != null)
                {
                    proc.Modifies.Add(new IdentifierExpr(Token.NoToken, errorVariable));
                }
                foreach (IdentifierExpr e in proc.Modifies)
                {
                    Contract.Assert(e != null);
                    if (e.Decl == null)
                        continue;
                    Variable v = e.Decl;
                    Constant c = new Constant(Token.NoToken, new TypedIdent(Token.NoToken, impl.Name + "_" + v.Name, v.TypedIdent.Type));
                    interfaceVars.Add(c);
                    if (v.Name == "error")
                    {
                        outputErrorVariable = c;
                        continue;
                    }
                    Expr eqExpr = Expr.Eq(new IdentifierExpr(Token.NoToken, c), new IdentifierExpr(Token.NoToken, v));
                    assertExpr = Expr.And(assertExpr, eqExpr);
                }

                this.interfaceVars = interfaceVars;
                this.assertExpr = Expr.Not(assertExpr);
                List<Variable> functionInterfaceVars = new List<Variable>();
                foreach (Variable v in interfaceVars)
                {
                    Contract.Assert(v != null);
                    functionInterfaceVars.Add(new Formal(Token.NoToken, new TypedIdent(Token.NoToken, v.Name, v.TypedIdent.Type), true));
                }
                TypedIdent ti = new TypedIdent(Token.NoToken, "", Microsoft.Boogie.Type.Bool);
                Contract.Assert(ti != null);
                Formal returnVar = new Formal(Token.NoToken, ti, false);
                Contract.Assert(returnVar != null);
                this.function = new Function(Token.NoToken, proc.Name, functionInterfaceVars, returnVar);
                ctxt.DeclareFunction(this.function, "");

                interfaceVarCopies = new List<List<Variable>>();
                int temp = 0;
                for (int i = 0; i < /* CommandLineOptions.Clo.ProcedureCopyBound */ 0; i++)
                {
                    interfaceVarCopies.Add(new List<Variable>());
                    foreach (Variable v in interfaceVars)
                    {
                        Constant constant = new Constant(Token.NoToken, new TypedIdent(Token.NoToken, v.Name + temp++, v.TypedIdent.Type));
                        interfaceVarCopies[i].Add(constant);
                        //program.TopLevelDeclarations.Add(constant);
                    }
                }
            }
예제 #14
0
        public void AnnotateLoops(Implementation impl, ProverContext ctxt)
        {
            Contract.Requires(impl != null);

            CurrentLocalVariables = impl.LocVars;
            variable2SequenceNumber = new Dictionary<Variable, int>();
            incarnationOriginMap = new Dictionary<Incarnation, Absy>();

            ResetPredecessors(impl.Blocks);

            #region Create the graph by adding the source node and each edge
            GraphUtil.Graph<Block> g = Program.GraphFromImpl(impl);
            #endregion

            //Graph<Block> g = program.ProcessLoops(impl);

            g.ComputeLoops(); // this is the call that does all of the processing
            if (!g.Reducible)
            {
                throw new System.Exception("Irreducible flow graphs are unsupported.");
            }

            #region add a symbolic annoation to every loop head
            foreach (Block header in cce.NonNull(g.Headers))
                AnnotateBlock(impl, ctxt, header);
            #endregion
        }
예제 #15
0
        /////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructor.  Initialize a checker with the program and log file.
        /// Optionally, use prover context provided by parameter "ctx".
        /// </summary>
        public Checker(VC.ConditionGeneration vcgen, Program prog, string /*?*/ logFilePath, bool appendLogFile, int timeout, ProverContext ctx = null)
        {
            Contract.Requires(vcgen != null);
            Contract.Requires(prog != null);
            this.timeout = timeout;
            this.Program = prog;

            ProverOptions options = cce.NonNull(CommandLineOptions.Clo.TheProverFactory).BlankProverOptions();

            if (logFilePath != null)
            {
                options.LogFilename = logFilePath;
                if (appendLogFile)
                {
                    options.AppendLogFile = appendLogFile;
                }
            }

            if (timeout > 0)
            {
                options.TimeLimit = timeout * 1000;
            }

            options.Parse(CommandLineOptions.Clo.ProverOptions);

            ContextCacheKey key = new ContextCacheKey(prog);
            ProverInterface prover;

            if (vcgen.CheckerCommonState == null)
            {
                vcgen.CheckerCommonState = new Dictionary <ContextCacheKey, ProverContext>();
            }
            IDictionary <ContextCacheKey, ProverContext> /*!>!*/ cachedContexts = (IDictionary <ContextCacheKey, ProverContext /*!*/>)vcgen.CheckerCommonState;

            if (ctx == null && cachedContexts.TryGetValue(key, out ctx))
            {
                ctx    = (ProverContext)cce.NonNull(ctx).Clone();
                prover = (ProverInterface)
                         CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx);
            }
            else
            {
                if (ctx == null)
                {
                    ctx = (ProverContext)CommandLineOptions.Clo.TheProverFactory.NewProverContext(options);
                }

                Setup(prog, ctx);

                // we first generate the prover and then store a clone of the
                // context in the cache, so that the prover can setup stuff in
                // the context to be cached
                prover = (ProverInterface)
                         CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx);
                cachedContexts.Add(key, cce.NonNull((ProverContext)ctx.Clone()));
            }

            this.thmProver = prover;
            this.gen       = prover.VCExprGen;
        }
예제 #16
0
 public void RetargetWithoutReset(Program prog, ProverContext ctx)
 {
     ctx.Clear();
     Setup(prog, ctx);
 }
예제 #17
0
 public FixedpointVC( Program _program, string/*?*/ logFilePath, bool appendLogFile, List<Checker> checkers)
     : base(_program, logFilePath, appendLogFile, checkers)
 {
     switch (CommandLineOptions.Clo.FixedPointMode)
     {
         case CommandLineOptions.FixedPointInferenceMode.Corral:
             mode = Mode.Corral;
             style = AnnotationStyle.Procedure;
             break;
         case CommandLineOptions.FixedPointInferenceMode.OldCorral:
             mode = Mode.OldCorral;
             style = AnnotationStyle.Procedure;
             break;
         case CommandLineOptions.FixedPointInferenceMode.Flat:
             mode = Mode.Boogie;
             style = AnnotationStyle.Flat;
             break;
         case CommandLineOptions.FixedPointInferenceMode.Procedure:
             mode = Mode.Boogie;
             style = AnnotationStyle.Procedure;
             break;
         case CommandLineOptions.FixedPointInferenceMode.Call:
             mode = Mode.Boogie;
             style = AnnotationStyle.Call;
             break;
     }
     ctx = new Context(); // TODO is this right?
     rpfp = new RPFP(RPFP.CreateLogicSolver(ctx));
     program = _program;
     gen = ctx;
     if(old_checker == null)
         checker = new Checker(this, program, logFilePath, appendLogFile, CommandLineOptions.Clo.ProverKillTime, null);
     else {
         checker = old_checker;
         checker.RetargetWithoutReset(program,checker.TheoremProver.Context);
     }
     old_checker = checker;
     boogieContext = checker.TheoremProver.Context;
     linOptions = null; //  new Microsoft.Boogie.Z3.Z3LineariserOptions(false, options, new List<VCExprVar>());
 }
예제 #18
0
파일: Check.cs 프로젝트: Guoanshisb/boogie
 public void RetargetWithoutReset(Program prog, ProverContext ctx)
 {
     ctx.Clear();
     Setup(prog, ctx);
 }
예제 #19
0
 private void AnnotateCallSites(Implementation impl, ProverContext ctxt, Dictionary<string, bool> impls)
 {
     foreach (var b in impl.Blocks)
     {
         foreach (var cmd in b.Cmds)
         {
             if (cmd is CallCmd)
             {
                 string name = (cmd as CallCmd).callee;
                 if(impls.ContainsKey(name))
                     goto annotate;
             }
         }
         continue;
     annotate:
         AnnotateBlock(impl, ctxt, b);
     }
 }
예제 #20
0
        public VCExpr LetVC(Block startBlock,
                            Dictionary<int, Absy> label2absy,
                            ProverContext proverCtxt,
                            out int assertionCount)
        {
          Contract.Requires(startBlock != null);
          Contract.Requires(label2absy != null);
          Contract.Requires(proverCtxt != null);
          Contract.Ensures(Contract.Result<VCExpr>() != null);

          Hashtable/*<Block, LetVariable!>*/ blockVariables = new Hashtable/*<Block, LetVariable!!>*/();
          List<VCExprLetBinding> bindings = new List<VCExprLetBinding>();
          VCExpr startCorrect = LetVC(startBlock, label2absy, blockVariables, bindings, proverCtxt, out assertionCount);
          if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed) {
            return proverCtxt.ExprGen.Let(bindings, proverCtxt.ExprGen.Not(startCorrect) );
          } else {
            return proverCtxt.ExprGen.Let(bindings, startCorrect );
          }
        }
예제 #21
0
 internal Counterexample(List <Block> trace, List <object> augmentedTrace, Model model, VC.ModelViewInfo mvInfo, ProverContext context)
 {
     Contract.Requires(trace != null);
     Contract.Requires(context != null);
     this.Trace                 = trace;
     this.AugmentedTrace        = augmentedTrace;
     this.Model                 = model;
     this.MvInfo                = mvInfo;
     this.Context               = context;
     this.calleeCounterexamples = new Dictionary <TraceLocation, CalleeCounterexampleInfo>();
 }