Exemple #1
0
        public void AddWitness(CommutativityWitness witness)
        {
            var key = Key(witness.firstAction, witness.secondAction);

            if (!witnesses.ContainsKey(key))
            {
                witnesses[key] = new List <CommutativityWitness>();
            }
            witnesses[key].Add(witness);
        }
            private void ComputeWitnessedTransitionRelationExprs()
            {
                witnessedTransitionRelations = new List <Expr>();
                Dictionary <Variable, List <CommutativityWitness> > varToWitnesses = trc.FrameWithWitnesses.
                                                                                     Where(x => NotEliminatedVars.Contains(frameIntermediateCopy[x])).
                                                                                     ToDictionary(
                    x => frameIntermediateCopy[x],
                    x => trc.globalVarToWitnesses[(GlobalVariable)x]);

                foreach (var witnessSet in varToWitnesses.Values.CartesianProduct())
                {
                    Dictionary <Variable, Expr> witnessSubst = new Dictionary <Variable, Expr>();
                    foreach (Tuple <Variable, CommutativityWitness> pair in
                             Enumerable.Zip(varToWitnesses.Keys, witnessSet, Tuple.Create))
                    {
                        CommutativityWitness witness = pair.Item2;
                        witnessSubst[pair.Item1] = ExprHelper.FunctionCall(
                            witness.function, witness.args.ToArray()
                            );
                    }
                    witnessedTransitionRelations.Add(
                        SubstitutionHelper.Apply(witnessSubst, TransitionRelationExpr));
                }
            }