Dm2 Ch4 Automata

38
Automata Nguyen An Khuong, Huynh Tuong Nguyen, Bui Hoai Thang Contents Motivation Alphabets, words and languages Regular expression or rationnal expression Non-deterministic finite automata Deterministic finite automata Recognized languages Determinisation 4.1 Chapter 4 Automata Discrete Mathematics II (Materials drawn from this chapter in: - Peter Linz. An Introduction to Formal Languages and Automata, (5th Ed.), Jones & Bartlett Learning, 2011. - John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullamn. Introduction to Automata Theory, Languages, and Computation (3rd Ed.), Prentice Hall, 2006. - Antal Iv´ anyi Algorithms of Informatics , Kempelen Farkas Hallgat´ oi Inform´ aci´osK¨ozpont,2011.) Nguyen An Khuong, Huynh Tuong Nguyen, Bui Hoai Thang Faculty of Computer Science and Engineering University of Technology, VNU-HCM

description

Automata

Transcript of Dm2 Ch4 Automata

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.1

    Chapter 4Automata

    Discrete Mathematics II

    (Materials drawn from this chapter in:- Peter Linz. An Introduction to Formal Languages and Automata, (5th Ed.),Jones & Bartlett Learning, 2011.- John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullamn. Introduction toAutomata Theory, Languages, and Computation (3rd Ed.), Prentice Hall,2006.

    - Antal Ivanyi Algorithms of Informatics, Kempelen Farkas Hallgatoi

    Informacios Kozpont, 2011. )

    Nguyen An Khuong, Huynh Tuong Nguyen, Bui Hoai ThangFaculty of Computer Science and Engineering

    University of Technology, VNU-HCM

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.2

    Contents

    1 Motivation

    2 Alphabets, words and languages

    3 Regular expression or rationnal expression

    4 Non-deterministic finite automata

    5 Deterministic finite automata

    6 Recognized languages

    7 Determinisation

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.3

    Introduction

    Standard states of a process in operating system

    O with label: states : transitions

    Waiting Blocked

    Running

    CPU

    Resource

    ResourceCPU

    Resource

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.4

    Why study automata theory?

    A useful modelfor many important kinds of software and hardware

    1 designing and checking the behaviour of digital circuits

    2 lexical analyser of a typical compiler: a compiler componentthat breaks the input text into logical units

    3 scanning large bodies of text, such as collections of Webpages, to find occurrences of words, phrases or other patterns

    4 verifying pratical systems of all types that have a finitenumber of distinct states, such as communications protocolsof protocols for secure exchange information, etc.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.5

    Alphabets, symbols

    Definition

    Alphabet (bng ch ci) is a finite and non-empty set ofsymbols (or characters).For example:

    = {a, b} The binary alphabet: = {0, 1} The set of all lower-case letters: = {a, b, . . . , z} The set of all ASCII characters.

    Remark

    is almost always all available characters (lowercase letters,capital letters, numbers, symbols and special characters such asspace or newline).But nothing prevents to imagine other sets.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.6

    Strings (words)

    Definition

    A string/word u (chui/t) over is a finite sequence (possiblyempty) of symbols (or characters) in .

    A empty string is denoted by . The length of the string, denoted by |u|, is the number ofcharacters.

    All the strings over is denoted by . A language L over is a sub-set of .

    Remark

    The purpose aims to analyze a string of in order to knowwhether it belongs or not to L.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.7

    Example

    Let = {0, 1}

    is a string with length of 0. 0 and 1 are the strings with length of 1. 00, 01, 10 and 11 are the strings with length of 2. is a language over . Its called the empty language. is a language over . Its called the universal language. {} is a language over . {0, 00, 001} is also a language over . The set of strings which contain an odd number of 0 is a languageover .

    The set of strings that contain as many of 1 as 0 is a languageover .

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.8

    String concatenation

    Intuitively, the concatenation of two strings 01 and 10 is 0110.Concatenating the empty string and the string 110 is the string110.

    Definition

    String concatenation is an application of to .Concatenation of two strings u and v in is the string u.v.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.9

    Languages

    Specifying languages

    A language can be specified in several ways:

    a) enumeration of its words, for example:

    L1 = {, 0, 1}, L2 = {a, aa, aaa, ab, ba}, L3 = {, ab, aabb, aaabbb, aaaabbbb, . . .},

    b) a property, such that all words of the language have this propertybut other words have not, for example:

    L4 = {anbn|n = 0, 1, 2, . . .}, L5 = {uu1|u }, L6 = {u {a, b}|na(u) = nb(u)} where na(u) denotes thenumber of letter a in word u.

    c) its grammar, for example:

    Let G = (N,T, P, S) whereN = {S}, T = {a, b}, P = {S aSb, S ab}i.e. L(G) = {anbn|N 1} sinceS aSb a2Sb2 . . . anSbn

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.10

    Operations on languages

    L, L1, L2 are languages over

    unionL1 L2 = {u | u L1 or u L2},

    intersectionL1 L2 = {u | u L1 and u L2},

    differenceL1 \ L2 = {u | u L1 and u 6 L2},

    complementL = \ L,

    multiplicationL1L2 = {uv | u L1, v L2},

    powerL0 = {}, Ln = Ln1L , if n 1,

    iteration or star operationL =

    i=0

    Li = L0 L L2 Li ,

    We will use also the notation L+

    L+ =i=1

    Li = L L2 Li .The union, product and iteration are called regular operations.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.11

    Example

    Let = {a, b, c} and L = {ab, aa, b, ca, bac}L2 = u.v, with u, v L including the following strings: abab, abaa, abb, abca, abbac, aaab, aaaa, aab, aaca, aabac, bab, baa, bb, bca, bbac, caab, caaa, cab, caca, cabac, bacab, bacaa, bacb, bacca, bacbac.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.12

    Exercise

    Let = {a, b, c}Give at least 3 strings for each of the following languages

    1) all strings with exactly one a.

    2) all strings of even length.

    3) all strings which the number of appearances of b is divisible by 3.

    4) all strings ending with a.

    5) all strings not ending with a.

    6) all non-empty strings not ending with a.

    7) all strings with at least one a.

    8) all strings with at most one a.

    9) all strings without any a.

    10) all strings including at least one a and whose the first appearanceof a is not followed by a c.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.13

    Exercise

    Let = {a, b, c} and L = {ab, aa, b, ca, bac}Which of the following strings are in L:

    1) aaa = a3,

    2) abaabaaabaa = aba2ba3ba2,

    3) bbb,

    4) aab,

    5) cc,

    6) aaaabaaaa = a4ba4,

    7) cabbbbaaaaaaaaab = cab3a9b,

    8) baaaaabaaaab = ba5ba4b,

    9) baaaaabaac = ba5ba2c,

    10) baca ?.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.14

    Regular expressions

    Regular expressions (biu thc chnh quy)

    Permit to specify a language with strings consist of letters and ,parentheses (), operating symbols +, ., . This string can beempty, denoted .

    Regular operations on the languages

    union or + product of concatenation transitive closure

    Example

    (a+ b) represent all the strings over the aphabet = {a, b} a(ba) represent the same language (a+ b)aab represent all strings ending with aab.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.15

    Regular expressions

    is a regular expression representing the empty language. is a regular expression representing language {}. If a , then a is a regular expression representing language {a}. If x, y are regular expressions representing languages X and Yrespectively, then (x+ y), (xy), x are regular expressionrepresenting languages X

    Y , XY and X respectively.

    x+ y y + x(x+ y) + z x+ (y + z)

    (xy)z x(yz)(x+ y)z xz + yzx(y + z) xy + xz

    (x+ y) (x + y) (x+ y) (x + y)(x+ y) (xy)

    (x) xxx xx

    xx + x

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.16

    Regular expressions

    Kleenes theorem

    Language L is regular if and only if there exists a regularexpression over representing language L.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.17

    Exercise

    Let = {a, b, c}Give at least 3 words for each language represented by thefollowing regular expressions

    1) a + b,

    2) ab+ ba,

    3) b(ca+ ac)(aa) + a(a+ b),

    4) (ab+ ba).

    Example

    ab = {b, ab, a2b, a3b, . . . , aaa . . . ab},

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.18

    Exercise

    Let = {a, b, c} and L = {ab, aa, b, ca, bac}Which languages represented by the following regular expressionsare in L:

    1) a + b,

    2) b,

    3) aab+ cabac,

    4) b(ca+ ac)(aa) + a(a+ b),

    5) (aaaabaaa)2c,

    6) b+ac (b+ = bb),

    7) (b+ c)ab+ (ba(c+ ab2 + a3 + a4 + b))?

    Define a (simple) regular expression representing the language L.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.19

    Finite automata

    Finite automata (tmat hu hn)

    The aim is representation of a process system. It consists of states (including an initial state and one orseveral (or one) final/accepting states) and transitions(events).

    The number of states must be finite.

    q0 q1

    ba, b

    Regular expression

    b(a+ b)

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.20

    Exercise

    Let = {a, b}Which of the strings

    1) a3b,

    2) aba2b,

    3) a4b2ab3a,

    4) a4ba4,

    5) ab4a9b,

    6) ba5ba4b,

    7) ba5b2,

    8) bab2a?

    are accepted by the following finite automata?

    q0 q1 q2

    a

    b

    a

    b

    a

    b

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.21

    Exercise

    Give regular expression for the following finite automata.

    q0 q1 q2

    a

    b

    a

    b

    a

    b

    and this one.

    q0 q1

    ba, b

    b

    a

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.22

    Nondeterministic finite automata

    Definition

    A nondeterministic finite automata (NFA, tmat hu hn phin nh) is mathematically represented by a 5-tuples(Q,, q0, , F ) where

    Q a finite set of states. is the alphabet of the automata. q0 Q is the initial state. : Q Q is a transition function. F Q is the set of final/accepting states.

    Remark

    According to an event, a state may go to one or more states.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.23

    NFA with empty symbol

    Other definition of NFA

    Finite automaton with transitions defined by character x (in ) orempty character .

    q0 q1 q2

    b

    a

    b

    a, b

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.24

    Exercise

    Consider the set of strings on {a, b} in which every aa is followedimmediately by b.For example aab, aaba, aabaabbaab are in the language,but aaab and aabaa are not.Construct an accepting NFA.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.25

    Exercise

    Let = {a, b, c}Construct an accepting finite automata for languages representedby the following regular expressions.

    E1 = a + b, E2 = b, E3 = aab+ cabac, E4 = b(ca+ ac)(aa) + a(a+ b), E5 = (aaaabaaa)2c, E6 = b+ac (b+ = bb), E7 = (b+ c)ab+ (ba(c+ ab2 + a3 + a4 + b)), E8 = [a(b+ c)abc].

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.26

    Deterministic finite automata

    Definition

    A deterministic finite automata (DFA, tmat hu hn n nh)is given by a 5-tuplet (Q,, q0, , F ) with

    Q a finite set of states. is the input alphabet of the automata. q0 Q is the initial state. : Q Q is a transition function. F Q is the set of final/accepting states.

    Condition

    Transition function is an application.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.27

    Example

    Let = {a, b}Hereinafter, a deterministic and complete automata thatrecognizes the set of strings which contain an odd number of a.

    q0 q1

    b

    a

    b

    a

    Q = {q0, q1}, (q0, a) = q1, (q0, b) = q0, (q1, a) = q0, (q1, b) = q1, F = {q1}.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.28

    Configurations and executions

    Let A = (Q,, q0, , F )

    A configuration (cu hnh) of automata A is a couple (q, u) whereq Q and u .We define the relation of derivation between configurations :(q, a.u) (q, u) iif (q, a) = q

    An execution (thc thi) of automata A is a sequence ofconfigurations(q0, u0) . . . (qn, un) such that(qi, ui) (qi+1, ui+1), for i = 0, 1, . . . , n 1.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.29

    Exercise

    Soit = {0, 1}

    Give an automaton that accepts all words that contain a numberof 0 multiple of 3.

    Give an execution of this automata on 1101010.

    Soit = {a, b}

    Give an automata that accepts all strings containing 2 charactersa.

    Give an execution of this automata on aabb, ababb and bbaa.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.30

    Recognized languages

    Definition

    A language L over an alphabet , defined as a sub-set of , isrecognized if there exists a finite automata accepting all strings ofL.

    Proposition

    If L1 and L2 are two recognized languages, then

    L1 L2 and L1 L2 are also recognized; L1.L2 and L1 are also recognized.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.31

    Example

    Sub-string ab

    Construct a DFA that recognizes the language over the alphabet{a, b} containing the sub-string ab.

    Regular expression

    (a+ b)ab(a+ b)

    Transition table

    a b q0 q1 q0q1 q1 q2q2 q2 q2

    Automata

    q0 q1 q2

    b

    a

    a

    b

    a, b

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.32

    Example

    Determine build a DFA that recognizes the language over thealphabet {a, b} with an even number of a and an even number b.

    Automata

    q0 q1

    q2 q3

    b

    a

    b

    aa

    b

    a

    b

    Transition table

    a b q0 q2 q1q1 q3 q0q2 q0 q3q3 q1 q2

    : start state: final state(s)

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.33

    Equivalent automatons

    Two following DFAs are equivalent?

    q0

    q1 q2

    bb

    a

    a

    a

    b

    p0

    p1 p2

    p3

    bb

    a

    a

    b

    a a

    a

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.34

    Equivalent automatons

    Two following DFAs are equivalent?

    q0

    q1 q2

    ab

    a

    a

    a

    b

    p0

    p1 p2

    p3

    bb

    a

    a

    b

    a a

    a

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.35

    From NFA to DFA

    Given a NFA

    0 1

    2

    b ba

    a

    Transition table

    a b {0} {1} {0}{1} {0, 2} {1}{0, 2} {1} {0, 2}

    Corresponding DFA

    {0} {1}

    {0, 2}

    b b

    b

    a

    aa

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.37

    Exercise

    Let = {a, b, c}Determine DFAs which corresponds to the following NFAs:

    0 1

    b, c b, c

    a,

    0 1 2a b

    c,

    0 1 2

    a b, c

    b,

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.38

    Exercise

    Let = {a, b, c}Determine finite automata, not necessarily deterministic,recognizing the following languages:

    L1 = {a, ab, ca, cab, acc}, L2 = { set of words of even number of a}, L3 = { set of words containing ab and ending with b}.

    Then, determine the corresponging DFAs.

  • Automata

    Nguyen An Khuong,Huynh Tuong Nguyen,

    Bui Hoai Thang

    Contents

    Motivation

    Alphabets, words andlanguages

    Regular expression orrationnal expression

    Non-deterministicfinite automata

    Deterministic finiteautomata

    Recognized languages

    Determinisation

    4.39

    Exercise

    Let = {a, b, c}Construct accepting DFAs for languages represented by thefollowing regular expressions.

    E1 = a + b, E2 = b, E3 = aab+ cabac, E4 = b(ca+ ac)(aa) + a(a+ b), E5 = (aaaabaaa)2c, E6 = b+ac (b+ = bb), E7 = (b+ c)ab+ (ba(c+ ab2 + a3 + a4 + b)), E8 = [a(b+ c)abc].

    MotivationAlphabets, words and languagesRegular expression or rationnal expressionNon-deterministic finite automataDeterministic finite automataRecognized languagesDeterminisation