Example #1
0
        public static void WriteTrailer(PipelineStatistics stats)
        {
            Contract.Requires(0 <= stats.ErrorCount);

            if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed)
            {
                Output.Print("..... {0} credible, {1} doomed{2}", stats.VerifiedCount,
                             stats.ErrorCount, stats.ErrorCount == 1 ? "" : "s");
            }
            else
            {
                Output.Print("..... {0} verified, {1} error{2}", stats.VerifiedCount,
                             stats.ErrorCount, stats.ErrorCount == 1 ? "" : "s");
            }

            if (stats.InconclusiveCount != 0)
            {
                Output.Print(", {0} inconclusive{1}", stats.InconclusiveCount,
                             stats.InconclusiveCount == 1 ? "" : "s");
            }

            if (stats.TimeoutCount != 0)
            {
                Output.Print(", {0} time out{1}", stats.TimeoutCount,
                             stats.TimeoutCount == 1 ? "" : "s");
            }

            if (stats.OutOfMemoryCount != 0)
            {
                Output.Print(", {0} out of memory", stats.OutOfMemoryCount);
            }

            Output.PrintLine("");
            Output.Flush();
        }
Example #2
0
 private static void WriteTrailer(PipelineStatistics stats)
 {
     if (!CommandLineOptions.Clo.Verify && stats.ErrorCount == 0)
     {
         Console.WriteLine();
         Console.Write("{0} did not attempt verification", CommandLineOptions.Clo.DescriptiveToolName);
         if (stats.InconclusiveCount != 0)
         {
             Console.Write(", {0} inconclusive{1}", stats.InconclusiveCount, Util.Plural(stats.InconclusiveCount));
         }
         if (stats.TimeoutCount != 0)
         {
             Console.Write(", {0} time out{1}", stats.TimeoutCount, Util.Plural(stats.TimeoutCount));
         }
         if (stats.OutOfMemoryCount != 0)
         {
             Console.Write(", {0} out of memory", stats.OutOfMemoryCount);
         }
         if (stats.OutOfResourceCount != 0)
         {
             Console.Write(", {0} out of resource", stats.OutOfResourceCount);
         }
         Console.WriteLine();
         Console.Out.Flush();
     }
     else
     {
         // This calls a routine within Boogie
         ExecutionEngine.printer.WriteTrailer(stats);
     }
 }
        /// <summary>
        /// Prove correctness with Boogie for a single Boogie program.
        /// This will report logical (asserts, ensures, decreases, ...) errors.
        /// </summary>
        private bool BoogieOnce(string moduleName, Bpl.Program boogieProgram)
        {
            ClearModelFile();

            if (boogieProgram.Resolve() != 0 || boogieProgram.Typecheck() != 0)
            {
                return(false);
            }

            ExecutionEngine.EliminateDeadVariables(boogieProgram);
            ExecutionEngine.CollectModSets(boogieProgram);
            ExecutionEngine.CoalesceBlocks(boogieProgram);
            ExecutionEngine.Inline(boogieProgram);

            var ps            = new PipelineStatistics();
            var programId     = "BoogieProgram_" + moduleName;
            var time          = DateTime.UtcNow.Ticks.ToString();
            var boogieOutcome = ExecutionEngine.InferAndVerify(boogieProgram, ps, programId, AddBoogieErrorToList, time);

            bool success = boogieOutcome == PipelineOutcome.Done ||
                           boogieOutcome == PipelineOutcome.VerificationCompleted;

            if (success)
            {
                _status = TranslationStatus.Boogied;
            }
            return(success);
        }
Example #4
0
        public static bool Boogie(IList <string> dafnyFileNames, Bpl.Program boogieProgram, string programId,
                                  out PipelineStatistics stats, out PipelineOutcome oc)
        {
            if (programId == null)
            {
                programId = "main_program_id";
            }

            string bplFilename;

            if (CommandLineOptions.Clo.PrintFile != null)
            {
                bplFilename = CommandLineOptions.Clo.PrintFile;
            }
            else
            {
                string baseName = cce.NonNull(Path.GetFileName(dafnyFileNames[dafnyFileNames.Count - 1]));
                baseName    = cce.NonNull(Path.ChangeExtension(baseName, "bpl"));
                bplFilename = Path.Combine(Path.GetTempPath(), baseName);
            }

            stats = null;
            oc    = BoogiePipelineWithRerun(boogieProgram, bplFilename, out stats, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? programId : null);
            return(stats.ErrorCount == 0 && stats.InconclusiveCount == 0 && stats.TimeoutCount == 0 && stats.OutOfMemoryCount == 0);
        }
