Beispiel #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);
            }
        }
Beispiel #2
0
 public TarjanThread(ConfigurationBase initialStep, BuchiAutomata ba, PATThreadPool threadPool, FairnessType FairnessType)
 {
     this.initialStep = initialStep;
     this.VerificationResult = VerificationResultType.UNKNOWN;
     this.BA = ba;
     this.ThreadPool = threadPool;
     this.FairnessType = FairnessType;
     this.FairSCC = null;
     this.JobFinished = false;
 }
Beispiel #3
0
        /**
         * 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 #4
0
        public NBA ltl2nba(LTLFormula ltl, BuchiAutomata buchiAutomata, bool exception_on_failure)
        {
            //Debug.Assert(_ltl2nba != null);

            NBA nba = LTL2NBA.ltl2nba(ltl, buchiAutomata);

            if (exception_on_failure && nba == null)
            {
                throw new Exception("Couldn't generate NBA from LTL formula!");
            }

            return nba;
        }
Beispiel #5
0
        public static Graph AutomatonToDot(BuchiAutomata BA)
        {
            Graph g = new Graph("graph");

            g.Directed = true;
            //g.MinNodeWidth = 0;
            //g.MinNodeHeight = 0;

            Dictionary <string, string> stateToNumber = new Dictionary <string, string>();

            for (int i = 0; i < BA.States.Length; i++)
            {
                string state = BA.States[i];

                //dot += ("s" + stateToNumber[state] + " [" + (isInitial ? "shape=box" : "") + ((isInitial && isFinal) ? "," : "") + (isFinal ? "style=dotted" : "") + "];\n");
                //Node d = g.AddNode("s" + stateToNumber[state.ToString()]);

                string label = "s" + i;
                Node   d     = g.AddNode(label);
                stateToNumber.Add(state, label);

                if (BA.InitialStates.Contains(state)) //.isInitial
                {
                    Node temp = g.AddNode("init-" + label);

                    //temp.Attr.Shape = Shape.InvHouse;
                    temp.Attr.LineWidth = 0;
                    temp.Attr.Color     = Color.White;
                    temp.LabelText      = "";
                    g.AddEdge("init-" + label, label);
                    d.Attr.FillColor = Color.Gray;
                }

                if (state.EndsWith(Constants.ACCEPT_STATE))
                {
                    d.Attr.Shape = Shape.DoubleCircle;
                    //d.Attr.AddStyle(Style.Dotted);
                }
            }

            foreach (Transition transition in BA.Transitions)
            {
                //dot += ("s" + stateToNumber[transition.getSourceState()] + " -> " + "s" + stateToNumber[transition.getTargetState()] + " [label=\"" + transition.getLabels() + "\"]" + ";\n");
                g.AddEdge(stateToNumber[transition.FromState.ToString()], Ultility.Ultility.PPStringList(transition.labels), stateToNumber[transition.ToState.ToString()]);
            }

            return(g);
        }
Beispiel #6
0
        /// <summary>
        /// Given a Buchi automaton, return true if and only if the automaton is a liveness property.
        /// A Buchi automaton is a liveness property if and only if its close automata accepts all words.
        /// </summary>
        /// <param name="ba"></param>
        /// <returns></returns>
        public static bool isLiveness(BuchiAutomata ba)
        {
            //return true;
            if (ba.SyntacticSafety)
            {
                return(false);
            }

            foreach (string state in ba.States)
            {
                if (!state.EndsWith(Constants.ACCEPT_STATE))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #7
0
        /// <summary>
        /// Given a Buchi automaton, return true if and only if the automaton is a liveness property.
        /// A Buchi automaton is a liveness property if and only if its close automata accepts all words.
        /// </summary>
        /// <param name="ba"></param>
        /// <returns></returns>
        public static bool isLiveness(BuchiAutomata ba)
        {
            //return true;
            if (ba.SyntacticSafety)
            {
                return false;
            }

            foreach (string state in ba.States)
            {
                if(!state.EndsWith(Constants.ACCEPT_STATE))
                {
                    return true;
                }
            }

            return false;
        }
Beispiel #8
0
        public EventBAPairSafety[] Next(BuchiAutomata BA, ConfigurationBase[] steps)
        {
            EventBAPairSafety[] product = new EventBAPairSafety[steps.Length]; // * BA.States.Length);

            for (int i = 0; i < steps.Length; i++)
            {
                List <string> targetStates = new List <string>();

                foreach (string state in States)
                {
                    List <string> states = BA.MakeOneMove(state, steps[i]);
                    Ultility.Ultility.Union(targetStates, states);
                }

                product[i] = new EventBAPairSafety(steps[i], targetStates);
            }

            return(product);
        }
Beispiel #9
0
        public static EventBAPairSafety GetInitialPairs(BuchiAutomata BA, ConfigurationBase initialStep)
        {
            List <string> intialBAStates = new List <string>();

            //List<string> existed = new List<string>();

            foreach (string s in BA.InitialStates)
            {
                List <string> next = BA.MakeOneMove(s, initialStep);

                foreach (string var in next)
                {
                    if (!intialBAStates.Contains(var))
                    {
                        //existed.Add(var);
                        intialBAStates.Add(var);
                    }
                }
            }

            return(new EventBAPairSafety(initialStep, intialBAStates));
        }
        public static EventBAPairSafetyPCSP GetInitialPairs(BuchiAutomata BA, MDPConfiguration initialStep)
        {
            List<string> intialBAStates = new List<string>();
            //HashSet<string> existed = new HashSet<string>();

            foreach (string s in BA.InitialStates)
            {
                List<string> next = BA.MakeOneMove(s, initialStep);

                foreach (string var in next)
                {
                    //if (!existed.Contains(var))
                    //{
                    //    existed.Add(var);
                    //    intialBAStates.Add(var);
                    //}
                    if (!intialBAStates.Contains(var))
                    {
                        intialBAStates.Add(var);
                    }
                }
            }

            return new EventBAPairSafetyPCSP(initialStep, intialBAStates);
        }
        public static List<EventBAPairSafetyPCSP> Next(BuchiAutomata BA, MDPConfiguration[] steps, List<string> BAStates)
        {
            List<EventBAPairSafetyPCSP> product = new List<EventBAPairSafetyPCSP>(steps.Length * BA.States.Length);

            for (int i = 0; i < steps.Length; i++)
            {
                List<string> targetStates = new List<string>();

                foreach (string state in BAStates)
                {
                    List<string> states = BA.MakeOneMove(state, steps[i]);
                    Common.Classes.Ultility.Ultility.Union(targetStates, states);
                }

                product.Add(new EventBAPairSafetyPCSP(steps[i], targetStates));
            }

            return product;
        }
Beispiel #12
0
        /**
         * Convert an LTL formula to an NBA
         * @param ltl
         * @return a pointer to the created NBA (caller gets ownership).
         */
        public static NBA ltl2nba(LTLFormula ltl, BuchiAutomata buchiAutomata)
        {
            // Create canonical APSet (with 'p0', 'p1', ... as AP)
            //LTLFormula ltl_canonical = ltl.copy();
            //APSet canonical_apset = ltl.getAPSet().createCanonical();
               // ltl_canonical.switchAPSet(canonical_apset);

            //AnonymousTempFile spin_outfile;
            //std::vector<std::string> arguments;
            //arguments.push_back("-f");
            //arguments.push_back(ltl_canonical->toStringInfix());

            //arguments.insert(arguments.end(), _arguments.begin(),_arguments.end());

            //const char *program_path=_path.c_str();

            //RunProgram spin(program_path,
            //        arguments,
            //        false,
            //        0,
            //        &spin_outfile,
            //        0);

            //int rv=spin.waitForTermination();
            //if (rv==0) {
            //  NBA_t *result_nba(new NBA_t(canonical_apset));

            //  FILE *f=spin_outfile.getInFILEStream();
            //  if (f==NULL) {
            //throw Exception("");
            //  }

            //  int rc=nba_parser_promela::parse(f, result_nba);
            //  fclose(f);

            //  if (rc!=0) {
            //throw Exception("Couldn't parse PROMELA file!");
            //  }

            NBA result_nba = new NBA(ltl.getAPSet());

            ////////////////////////////////////////////////////////////
            //todo: create the NBA from the BA
            //
            //
            ////////////////////////////////////////////////////////////
            NBABuilder builder = new NBABuilder(result_nba);
            //int current_state = 0;
            //bool current_state_valid=false;

            //foreach (string state in buchiAutomata.States)
            //{

            //    if (buchiAutomata.InitialStates.Contains(state))
            //    {
            //        int current_state = builder.findOrAddState(state);
            //        if (buchiAutomata.InitialStates.Contains(state))
            //        {
            //            builder.setStartState(current_state);
            //        }
            //    }
            //}

            foreach (string state in buchiAutomata.States)
            {
                //if (!buchiAutomata.InitialStates.Contains(state))
                {
                    ////s.AppendLine(state);
                    //if (current_state_valid) {
                    //    builder.addAdditionalNameToState(state, current_state);
                    //}
                    //else
                    //{
                    int current_state = builder.findOrAddState(state);
                    //std::string& label=$1;
                    //if (label.find("accept") != std::string::npos) {
                    if (state.EndsWith(Constants.ACCEPT_STATE))
                    {
                        builder.setFinal(current_state);
                    }
                    //if (label.find("accept_all") != std::string ::npos)
                    //{
                    //    // dirty hack: accept_all + skip -> trueloop
                    //    builder.setFinal(current_state);
                    //    builder.addEdge(current_state, current_state, std::string ("t"));
                    //}

                    if (buchiAutomata.InitialStates.Contains(state))
                    {
                        builder.setStartState(current_state);
                    }
                    //current_state_valid = true;
                    //}
                }
            }

            //s.AppendLine("Transitions");
            foreach (Transition transition in buchiAutomata.Transitions)
            {
                int from = builder.findOrAddState(transition.FromState);
                int to = builder.findOrAddState(transition.ToState);
                builder.addEdge(from, to, transition.labels);
            }

            // switch back to original APSet
            //result_nba.switchAPSet(ltl.getAPSet());

            //todo:
            //construct the NBA here

            return result_nba;
        }
