/**
         * Generate a DRA for an LTL formula using scheck
         * @param ltl the formula
         * @param scheck_path the path to the scheck executable
         * @return a shared_ptr to the generated DRA (on failure returns a ptr to 0)
         */
        //template <class DRA>
        //typename DRA::shared_ptr
        public DRA ltl2dra(LTLFormula ltl, BuchiAutomata buchiAutomata)
        {
            LTLFormula ltl_;
            LTLFormula ltl_for_scheck = null;

            bool safe = false;

            if (ltl.isSafe())
            {
                safe           = true;
                ltl_           = ltl.negate();
                ltl_for_scheck = ltl_;
            }
            else if (ltl.isCoSafe())
            {
                ltl_for_scheck = ltl;
            }
            else
            {
                if (_only_syn)
                {
                    // Not syntactically safe -> abort
                    //typename
                    //DRA::shared_ptr p;
                    //return p;
                    return(null);
                }
            }

            //    std::cerr<< "Calling scheck with "
            //	     <<ltl_for_scheck->toStringPrefix() << " : " << safe << std::endl;

            //NBA nba = ltl2dba(ltl_for_scheck, buchiAutomata); //, scheck_path, _only_syn

            NBA nba = LTL2NBA.ltl2nba(ltl_for_scheck, buchiAutomata); //, scheck_path, _only_syn

            if (nba == null)
            {
                //typename
                //DRA::shared_ptr p;
                //return p;

                return(null);
            }

            //    nba->print(std::cerr);

            // safe -> negate DRA
            return(DBA2DRA.dba2dra(nba, safe));
            //    return dba2dra<DRA>(*nba, safe);
            // nba is auto-destructed
            //<NBA_t,DRA>
        }
Beispiel #2
0
        public void convert(NBA nba, DRA dra_result, int limit)  //=0
        {
            if (nba.size() == 0 || nba.getStartState() == null)
            {
                // the NBA is empty -> construct DRA that is empty

                dra_result.constructEmpty();
                return;
            }

            if (_options.dba_check && nba.isDeterministic())
            {
                DBA2DRA.dba2dra(nba, dra_result);
                return;
            }

            if (_options.stutter_closure)
            {
                if (_stutter_information != null && !_stutter_information.isCompletelyInsensitive())
                {
                    //std::cerr <<
                    //"WARNING: NBA might not be 100% stutter insensitive, applying stutter closure can create invalid results!" <<
                    //std::endl;
                }

                NBA nba_closed = NBAStutterClosure.stutter_closure(nba);

                if (can_stutter())
                {
                    convert_safra_stuttered(nba_closed, dra_result, limit);
                    return;
                }

                convert_safra(nba_closed, dra_result, limit);
                return;
            }


            if (can_stutter())
            {
                convert_safra_stuttered(nba, dra_result, limit);
                return;
            }

            convert_safra(nba, dra_result, limit);

            return;
        }