Example #5
0
        public static void Compile(string fileName, ReadOnlyCollection <string> otherFileNames, Program dafnyProgram,
                                   PipelineOutcome oc, PipelineStatistics stats, bool verified)
        {
            var resultFileName = DafnyOptions.O.DafnyPrintCompiledFile ?? fileName;

            switch (oc)
            {
            case PipelineOutcome.VerificationCompleted:
                ExecutionEngine.printer.WriteTrailer(stats);
                if ((DafnyOptions.O.Compile && verified && CommandLineOptions.Clo.ProcsToCheck == null) || DafnyOptions.O.ForceCompile)
                {
                    CompileDafnyProgram(dafnyProgram, resultFileName, otherFileNames);
                }
                break;

            case PipelineOutcome.Done:
                ExecutionEngine.printer.WriteTrailer(stats);
                if (DafnyOptions.O.ForceCompile)
                {
                    CompileDafnyProgram(dafnyProgram, resultFileName, otherFileNames);
                }
                break;

            default:
                // error has already been reported to user
                break;
            }
        }
Example #6
0
        public static bool BoogieOnce(string baseFile, string moduleName, Bpl.Program boogieProgram, string programId,
                                      out PipelineStatistics stats, out PipelineOutcome oc)
        {
            if (programId == null)
            {
                programId = "main_program_id";
            }
            programId += "_" + moduleName;

            string bplFilename;

            if (CommandLineOptions.Clo.PrintFile != null)
            {
                bplFilename = CommandLineOptions.Clo.PrintFile;
            }
            else
            {
                string baseName = cce.NonNull(Path.GetFileName(baseFile));
                baseName    = cce.NonNull(Path.ChangeExtension(baseName, "bpl"));
                bplFilename = Path.Combine(Path.GetTempPath(), baseName);
            }

            bplFilename = BoogieProgramSuffix(bplFilename, moduleName);
            stats       = null;
            oc          = BoogiePipelineWithRerun(boogieProgram, bplFilename, out stats, 1 < Microsoft.Armada.ArmadaOptions.Clo.VerifySnapshots ? programId : null);
            return((oc == PipelineOutcome.Done || oc == PipelineOutcome.VerificationCompleted) && stats.ErrorCount == 0 && stats.InconclusiveCount == 0 && stats.TimeoutCount == 0 && stats.OutOfMemoryCount == 0);
        }
Example #7
0
        public static bool BoogieOnce(string baseFile, string moduleName, Bpl.Program boogieProgram, string programId,
                                      out PipelineStatistics stats, out PipelineOutcome oc)
        {
            if (programId == null)
            {
                programId = "main_program_id";
            }
            programId += "_" + moduleName;

            string bplFilename;

            if (CommandLineOptions.Clo.PrintFile != null)
            {
                bplFilename = CommandLineOptions.Clo.PrintFile;
            }
            else
            {
                string baseName = cce.NonNull(Path.GetFileName(baseFile));
                baseName    = cce.NonNull(Path.ChangeExtension(baseName, "bpl"));
                bplFilename = Path.Combine(Path.GetTempPath(), baseName);
            }

            bplFilename = BoogieProgramSuffix(bplFilename, moduleName);
            stats       = null;
            oc          = BoogiePipelineWithRerun(boogieProgram, bplFilename, out stats, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? programId : null);
            return(IsBoogieVerified(oc, stats));
        }
Example #8
0
        public void GetData()
        {
            if (this.hasrun == false) { return; }

            while (!this.context.CurrentDeviceContext.IsDataAvailable(this.query)) { }

            this.Statistics = this.context.CurrentDeviceContext.GetData<PipelineStatistics>(this.query);
        }