Beispiel #13
0
        /**
         * Constructor
         * @param ltl The LTL formula
         * @param options the LTL2DSTAR options
         * @param sched a reference back to the scheduler
         */
        public LTL2DSTAR_Tree_Union(LTLFormula ltl, BuchiAutomata ba, LTL2DSTAR_Options options, LTL2DSTAR_Scheduler sched)
            : base(ltl, ba, options, sched)
        {
            _left_tree = null;
            _right_tree = null; //(0)

            _left = _ltl.getSubFormula(_ltl.getRootNode().getLeft());

            _right = _ltl.getSubFormula(_ltl.getRootNode().getRight());

            generateTree();
        }
        public static List<LocalPair> NextLocal(BuchiAutomata BA, IEnumerable<ConfigurationBase> steps, string BAState)
        {
            List<LocalPair> product = new List<LocalPair>(steps.Count() * BA.States.Length);

            //for (int i = 0; i < steps.Length; i++)
            foreach (var step in steps)
            {
                //ConfigurationBase step = steps[i];
                List<string> states = BA.MakeOneMove(BAState, step);

                for (int j = 0; j < states.Count; j++)
                {
                    product.Add(new LocalPair(step, states[j]));
                }
            }

            return product;
        }
Beispiel #15
0
        public AutomataBDD EncodeBA(BuchiAutomata buchi)
        {
            //
            string processVariableName = Model.GetNewTempVarName();
            this.model.AddLocalVar(processVariableName, 0, buchi.States.Length - 1);

            //
            this.stateIndexOfCurrentProcess = new Dictionary<string, int>();
            //collect the state index
            foreach (string state in buchi.States)
            {
                this.stateIndexOfCurrentProcess.Add(state, this.stateIndexOfCurrentProcess.Count);
            }

            AutomataBDD processAutomataBDD = new AutomataBDD();

            //Set variable
            processAutomataBDD.variableIndex.Add(this.model.GetVarIndex(processVariableName));

            //Set initial expression
            processAutomataBDD.initExpression = new BoolConstant(false);

            foreach (string initState in buchi.InitialStates)
            {
                processAutomataBDD.initExpression = Expression.OR(processAutomataBDD.initExpression,
                                                            Expression.EQ(new Variable(processVariableName),
                                                                            new IntConstant(this.stateIndexOfCurrentProcess[initState])));
            }

            //set acceptance expression
            processAutomataBDD.acceptanceExpression = new BoolConstant(false);
            foreach (string state in buchi.States)
            {
                if (state.EndsWith(Constants.ACCEPT_STATE))
                {
                    processAutomataBDD.acceptanceExpression = Expression.OR(processAutomataBDD.acceptanceExpression,
                                                            Expression.EQ(new Variable(processVariableName),
                                                                            new IntConstant(this.stateIndexOfCurrentProcess[state])));
                }
            }

            //Encode transition
            foreach (BA.Transition transition in buchi.Transitions)
            {
                List<CUDDNode> transitionBDDs = this.EncodeTransitionBA(transition, buchi.DeclarationDatabase, processVariableName);

                processAutomataBDD.transitionBDD.AddRange(transitionBDDs);
            }

            //
            return processAutomataBDD;
        }
