MELJUN CORTES automata theory

31
MELJUN CORTES MELJUN CORTES

Transcript of MELJUN CORTES automata theory

MELJUN CORTESMELJUN CORTES

Automata are abstract mathematical models of machines that perform computations on an input by moving through a series of states or configurations.

Automaton

An automaton is represented formally by the 5-tuple of elements {Q,Σ,δ,q0,A}, where:

▪ Q is a finite set of states.

▪ Σ is a finite set of symbols.

Automaton

An automaton is represented formally by the 5-tuple of elements {Q,Σ,δ,q0,A}, where:

▪ δ is the transition function.

▪ q0 is the start state, where q0 Q.∈

▪ A is a set of states of Q (i.e. A Q) called ⊆ accept states.

Input word

An automaton reads a finite string of symbols a1,a2,...., an , where ai Σ, which is called a ∈ input word.

Accepting word

A word w Σ* is accepted by the automaton if ∈qn A.∈

Run

A run of the automaton on an input word w = a1,a2,...., an Σ*, is a sequence of states q∈ 0,q1,q2,...., qn, where qi Q such that q∈ 0 is the start state and qi = δ(qi-1,ai) for 0 < i ≤ n.

A finite automaton (FA) is a simple idealized machine used to recognize patterns within input taken from some character set (or alphabet) C.

A finite automaton consists of:

a finite set S of N states a special start state a set of final (or accepting) states a set of transitions T from one state to another,

labeled with chars in C

As noted above, we can represent a FA graphically, with nodes for states, and arcs for transitions.

We execute our FA on an input sequence as follows: Begin in the start state If the next input char matches the label on a

transition from the current state to a new state, go to that new state

Continue making transitions on each input char▪ If no move is possible, then stop▪ If in accepting state, then accept

It is a finite state machine which accepts the word "nice". In this FSM the only accepting state is number 7.

For each input symbol in Σ, there is exactly one transition of each state (possibly back to the state itself).

It do not accept empty strings.

A deterministic finite automaton (DFA) consists of

A finite set of states (often denoted Q) A finite set Σ of symbols (alphabet) A transition function that takes as argument a

state and a symbol and returns a state (often denoted δ)

A start state often denoted q0 A set of final or accepting states (often denoted F)

We have q0 Q and F Q∈ ⊆

So a DFA is mathematically represented as a 5-uple (Q, Σ, δ, q0, F )

The transition function δ is a function in Q × Σ Q→ Q × Σ is the set of 2-tuples (q, a) with q Q and a ∈ ∈

Σ

How to present a DFA? With a transition table

How to present a DFA? With a transition table

Inputs

0 1

How to present a DFA? With a transition table

Inputs States

0 1

q0

q1

q2

How to present a DFA? With a transition table

The indicates the →start state

0 1

q0

q1

q2

How to present a DFA? With a transition table

The indicates the →start state

The indicates the ∗final state(s)

0 1

q0

q1

* q2

How to present a DFA? With a transition table

δ (q0,0) = q1

δ (q0,0) = q0

0 1

q0 q1 q0

q1

* q2

How to present a DFA? With a transition table

δ (q0,0) = q1

δ (q0,0) = q0

δ (q1,0) = q2

δ (q1,0) = q1

0 1

q0 q1 q0

q1 q2 q1

* q2

How to present a DFA? With a transition table

δ (q0,0) = q1

δ (q0,0) = q0

δ (q1,0) = q2

δ (q1,0) = q1

δ (q2,0) = q2

δ (q2,0) = q2

0 1

q0 q1 q0

q1 q2 q1

* q2 q2 q2

Construct a DFA that accepts the language

L = {010, 1}

( Σ = {0, 1} )

Construct a DFA that accepts the language

L = {010, 1}

( Σ = {0, 1} )

Set of all strings over {0,1} where 1 is always even.

Set of all strings over {0,1} where 1 is always even.

Set of all strings over {0,1} where 1 is always odd.

Set of all strings over {0,1} where 1 is always odd.