Example #9
0
 public static bool IsBoogieVerified(PipelineOutcome outcome, PipelineStatistics statistics)
 {
     return((outcome == PipelineOutcome.Done || outcome == PipelineOutcome.VerificationCompleted) &&
            statistics.ErrorCount == 0 &&
            statistics.InconclusiveCount == 0 &&
            statistics.TimeoutCount == 0 &&
            statistics.OutOfResourceCount == 0 &&
            statistics.OutOfMemoryCount == 0);
 }
Example #10
0
 public StaticLocksetAnalyser(AnalysisContext ac, EntryPointPair pair, ErrorReporter errorReporter,
                              PipelineStatistics stats)
 {
     Contract.Requires(ac != null && pair != null && errorReporter != null && stats != null);
     this.AC            = ac;
     this.EP1           = pair.EntryPoint1;
     this.EP2           = pair.EntryPoint2;
     this.ErrorReporter = errorReporter;
     this.Stats         = stats;
 }
Example #11
0
        public void GetData()
        {
            if (this.hasrun == false)
            {
                return;
            }

            while (!this.context.CurrentDeviceContext.IsDataAvailable(this.query))
            {
            }

            this.Statistics = this.context.CurrentDeviceContext.GetData <PipelineStatistics>(this.query);
        }
Example #12
0
        /// <summary>
        /// Resolve, type check, infer invariants for, and verify the given Boogie program.
        /// The intention is that this Boogie program has been produced by translation from something
        /// else.  Hence, any resolution errors and type checking errors are due to errors in
        /// the translation.
        /// The method prints errors for resolution and type checking errors, but still returns
        /// their error code.
        /// </summary>
        static PipelineOutcome BoogiePipelineWithRerun(Bpl.Program /*!*/ program, string /*!*/ bplFileName,
                                                       out PipelineStatistics stats, string programId)
        {
            Contract.Requires(program != null);
            Contract.Requires(bplFileName != null);
            Contract.Ensures(0 <= Contract.ValueAtReturn(out stats).InconclusiveCount&& 0 <= Contract.ValueAtReturn(out stats).TimeoutCount);

            stats = new PipelineStatistics();
            LinearTypeChecker ltc;
            CivlTypeChecker   ctc;
            PipelineOutcome   oc = ExecutionEngine.ResolveAndTypecheck(program, bplFileName, out ltc, out ctc);

            switch (oc)
            {
            case PipelineOutcome.Done:
                return(oc);

            case PipelineOutcome.ResolutionError:
            case PipelineOutcome.TypeCheckingError:
            {
                ExecutionEngine.PrintBplFile(bplFileName, program, false, false, CommandLineOptions.Clo.PrettyPrint);
                Console.WriteLine();
                Console.WriteLine("*** Encountered internal translation error - re-running Boogie to get better debug information");
                Console.WriteLine();

                List <string /*!*/> /*!*/ fileNames = new List <string /*!*/>();
                fileNames.Add(bplFileName);
                Bpl.Program reparsedProgram = ExecutionEngine.ParseBoogieProgram(fileNames, true);
                if (reparsedProgram != null)
                {
                    ExecutionEngine.ResolveAndTypecheck(reparsedProgram, bplFileName, out ltc, out ctc);
                }
            }
                return(oc);

            case PipelineOutcome.ResolvedAndTypeChecked:
                ExecutionEngine.EliminateDeadVariables(program);
                ExecutionEngine.CollectModSets(program);
                ExecutionEngine.CoalesceBlocks(program);
                ExecutionEngine.Inline(program);
                return(ExecutionEngine.InferAndVerify(program, stats, programId));

            default:
                Contract.Assert(false); throw new cce.UnreachableException(); // unexpected outcome
            }
        }
