Exemple #1
0
        public void Compress(ISet <string> keep)
        {
            ISet <string> used = new HashSet <string>(keep);

            BoolExpr[] s           = this.Solver.Assertions;
            int        nAssertions = s.Length;

            bool[] added = new bool[nAssertions];

            bool changed = true;

            while (changed)
            {
                changed = false;
                for (int i = 0; i < nAssertions; ++i)
                {
                    if (!added[i])
                    {
                        foreach (string constant in ToolsZ3.Get_Constants(s[i]))
                        {
                            if (used.Contains(constant))
                            {
                                foreach (string constant2 in ToolsZ3.Get_Constants(s[i]))
                                {
                                    used.Add(constant2);
                                }
                                added[i] = true;
                                changed  = true;
                                break;
                            }
                        }
                    }
                }
            }
            this.Solver.Reset();
            for (int i = 0; i < nAssertions; ++i)
            {
                if (added[i])
                {
                    this.Solver.Assert(s[i]);
                }
            }
        }