Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lecture9a_FSM.doc
Скачиваний:
3
Добавлен:
19.11.2019
Размер:
5.49 Mб
Скачать

Mathematical model

In accordance to the general classification, the following formal definitions are found:

  • A deterministic finite state machine or acceptor deterministic finite state machine is a quintuple (Σ,S, ,δ,F), where:

    • Σ is the input alphabet (a finite, non-empty set of symbols).

    • S is a finite, non-empty set of states.

    • is an initial state, an element of S.

    • δ is the state-transition function: (in a nondeterministic finite state machine it would be , ie., δ would return a set of states).

    • F is the set of final states, a (possibly empty) subset of S.

For both deterministic and non-deterministic FSMs, it is conventional to allow δ to be a partial function, i.e. δ(q,x) does not have to be defined for every combination of and . If an FSM M is in a state q, the next symbol is x and δ(q,x) is not defined, then M can announce an error (i.e. reject the input).

  • A finite state transducer is a sextuple (Σ,Γ,S, ,δ,ω), where:

    • Σ is the input alphabet (a finite non empty set of symbols).

    • Γ is the output alphabet (a finite, non-empty set of symbols).

    • S is a finite, non-empty set of states.

    • is the initial state, an element of S. In a Nondeterministic finite state machine, is a set of initial states.

    • δ is the state-transition function: .

    • ω is the output function.

If the output function is a function of a state and input alphabet ( ) that definition corresponds to the Mealy model, and can be modelled as a Mealy machine. If the output function depends only on a state ( ) that definition corresponds to the Moore model, and can be modelled as a Moore machine. A finite-state machine with no output function at all is known as a semiautomaton or transition system.

To understand how to avoid the common pitfalls in statechart designs, let's first review the basic components in Quantum Framework (QF) and the extension that can better support orthogonal regions. QF is one of the few source-level statechart frameworks available today. It was introduced by Miro Samek in his book Practical Statecharts in C/C++. The fundamental statechart engine in QF is called QHsm, where HSM stands for hierarchical state machine. This class is abstract and is inherited by concrete state machines. It provides a public interface for dispatching events to state-handler methods and for checking the current state.

To integrate an execution context into a state machine, QActive is derived from QHsm to aggregate a thread and an event queue. An instance of QActive is called an active object. In the original QF, there's only one event queue per active object. As an extension to QF, QActiveExt is derived from QActive to include a second queue, called the internal event queue. To distinguish it from the original queue, we call the original queue the main event queue. The use of internal events in statecharts isn't new and a similar idea has been suggested.

Orthogonal regions In the Unified Modeling Language, or UML (www.omg.org), orthogonal regions are concurrent substates in a composite state.4 The QHsm and QActive classes don't support orthogonal regions. However, with the use of object composition, it's possible to support certain features of orthogonal regions explicitly. In Figure 3, the active object comprises m state-machine objects, each modeling an orthogonal region.

In computer science, a thread of execution results from a fork of a computer program into two or more concurrently running tasks. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources.

In the theory of computation, a deterministic finite state machine (also known as deterministic finite state automaton (DFSA) or deterministic finite automaton (DFA) ) is a finite state machine where for each pair of state and input symbol there is one and only one transition to a next state. DFAs recognize the set of regular languages and no other languages.

A DFA will take in a string of input symbols. For each input symbol it will then transition to a state given by following a transition function. When the last input symbol has been received it will either accept or reject the string depending on whether the DFA is in an accepting state or a non-accepting state.

В теории вычислений детерминистический конечный автомат (также известный как deterministic finite state automaton (DFSA) или deterministic finite automaton (DFA) является таким конечным автоматом, в котором для каждой пары состояний и входного символа имеется только один переход в следующее состояние. Конечные автоматы DFA признают только определенный набор регулярных языков и никаких других языков.

Автомат DFA принимает строку (последовательность) входных символов. Для каждого входного символа затем последует переход в состояние, который обеспечивается функцией перехода. После получения последнего символа он (автомат) примет или отвергнет

Строку в зависимости от того состояния, в котором находится автомат DFA - поглощающем состоянии конечного автомата или непоглощающем состоянии.

A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of (автомат DFA имеет 5-ти кортежную группу взаимосвязанных элементов данных или записей), которая включает):

  • a finite set of states (S) (конечный набор состояний - (S));

  • a finite set called the alphabet (Σ) – (конечный набор, называемый алфавитом (Σ));

  • a transition function (T : S × Σ → S) - (функция перехода T : S × Σ → S);

  • a start state (sS) (начальное состояние s S);

  • a set of accept states (AS) (набор поглощающих состояний AS).

Let M be a DFA such that M = (S, Σ, T, s, A), and be a string over the alphabet Σ.

Пусть М – это автомат DFA, причем M = (S, Σ, T, s, A) и - строка над алфавитом Σ.

M accepts the string X if a sequence of states, , exists in S with the following conditions (М поглощает (принимает) строку Х при условии, что последовательность состояний существует в S при следующих условиях):

  1. for

  2. rnA.

As shown in the first condition, the machine starts in the start state s. The second condition says that given each character of string X, the machine will transition from state to state according to the transition function T. The last condition says that the machine accepts X if the last input of X causes the machine to halt in one of the accepting states. Otherwise, it is said to reject the string. The set of strings the DFA accepts form a language, which is the language the DFA recognizes.

A DFA without a list of accept states and without a designated starting state is known as a transition system or semi-automaton.

Как следует из 1-го условия, автомат начинает работу с начального состояния .

2-е условие указывает на то, что для данного каждого символа строки Х автомат перейдет из одного состояния в другое согласно функции перехода.

Последнее условие указывает, что автомат поглощает Х, если последний ввод строки Х вынуждает автомат останавливаться в одном из поглощающих состояний.

В противном случае указывается, что автомат отвергает строку.

Набор строк, которые принимает DFA, образуют язык, который является языком, который DFA признает.

DFA без списка поглощающих состояний и без назначенного начального состояния называется переходной системой или полуавтоматом.

Example (пример)

The following example is of a DFA M, with a binary alphabet, which requires that the input contains an even number of 0s. Следующий пример является автоматом М DFA с двоичным алфавитом и четным числом 0 (нулей).

The state diagram for M (диаграмма состояний М)

M = (S, Σ, T, s, A) where (где):

  • S = {S1, S2},

  • Σ = {0, 1},

  • s = S1,

  • A = {S1}, and

  • T is defined by the following state transition table (Т определяется следующей таблицей перехода состояний):

The state S1 represents that there has been an even number of 0s in the input so far, while S2 signifies an odd number. A 1 in the input does not change the state of the automaton. When the input ends, the state will show whether the input contained an even number of 0s or not. If the language did contain an even number of 0s, M will finish in state S1, an accepting state, so the input string will be accepted.

The language of M is the regular language given by the regular expression (1*(0(1)*0)*)*

Состояние S1 представляет собой четное число нулей (0) входе до настоящего времени, в то время как S2 означает нечетное число. Единица (1) на входе не изменяет состояние автомата. Когда прекращается входной сигнал, состояние будет указывать на то, содержал ли входной сигнал четное число нулей или нет.

Если язык содержал четное число нулей, М закончится в состоянии S1, поглощающем состоянии, таким образом входная строка будет принята.

Язык М является регулярным языком, (языком с регулярной структурой), который задается регулярным выражением (1*(0(1)*0)*)*.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]