Beispiel #16
0
 /**
  * Constructor
  * @param ltl The LTL formula
  * @param options the LTL2DSTAR options
  * @param sched a reference back to the scheduler
  */
 public LTL2DSTAR_Tree_Rabin(LTLFormula ltl, BuchiAutomata ba, LTL2DSTAR_Options options, LTL2DSTAR_Scheduler sched)
     : base(ltl, ba, options, sched)
 {
     _tree_normal = null;
     _tree_union = null;
     generateTree();
 }
 /** Check for partial stutter insensitiveness for a LTL formula.
  *  @param ltl the LTL formula
  *  @param llt2nba the LTL2NBA translator, has to provide function ltl2nba(ltl)
  */
 public void checkPartial(LTLFormula ltl, BuchiAutomata ba, LTL2DRA ltl2nba)
 {
     checkNBAs(ltl2nba.ltl2nba(ltl, ba), ltl2nba.ltl2nba(ltl.negate().toPNF(), ba));//true
 }
Beispiel #18
0
        /** Type of a vector over the children */
        //typedef std::vector<LTL2DSTAR_Tree*> child_vector;
        /**
         * Constructor
         * @param ltl The LTL formula
         * @param options the LTL2DSTAR options
         * @param sched a reference back to the scheduler
         */
        protected LTL2DSTAR_Tree(LTLFormula ltl, BuchiAutomata ba, LTL2DSTAR_Options options, LTL2DSTAR_Scheduler sched)
        {
            _ltl = ltl;
            buchiAutomata = ba;
            _options = options;
            _sched = sched;

            children = new List<LTL2DSTAR_Tree>();
        }
