diff --git a/Source/Concurrency/InductiveSequentialization.cs b/Source/Concurrency/InductiveSequentialization.cs index 28fe7bb4a..13d30f022 100644 --- a/Source/Concurrency/InductiveSequentialization.cs +++ b/Source/Concurrency/InductiveSequentialization.cs @@ -515,21 +515,9 @@ protected List GenerateSideConditionChecker(Action act) private List GenerateInconsistencyChecker(Action E1, Action E2) { - var gateE1 = (Expr)Expr.True; - foreach(var g in E1.Gate) - { - gateE1 = Expr.And(gateE1, g.Expr); - } - var gateE2 = (Expr)Expr.True; - foreach(var g in E2.Gate) - { - gateE2 = Expr.And(gateE2, g.Expr); - } - var gateM = (Expr)Expr.True; - foreach(var g in targetAction.Gate) - { - gateM = Expr.And(gateM, g.Expr); - } + var gateE1 = Expr.And(E1.Gate.Select(x => x.Expr)); + var gateE2 = Expr.And(E2.Gate.Select(x => x.Expr)); + var gateM = Expr.And(targetAction.Gate.Select(x => x.Expr)); var locals = new List(); var localE1 = civlTypeChecker.LocalVariable($"E1_{E1.Name}", E1.ActionDecl.PendingAsyncType); @@ -551,10 +539,10 @@ private List GenerateInconsistencyChecker(Action E1, Action E2) locals.AddRange(localsForGlobals); locals.AddRange(localsForInM); - List inputExprsM = new List(); - List inputExprsE1 = new List(); - List inputExprsE2 = new List(); - List globalExprs = new List(); + var inputExprsM = new List(); + var inputExprsE1 = new List(); + var inputExprsE2 = new List(); + var globalExprs = new List(); foreach(var l in localsForInM) { @@ -588,9 +576,10 @@ private List GenerateInconsistencyChecker(Action E1, Action E2) foreach(var domain in ltc.LinearDomains) { + //Constructing expressions for collection of permissions in globals and local/input params of M, E1, and E2 var collectG = ltc.UnionExprForPermissions(domain, ltc.PermissionExprs(domain, civlTypeChecker.GlobalVariables.Where(v => LinearTypeChecker.InKinds.Contains(LinearTypeChecker.FindLinearKind(v))))); - + var pendingAsyncLinearParamsM = targetAction.Impl.InParams .Where(v => LinearTypeChecker.InKinds.Contains(LinearTypeChecker.FindLinearKind(v))) .Select(v => substM(v)).ToList(); @@ -609,6 +598,7 @@ private List GenerateInconsistencyChecker(Action E1, Action E2) CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, pendingAsyncLinearParamsE2); var collectInE2 = ltc.UnionExprForPermissions(domain, ltc.PermissionExprs(domain, pendingAsyncLinearParamsE2)); + // Checks for disjointness of permissions in the same state var noDuplicationExpr1 = Expr.Eq( ExprHelper.FunctionCall(domain.mapAnd, collectG, collectInE1), ExprHelper.FunctionCall(domain.mapConstBool, Expr.False)); @@ -620,6 +610,8 @@ private List GenerateInconsistencyChecker(Action E1, Action E2) ExprHelper.FunctionCall(domain.mapConstBool, Expr.False)); disjointnessExpr[domain] = Expr.And(Expr.And(noDuplicationExpr1, noDuplicationExpr2), noDuplicationExpr3); + + // If E1 and E2 are descendants of M, then the subset property below should hold subsetExpr[domain] = Expr.And(ltc.SubsetExprForPermissions(domain, collectInE1 , collectInM), ltc.SubsetExprForPermissions(domain, collectInE2, collectInM)); } @@ -683,7 +675,7 @@ protected List GenerateExitConditionProperty1Checker(Action action) GetCheck(action.tok, Expr.And(elimExprs), "Exit condition property 1 failed"), }; - //CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds); + // CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds); return GetCheckerTuple($"{rule}_ExitProperty1Checker_{action.Name}", new List(), action.Impl.InParams, action.Impl.OutParams, new List(), cmds); } diff --git a/Source/Concurrency/LinearityChecker.cs b/Source/Concurrency/LinearityChecker.cs index 64bc5822f..664265f71 100644 --- a/Source/Concurrency/LinearityChecker.cs +++ b/Source/Concurrency/LinearityChecker.cs @@ -20,6 +20,7 @@ public LinearityCheck(LinearDomain domain, Expr assume, Expr assert, string mess this.checkName = checkName; } } + class LinearityChecker { private CivlTypeChecker civlTypeChecker; diff --git a/Test/civl/inductive-sequentialization/snapshot-scatter-gather-full.bpl b/Test/civl/inductive-sequentialization/snapshot-scatter-gather.bpl similarity index 100% rename from Test/civl/inductive-sequentialization/snapshot-scatter-gather-full.bpl rename to Test/civl/inductive-sequentialization/snapshot-scatter-gather.bpl diff --git a/Test/civl/inductive-sequentialization/snapshot-scatter-gather-full.bpl.expect b/Test/civl/inductive-sequentialization/snapshot-scatter-gather.bpl.expect similarity index 100% rename from Test/civl/inductive-sequentialization/snapshot-scatter-gather-full.bpl.expect rename to Test/civl/inductive-sequentialization/snapshot-scatter-gather.bpl.expect