public static IList <Tuple <TermIdent, TypeIsa> > GlobalFixedVariables( BoogieContextIsa boogieContext, IEnumerable <Function> functions, IEnumerable <Variable> variables, TermIdent normalInitState, IDictionary <Function, TermIdent> funToInterpMapping, IsaUniqueNamer uniqueNamer) { var absValType = new VarType("a"); var pureTyIsaTransformer = LemmaHelper.ConretePureTyIsaTransformer(absValType); var result = new List <Tuple <TermIdent, TypeIsa> > { Tuple.Create((TermIdent)boogieContext.absValTyMap, IsaBoogieType.AbstractValueTyFunType(absValType)), Tuple.Create((TermIdent)boogieContext.varContext, IsaBoogieType.VarContextType()), Tuple.Create((TermIdent)boogieContext.funContext, IsaBoogieType.FunInterpType(absValType)), Tuple.Create(normalInitState, IsaBoogieType.NormalStateType(absValType)) }; foreach (var kv in funToInterpMapping) { result.Add(Tuple.Create(kv.Value, IsaBoogieType.BoogieFuncInterpType(absValType))); var boogieFun = kv.Key; //get untyped version, maybe should precompute this somewhere and re-use or get the data from the VC TypeUtil.SplitTypeParams(boogieFun.TypeParameters, boogieFun.InParams.Select(v => v.TypedIdent.Type), out var explicitTypeVars, out _); var typeIsa = pureTyIsaTransformer.Translate(new Function(null, boogieFun.Name, explicitTypeVars, boogieFun.InParams, boogieFun.OutParams[0])); result.Add(Tuple.Create( IsaCommonTerms.TermIdentFromName(uniqueNamer.GetName(boogieFun, boogieFun.Name)), typeIsa)); } foreach (var v in variables) { var typeIsa = pureTyIsaTransformer.Translate(v); result.Add(Tuple.Create(IsaCommonTerms.TermIdentFromName(uniqueNamer.GetName(v, v.Name)), typeIsa)); } return(result); }
private ContextElem LemmaContext( CFGRepr cfg, Term vcAssm ) { var multiRed = IsaBoogieTerm.RedCFGMulti( BoogieContextIsa.CreateWithNewVarContext( boogieContext, new TermTuple(programAccessor.ConstsAndGlobalsDecl(), programAccessor.ParamsAndLocalsDecl()) ), programAccessor.CfgDecl(), IsaBoogieTerm.CFGConfigNode(new NatConst(cfg.GetUniqueIntLabel(cfg.entry)), IsaBoogieTerm.Normal(normalInitState)), IsaBoogieTerm.CFGConfig(finalNodeOrReturn, finalState) ); var closedAssm = EndToEndAssumptions.ClosednessAssumption(boogieContext.absValTyMap); var nonEmptyTypesAssm = EndToEndAssumptions.NonEmptyTypesAssumption(boogieContext.absValTyMap); var finterpAssm = IsaBoogieTerm.FunInterpWf(boogieContext.absValTyMap, programAccessor.FunctionsDecl(), boogieContext.funContext); var absValType = new VarType("a"); //need to explicitly give type for normal state, otherwise Isabelle won't know that the abstract value type is the same as used in the VC var axiomAssm = EndToEndAssumptions.AxiomAssumption(boogieContext, programAccessor, new TermWithExplicitType(normalInitState, IsaBoogieType.NormalStateType(absValType))); var presAssm = IsaBoogieTerm.ExprAllSat(boogieContext, normalInitState, programAccessor.PreconditionsDecl()); var localsAssm = EndToEndAssumptions.LocalStateAssumption(boogieContext, IsaCommonTerms.Snd(boogieContext.varContext), normalInitState); var globalsAssm = EndToEndAssumptions.GlobalStateAssumption(boogieContext, IsaCommonTerms.Fst(boogieContext.varContext), normalInitState); var oldGlobalStateAssm = EndToEndAssumptions.OldGlobalStateAssumption(normalInitState); var binderEmptyAssm = EndToEndAssumptions.BinderStateEmpty(normalInitState); return (ContextElem.CreateWithAssumptions( new List <Term> { multiRed, vcAssm, closedAssm, nonEmptyTypesAssm, finterpAssm, axiomAssm, presAssm, localsAssm, globalsAssm, oldGlobalStateAssm, binderEmptyAssm }, new List <string> { redAssmName, vcAssmName, closedAssmName, nonEmptyTypesAssmName, finterpAssmName, axiomAssmName, preconditionsAssmName, paramsLocalsAssmName, constsGlobalsAssmName, oldGlobalAssmName, binderEmptyAssmName } )); }