public StackVarHidingProofGenerator(ProofGenerationParams i_pgp, StackVariableHidingStrategyDecl i_strategy) : base(i_pgp) { strategy = i_strategy; hiddenVariablesMethodName = strategy.MethodName; hiddenVariables = new HashSet <string>(strategy.Variables); suppressedPCs = new HashSet <ArmadaPC>(); }
public void GenerateProof() { if (!GetLevelsAndStrategy()) { return; } ProofGenerationParams pgp = new ProofGenerationParams(prog, mProof, mLow, mHigh); AbstractProofGenerator pg = null; if (strategy is StackVariableHidingStrategyDecl) { pg = new StackVarHidingProofGenerator(pgp, (StackVariableHidingStrategyDecl)strategy); } else if (strategy is VariableHidingStrategyDecl) { pg = new VarHidingProofGenerator(pgp, (VariableHidingStrategyDecl)strategy); } else if (strategy is StackVariableIntroStrategyDecl) { pg = new StackVarIntroProofGenerator(pgp, (StackVariableIntroStrategyDecl)strategy); } else if (strategy is VariableIntroStrategyDecl) { pg = new VarIntroProofGenerator(pgp, (VariableIntroStrategyDecl)strategy); } else if (strategy is AssumeIntroStrategyDecl) { pg = new AssumeIntroProofGenerator(pgp, (AssumeIntroStrategyDecl)strategy); } else if (strategy is TSOEliminationStrategyDecl) { pg = new TSOEliminationProofGenerator(pgp, (TSOEliminationStrategyDecl)strategy); } else if (strategy is ReductionStrategyDecl) { pg = new ReductionProofGenerator(pgp, (ReductionStrategyDecl)strategy); } else if (strategy is WeakeningStrategyDecl) { pg = new WeakeningProofGenerator(pgp, (WeakeningStrategyDecl)strategy); } else if (strategy is StarWeakeningStrategyDecl) { pg = new StarWeakeningProofGenerator(pgp, (StarWeakeningStrategyDecl)strategy); } else if (strategy is CombiningStrategyDecl) { pg = new CombiningProofGenerator(pgp, (CombiningStrategyDecl)strategy); } if (pg != null) { pg.GenerateProof(); pgp.proofFiles.Print(); } }
public GlobalVarHidingProofGenerator(ProofGenerationParams i_pgp, GlobalVariableHidingStrategyDecl i_strategy) : base(i_pgp, true) { strategy = i_strategy; hiddenVariables = new HashSet <string>(strategy.Variables); if (hiddenVariables.All(varName => pgp.symbolsLow.Globals.Lookup(varName).varType == ArmadaVarType.Ghost)) { canHideTau = false; } }
public void GenerateProof() { if (!GetLevelsAndStrategy()) { return; } ProofGenerationParams pgp = new ProofGenerationParams(prog, mProof, mLow, mHigh); AbstractProofGenerator pg = null; if (strategy is GlobalVariableHidingStrategyDecl gvhsd) { pg = new GlobalVarHidingProofGenerator(pgp, gvhsd); } else if (strategy is StackVariableHidingStrategyDecl svhsd) { pg = new StackVarHidingProofGenerator(pgp, svhsd); } else if (strategy is GlobalVariableIntroStrategyDecl gvisd) { pg = new GlobalVarIntroProofGenerator(pgp, gvisd); } else if (strategy is StackVariableIntroStrategyDecl svisd) { pg = new StackVarIntroProofGenerator(pgp, svisd); } else if (strategy is AssumeIntroStrategyDecl aisd) { pg = new AssumeIntroProofGenerator(pgp, aisd); } else if (strategy is TSOEliminationStrategyDecl tesd) { pg = new TSOEliminationProofGenerator(pgp, tesd); } else if (strategy is ReductionStrategyDecl rsd) { pg = new ReductionProofGenerator(pgp, rsd); } else if (strategy is WeakeningStrategyDecl wsd) { pg = new WeakeningProofGenerator(pgp, wsd); } else if (strategy is StarWeakeningStrategyDecl swsd) { pg = new StarWeakeningProofGenerator(pgp, swsd); } else if (strategy is CombiningStrategyDecl csd) { pg = new CombiningProofGenerator(pgp, csd); } if (pg != null) { pg.GenerateProof(); pgp.proofFiles.Print(); } }
public StackVarIntroProofGenerator(ProofGenerationParams i_pgp, StackVariableIntroStrategyDecl i_strategy) : base(i_pgp, false) { strategy = i_strategy; var v = pgp.symbolsHigh.Lookup(strategy.MethodName, strategy.VariableName); if (!(v is MethodStackFrameUnaddressableLocalArmadaVariable)) { AH.PrintError(pgp.prog, $"Variable {strategy.MethodName}.{strategy.VariableName} isn't a noaddr stack variable, but stack_var_intro can only introduce noaddr stack variables"); } }
public GlobalVarIntroProofGenerator(ProofGenerationParams i_pgp, GlobalVariableIntroStrategyDecl i_strategy) : base(i_pgp, true /* can introduce tau */) { strategy = i_strategy; introducedVariables = new HashSet <string>(); foreach (var tok in strategy.Variables) { introducedVariables.Add(tok.val); } if (introducedVariables.All(varName => pgp.symbolsHigh.Globals.Lookup(varName).varType == ArmadaVarType.Ghost)) { canIntroduceTau = false; } }
public AtomicSpec(ProofGenerationParams i_pgp, ArmadaSymbolTable i_symbols, string i_auxName, string i_prefix, bool i_low, string i_moduleName, string i_typeState, string i_specFunctions, string i_spec, string i_validStep, string i_getNextState) { pgp = i_pgp; symbols = i_symbols; auxName = i_auxName; prefix = i_prefix; low = i_low; moduleName = i_moduleName; typeState = i_typeState; specFunctions = i_specFunctions; spec = i_spec; validStep = i_validStep; getNextState = i_getNextState; }
public StackVarHidingProofGenerator(ProofGenerationParams i_pgp, StackVariableHidingStrategyDecl i_strategy) : base(i_pgp, false) { strategy = i_strategy; hiddenVariablesMethodName = strategy.MethodName; hiddenVariables = new HashSet <string>(strategy.Variables); foreach (var varName in strategy.Variables) { var v = pgp.symbolsLow.Lookup(hiddenVariablesMethodName, varName); if (!(v is MethodStackFrameUnaddressableLocalArmadaVariable)) { AH.PrintError(pgp.prog, $"Variable {hiddenVariablesMethodName}.{varName} isn't a noaddr stack variable, but stack_var_hiding can only hide noaddr stack variables"); } } }
public WeakeningProofGenerator(ProofGenerationParams i_pgp, WeakeningStrategyDecl i_strategy) : base(i_pgp) { strategy = i_strategy; }
public StarWeakeningProofGenerator(ProofGenerationParams i_pgp, StarWeakeningStrategyDecl i_strategy) : base(i_pgp) { strategy = i_strategy; weakenedPCs = new HashSet <ArmadaPC>(); }
public StackVarIntroProofGenerator(ProofGenerationParams i_pgp, StackVariableIntroStrategyDecl i_strategy) : base(i_pgp, i_strategy) { strategy = i_strategy; }
public VarHidingProofGenerator(ProofGenerationParams i_pgp, bool i_canHideTau) : base(i_pgp, true) { canHideTau = i_canHideTau; }