Example #13
0
        private static void WriteStatss(Dictionary <string, PipelineStatistics> statss)
        {
            var statSum = new PipelineStatistics();

            foreach (var stats in statss)
            {
                statSum.VerifiedCount           += stats.Value.VerifiedCount;
                statSum.ErrorCount              += stats.Value.ErrorCount;
                statSum.TimeoutCount            += stats.Value.TimeoutCount;
                statSum.OutOfMemoryCount        += stats.Value.OutOfMemoryCount;
                statSum.CachedErrorCount        += stats.Value.CachedErrorCount;
                statSum.CachedInconclusiveCount += stats.Value.CachedInconclusiveCount;
                statSum.CachedOutOfMemoryCount  += stats.Value.CachedOutOfMemoryCount;
                statSum.CachedTimeoutCount      += stats.Value.CachedTimeoutCount;
                statSum.CachedVerifiedCount     += stats.Value.CachedVerifiedCount;
                statSum.InconclusiveCount       += stats.Value.InconclusiveCount;
            }
            ExecutionEngine.printer.WriteTrailer(statSum);
        }
Example #14
0
        /// <summary>
        /// Pipeline the boogie program to Dafny where it is valid
        /// </summary>
        /// <returns>Exit value</returns>
        public static PipelineOutcome BoogiePipeline(Bpl.Program program, IList <string> fileNames, string programId, ErrorReporterDelegate er, out PipelineStatistics stats, out List <ErrorInformation> errorList, Program tmpDafnyProgram = null)
        {
            Contract.Requires(program != null);
            Contract.Ensures(0 <= Contract.ValueAtReturn(out stats).InconclusiveCount&& 0 <= Contract.ValueAtReturn(out stats).TimeoutCount);

            LinearTypeChecker ltc;
            CivlTypeChecker   ctc;
            string            baseName = cce.NonNull(Path.GetFileName(fileNames[fileNames.Count - 1]));

            baseName = cce.NonNull(Path.ChangeExtension(baseName, "bpl"));
            string bplFileName = Path.Combine(Path.GetTempPath(), baseName);

            errorList = new List <ErrorInformation>();
            stats     = new PipelineStatistics();



            PipelineOutcome oc = ExecutionEngine.ResolveAndTypecheck(program, bplFileName, out ltc, out ctc);

            switch (oc)
            {
            case PipelineOutcome.ResolvedAndTypeChecked:
                ExecutionEngine.EliminateDeadVariables(program);
                ExecutionEngine.CollectModSets(program);
                ExecutionEngine.CoalesceBlocks(program);
                ExecutionEngine.Inline(program);
                errorList = new List <ErrorInformation>();
                var tmp = new List <ErrorInformation>();

                oc = ExecutionEngine.InferAndVerify(program, stats, programId, errorInfo =>
                {
                    tmp.Add(errorInfo);
                    er?.Invoke(new CompoundErrorInformation(errorInfo.Tok, errorInfo.Msg, errorInfo, tmpDafnyProgram));
                });
                errorList.AddRange(tmp);

                return(oc);

            default:
                Contract.Assert(false); throw new cce.UnreachableException(); // unexpected outcome
            }
        }
Example #15
0
        public static void WriteTrailer(PipelineStatistics stats)
        {
            Contract.Requires(0 <= stats.ErrorCount);

            if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed)
            {
                Console.Write("{0} finished with {1} credible, {2} doomed{3}",
                              CommandLineOptions.Clo.DescriptiveToolName, stats.VerifiedCount,
                              stats.ErrorCount, stats.ErrorCount == 1 ? "" : "s");
            }
            else
            {
                Console.Write("{0} finished with {1} (out of {2}) entry point pairs verified, {3} error{4}",
                              CommandLineOptions.Clo.DescriptiveToolName, stats.VerifiedCount, DeviceDriver.EntryPointPairs.Count,
                              stats.ErrorCount, stats.ErrorCount == 1 ? "" : "s");
            }

            if (stats.InconclusiveCount != 0)
            {
                Console.Write(", {0} inconclusive{1}", stats.InconclusiveCount,
                              stats.InconclusiveCount == 1 ? "" : "s");
            }

            if (stats.TimeoutCount != 0)
            {
                Console.Write(", {0} time out{1}", stats.TimeoutCount,
                              stats.TimeoutCount == 1 ? "" : "s");
            }

            if (stats.OutOfMemoryCount != 0)
            {
                Console.Write(", {0} out of memory", stats.OutOfMemoryCount);
            }

            Console.WriteLine();
            Console.Out.Flush();
        }
