Esempio n. 1
0
        public static VarSet GetAllVars(Program p)
        {
            //List<GlobalVariable> globalDecls = BoogieUtil.GetGlobalVariables(p);
            var procedures      = BoogieUtil.GetProcedures(p);
            var implementations = BoogieUtil.GetImplementations(p);
            var allVars         = new VarSet();

            foreach (var proc in procedures)
            {
                var uses = new GlobalVarsUsed();
                uses.VisitRequiresSeq(proc.Requires);
                uses.VisitEnsuresSeq(proc.Ensures);
                // skip visiting modifies clause
                allVars.Add(new VarSet(uses.globalsUsed, proc.Name));
            }

            foreach (var impl in implementations)
            {
                var uses = new GlobalVarsUsed();
                uses.VisitBlockList(impl.Blocks);
                allVars.Add(new VarSet(uses.globalsUsed, impl.Name));
            }

            //globalDecls.Iterate(x => procedures.Iterate(y => allVars.Add(x.Name, y.Name)));
            //globalDecls.Iterate(x => implementations.Iterate(y => allVars.Add(x.Name, y.Name)));
            return(allVars);
        }
Esempio n. 2
0
 public void ProjectOnProcedures(HashSet <string> procs, out VarSet projection, out VarSet complement)
 {
     projection = new VarSet();
     complement = new VarSet();
     foreach (Duple <string, string> x in values)
     {
         if (procs.Contains(x.snd))
         {
             projection.Add(x);
         }
         else
         {
             complement.Add(x);
         }
     }
 }
Esempio n. 3
0
 public void ProjectOnVariables(HashSet <string> vars, out VarSet projection, out VarSet complement)
 {
     projection = new VarSet();
     complement = new VarSet();
     foreach (Duple <string, string> x in values)
     {
         if (vars.Contains(x.fst))
         {
             projection.Add(x);
         }
         else
         {
             complement.Add(x);
         }
     }
 }