コード例 #1
0
        /// <summary>
        /// Constructs a new automaton for the given formula.
        /// </summary>
        /// <param name="formula"></param>
        /// <param name="options"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public static BuchiAutomata FormulaToBA(string formula, string options, IToken token)
        {
            if (formula.Length > 4095)
            {
                throw new ParsingException("LTL2BA limitation: formula must not be longer than 4095 characters", token);
            }

            //formula = formula.Replace(" tau ", Common.Classes.Ultility.Constants.TAU);

            try
            {
                ltl2ba.main.ConvertFormula(formula, options);
                BuchiAutomata BA = BuildBA();

                //check whether it is syntaically safe.
                ltl2ba.Node LTL = ParseLTL(formula, options, token);
                BA.SyntacticSafety = LivenessChecking.HasSyntaxSafeOperator(LTL);

                return(BA);
            }
            catch (Exception ex)
            {
                throw new ParsingException("Invalid LTL formula: " + ex.Message, token);
            }
        }
コード例 #2
0
        private static LTLNode TranslateLTL(ltl2ba.Node LTLHeadNode)
        {
            type_t  type = new type_t();
            LTLNode node = new LTLNode(type, TranslateLTL(LTLHeadNode.lft), TranslateLTL(LTLHeadNode.rgt));

            return(node);
        }