Beispiel #19
0
        /** The output format */
        //enum {OUT_v2, OUT_NBA, OUT_DOT, OUT_PLUGIN} flag_output;
        public static DRA ConvertBA2DRA(BuchiAutomata BA, Node LTLHeadNode)
        {
            /** Flag: Convert LTL->DRA->NBA? */
            //bool flag_dra2nba;

            /** Flag: Print the NBA afert LTL->NBA? */
            //bool flag_print_ltl_nba;

            /** Flag: Use limiting with scheduler? */
            bool flag_sched_limits;

            /** The limiting factor for the scheduler (alpha) */
            double alpha;

            /** The options for Safra's algorithm */
            Options_Safra opt_safra = new Options_Safra();

            /** The options for LTL2DSTAR */
            LTL2DSTAR_Options opt_ltl2dstar = new LTL2DSTAR_Options();

            opt_ltl2dstar.opt_safra = opt_safra;

            //            std::map<std::string, std::string> defaults;
            //defaults["--ltl2nba"]="--ltl2nba=spin:ltl2ba";
            //defaults["--automata"]="--automata=rabin";
            //defaults["--output"]="--output=automaton";
            //defaults["--detailed-states"]="--detailed-states=no";
            //defaults["--safra"]="--safra=all";
            //defaults["--bisimulation"]="--bisimulation=yes";
            //defaults["--opt-acceptance"]="--opt-acceptance=yes";
            //defaults["--union"]="--union=yes";
            //defaults["--alpha"]="--alpha=10.0";
            //defaults["--stutter"]="--stutter=yes";
            //defaults["--partial-stutter"]="--partial-stutter=no";
            ////      defaults["--scheck"]=""; // scheck disabled
            ///
            ///
            // default values...
            //flag_dra2nba = false;
            flag_sched_limits = false;

            alpha = 1.0;

            // options not yet covered
            //flag_print_ltl_nba = false;
            //flag_stat_nba = false;

            //if (isRabin)
            //{
            opt_ltl2dstar.automata = automata_type.RABIN;
            //}
            //else
            //{
            //    opt_ltl2dstar.automata = automata_type.STREETT;
            //}
            opt_safra.opt_all();
            opt_safra.stutter = false;
            opt_ltl2dstar.bisim = false;

            opt_safra.opt_rename = false;

            LTLFormula ltl = LTLPrefixParser.parse(LTLHeadNode);
            //APSet ap_set = ltl.getAPSet();

            //Debug.Assert(ltl2nba != null);
            LTL2DRA ltl2dra = new LTL2DRA(opt_safra); //, ltl2nba.get()

            //if (opt_ltl2dstar.automata == automata_type.ORIGINAL_NBA)
            //{
            //    // We just generate the NBA for the LTL formula
            //    // and print it

            //    NBA nba = ltl2dra.ltl2nba(ltl);
            //    if (nba == null)
            //    {
            //        throw new Exception("Can't generate NBA for LTL formula");
            //    }

            //    //if (flag_output==OUT_DOT) {
            //    //  nba->print_dot(out);
            //    //} else {
            //    //  nba->print_lbtt(out);
            //    //}
            //    //return 0;
            //}

            LTL2DSTAR_Scheduler ltl2dstar_sched = new LTL2DSTAR_Scheduler(ltl2dra, flag_sched_limits, alpha);

            //ltl2dstar_sched.flagStatNBA(flag_stat_nba);
            ltl2dstar_sched.flagStatNBA(false);

            opt_ltl2dstar.opt_safra = opt_safra;
            DRA dra = ltl2dstar_sched.calculate(ltl, BA, opt_ltl2dstar);

            //if (!dra.isCompact()) {
            //  dra.makeCompact();
            //}

            if (dra == null)
            {
                throw new Exception("Couldn't generate DRA!");
            }

            //if (!dra.isCompact()) {
            //  dra.makeCompact();
            //}

            return dra;
        }
