Example #1
0
        public void Step(MonitoredState state)
        {
            if (currentNegative == null | currentPositive == null)
                return;

            var successors = positiveNFA.Post (currentPositive, (l, t) => state.Evaluate (l.LiteralSet));
            if (successors.Count () == 1) {
                currentPositive = successors.Single ();

            } else if (successors.Count () == 0) {
                // There is no way to satisfy the formula
                currentPositive = null;
                Status = MonitorStatus.False;
                return;

            } else {
                throw new NotImplementedException ("Non deterministic automaton not supported.");
            }

            successors = negativeNFA.Post (currentNegative,(l, t) => state.Evaluate (l.LiteralSet));
            if (successors.Count () == 1) {
                currentNegative = successors.Single ();

            } else if (successors.Count () == 0) {
                // There is no way to dissatisfy the formula
                currentNegative = null;
                Status = MonitorStatus.True;
                return;

            } else {
                throw new NotImplementedException ("Non deterministic automaton not supported.");
            }

            UpdateStatus ();
        }
Example #2
0
        public LTLMonitor(ITLFormula formula)
        {
            var tpositiveNFA = translator.GetBuchiAutomaton (formula).ToNFA();
            var tnegativeNFA = translator.GetBuchiAutomaton (formula.Negate ()).ToNFA();

            positiveNFA = tpositiveNFA.Determinize ();
            negativeNFA = tnegativeNFA.Determinize ();

            currentNegative = negativeNFA.InitialNode;
            currentPositive = positiveNFA.InitialNode;

            UpdateStatus ();
        }