public void GenerateOverallAtomicPathLemma(string fileName, string perPathLemmaName, string overallLemmaName, string overallPostcondition, PathToBoolDelegate pathFilter) { string str = $@" lemma lemma_{prefix}_{overallLemmaName}( asf: AtomicSpecFunctions<{typeState}, {prefix}_Path, {moduleName}.Armada_PC>, s: {typeState}, path: {prefix}_Path, tid: Armada_ThreadHandle ) requires asf == {prefix}_GetSpecFunctions() requires asf.path_valid(s, path, tid) ensures {overallPostcondition} {{ match path {{ "; str += String.Join("\n", atomicPaths.Select(atomicPath => $"case {prefix}_Path_{atomicPath.Name}(_) => " + (pathFilter(atomicPath) ? $"lemma_{prefix}_{perPathLemmaName}_{atomicPath.Name}(asf, s, path, tid);" : "assert {overallPostcondition};"))); str += "}\n}\n"; if (fileName == null) { pgp.AddLemma(str); } else { pgp.AddLemma(str, fileName); } }
public void GeneratePerAtomicPathLemma(string fileName, string lemmaName, PathToBoolDelegate pathFilter, PathToStringDelegate postconditionDelegate, PathToStringDelegate proofBodyDelegate) { string str; var pr = new PathPrinter(this); foreach (var atomicPath in atomicPaths.Where(ap => pathFilter(ap))) { str = $@" lemma lemma_{prefix}_{lemmaName}_{atomicPath.Name}( asf: AtomicSpecFunctions<{typeState}, {prefix}_Path, {moduleName}.Armada_PC>, s: {typeState}, path: {prefix}_Path, tid: Armada_ThreadHandle ) requires asf == {prefix}_GetSpecFunctions() requires path.{prefix}_Path_{atomicPath.Name}? requires asf.path_valid(s, path, tid) ensures {postconditionDelegate(atomicPath)} {{ { pr.GetOpenValidPathInvocation(atomicPath) } { proofBodyDelegate(atomicPath) } ProofCustomizationGoesHere(); }} "; if (fileName == null) { pgp.AddLemma(str); } else { pgp.AddLemma(str, fileName); } } }