Пример #1
0
        protected DeclFreeProverContext(DeclFreeProverContext ctxt)
        {
            Contract.Requires(ctxt != null);
            this.gen        = ctxt.gen;
            this.genOptions = ctxt.genOptions;
            Boogie2VCExprTranslator t = (Boogie2VCExprTranslator)ctxt.translator.Clone();

            Contract.Assert(t != null);
            this.translator           = t;
            this.orderingAxiomBuilder = new OrderingAxiomBuilder(ctxt.gen, t, ctxt.orderingAxiomBuilder);

            StringBuilder cmds = new StringBuilder();

            distincts      = new List <Variable>(ctxt.distincts);
            axiomConjuncts = new List <VCExpr>(ctxt.axiomConjuncts);

            if (ctxt.exprTranslator == null)
            {
                exprTranslator = null;
            }
            else
            {
                exprTranslator = (VCExprTranslator)cce.NonNull(ctxt.exprTranslator.Clone());
            }
        }
Пример #2
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;
        }
Пример #3
0
        private void SetupOrderingAxiomBuilder(VCExpressionGenerator gen, Boogie2VCExprTranslator t)
        {
            OrderingAxiomBuilder oab = new OrderingAxiomBuilder(gen, t);

            Contract.Assert(oab != null);
            oab.Setup();
            this.orderingAxiomBuilder = oab;
        }
Пример #4
0
 public OrderingAxiomBuilder(VCExpressionGenerator gen,
                             Boogie2VCExprTranslator translator)
 {
     Contract.Requires(gen != null);
     Contract.Requires(translator != null);
     this.Gen              = gen;
     this.Translator       = translator;
     OneStepFuns           = new Dictionary <Type, Function>();
     Constants             = new List <Constant>();
     CompleteConstantsOpen = new List <Constant>();
     AllAxioms             = new List <VCExpr>();
     IncAxioms             = new List <VCExpr>();
 }
Пример #5
0
        public DeclFreeProverContext(VCExpressionGenerator gen,
                                     VCGenerationOptions genOptions)
        {
            Contract.Requires(gen != null);
            Contract.Requires(genOptions != null);
            this.gen        = gen;
            this.genOptions = genOptions;
            Boogie2VCExprTranslator t = new Boogie2VCExprTranslator(gen, genOptions);

            this.translator = t;

            SetupOrderingAxiomBuilder(gen, t);

            distincts      = new List <Variable>();
            axiomConjuncts = new List <VCExpr>();

            exprTranslator = null;
        }
Пример #6
0
 public override void FullReset(VCExpressionGenerator gen)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 public abstract void FullReset(VCExpressionGenerator gen);
Пример #8
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>());
 }