Esempio n. 1
0
        private void CheckCompatibiltyWith(SFA <FUNC, TERM, SORT> B)
        {
            if (solver != B.solver)
            {
                throw new AutomataException(AutomataExceptionKind.SolversAreNotIdentical);
            }

            if (!Object.Equals(inpSort, B.inpSort))
            {
                throw new AutomataException(AutomataExceptionKind.InputSortsMustBeIdentical);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates an automaton that accepts the union of L(this) and L(B)
        /// </summary>
        /// <param name="B">given automaton</param>
        /// <returns>an automaton that accepts the union of L(this) and L(B)</returns>
        public SFA <FUNC, TERM, SORT> Union(SFA <FUNC, TERM, SORT> B)
        {
            if (B == null)
            {
                throw new ArgumentNullException("B");
            }

            CheckCompatibiltyWith(B);

            string prodName = string.Format("[{0}_x_{1}]", name, B.Name);
            var    AxB      = Automaton <TERM> .MkSum(automaton, B.automaton);

            return(new SFA <FUNC, TERM, SORT>(solver, inpSort, prodName, AxB));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns true if the language of the current SFA is a subset of L(A)
        /// </summary>
        /// <param name="A">superset automaton</param>
        /// <returns>true if L(this) is subset of L(A)</returns>
        public bool IsSubsetOf(SFA <FUNC, TERM, SORT> A)
        {
            if (A == null)
            {
                throw new ArgumentNullException("A");
            }

            CheckCompatibiltyWith(A);

            List <TERM> w;
            bool        res = Automaton <TERM> .CheckDifference(this.automaton, A.automaton, 0, out w);

            return(!res);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates an automaton that accepts L(this)\L(B)
        /// </summary>
        /// <param name="B">given automaton to subtract from current automaton</param>
        /// <returns>an automaton that accepts L(this)\L(B)</returns>
        public SFA <FUNC, TERM, SORT> Minus(SFA <FUNC, TERM, SORT> B)
        {
            if (B == null)
            {
                throw new ArgumentNullException("B");
            }

            CheckCompatibiltyWith(B);

            string diffName = string.Format("[{0}_-_{1}]", name, B.Name);
            var    AmB      = Automaton <TERM> .MkDifference(automaton, B.automaton, 0);

            return(new SFA <FUNC, TERM, SORT>(solver, inpSort, diffName, AmB));
        }