コード例 #1
0
ファイル: Checker.cs プロジェクト: shaobo-he/boogie
        public ProverInterface.Outcome Verify(ProverInterface proverInterface, Dictionary <Variable, bool> assignment, out List <Counterexample> errors, int taskID = -1)
        {
            collector.examples.Clear();

            if (CommandLineOptions.Clo.Trace)
            {
                Console.WriteLine("Verifying " + descriptiveName);
            }
            DateTime now = DateTime.UtcNow;

            VCExpr vc = proverInterface.VCExprGen.Implies(BuildAxiom(proverInterface, assignment), conjecture);

            proverInterface.BeginCheck(descriptiveName, vc, handler);
            ProverInterface.Outcome proverOutcome = proverInterface.CheckOutcome(handler, taskID: taskID);

            double queryTime = (DateTime.UtcNow - now).TotalSeconds;

            stats.proverTime += queryTime;
            stats.numProverQueries++;
            if (CommandLineOptions.Clo.Trace)
            {
                Console.WriteLine("Outcome = " + proverOutcome);
                Console.WriteLine("Time taken = " + queryTime);
            }

            errors = collector.examples;
            return(proverOutcome);
        }
コード例 #2
0
        private bool ProcessImpl(Implementation impl)
        {
            var ret = false;
            var gen = prover.VCExprGen;

            // construct summaries
            var env = VCExpressionGenerator.True;

            foreach (var tup in impl2CalleeSummaries[impl.Name])
            {
                if (tup.Item1 == impl.Name)
                {
                    continue;
                }

                var calleeSummary =
                    impl2Summary[tup.Item1].GetSummaryExpr(
                        GetVarMapping(name2Impl[tup.Item1], tup.Item2), prover.VCExprGen);
                env = gen.AndSimp(env, gen.Eq(tup.Item2, calleeSummary));
            }

            while (true)
            {
                // construct self summaries
                var summaryExpr = VCExpressionGenerator.True;
                foreach (var tup in impl2CalleeSummaries[impl.Name])
                {
                    if (tup.Item1 != impl.Name)
                    {
                        continue;
                    }

                    var ts =
                        impl2Summary[tup.Item1].GetSummaryExpr(
                            GetVarMapping(name2Impl[tup.Item1], tup.Item2), prover.VCExprGen);
                    summaryExpr = gen.AndSimp(summaryExpr, gen.Eq(tup.Item2, ts));
                }
                Console.WriteLine("Trying summary for {0}: {1}", impl.Name, summaryExpr);

                reporter.model = null;
                var vc = gen.AndSimp(env, summaryExpr);
                vc = gen.Implies(vc, impl2VC[impl.Name]);

                //Console.WriteLine("Checking: {0}", vc);

                prover.BeginCheck(impl.Name, vc, reporter);
                ProverInterface.Outcome proverOutcome = prover.CheckOutcome(reporter);
                if (reporter.model == null)
                {
                    break;
                }

                var state = CollectState(impl);
                impl2Summary[impl.Name].Join(state);
                ret = true;
            }
            return(ret);
        }