示例#1
0
        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));
        }
        /**
         * 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();
        }
        /**
         * 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();
        }
示例#4
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);
        }
示例#5
0
        private void GenerateDRAGraph(bool isRabin)
        {
            try
            {
                EnableDisableUI(false);

                string ltl = TextBox_Prop.Text;
                if (!isRabin)
                {
                    ltl = "! " + ltl;
                }
                BuchiAutomata BA          = LTL2BA.FormulaToBA(ltl, options, new CommonToken(0, ""));
                ltl2ba.Node   LTLHeadNode = LTL2BA.ParseLTL(ltl, options, new CommonToken(0, ""));

                timer.Reset();
                timer.Start();
                bool islive = LivenessChecking.isLiveness(BA);
                timer.Stop();

                this.Label_IsSafety.Tag = timer.Elapsed.TotalSeconds;

                if (!islive)
                {
                    //this.Label_IsSafety.Text = "The formula is a safety property (checked in " + timer.Elapsed.TotalSeconds + "s).";
                    this.Label_IsSafety.Text = string.Format(Resources.The_formula_is_a_safety_property__checked_in__0__s__, timer.Elapsed.TotalSeconds);
                }
                timer.Reset();
                timer.Start();
                DRA dra = BA2DRAConverter.ConvertBA2DRA(BA, LTLHeadNode);
                timer.Stop();

                gViewer.Graph    = dra.AutomatonToDot();
                gViewer.AutoSize = true;

                this.StatusLabel_Status.Tag = timer.Elapsed.TotalSeconds;

                if (isRabin)
                {
                    this.StatusLabel_Status.Text = string.Format(Resources.Rabin_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2_s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds);
                }
                else
                {
                    this.StatusLabel_Status.Text = string.Format(Resources.Streett_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2_s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds);
                }
                StatusLabel_Accept.Visible = false;

                if (this.TextBox_Prop.Items.Contains(TextBox_Prop.Text))
                {
                    this.TextBox_Prop.Items.Add(TextBox_Prop.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Resources.The_input_LTL_is_not_correct__ + ex.Message, PAT.Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            EnableDisableUI(true);
        }
        /** 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>();
        }
示例#7
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;
 }
示例#8
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);
        }
示例#9
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>
        }
示例#10
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();
        }
示例#11
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);
        }
示例#12
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;
            }
        }
示例#13
0
        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);
        }
示例#14
0
        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);
        }
示例#15
0
        private void Button_Generate_Click(object sender, System.EventArgs e)
        {
            try
            {
                EnableDisableUI(false);
                timer.Reset();
                timer.Start();
                BuchiAutomata BA = LTL2BA.FormulaToBA(TextBox_Prop.Text, options, new CommonToken(0, ""));
                timer.Stop();

                gViewer.Graph    = LTL2BA.AutomatonToDot(BA);
                gViewer.AutoSize = true;

                //this.StatusLabel_Status.Text = "Büchi Automata Generated with " + (gViewer.Graph.NodeCount - 1) + " Nodes " + (gViewer.Graph.EdgeCount - 1) + " Edges (checked in " + timer.Elapsed.TotalSeconds + "s).";
                this.StatusLabel_Status.Text = string.Format(Resources.Büchi_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2__s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds);
                this.StatusLabel_Status.Tag  = timer.Elapsed.TotalSeconds;


                timer.Reset();
                timer.Start();
                bool islive = LivenessChecking.isLiveness(BA);
                timer.Stop();

                this.Label_IsSafety.Tag = timer.Elapsed.TotalSeconds;

                if (!islive)
                {
                    this.Label_IsSafety.Text = string.Format(Resources.The_formula_is_a_safety_property__checked_in__0__s__, timer.Elapsed.TotalSeconds);
                }

                if (this.TextBox_Prop.Items.Contains(TextBox_Prop.Text))
                {
                    this.TextBox_Prop.Items.Add(TextBox_Prop.Text);
                }

                StatusLabel_Accept.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Resources.The_input_LTL_is_not_correct__ + ex.Message, PAT.Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            EnableDisableUI(true);
        }
示例#16
0
        /// <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);
        }
示例#17
0
        private AssertionBase createLTLAssertion(AssertionExpr assertion, string options)
        {
            Spec.ExecProcessDatabase.TryGetValue(assertion.Target, out DefinitionRef execProc);
            ADLAssertionLTL assertLTL = null;

            if (execProc != null)
            {
                String ltl = assertion.Expression.Trim();
                // Update LTL state
                if (ltl.IndexOf(".") != -1)
                {
                    ltl = ltl.Replace('.', '_');
                }


                // create ADLAssertionLTL
                assertLTL = new ADLAssertionLTL(execProc, ltl);
                BuchiAutomata PositiveBA = LTL2BA.FormulaToBA(ltl, options, null);
                // default to false for x operator U X V T F R  NOT SUPPORTED for now
                bool hasXoperator = false;
                PositiveBA.HasXOperator = hasXoperator;
                if (!LivenessChecking.isLiveness(PositiveBA))
                {
                    assertLTL.SeteBAs(null, PositiveBA);
                }
                else
                {
                    BuchiAutomata BA = LTL2BA.FormulaToBA("!(" + ltl + ")", options, null); //.Replace(".", Ultility.Ultility.DOT_PREFIX)
                    BA.HasXOperator = hasXoperator;
                    assertLTL.SeteBAs(BA, PositiveBA);
                }
            }
            else
            {
                throw new Exception("Unknown target process for assertion");
            }

            return(assertLTL);
        }
示例#18
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);
        }
示例#19
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);
        }
示例#20
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);
        }
示例#21
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));
        }
 /** 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
 }
        /** 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));
        }
示例#24
0
        public ModelCheckingForm1(string Name, SpecificationBase spec, bool UseFairness)
        {
            ModelCheckingFormInstance = this;
            InitializeComponent();

            InitializeResourceText();

            this.Spec = spec;
            //timer = new Stopwatch();

            int Index = 1;

            foreach (KeyValuePair <string, AssertionBase> entry in Spec.AssertionDatabase)
            {
                ListViewItem item = new ListViewItem(new string[] { "", Index.ToString(), entry.Key });

                //remember the type of the assertion
                item.Tag = entry.Value.AssertionType;

                //if the assertion is LTL, the button of the view BA should be enabled.
                if (entry.Value is AssertionLTL)
                {
                    BuchiAutomata BA = (entry.Value as AssertionLTL).BA;

                    if (BA != null)
                    {
                        if (BA.HasXOperator)
                        {
                            item.SubItems[0].Tag = true;
                        }
                    }
                }

                //if (entry.Value is AssertionLTLSafety)
                //{
                //    BuchiAutomata BA = (entry.Value as AssertionLTLSafety).BA;

                //    if (BA != null)
                //    {
                //        if (BA.HasXOperator)
                //        {
                //            item.SubItems[0].Tag = true;
                //        }
                //    }
                //}


                //set the question mark image
                item.ImageIndex = 2;

                this.ListView_Assertions.Items.Add(item);
                Index++;
            }

            ////select the first assertion
            //if (this.ListView_Assertions.Items.Count > 0)
            //{
            //    this.ListView_Assertions.Items[0].Selected = true;
            //}


            if (Name != "")
            {
                this.Text = this.Text + " - " + Name;
            }

            this.StatusLabel_Text.Text = Resources.Select_an_assertion_to_start_with;

            ComboBox_Fairness.SelectedIndex = 0;

            //if there is no fair events in the system, then remove the "Fairness Label Only" entry.
            //if(!spec.HasFairEvent)
            //{
            //    ComboBox_Fairness.Items.RemoveAt(1);
            //}

            if (!UseFairness)
            {
                this.ComboBox_Fairness.Visible = false;
                this.Label_Fairness.Visible    = false;
            }

            this.CheckBox_BDD.Visible = false;
        }