Ejemplo n.º 1
0
        /// <summary>
        /// Вычисление ДК
        /// </summary>
        /// <param name="b">ЕПК</param>
        /// <returns>ДК</returns>
        public static LongBits GetDK(LongBits b)
        {
            int      n = GetN(b.Length + 1);
            LongBits a = new LongBits(n);

            for (int i = 0; i < a.Length; i++)
            {
                a[i] = a.Negative(i);
                int kmax = (int)Math.Pow(2, n - 1 - i) - 1;
                for (int k = 0; k <= kmax; k++)
                {
                    int tmin = (int)Math.Pow(2, i) * (2 * k + 1);
                    int tmax = (int)Math.Pow(2, i + 1) * (k + 1) - 1;
                    for (int t = tmin; t <= tmax; t++)
                    {
                        a[i] &= b.Negative(t - 1);
                    }
                }
                a[i] = a.Negative(i);
            }
            return(a);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Вывод формулы
        /// </summary>
        /// <param name="b">ЕПК</param>
        /// <param name="a">ДК</param>
        /// <returns>Формула ДК</returns>
        public static string[] Formules(LongBits b, out LongBits a)
        {
            int n = GetN(b.Length + 1);

            a = new LongBits(n);

            string[] formules = new string[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = a.Negative(i);
                string withoutDigit = string.Empty;
                string withDigit    = string.Empty;
                int    kmax         = (int)Math.Pow(2, n - 1 - i) - 1;
                for (int k = 0; k <= kmax; k++)
                {
                    int tmin = (int)Math.Pow(2, i) * (2 * k + 1);
                    int tmax = (int)Math.Pow(2, i + 1) * (k + 1) - 1;
                    for (int t = tmin; t <= tmax; t++)
                    {
                        withoutDigit += "¬b" + t;
                        withDigit    += b.Negative(t - 1);

                        a[i] &= b.Negative(t - 1);

                        if (k != kmax || t != tmax)
                        {
                            withoutDigit += "ʌ";
                            withDigit    += "ʌ";
                        }
                    }
                }
                a[i]        = a.Negative(i);
                formules[i] = "¬(" + withoutDigit + ")=" + "¬(" + withDigit + ")=" + a[i];
            }
            return(formules);
        }