Пример #1
0
        private long GetCompleteDareTime()
        {
            Stopwatch stopwatch           = new Stopwatch();
            var       completeDareProgram = SimpleCloner.CloneProgram(_program);
            var       dareController      = new DareController(completeDareProgram);

            stopwatch.Start();
            var removalOrderTesterAssert = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetAssertDictionary(), completeDareProgram);

            removalOrderTesterAssert.TestDifferentRemovals();
            var removalOrderTesterInvar = new RemovalOrderTester <MaybeFreeExpression>(dareController.AllRemovableTypes.GetInvariantDictionary(), completeDareProgram);

            removalOrderTesterInvar.TestDifferentRemovals();
            var removalOrderTesterLemmaCall = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetLemmaCallDictionary(), completeDareProgram);

            removalOrderTesterLemmaCall.TestDifferentRemovals();
            var removalOrderTesterDecreases = new RemovalOrderTester <Expression>(dareController.AllRemovableTypes.GetDecreasesDictionary(), completeDareProgram);

            removalOrderTesterDecreases.TestDifferentRemovals();
            var removalOrderTesterCalc = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetCalcDictionary(), completeDareProgram);

            removalOrderTesterCalc.TestDifferentRemovals();
            stopwatch.Stop();
            return(stopwatch.ElapsedMilliseconds);
        }
Пример #2
0
        private void CompareAllRemovals(Program program)
        {
            var oneAtATimeProg = SimpleCloner.CloneProgram(program);
            var simulProg      = SimpleCloner.CloneProgram(program);

            var oneAtATime              = new DareController(oneAtATimeProg, new OneAtATimeRemover(oneAtATimeProg));
            var simultaneous            = new DareController(simulProg, new SimultaneousMethodRemover(simulProg));
            var allType                 = new DareController(SimpleCloner.CloneProgram(program));
            var allRemovableTypeResults = allType.FastRemoveAllRemovables();

            var asserts              = oneAtATime.FindRemovableAsserts();
            var invariants           = oneAtATime.FindRemovableInvariants();
            var decreases            = oneAtATime.FindRemovableDecreases();
            var lemmaCalls           = oneAtATime.FindRemovableLemmaCalls();
            var simplifiedAsserts    = oneAtATime.GetSimplifiedAsserts();
            var simplifiedInvariants = oneAtATime.GetSimplifiedInvariants();

            var simAsserts              = simultaneous.FindRemovableAsserts();
            var simInvariants           = simultaneous.FindRemovableInvariants();
            var simDecreases            = simultaneous.FindRemovableDecreases();
            var simLemmaCalls           = simultaneous.FindRemovableLemmaCalls();
            var simSimplifiedAsserts    = simultaneous.GetSimplifiedAsserts();
            var simSimplifiedInvariants = simultaneous.GetSimplifiedInvariants();
            var oaatRemovedCalcs        = oneAtATime.FindRemovableCalcs();
            var simulRemovedCalcs       = simultaneous.FindRemovableCalcs();

            Assert.True(oneAtATime.IsProgramValid());
            Assert.True(simultaneous.IsProgramValid());
            Assert.True(allType.IsProgramValid());

            Assert.AreEqual(asserts.Count, simAsserts.Count);
            Assert.AreEqual(asserts.Count, allRemovableTypeResults.RemovableAsserts.Count);


            Assert.AreEqual(invariants.Count, simInvariants.Count);
            Assert.AreEqual(invariants.Count, allRemovableTypeResults.RemovableInvariants.Count);

            Assert.AreEqual(decreases.Count, simDecreases.Count);
            Assert.AreEqual(decreases.Count, allRemovableTypeResults.RemovableDecreases.Count);

            Assert.AreEqual(lemmaCalls.Count, simLemmaCalls.Count);
            Assert.AreEqual(lemmaCalls.Count, allRemovableTypeResults.RemovableLemmaCalls.Count);

            Assert.AreEqual(simplifiedAsserts.Count, simSimplifiedAsserts.Count);
            Assert.AreEqual(simplifiedAsserts.Count, allRemovableTypeResults.SimplifiedAsserts.Count);

            Assert.AreEqual(simplifiedInvariants.Count, simSimplifiedInvariants.Count);
            Assert.AreEqual(simplifiedInvariants.Count, allRemovableTypeResults.SimplifiedInvariants.Count);

            var allTypeCalcs = allRemovableTypeResults.SimplifiedCalcs;

            Assert.AreEqual(oaatRemovedCalcs.Item1.Count, simulRemovedCalcs.Item1.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item1.Count, allTypeCalcs.Item1.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item2.Count, simulRemovedCalcs.Item2.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item2.Count, allTypeCalcs.Item2.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item3.Count, simulRemovedCalcs.Item3.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item3.Count, allTypeCalcs.Item3.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item4.Count, simulRemovedCalcs.Item4.Count);
            Assert.AreEqual(oaatRemovedCalcs.Item4.Count, allRemovableTypeResults.RemovableCalcs.Count);
        }
