public bool Contains23(int surr2, int surr3)
        {
            Prepare231();

            if (Ints231.Contains23(insertList, insertCount, surr2, surr3))
            {
                return(true);
            }

            if (!table.Contains23(surr2, surr3))
            {
                return(false);
            }

            int idx = Ints231.IndexFirst23(deleteList, deleteCount, surr2, surr3);

            if (idx == -1)
            {
                return(true);
            }
            int count = Ints231.Count23(deleteList, deleteCount, surr2, surr3, idx);

            TernaryTable.Iter it = table.GetIter23(surr2, surr3);
            while (!it.Done())
            {
                // Tuples in the [idx, idx+count) range are sorted in any order, since two arguments are the same
                if (!Ints123.Contains1(deleteList, idx, count, it.Get1()))
                {
                    return(true);
                }
                it.Next();
            }

            return(false);
        }
        public void CheckKey_23()
        {
            if (insertCount != 0)
            {
                Prepare231();

                int prevArg1 = -1;
                int prevArg2 = -1;
                int prevArg3 = -1;

                for (int i = 0; i < insertCount; i++)
                {
                    int arg1 = insertList[3 * i];
                    int arg2 = insertList[3 * i + 1];
                    int arg3 = insertList[3 * i + 2];

                    if (arg2 == prevArg2 & arg3 == prevArg3 & arg1 != prevArg1)
                    {
                        throw Cols23KeyViolationException(arg1, arg2, arg3, prevArg1);
                    }

                    if (!Ints231.Contains23(deleteList, deleteCount, arg2, arg3) && table.Contains23(arg2, arg3))
                    {
                        throw Cols23KeyViolationException(arg1, arg2, arg3);
                    }

                    prevArg1 = arg1;
                    prevArg2 = arg2;
                    prevArg3 = arg3;
                }
            }
        }
        //////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////

        public bool Contains1(int surr1)
        {
            Prepare123();

            if (Ints123.Contains1(insertList, insertCount, surr1))
            {
                return(true);
            }

            if (!table.Contains1(surr1))
            {
                return(false);
            }

            int idx = Ints123.IndexFirst1(deleteList, deleteCount, surr1);

            if (idx == -1)
            {
                return(true);
            }
            int count = Ints123.Count1(deleteList, deleteCount, surr1, idx);

            TernaryTable.Iter it = table.GetIter1(surr1);
            while (!it.Done())
            {
                // Tuples in the [idx, idx+count) range are sorted in both 1/2/3
                // and 2/3/1 order, since the first argument is always the same
                if (!Ints231.Contains23(deleteList, idx, count, it.Get1(), it.Get2()))
                {
                    return(true);
                }
                it.Next();
            }

            return(false);
        }