public void AddTacticErrors(ResolverTagger errorListHolder, ITextSnapshot snap, string requestId, string file)
        {
            Contract.Requires(errorListHolder != null);
            Contract.Requires(snap != null);
            Contract.Requires(!string.IsNullOrEmpty(requestId));
            Contract.Requires(!string.IsNullOrEmpty(file));
            if (!(FoundCalling && FoundTactic))
            {
                return;
            }

            errorListHolder.AddError(
                new DafnyError(_errTok.filename, _errTok.line - 1, _errTok.col - 1, ErrorCategory.AuxInformation,
                               $"Tacny Generated File: {_errMessage} at ({_errTok.line},{_errTok.col - 1})", null, false, null, false),
                "$$program_tactics$$", requestId);

            errorListHolder.AddError(
                new DafnyError(file, CallingLine - 1, CallingCol - 1, ErrorCategory.TacticError,
                               "Failing Call to " + _activeTactic, snap, true, ""),
                "$$program_tactics$$", requestId);

            errorListHolder.AddError(
                new DafnyError(file, (FoundFailing ? FailingLine : TacticLine) - 1,
                               (FoundFailing ? FailingCol : TacticCol) - 1, ErrorCategory.TacticError,
                               _errMessage, snap, true, ""),
                "$$program_tactics$$", requestId);
        }
示例#2
0
 public static bool Verify(Program dafnyProgram, ResolverTagger resolver, string uniqueIdPrefix, string requestId, ErrorReporterDelegate er, Program unresolvedProgram)
 {
   var translator = new Translator(dafnyProgram.reporter, er)
   {
     InsertChecksums = true,
     UniqueIdPrefix = uniqueIdPrefix
   };
   var boogieProgram = translator.Translate(dafnyProgram, unresolvedProgram);
   resolver.ReInitializeVerificationErrors(requestId, boogieProgram.Implementations);
   var outcome = BoogiePipeline(boogieProgram, 1 < CommandLineOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, er);
   return outcome == PipelineOutcome.Done || outcome == PipelineOutcome.VerificationCompleted;
 }
示例#3
0
        public static bool Verify(Program dafnyProgram, ResolverTagger resolver, string uniqueIdPrefix, string requestId, ErrorReporterDelegate er, Program unresolvedProgram)
        {
            var translator = new Translator(dafnyProgram.reporter, er)
            {
                InsertChecksums = true,
                UniqueIdPrefix  = uniqueIdPrefix
            };
            var boogieProgram = translator.Translate(dafnyProgram, unresolvedProgram);

            resolver.ReInitializeVerificationErrors(requestId, boogieProgram.Implementations);
            var outcome = BoogiePipeline(boogieProgram, 1 < CommandLineOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, er);

            return(outcome == PipelineOutcome.Done || outcome == PipelineOutcome.VerificationCompleted);
        }