Example #16
0
 internal RaceCheckAnalysis(AnalysisContext ac)
 {
     Contract.Requires(ac != null);
     this.AC    = ac;
     this.Stats = new PipelineStatistics();
 }
Example #17
0
 public void WriteTrailer(PipelineStatistics stats)
 {
 }
Example #18
0
        public static void Main(string[] args)
        {
            Contract.Requires(cce.NonNullElements(args));

            CommandLineOptions.Install(new WhoopRaceCheckerCommandLineOptions());

            try
            {
                WhoopRaceCheckerCommandLineOptions.Get().RunningBoogieFromCommandLine = true;

                if (!WhoopRaceCheckerCommandLineOptions.Get().Parse(args))
                {
                    Environment.Exit((int)Outcome.FatalError);
                }

                if (WhoopRaceCheckerCommandLineOptions.Get().Files.Count == 0)
                {
                    Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: no input files were specified");
                    Environment.Exit((int)Outcome.FatalError);
                }

                List <string> fileList = new List <string>();

                foreach (string file in WhoopRaceCheckerCommandLineOptions.Get().Files)
                {
                    string extension = Path.GetExtension(file);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    fileList.Add(file);
                }

                foreach (string file in fileList)
                {
                    Contract.Assert(file != null);
                    string extension = Path.GetExtension(file);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    if (extension != ".bpl")
                    {
                        Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: {0} is not a .bpl file", file);
                        Environment.Exit((int)Outcome.FatalError);
                    }
                }

                DeviceDriver.ParseAndInitialize(fileList);
                Summarisation.SummaryInformationParser.FromFile(fileList);

                PipelineStatistics stats = new PipelineStatistics();
                ExecutionTimer     timer = null;

                if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime)
                {
                    Console.WriteLine("\n[RaceChecker] runtime");
                    Console.WriteLine(" |");
                    timer = new ExecutionTimer();
                    timer.Start();
                }

                var pairMap = new Dictionary <EntryPointPair, Tuple <AnalysisContext, ErrorReporter> >();
                foreach (var pair in DeviceDriver.EntryPointPairs)
                {
                    AnalysisContext ac            = null;
                    var             parser        = new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl");
                    var             errorReporter = new ErrorReporter(pair);

                    if (pair.EntryPoint1.Name.Equals(pair.EntryPoint2.Name))
                    {
                        string extension = null;
                        if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint1.Name))
                        {
                            extension = "$summarised";
                        }
                        else
                        {
                            extension = "$instrumented";
                        }

                        parser.TryParseNew(ref ac, new List <string> {
                            "check_" + pair.EntryPoint1.Name + "_" +
                            pair.EntryPoint2.Name, pair.EntryPoint1.Name + extension
                        });
                    }
                    else
                    {
                        string extension1 = null;
                        if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint1.Name))
                        {
                            extension1 = "$summarised";
                        }
                        else
                        {
                            extension1 = "$instrumented";
                        }

                        string extension2 = null;
                        if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint2.Name))
                        {
                            extension2 = "$summarised";
                        }
                        else
                        {
                            extension2 = "$instrumented";
                        }

                        parser.TryParseNew(ref ac, new List <string> {
                            "check_" + pair.EntryPoint1.Name + "_" +
                            pair.EntryPoint2.Name, pair.EntryPoint1.Name + extension1, pair.EntryPoint2.Name + extension2
                        });
                    }

                    new StaticLocksetAnalyser(ac, pair, errorReporter, stats).Run();
                    pairMap.Add(pair, new Tuple <AnalysisContext, ErrorReporter>(ac, errorReporter));
                }

                if (WhoopRaceCheckerCommandLineOptions.Get().FindBugs)
                {
                    foreach (var pair in pairMap)
                    {
                        if (!WhoopRaceCheckerCommandLineOptions.Get().YieldAll&&
                            WhoopRaceCheckerCommandLineOptions.Get().SkipRaceFreePairs&&
                            !pair.Value.Item2.FoundErrors)
                        {
                            continue;
                        }

                        AnalysisContext ac = null;
                        new AnalysisContextParser(fileList[fileList.Count - 1],
                                                  "wbpl").TryParseNew(ref ac);

                        new YieldInstrumentationEngine(ac, pair.Key, pair.Value.Item1, pair.Value.Item2).Run();
                    }
                }

                if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime)
                {
                    timer.Stop();
                    Console.WriteLine(" |");
                    Console.WriteLine(" |--- [Total] {0}", timer.Result());
                }

                Whoop.IO.Reporter.WriteTrailer(stats);

                Outcome oc = Outcome.Done;
                if ((stats.ErrorCount + stats.InconclusiveCount + stats.TimeoutCount + stats.OutOfMemoryCount) > 0)
                {
                    oc = Outcome.LocksetAnalysisError;
                }

                Environment.Exit((int)oc);
            }
            catch (Exception e)
            {
                Console.Error.Write("Exception thrown in Whoop: ");
                Console.Error.WriteLine(e);
                Environment.Exit((int)Outcome.FatalError);
            }
        }
