public TPTPProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen, DeclFreeProverContext ctx) : base(options, "", "", "", "", gen) { Contract.Requires(options != null); Contract.Requires(gen != null); Contract.Requires(ctx != null); // No bg predicate at the moment // InitializeGlobalInformation("UnivBackPred.tptp"); this.ctx = ctx; this.Gen = gen; TypeAxiomBuilder axBuilder; switch (CommandLineOptions.Clo.TypeEncodingMethod) { case CommandLineOptions.TypeEncoding.Arguments: axBuilder = new TypeAxiomBuilderArguments(gen); axBuilder.Setup(); break; case CommandLineOptions.TypeEncoding.Monomorphic: axBuilder = new TypeAxiomBuilderPremisses(gen); break; default: axBuilder = new TypeAxiomBuilderPremisses(gen); axBuilder.Setup(); break; } AxBuilder = axBuilder; UniqueNamer namer = new UniqueNamer(); Namer = namer; Namer.Spacer = "__"; this.DeclCollector = new TypeDeclCollector(namer); }
///////////////////////////////////////////////////////////////////////////////// /// <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; }
public override object NewProverContext(ProverOptions options) { Contract.Requires(options != null); Contract.Ensures(Contract.Result <object>() != null); throw new NotImplementedException(); }
public static ProverInterface CreateProver(Program prog, string/*?*/ logFilePath, bool appendLogFile, int timeout, int taskID = -1) { Contract.Requires(prog != null); 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; } if (taskID >= 0) { options.Parse(CommandLineOptions.Clo.Cho[taskID].ProverOptions); } else { options.Parse(CommandLineOptions.Clo.ProverOptions); } ProverContext ctx = (ProverContext)CommandLineOptions.Clo.TheProverFactory.NewProverContext(options); // set up the context foreach (Declaration decl in prog.TopLevelDeclarations) { Contract.Assert(decl != null); TypeCtorDecl t = decl as TypeCtorDecl; if (t != null) { ctx.DeclareType(t, null); } } foreach (Declaration decl in prog.TopLevelDeclarations) { Contract.Assert(decl != null); Constant c = decl as Constant; if (c != null) { ctx.DeclareConstant(c, c.Unique, null); } else { Function f = decl as Function; if (f != null) { ctx.DeclareFunction(f, null); } } } foreach (var ax in prog.Axioms) { ctx.AddAxiom(ax, null); } foreach (Declaration decl in prog.TopLevelDeclarations) { Contract.Assert(decl != null); GlobalVariable v = decl as GlobalVariable; if (v != null) { ctx.DeclareGlobalVariable(v, null); } } return (ProverInterface)CommandLineOptions.Clo.TheProverFactory.SpawnProver(options, ctx); }
public override object SpawnProver(ProverOptions options, object ctxt) { //Contract.Requires(ctxt != null); //Contract.Requires(options != null); Contract.Ensures(Contract.Result<object>() != null); return this.SpawnProver(options, cce.NonNull((SMTLibProverContext)ctxt).ExprGen, cce.NonNull((SMTLibProverContext)ctxt)); }
protected virtual SMTLibProcessTheoremProver SpawnProver(ProverOptions options, VCExpressionGenerator gen, SMTLibProverContext ctx) { Contract.Requires(options != null); Contract.Requires(gen != null); Contract.Requires(ctx != null); Contract.Ensures(Contract.Result<SMTLibProcessTheoremProver>() != null); return new SMTLibProcessTheoremProver(options, gen, ctx); }
public override object NewProverContext(ProverOptions options) { //Contract.Requires(options != null); Contract.Ensures(Contract.Result<object>() != null); VCExpressionGenerator gen = new VCExpressionGenerator(); List<string>/*!>!*/ proverCommands = new List<string/*!*/>(); proverCommands.Add("smtlib"); var opts = (SMTLibProverOptions)options ; if (opts.Solver == SolverKind.Z3) proverCommands.Add("z3"); else proverCommands.Add("external"); VCGenerationOptions genOptions = new VCGenerationOptions(proverCommands); return new SMTLibProverContext(gen, genOptions); }
public SMTLibProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen, SMTLibProverContext ctx) { Contract.Requires(options != null); Contract.Requires(gen != null); Contract.Requires(ctx != null); InitializeGlobalInformation(); this.options = (SMTLibProverOptions)options; this.ctx = ctx; this.gen = gen; this.usingUnsatCore = false; SetupAxiomBuilder(gen); Namer = new SMTLibNamer(); ctx.parent = this; this.DeclCollector = new TypeDeclCollector((SMTLibProverOptions)options, Namer); if (CommandLineOptions.Clo.PrintFixedPoint != null || CommandLineOptions.Clo.PrintConjectures != null) { declHandler = new MyDeclHandler(); DeclCollector.SetDeclHandler(declHandler); } SetupProcess(); if (CommandLineOptions.Clo.StratifiedInlining > 0 || CommandLineOptions.Clo.ContractInfer || CommandLineOptions.Clo.SecureVcGen != null) { // Prepare for ApiChecker usage if (options.LogFilename != null && currentLogFile == null) { currentLogFile = OpenOutputFile(""); } PrepareCommon(); } }
public override object SpawnProver(ProverOptions options, object ctxt) { return new Z3apiProcessTheoremProver((Z3InstanceOptions) options, (Z3apiProverContext) ctxt); }
// Really returns ProverInterface. //public abstract object! SpawnProver(ProverOptions! options, object! ctxt); public abstract object SpawnProver(ProverOptions options, object ctxt);
// Really returns ProverContext public abstract object /*!*/ NewProverContext(ProverOptions /*!*/ options);
public virtual bool SupportsLabels(ProverOptions options) { return true; }
public override object NewProverContext(ProverOptions options) { Contract.Requires(options != null); Contract.Ensures(Contract.Result<object>() != null); throw new NotImplementedException(); }
// Really returns ProverContext /*!*/ public abstract object NewProverContext(ProverOptions/*!*/ options);
public SMTLibProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen, SMTLibProverContext ctx) { Contract.Requires(options != null); Contract.Requires(gen != null); Contract.Requires(ctx != null); InitializeGlobalInformation(); this.options = (SMTLibProverOptions)options; this.ctx = ctx; this.gen = gen; this.usingUnsatCore = false; SetupAxiomBuilder(gen); Namer = new SMTLibNamer(); ctx.parent = this; this.DeclCollector = new TypeDeclCollector((SMTLibProverOptions)options, Namer); SetupProcess(); if (CommandLineOptions.Clo.StratifiedInlining > 0 || CommandLineOptions.Clo.ContractInfer) { // Prepare for ApiChecker usage if (options.LogFilename != null && currentLogFile == null) { currentLogFile = OpenOutputFile(""); } if (CommandLineOptions.Clo.ContractInfer) { SendThisVC("(set-option :produce-unsat-cores true)"); this.usingUnsatCore = true; } PrepareCommon(); } }
public override object NewProverContext(ProverOptions options) { //Contract.Requires(options != null); Contract.Ensures(Contract.Result<object>() != null); if (CommandLineOptions.Clo.BracketIdsInVC < 0) { CommandLineOptions.Clo.BracketIdsInVC = 0; } VCExpressionGenerator gen = new VCExpressionGenerator(); List<string>/*!>!*/ proverCommands = new List<string/*!*/>(); proverCommands.Add("tptp"); proverCommands.Add("external"); VCGenerationOptions genOptions = new VCGenerationOptions(proverCommands); Contract.Assert(genOptions != null); return new DeclFreeProverContext(gen, genOptions); }
public virtual bool SupportsLabels(ProverOptions options) { return(true); }
public override object NewProverContext(ProverOptions opts) { if (CommandLineOptions.Clo.BracketIdsInVC < 0) { CommandLineOptions.Clo.BracketIdsInVC = 0; } VCExpressionGenerator gen = new VCExpressionGenerator(); return new Z3apiProverContext((Z3InstanceOptions)opts, gen); }
public override bool SupportsLabels(ProverOptions options) { return ((SMTLibProverOptions)options).SupportsLabels; }
private static ProverOptions AddInterpOption(ProverOptions options) { var opts = (SMTLibProverOptions)options; opts.AddSmtOption("produce-interpolants", "true"); if (CommandLineOptions.Clo.PrintFixedPoint == null) CommandLineOptions.Clo.PrintFixedPoint = "itp.fixedpoint.bpl"; return opts; }
public SMTLibInterpolatingProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen, SMTLibProverContext ctx) : base(AddInterpOption(options), gen, ctx) { }