public static void CleanUp() { if (old_checker != null) { old_checker.Close(); old_checker = null; } }
public Evc(Checker check) { Contract.Requires(check != null); m_Checker = check; }
/* #region _TESTING_NEW_STUFF_ CommandLineOptions.Clo.vcVariety = CommandLineOptions.VCVariety.Block; //VCExpr wp = Wlp.Block(block, SuccCorrect, context); // Computes wp.S.true CommandLineOptions.Clo.vcVariety = CommandLineOptions.VCVariety.Doomed; #endregion */ VCExpr GenerateEVC(Implementation impl, out Dictionary<int, Absy> label2absy, Checker ch, out int assertionCount) { Contract.Requires(impl != null); Contract.Requires(ch != null); Contract.Ensures(Contract.Result<VCExpr>() != null); TypecheckingContext tc = new TypecheckingContext(null); impl.Typecheck(tc); label2absy = new Dictionary<int, Absy>(); VCExpr vc; switch (CommandLineOptions.Clo.vcVariety) { case CommandLineOptions.VCVariety.Doomed: vc = LetVC(cce.NonNull(impl.Blocks[0]), label2absy, ch.TheoremProver.Context, out assertionCount); break; default: Contract.Assert(false); throw new cce.UnreachableException(); // unexpected enumeration value } return vc; }
public void RespawnChecker(Implementation passive_impl, Checker check) { Contract.Requires(check != null); m_Check = check; Label2Absy = new Dictionary<int, Absy>(); // This is only a dummy m_Evc = new Evc(check); Dictionary<int, Absy> l2a = null; int assertionCount; // compute and then ignore VCExpr vce = this.GenerateEVC(passive_impl, out l2a, check, out assertionCount); Contract.Assert(vce != null); Contract.Assert(l2a != null); Label2Absy = l2a; m_Evc.Initialize(vce); }
public DoomCheck (Implementation passive_impl, Block unifiedExit, Checker check, List<Block> uncheckable, out int assertionCount) { Contract.Requires(passive_impl != null); Contract.Requires(check != null); Contract.Requires(uncheckable != null); m_Check = check; int replaceThisByCmdLineOption = CommandLineOptions.Clo.DoomStrategy ; if (CommandLineOptions.Clo.DoomStrategy!=-1) Console.Write("Running experiments using {0} /", replaceThisByCmdLineOption); switch (replaceThisByCmdLineOption) { default: { if (CommandLineOptions.Clo.DoomStrategy != -1) Console.WriteLine("Path Cover specialK Strategy"); m_Order = new PathCoverStrategyK(passive_impl, unifiedExit, uncheckable); break; } case 1: { if (CommandLineOptions.Clo.DoomStrategy != -1) Console.WriteLine("Path Cover L Strategy"); m_Order = new PathCoverStrategy(passive_impl, unifiedExit, uncheckable); break; } case 2: { if (CommandLineOptions.Clo.DoomStrategy != -1) Console.WriteLine("hasse strategy"); m_Order = new HierachyStrategy(passive_impl, unifiedExit, uncheckable); break; } case 3: { if (CommandLineOptions.Clo.DoomStrategy != -1) Console.WriteLine("hasse+ce strategy"); m_Order = new HierachyCEStrategy(passive_impl, unifiedExit, uncheckable); break; } case 4: { if (CommandLineOptions.Clo.DoomStrategy != -1) Console.WriteLine("no strategy"); m_Order = new NoStrategy(passive_impl, unifiedExit, uncheckable); break; } } Label2Absy = new Dictionary<int, Absy>(); // This is only a dummy m_Evc = new Evc(check); Dictionary<int, Absy> l2a = null; VCExpr vce = this.GenerateEVC(passive_impl, out l2a, check, out assertionCount); Contract.Assert(vce != null); Contract.Assert( l2a!=null); Label2Absy = l2a; m_Evc.Initialize(vce); }
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>()); }
private void GenerateVCForStratifiedInlining(Program program, StratifiedInliningInfo info, Checker checker) { Contract.Requires(program != null); Contract.Requires(info != null); Contract.Requires(checker != null); Contract.Requires(info.impl != null); Contract.Requires(info.impl.Proc != null); Implementation impl = info.impl; if (mode == Mode.Boogie && style == AnnotationStyle.Flat && impl.Name != main_proc_name) return; Contract.Assert(impl != null); ConvertCFG2DAG(impl,edgesCut); VC.ModelViewInfo mvInfo; PassifyImpl(impl, out mvInfo); Dictionary<int, Absy> label2absy = null; VCExpressionGenerator gen = checker.VCExprGen; Contract.Assert(gen != null); VCExpr vcexpr; if(NoLabels){ // int assertionCount = 0; VCExpr startCorrect = null; /* VC.VCGen.LetVC(cce.NonNull(impl.Blocks[0]), null, null, info.blockVariables, info.bindings, info.ctxt, out assertionCount); */ vcexpr = gen.Let(info.bindings, startCorrect); } else vcexpr = GenerateVC(impl, null /* info.controlFlowVariable */, out label2absy, info.ctxt); if(mode != Mode.Boogie) vcexpr = gen.Not(vcexpr); Contract.Assert(vcexpr != null); info.label2absy = label2absy; info.mvInfo = mvInfo; List<VCExpr> interfaceExprs = new List<VCExpr>(); if (true /* was: !info.isMain */) { Boogie2VCExprTranslator translator = checker.TheoremProver.Context.BoogieExprTranslator; Contract.Assert(translator != null); info.privateVars = new List<VCExprVar>(); foreach (Variable v in impl.LocVars) { Contract.Assert(v != null); info.privateVars.Add(translator.LookupVariable(v)); } foreach (Variable v in impl.OutParams) { Contract.Assert(v != null); info.privateVars.Add(translator.LookupVariable(v)); } info.interfaceExprVars = new List<VCExprVar>(); foreach (Variable v in info.interfaceVars) { Contract.Assert(v != null); VCExprVar ev = translator.LookupVariable(v); Contract.Assert(ev != null); info.interfaceExprVars.Add(ev); interfaceExprs.Add(ev); } } Function function = cce.NonNull(info.function); Contract.Assert(function != null); info.funcExpr = gen.Function(function, interfaceExprs); info.vcexpr = vcexpr; if (mode == Mode.Boogie) { Term z3vc = boogieContext.VCExprToTerm(vcexpr, linOptions); FactorVCs(z3vc, DualityVCs); } else { // Index the procedures by relational variable FuncDecl R = boogieContext.VCExprToTerm(info.funcExpr, linOptions).GetAppDecl(); relationToProc.Add(R, info); info.node = rpfp.CreateNode(boogieContext.VCExprToTerm(info.funcExpr, linOptions)); rpfp.nodes.Add(info.node); if (info.isMain || QKeyValue.FindBoolAttribute(impl.Attributes, "entrypoint")) info.node.Bound.Formula = ctx.MkFalse(); } }