/// <summary> /// Provide program for the next procedure (for the global declarations). /// </summary> public static void Program(Program p) { if (boogieGlobalData == null) { boogieGlobalData = new BoogieGlobalData(p.Functions, p.Axioms, p.GlobalVariables, p.Constants); var methodData = BoogieMethodData.CreateOnlyGlobal(boogieGlobalData); var fixedVarTranslation = new DeBruijnFixedVarTranslation(methodData); var fixedTyVarTranslation = new DeBruijnFixedTVarTranslation(methodData); var factory = new DeBruijnVarFactory(fixedVarTranslation, fixedTyVarTranslation, boogieGlobalData); var globalDataTheoryName = "global_data"; var globalDataConfig = new IsaProgramGeneratorConfig(null, true, true, true, false, SpecsConfig.None, false); globalDataProgAccess = new IsaProgramGenerator().GetIsaProgram( globalDataTheoryName, "proc", methodData, globalDataConfig, factory, null, out var declsGlobalData, !CommandLineOptions.Clo.GenerateIsaProgNoProofs, true ); var globalDataTheory = new Theory(globalDataTheoryName, new List <string> { "Boogie_Lang.Semantics", "Boogie_Lang.TypeSafety", "Boogie_Lang.Util" }, declsGlobalData); ProofGenerationOutput.StoreTheoriesTopLevel(new List <Theory> { globalDataTheory }); } }
public DeBruijnVarFactory( IFixedVariableTranslation <Variable> varTranslation, DeBruijnFixedTVarTranslation tvarTranslation, BoogieGlobalData boogieGlobalData) { this.varTranslation = varTranslation; this.tvarTranslation = tvarTranslation; globalData = boogieGlobalData; }
private static BoogieMethodData MethodDataFromImpl( Implementation impl, BoogieGlobalData globalData, List <Variable> extraLocalVariables = null ) { //add out params to local variables for now var locals = new List <Variable>(impl.LocVars).Union(impl.OutParams); if (extraLocalVariables != null) { locals = locals.Union(extraLocalVariables); } /* procedures and implementations do not use the same objects for the variables in the spec --> need to sync * for pre- and postcondition */ var formalProcImplSubst = Substituter.SubstitutionFromDictionary(impl.GetImplFormalMap()); var preconditions = new List <Tuple <Expr, bool> >(); foreach (var req in impl.Proc.Requires) { var e = Substituter.Apply(formalProcImplSubst, req.Condition); preconditions.Add(Tuple.Create(e, req.Free)); } var postconditions = new List <Tuple <Expr, bool> >(); foreach (var ens in impl.Proc.Ensures) { var e = Substituter.Apply(formalProcImplSubst, ens.Condition); postconditions.Add(Tuple.Create(e, ens.Free)); } return(new BoogieMethodData( globalData, new List <TypeVariable>(impl.TypeParameters), new List <Variable>(impl.InParams), locals, null, new List <IdentifierExpr>(impl.Proc.Modifies), preconditions, postconditions)); }