Пример #3
0
        private bool TryEnsureProgramVerifies(Program program)
        {
            var copy           = SimpleCloner.CloneProgram(program);
            var dareController = new DareController(copy);

            return(dareController.IsProgramValid());
        }
Пример #4
0
 public void PerformLogging()
 {
     GetVerificationTimeBefore();
     OriginalDareController = new DareController(OriginalProgram); //this is for counting later...
     ModifiedProgram        = SimpleCloner.CloneProgram(OriginalProgram);
     ModifiedDareController = new DareController(ModifiedProgram);
     SimpData = ModifiedDareController.FastRemoveAllRemovables();
     GetVerificationTimeAfter();
 }
Пример #5
0
        public void TestSimultaneousAllTypeRemoverConjunctions()
        {
            Initialise();
            var program = GetProgram("ListCopy.dfy");

            var dareController = GetDareController(SimpleCloner.CloneProgram(program));
            var data           = dareController.FastRemoveAllRemovables();

            Assert.AreEqual(1, data.SimplifiedInvariants.Count);
        }
Пример #6
0
        private long GetParallelRemovalTime()
        {
            var allTypeProgram = SimpleCloner.CloneProgram(_program);
            var allType        = new DareController(allTypeProgram);
            var stopwatch      = new Stopwatch();

            stopwatch.Start();
            allType.FastRemoveAllRemovables(new StopChecker());
            stopwatch.Stop();
            return(stopwatch.ElapsedMilliseconds);
        }
Пример #7
0
        private long GetVerificationTime(Program program)
        {
            var verifier            = new SimpleVerifier();
            var sw                  = new Stopwatch();
            var origSnapshotSetting = DafnyOptions.O.VerifySnapshots;

            DafnyOptions.O.VerifySnapshots = 0;
            var programClone = SimpleCloner.CloneProgram(program);

            sw.Start();
            verifier.IsProgramValid(programClone);
            sw.Stop();
            DafnyOptions.O.VerifySnapshots = origSnapshotSetting;
            return(sw.ElapsedMilliseconds);
        }
Пример #8
0
        private long GetOaatTime()
        {
            var ooatProgram    = SimpleCloner.CloneProgram(_program);
            var dareController = new DareController(ooatProgram, new OneAtATimeRemover(ooatProgram));
            var stopwatch      = new Stopwatch();

            stopwatch.Start();
            dareController.FindRemovableAsserts();
            dareController.FindRemovableInvariants();
            dareController.FindRemovableDecreases();
            dareController.FindRemovableLemmaCalls();
            dareController.GetSimplifiedAsserts();
            dareController.GetSimplifiedInvariants();
            dareController.FindRemovableCalcs();

            stopwatch.Stop();
            return(stopwatch.ElapsedMilliseconds);
        }
Пример #9
0
 public LogData(Program program, int numberOfVerifications)
 {
     _numberOfVerifications = numberOfVerifications;
     OriginalProgram        = SimpleCloner.CloneProgram(program);
 }
Пример #10
0
 public LogData(Program program)
 {
     OriginalProgram = SimpleCloner.CloneProgram(program);
 }