示例#4
0
        public bool Verify(Ivy.Program ivyProgram, ResolverTagger resolver, string uniqueIdPrefix, string requestId, ErrorReporterDelegate er)
        {
            Ivy.Translator translator      = new Ivy.Translator(ivyProgram.reporter);
            var            translatorFlags = new Ivy.Translator.TranslatorFlags()
            {
                InsertChecksums = true, UniqueIdPrefix = uniqueIdPrefix
            };


            var boogiePrograms = Ivy.Translator.Translate(ivyProgram, ivyProgram.reporter, translatorFlags);

            var impls = boogiePrograms.SelectMany(p => p.Item2.Implementations);

            resolver.ReInitializeVerificationErrors(requestId, impls);

            bool success   = false;
            var  errorSink = new ErrorSink(this);

            foreach (var kv in boogiePrograms)
            {
                var boogieProgram = kv.Item2;

                // TODO(wuestholz): Maybe we should use a fixed program ID to limit the memory overhead due to the program cache in Boogie.
                PipelineOutcome oc = BoogiePipeline(boogieProgram, 1 < Ivy.DafnyOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, errorSink, er);
                switch (oc)
                {
                case PipelineOutcome.Done:
                case PipelineOutcome.VerificationCompleted:
                    // TODO:  This would be the place to proceed to compile the program, if desired
                    success = true;
                    break;

                case PipelineOutcome.FatalError:
                default:
                    return(false);
                }
            }
            return(success);
        }
    public void AddTacticErrors(ResolverTagger errorListHolder, ITextSnapshot snap, string requestId, string file)
    {
      Contract.Requires(errorListHolder != null);
      Contract.Requires(snap != null);
      Contract.Requires(!string.IsNullOrEmpty(requestId));
      Contract.Requires(!string.IsNullOrEmpty(file));
      if (!(FoundCalling && FoundTactic)) return;

      errorListHolder.AddError(
        new DafnyError(_errTok.filename, _errTok.line -1, _errTok.col - 1, ErrorCategory.AuxInformation, 
         $"Tacny Generated File: {_errMessage} at ({_errTok.line},{_errTok.col - 1})", null, false, null, false),
        "$$program_tactics$$", requestId);
      
      errorListHolder.AddError(
        new DafnyError(file, CallingLine - 1, CallingCol - 1, ErrorCategory.TacticError,
        "Failing Call to " + _activeTactic, snap, true, ""),
        "$$program_tactics$$", requestId);
      
      errorListHolder.AddError(
        new DafnyError(file, (FoundFailing ? FailingLine : TacticLine) - 1,
        (FoundFailing ? FailingCol : TacticCol) - 1, ErrorCategory.TacticError,
        _errMessage, snap, true, ""),
        "$$program_tactics$$", requestId);
    }
示例#6
0
        public static bool Verify(Dafny.Program dafnyProgram, ResolverTagger resolver, string uniqueIdPrefix, string requestId, ErrorReporterDelegate er)
        {
            Dafny.Translator translator = new Dafny.Translator(dafnyProgram.reporter);
              var translatorFlags = new Dafny.Translator.TranslatorFlags() { InsertChecksums = true, UniqueIdPrefix = uniqueIdPrefix };

              var boogiePrograms = Dafny.Translator.Translate(dafnyProgram, dafnyProgram.reporter, translatorFlags);

              var impls = boogiePrograms.SelectMany(p => p.Item2.Implementations);
              resolver.ReInitializeVerificationErrors(requestId, impls);

              bool success = false;

              foreach (var kv in boogiePrograms) {
            var boogieProgram = kv.Item2;

            // TODO(wuestholz): Maybe we should use a fixed program ID to limit the memory overhead due to the program cache in Boogie.
            PipelineOutcome oc = BoogiePipeline(boogieProgram, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, er);
            switch (oc) {
              case PipelineOutcome.Done:
              case PipelineOutcome.VerificationCompleted:
            // TODO:  This would be the place to proceed to compile the program, if desired
            success = true;
            break;
              case PipelineOutcome.FatalError:
              default:
            return false;
            }
              }
              return success;
        }
示例#7
0
    public static bool Verify(Dafny.Program dafnyProgram, ResolverTagger resolver, string uniqueIdPrefix, string requestId, ErrorReporterDelegate er) {
      Dafny.Translator translator = new Dafny.Translator();
      translator.InsertChecksums = true;
      translator.UniqueIdPrefix = uniqueIdPrefix;
      Bpl.Program boogieProgram = translator.Translate(dafnyProgram);

      resolver.ReInitializeVerificationErrors(requestId, boogieProgram.Implementations);

      // TODO(wuestholz): Maybe we should use a fixed program ID to limit the memory overhead due to the program cache in Boogie.
      PipelineOutcome oc = BoogiePipeline(boogieProgram, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, er);
      switch (oc) {
        case PipelineOutcome.Done:
        case PipelineOutcome.VerificationCompleted:
          // TODO:  This would be the place to proceed to compile the program, if desired
          return true;
        case PipelineOutcome.FatalError:
        default:
          return false;
      }
    }