Skip to content

Commit

Permalink
fix and get rid of more accessors other than the two that are require…
Browse files Browse the repository at this point in the history
…d for a phase
  • Loading branch information
gauravpartha committed May 9, 2023
1 parent 6b5c0f1 commit 67c4d65
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
8 changes: 2 additions & 6 deletions Source/ProofGeneration/Passification/PassificationEndToEnd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public class PassificationEndToEnd
private StateRelationData oldRelationData;
private IProgramAccessor passiveProgramAccessor;

private IProgramAccessor beforePhaseProgramAccessor;

private TermIdent passiveVarContext;
private IProgramAccessor programAccessor;
private IVariableTranslation<Variable> varTranslation;
Expand All @@ -60,7 +58,6 @@ public IEnumerable<OuterDecl> EndToEndProof(
string entryCfgLemma,
string boogieToVcLemma,
Term vcAssm,
IProgramAccessor beforePhaseProgramAccessor,
IProgramAccessor programAccessor,
IProgramAccessor passiveProgramAccessor,
Tuple<string, string> varContextNonPassivePassive,
Expand All @@ -72,7 +69,6 @@ public IEnumerable<OuterDecl> EndToEndProof(
this.entryCfgLemma = entryCfgLemma;
this.boogieToVcLemma = boogieToVcLemma;
this.vcAssm = vcAssm;
this.beforePhaseProgramAccessor = beforePhaseProgramAccessor;
this.programAccessor = programAccessor;
this.passiveProgramAccessor = passiveProgramAccessor;
boogieContext = new BoogieContextIsa(
Expand Down Expand Up @@ -171,7 +167,7 @@ private List<OuterDecl> GenerateLemma()

foreach (var idVar in varIds)
relWfProofMethods.Add(
ProofUtil.Apply(ProofUtil.Simp(beforePhaseProgramAccessor.LookupVarTyLemma(idVar.Item2),
ProofUtil.Apply(ProofUtil.Simp(programAccessor.LookupVarTyLemma(idVar.Item2),
passiveProgramAccessor.LookupVarTyLemma(idVar.Item2)))
);

Expand Down Expand Up @@ -444,7 +440,7 @@ private ContextElem Context()
var multiRed = IsaBoogieTerm.RedCFGMulti(
BoogieContextIsa.CreateWithNewVarContext(
boogieContext,
new TermTuple(beforePhaseProgramAccessor.ConstsAndGlobalsDecl(), beforePhaseProgramAccessor.ParamsAndLocalsDecl())
new TermTuple(programAccessor.ConstsAndGlobalsDecl(), programAccessor.ParamsAndLocalsDecl())
),
programAccessor.CfgDecl(),
IsaBoogieTerm.CFGConfigNode(new NatConst(cfg.GetUniqueIntLabel(cfg.entry)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class PassificationLemmaManager

private readonly TermIdent normalInitState = IsaCommonTerms.TermIdentFromName("n_s");

private readonly OldVarFinder oldVarFinder = new OldVarFinder();
private readonly OldVarFinder oldVarFinder = new();
private readonly IDictionary<Block, Block> origToPassiveBlock;
private readonly IProgramAccessor passiveProgramAccessor;

Expand All @@ -38,7 +38,6 @@ internal class PassificationLemmaManager
private readonly IVariableTranslation<Variable> passiveVarTranslation;

private readonly IProgramAccessor programAccessor;
private readonly IProgramAccessor beforePhaseProgramAccessor;

private readonly Dictionary<Block, int> smallestRequiredVersionDict = new Dictionary<Block, int>();
private readonly TermIdent stateRel = IsaCommonTerms.TermIdentFromName("R");
Expand All @@ -50,7 +49,6 @@ internal class PassificationLemmaManager
public PassificationLemmaManager(
CFGRepr cfg,
IDictionary<Block, Block> origToPassiveBlock,
IProgramAccessor beforePhaseProgramAccessor,
IProgramAccessor programAccessor,
IProgramAccessor passiveProgramAccessor,
Tuple<string, string> varContextNonPassivePassive,
Expand All @@ -61,7 +59,6 @@ public PassificationLemmaManager(
{
this.cfg = cfg;
this.origToPassiveBlock = origToPassiveBlock;
this.beforePhaseProgramAccessor = beforePhaseProgramAccessor;
this.programAccessor = programAccessor;
this.passiveProgramAccessor = passiveProgramAccessor;
_oldStateRelationData = oldStateRelationData;
Expand Down Expand Up @@ -116,7 +113,7 @@ public Tuple<LemmaDecl, LemmaDecl> GenerateBlockLemma(Block block, string localL
* in which case the variable is not newly constrained */
if (!tuple.Item3) constrainedPassiveVars.Add(passiveVarTerm);
lookupTyUpdatesLemmas.Add(
Tuple.Create(beforePhaseProgramAccessor.LookupVarTyLemma(origVar),
Tuple.Create(programAccessor.LookupVarTyLemma(origVar),
passiveProgramAccessor.LookupVarTyLemma(passiveVar))
);
}
Expand Down
7 changes: 2 additions & 5 deletions Source/ProofGeneration/Passification/PassificationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static Theory PassificationProof(
CFGRepr beforePassificationCfg,
IDictionary<Block, Block> nonPassiveToPassiveBlock,
PassiveRelationGen relationGen,
IProgramAccessor beforePhaseProgramAccess,
IProgramAccessor beforePassiveProgAccess,
IProgramAccessor passiveProgAccess,
BoogieMethodData beforePassiveData,
Expand Down Expand Up @@ -63,7 +62,6 @@ public static Theory PassificationProof(
var beforePassiveLemmaManager = new PassificationLemmaManager(
beforePassificationCfg,
nonPassiveToPassiveBlock,
beforePhaseProgramAccess,
beforePassiveProgAccess,
passiveProgAccess,
varContextNonPassivePassive,
Expand All @@ -77,7 +75,7 @@ public static Theory PassificationProof(

var varContextAbbrev = new AbbreviationDecl(
varContextName,
new Tuple<IList<Term>, Term>(new List<Term>(), beforePhaseProgramAccess.VarContext())
new Tuple<IList<Term>, Term>(new List<Term>(), beforePassiveProgAccess.VarContext())
);

var passiveVarContextAbbrev = new AbbreviationDecl(
Expand Down Expand Up @@ -120,7 +118,6 @@ relation used to construct the initial passive state set in the end-to-end proof
GetCfgLemmaName(beforePassificationCfg.entry, lemmaNamer),
boogieToVcTheoryName + "." + boogieToVcLemma.Name,
vcAssm,
beforePhaseProgramAccess,
beforePassiveProgAccess,
passiveProgAccess,
varContextNonPassivePassive,
Expand All @@ -133,7 +130,7 @@ relation used to construct the initial passive state set in the end-to-end proof

var imports = new List<string>
{
"Boogie_Lang.Semantics", "Boogie_Lang.Util", beforePhaseProgramAccess.TheoryName(),
"Boogie_Lang.Semantics", "Boogie_Lang.Util", beforePassiveProgAccess.TheoryName(),
passiveProgAccess.TheoryName(), "Boogie_Lang.PassificationML",
boogieToVcTheoryName
};
Expand Down
6 changes: 3 additions & 3 deletions Source/ProofGeneration/ProofGenerationLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,9 @@ from calls.
false,
false,
false,
proofGenInfo.GetOptimizationsFlag(),
parentAccessorForBeforeCfgToDag == null || proofGenInfo.GetOptimizationsFlag(),
parentAccessorForBeforeCfgToDag != null ? SpecsConfig.None : specsConfigDefault,
proofGenInfo.GetOptimizationsFlag());
parentAccessorForBeforeCfgToDag == null || proofGenInfo.GetOptimizationsFlag());

beforeCfgToDagProgAccess = new IsaProgramGenerator().GetIsaProgram(
beforeCfgToDagTheoryName,
Expand Down Expand Up @@ -789,7 +789,7 @@ from calls.
false,
parentProgramAccessorForPassification == null,
parentProgramAccessorForPassification != null ? SpecsConfig.None : specsConfigDefault,
false);
parentProgramAccessorForPassification == null);
beforePassiveProgAccess = new IsaProgramGenerator().GetIsaProgram(beforePassiveProgTheoryName,
afterPassificationImpl.Name,
afterOptimizationsData, beforePassiveConfig, afterOptimizationsVarTranslationFactory,
Expand Down

0 comments on commit 67c4d65

Please sign in to comment.