Beispiel #20
0
 /**
  * Convert an LTL formula to an NBA using the specified LTL2NBA translator
  * @param ltl the formula
  * @param exception_on_failure if false, on error a null pointer is returned
  * @return a shared_ptr to the created NBA
  */
 public NBA ltl2nba(LTLFormula ltl, BuchiAutomata buchiAutomata)
 {
     return ltl2nba(ltl, buchiAutomata, false);
 }
Beispiel #21
0
        /**
         * Convert an LTL formula to a DRA.
         * @param ltl the LTL formula
         * @param options which operators are allowed
         * @return a shared_ptr to the DRA
         */
        private DRA ltl2dra(LTLFormula ltl, BuchiAutomata buchiAutomata,  LTL2DSTAR_Options options)
        {
            APSet ap_set = ltl.getAPSet();

            LTLFormula ltl_pnf = ltl.toPNF();

            if (options.allow_union && ltl_pnf.getRootNode().getType() == type_t.T_OR)
            {
                LTLFormula ltl_left = ltl_pnf.getSubFormula(ltl_pnf.getRootNode().getLeft());

                LTLFormula ltl_right = ltl_pnf.getSubFormula(ltl_pnf.getRootNode().getRight());

                LTL2DSTAR_Options rec_opt = options;
                rec_opt.recursion();

                DRA dra_left = ltl2dra(ltl_left, buchiAutomata, rec_opt);
                DRA dra_right = ltl2dra(ltl_right,buchiAutomata, rec_opt);

                return DRA.calculateUnion(dra_left, dra_right, _safra_opt.union_trueloop) as DRA;
            }

            if (options.safety)
            {
                LTLSafetyAutomata lsa = new LTLSafetyAutomata();

                DRA safety_dra = lsa.ltl2dra(ltl, buchiAutomata);

                if (safety_dra != null)
                {
                    return safety_dra;
                }
            }

            DRA dra = new DRA(ap_set);

            NBA nba = LTL2NBA.ltl2nba(ltl_pnf, buchiAutomata);

            if (nba == null)
            {
                throw new Exception("Couldn't create NBA from LTL formula");
            }

            NBA2DRA nba2dra = new NBA2DRA(_safra_opt);

            nba2dra.convert(nba, dra);

            if (options.optimizeAcceptance)
            {
                dra.optimizeAcceptanceCondition();
            }

            if (options.bisim)
            {
                DRAOptimizations dra_optimizer = new DRAOptimizations();
                dra = dra_optimizer.optimizeBisimulation(dra);
            }

            return dra;
        }
