# Bina Nusantara Finite Automata II (FA) Pertemuan 24: Mata kuliah:K0144/ Matematika Diskrit Tahun:2008.

## Presentation on theme: "Bina Nusantara Finite Automata II (FA) Pertemuan 24: Mata kuliah:K0144/ Matematika Diskrit Tahun:2008."— Presentation transcript:

Bina Nusantara Finite Automata II (FA) Pertemuan 24: Mata kuliah:K0144/ Matematika Diskrit Tahun:2008

Bina Nusantara Learning Outcomes Mahasiswa dpt membandingkan berbagai bentuk algoritma FA untuk suatu ekspresi/Syntax program agar dapat dianalisis diterima/ditolak..

Bina Nusantara Outline Materi: FA sebagai model komputasi Gambaran FA dgn digraph Definisi formal Analisis FA NFA Aplikasi state transduser

Bina Nusantara Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only one transition of the following form occurs: q’  sp b a q > b a r b a t ba ab

Bina Nusantara Expressiveness of DFA DFA are a type of programs Contains concepts of imperative languages: sequences, branching and loops. Can implement a newspaper vendor machine (see Page 20 of the book) Can implement pattern matching: find all text containing “Britney Spears” Can only implement programs that require a constant amount of memory (or “Justin Timberlake”)

Bina Nusantara Another Example sq b a b a r a b q b a a r > sq a r a b q a b b r > L(A) is the set of all strings having 2 consecutive a’s A B L(B) is the set of all strings having 2 consecutive b’s

Bina Nusantara Nondeterministic Finite Automata s q b a r a b q b a a r > a q r b q’ b a b r’ a Automaton accepting strings containing 2 a’s or 2 b’s Deterministic?

Bina Nusantara Nondeterministic Finite Automata (NFA) For every state q in S and every character  in , one of the following will happen: qq’  No transition: occurs One or more transition:qq’  occurs p  …

Bina Nusantara Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called states  is a finite input alphabet s  Q called the initial state F  Q called the favorable states   Q × (  × {e}) × Q

Bina Nusantara Nondeterministic Finite Automata (NFA) What else can occur in NFAs? qq’ e “the empty string” If we start with the configuration (q,aaabbb) and apply this transition, what is the resulting configuration? (q’, aaabbb) “e-transitions” do not process any characters, they just allow to “jump” between states

Bina Nusantara String Accepted by NFA Given an NFA A = (Q, , ,s,F), and a string w   *, we say that w is accepted by A if at least one of the configurations yielded by (s,w) is a configuration of the form (f,e) with f a favorable state What is the language accepted by an NFA? L(A) = {w   * : w is accepted by A}

Bina Nusantara Example sq r q b r > b a b

Bina Nusantara Example # 2 s q b a r a b q b a a r > a q r b q’ b a b r’ a

Bina Nusantara NFA vs DFA Are deterministic automata, nondeterministic? The oracle explanation of NFAs: there is an oracle that always makes the right choice Suppose that while processing a configuration (r,w) only by going to state p, a favorable state can be reached. Then, the oracle will choose p Is the oracle explanation compatible with our definition of acceptability in NFAs? p r a q e

Bina Nusantara NFA vs DFA (2) Are NFAs more powerful than DFAs? (i.e., are there languages that can be recognized by NFAs but not by DFAs) sq r q b r > b a b

Bina Nusantara NFA vs DFA (3) s q b a r a b q b a a r > a q r b q’ b a b r’ a

Bina Nusantara

Similar presentations