Example #19
0
        private void ProcessOutcome(Implementation impl, VC.VCGen.Outcome outcome, List <Counterexample> errors,
                                    string timeIndication, PipelineStatistics stats)
        {
            switch (outcome)
            {
            case VC.VCGen.Outcome.ReachedBound:
                Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                Console.WriteLine(string.Format("Stratified Inlining: Reached recursion bound of {0}",
                                                WhoopRaceCheckerCommandLineOptions.Get().RecursionBound));
                stats.VerifiedCount++;
                break;

            case VC.VCGen.Outcome.Correct:
                if (WhoopRaceCheckerCommandLineOptions.Get().vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}credible", timeIndication));
                    stats.VerifiedCount++;
                }
                else
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                    stats.VerifiedCount++;
                }
                break;

            case VC.VCGen.Outcome.TimedOut:
                stats.TimeoutCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}timed out", timeIndication));
                break;

            case VC.VCGen.Outcome.OutOfMemory:
                stats.OutOfMemoryCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}out of memory", timeIndication));
                break;

            case VC.VCGen.Outcome.Inconclusive:
                stats.InconclusiveCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}inconclusive", timeIndication));
                break;

            case VC.VCGen.Outcome.Errors:
                Contract.Assert(errors != null);
                if (WhoopRaceCheckerCommandLineOptions.Get().vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}doomed", timeIndication));
                    stats.ErrorCount++;
                }

                errors.Sort(new CounterexampleComparer());
                int errorCount = 0;

                foreach (Counterexample error in errors)
                {
                    errorCount += this.ErrorReporter.ReportCounterexample(error);
                }

                if (errorCount == 0)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                    stats.VerifiedCount++;
                }
                else
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}error{1}", timeIndication, errorCount == 1 ? "" : "s"));
                    stats.ErrorCount += errorCount;
                }
                break;

            default:
                Contract.Assert(false); // unexpected outcome
                throw new cce.UnreachableException();
            }
        }
 public void WriteTrailer(PipelineStatistics stats)
 {
     //Since it is a sink, nothing needs to be done.
     //The method needs to be provided though, because its abstract variant is inherited.
 }