Beispiel #22
0
        public EventBAPairSafety[] Next(BuchiAutomata BA, ConfigurationBase[] steps)
        {
            EventBAPairSafety[] product = new EventBAPairSafety[steps.Length]; // * BA.States.Length);

            for (int i = 0; i < steps.Length; i++)
            {
                List<string> targetStates = new List<string>();

                foreach (string state in States)
                {
                    List<string> states = BA.MakeOneMove(state, steps[i]);
                    Ultility.Ultility.Union(targetStates, states);
                }

                product[i] = new EventBAPairSafety(steps[i], targetStates);
            }

            return product;
        }
Beispiel #23
0
        public static EventBAPairSafety GetInitialPairs(BuchiAutomata BA, ConfigurationBase initialStep)
        {
            List<string> intialBAStates = new List<string>();
            //List<string> existed = new List<string>();

            foreach (string s in BA.InitialStates)
            {
                List<string> next = BA.MakeOneMove(s, initialStep);

                foreach (string var in next)
                {
                    if (!intialBAStates.Contains(var))
                    {
                        //existed.Add(var);
                        intialBAStates.Add(var);
                    }
                }
            }

            return new EventBAPairSafety(initialStep, intialBAStates);
        }
 /** Check for partial stutter insensitiveness for a LTL formula, using an
  *  already calculated NBA.
  *  @param nba an NBA for the positive formula
  *  @param ltl_neg the negated LTL formula (in PNF)
  *  @param llt2nba the LTL2NBA translator, has to provide function ltl2nba(ltl)
  */
 public void checkPartial(NBA nba, BuchiAutomata ba, LTLFormula ltl_neg, LTL2DRA ltl2nba)
 {
     checkNBAs(nba, ltl2nba.ltl2nba(ltl_neg, ba));
 }
Beispiel #25
0
 /**
  * Constructor
  * @param ltl The LTL formula
  * @param options the LTL2DSTAR options
  * @param sched a reference back to the scheduler
  */
 public LTL2DSTAR_Tree_Streett(LTLFormula ltl, BuchiAutomata ba,
            LTL2DSTAR_Options options,
            LTL2DSTAR_Scheduler sched)
     : base(ltl, ba, options, sched)
 {
     generateTree();
 }
        /// <summary>
        /// Given one environment, get the initial states of the product of the system and the automata. Notice that the automata 
        /// is allowed to make one move first. This is necessary to check the very first state of the system. 
        /// </summary>
        /// <param name="initialStep"></param>
        /// <returns></returns>
        public static List<LocalPair> GetInitialPairsLocal(BuchiAutomata BA, ConfigurationBase initialStep)
        {
            List<LocalPair> toReturn = new List<LocalPair>();
            HashSet<string> existed = new HashSet<string>();

            foreach (string s in BA.InitialStates)
            {
                List<string> next = BA.MakeOneMove(s, initialStep);

                foreach (string var in next)
                {
                    if (existed.Add(var))
                    {
                        toReturn.Add(new LocalPair(initialStep, var));
                    }
                }
            }

            return toReturn;
        }
Beispiel #27
0
        /**
          * Generate a DRA/DSA for the LTL formula
          */
        public DRA calculate(LTLFormula ltl, BuchiAutomata ba, LTL2DSTAR_Options ltl_opt)
        {
            LTLFormula ltl_p = (ltl.toPNF());

            //if (ltl_opt.verbose_scheduler) {
            //  std::cerr << ltl_p->toStringInfix() << std::endl;
            //}

            LTL2DSTAR_Tree_Start root = new LTL2DSTAR_Tree_Start(ltl_p, ba, ltl_opt, this);

            //if (ltl_opt.verbose_scheduler) {
            //  root.printTree(std::cerr);
            //}

            root.calculate();

            DRA result = root._automaton;
            if (result != null)
            {
                result.setComment(root._comment); //+ getTimingInformation()
            }
            return result;
        }
Beispiel #28
0
        public virtual void SeteBAs(BuchiAutomata ba, BuchiAutomata positiveBA)
        {
            negationLTLBuchi = ba;

            //this is a safety
            if (!LivenessChecking.isLiveness(positiveBA))
            {
                //AssertType = AssertionType.LTLSafety;
                IsSafety = true;
                BA = positiveBA;
            }
            else
            {
                BA = ba;
            }
        }