View
224
Download
3
Tags:
Embed Size (px)
Citation preview
1
Pertemuan 2Finite Automata
Matakuliah : T0162/Teori Bahasa dan Automata
Tahun : 2009
2
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :• Menjelaskan Finite Automata• Menjelaskan dan memberikan contoh NFA
dan DFA
Finite automaton
• As was metioned earlier, a finite automaton has a set of states, and its “control” moves from state to state in response to external “inputs”
• Deterministic meaning that automaton cannot be in more than one state at any one time, or nondeterministic that it may be in several states at once.
3
examples
4
example
Interaction between participants :
5
The protocol
• The three participants must design their behaviors carefully.
• The back must behave responsibly, or it cannot be a bank
• It must make sure that two stores cannot both redeem the same money file, and it must not allow money to be
both canceled and redeemed.
Protocols of this type can be represented as finite automata. That is, the state “remembers” that certain important events havce happeded.
6
example
7
Explanation(c)
• First automaton(c) for the bank, the start state is state 1: it represents the situation where the bank has issued the money file in question but has not been requested either to redeem it or to cancel it.
• If a cancel request is sent to the bank by the customer, then the bank restores the money to the customer’s account and enters state 2.
• The latter state represents situtaion where the money has been cancelled.
8
Explanation (a)
• The automaton representing the actions of the store. While the bank always does the right thing, the store’s system has some defects.
• Imagine that the shipping and financial operations are done by separate processes, so there is the opportunity for the ship action to be done either before, after, or during the redemption of the electronic money.
• That policy allows the store to get into a situation where it has already shipped the goods and then finds out the money was bogus.
9
Explanation (b)
• This automaton has only one state, refrelcting the fact that the customer “can do anything”. The customer can perform the pay and cancel actions any number of times.
10
Enabling automata to ignore actions
11
solution
12
DFA
• The term deterministic refers to the fact that on each input there is one and only one state to which the automaton can transition from its current state
13
2 types of finite automata
14
Example DFA
15
example
16
17
example
18
Transition tables
19
NFA
• A nondeterministic finite automaton (NFA) has the power to be in several states at once.
20
Example NFA
• Terdapat lebih dari satu transisi untuk input yang sama dari suatu state.
• Contoh :
21
q 0 q 3 q 4
q 1
q 2
Start
1
1
10
0 0 0
01
1
Example NFA
22
Example NFA
23
answer
24
example
25
example
26
27
Summary