Example #21
0
        static ExitValue ProcessFiles(IList <string /*!*/> /*!*/ dafnyFileNames, ReadOnlyCollection <string> otherFileNames,
                                      ErrorReporter reporter, bool lookForSnapshots = true, string programId = null)
        {
            Contract.Requires(cce.NonNullElements(dafnyFileNames));

            if (programId == null)
            {
                programId = "main_program_id";
            }

            ExitValue exitValue = ExitValue.VERIFIED;

            if (CommandLineOptions.Clo.VerifySeparately && 1 < dafnyFileNames.Count)
            {
                foreach (var f in dafnyFileNames)
                {
                    string extension = Path.GetExtension(f);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    if (extension != ".dfy")
                    {
                        continue;
                    }
                    Console.WriteLine();
                    Console.WriteLine("-------------------- {0} --------------------", f);
                    var ev = ProcessFiles(new List <string> {
                        f
                    }, new List <string>().AsReadOnly(), reporter, lookForSnapshots, f);
                    if (exitValue != ev && ev != ExitValue.VERIFIED)
                    {
                        exitValue = ev;
                    }
                }
                return(exitValue);
            }

            if (0 <= CommandLineOptions.Clo.VerifySnapshots && lookForSnapshots)
            {
                var snapshotsByVersion = ExecutionEngine.LookForSnapshots(dafnyFileNames);
                foreach (var s in snapshotsByVersion)
                {
                    var ev = ProcessFiles(new List <string>(s), new List <string>().AsReadOnly(), reporter, false, programId);
                    if (exitValue != ev && ev != ExitValue.VERIFIED)
                    {
                        exitValue = ev;
                    }
                }
                return(exitValue);
            }

            using (XmlFileScope xf = new XmlFileScope(CommandLineOptions.Clo.XmlSink, dafnyFileNames[dafnyFileNames.Count - 1])) {
                Dafny.Program dafnyProgram;
                string        programName = dafnyFileNames.Count == 1 ? dafnyFileNames[0] : "the program";
                string        err         = Dafny.Main.ParseCheck(dafnyFileNames, programName, reporter, out dafnyProgram);
                if (err != null)
                {
                    exitValue = ExitValue.DAFNY_ERROR;
                    ExecutionEngine.printer.ErrorWriteLine(Console.Out, err);
                }
                else if (dafnyProgram != null && !CommandLineOptions.Clo.NoResolve && !CommandLineOptions.Clo.NoTypecheck &&
                         DafnyOptions.O.DafnyVerify)
                {
                    Dafny.Translator translator    = new Dafny.Translator(dafnyProgram.reporter);
                    Bpl.Program      boogieProgram = translator.Translate(dafnyProgram);
                    if (CommandLineOptions.Clo.PrintFile != null)
                    {
                        ExecutionEngine.PrintBplFile(CommandLineOptions.Clo.PrintFile, boogieProgram, false, false, CommandLineOptions.Clo.PrettyPrint);
                    }

                    string bplFilename;
                    if (CommandLineOptions.Clo.PrintFile != null)
                    {
                        bplFilename = CommandLineOptions.Clo.PrintFile;
                    }
                    else
                    {
                        string baseName = cce.NonNull(Path.GetFileName(dafnyFileNames[dafnyFileNames.Count - 1]));
                        baseName    = cce.NonNull(Path.ChangeExtension(baseName, "bpl"));
                        bplFilename = Path.Combine(Path.GetTempPath(), baseName);
                    }

                    PipelineStatistics stats = null;
                    PipelineOutcome    oc    = BoogiePipelineWithRerun(boogieProgram, bplFilename, out stats, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? programId : null);
                    var allOk          = stats.ErrorCount == 0 && stats.InconclusiveCount == 0 && stats.TimeoutCount == 0 && stats.OutOfMemoryCount == 0;
                    var resultFileName = DafnyOptions.O.DafnyPrintCompiledFile ?? dafnyFileNames[0];
                    switch (oc)
                    {
                    case PipelineOutcome.VerificationCompleted:
                        ExecutionEngine.printer.WriteTrailer(stats);
                        if ((DafnyOptions.O.Compile && allOk && CommandLineOptions.Clo.ProcsToCheck == null) || DafnyOptions.O.ForceCompile)
                        {
                            CompileDafnyProgram(dafnyProgram, resultFileName, otherFileNames);
                        }
                        break;

                    case PipelineOutcome.Done:
                        ExecutionEngine.printer.WriteTrailer(stats);
                        if (DafnyOptions.O.ForceCompile)
                        {
                            CompileDafnyProgram(dafnyProgram, resultFileName, otherFileNames);
                        }
                        break;

                    default:
                        // error has already been reported to user
                        break;
                    }
                    exitValue = allOk ? ExitValue.VERIFIED : ExitValue.NOT_VERIFIED;
                }

                if (err == null && dafnyProgram != null && DafnyOptions.O.PrintStats)
                {
                    Util.PrintStats(dafnyProgram);
                }
                if (err == null && dafnyProgram != null && DafnyOptions.O.PrintFunctionCallGraph)
                {
                    Util.PrintFunctionCallGraph(dafnyProgram);
                }
            }
            return(exitValue);
        }