Anda di halaman 1dari 39

OTOMATA

DAN TEORI
BAHASA
8
Materi :
1. Mesin Moore
2. Mesin Mealy
3. Perbandingan
MESIN MOORE
• FSA (Finite State Automata) yang
telah dipelajari adalah FSA yang
hanya dapat menerima atau
menolak string yang di inputkan
• String “aaabb” diterima atau tidak
• FSA seperti itu disebut ACCEPTER
MESIN MOORE
a
A B
a
b
a D
C

• String aa dan ba diterima oleh FSA tersebut,


sedangkan string yang lain ditolak
MESIN MOORE
•FSA (Finite State Automata) yang
mempunyai keputusan sebagai output,
Automata ini disebut TRANSDUCER

•Salah satu contoh FSA yang termasuk


Transducer atau FSA yang mempunyai
output adalah Mesin MOORE
MESIN MOORE
•Pada Mesin Moore outputnya
berasosiasi dengan state, atau
tertulis pada setiap state

•Sehingga Jumlah State sama


dengan jumlah Output
MESIN MOORE
M={Q,, , S, , }

Q : Himpunan State
 : Himpunan Input
 : Fungsi Transisi
S : Simbol State Awal
D : Himpunan Output
l : Fungsi Output untuk setiap state

Komponen final state dari DFA dihilangkan, karena disini keputusan dimunculkan
sebagai output
MESIN MOORE
• Salah satu contoh penerapan mesin Moore
adalah mesin untuk memperoleh sisa
pembagian atau
n MOD m
• Contoh :
Mesin Moore untuk menentukan n mod 2
dengan inputan berupa biner
N MOD 2

MESIN MOORE
• n mod 2 diinisialisasikan n mod m, jadi m = 2
• Isi kolom desimal dengan ketentuan
m x 2 = 2 x 2 = 4, jadi ada 4 desimal dan dimulai dari 0
Desimal Desimal Output Biner Transisi
Modulo 2 State 8421
0

3
N MOD 2

MESIN MOORE
• Isi kolom desimal modulo m atau desimal modulo 2

Desimal Desimal Output Biner Transisi


Modulo 2 State 8421
0 0

1 1

2 0

3 1
N MOD 2

MESIN MOORE
• Isi kolom output state secara berurutan dan bergantian,
bisa A B A B atau q0 q1 q0 q1
(tergantung hasil jenis desimal modulo 2)

Desimal Desimal Output Biner Transisi


Modulo 2 State 8421
0 0 q0

1 1 q1

2 0 q0

3 1 q1
N MOD 2

MESIN MOORE
• Isi kolom biner dengan konversi kolom desimal ke biner

Desimal Desimal Output Biner Transisi


Modulo 2 State 8421
0 0 q0 0000

1 1 q1 0001

2 0 q0 0010

3 1 q1 0011
N MOD 2

MESIN MOORE
• Isi kolom transisi
• Karena desimal ada 4 dan ouput ada 2, maka dibagi 2 bagian

Desimal Desimal Output Biner Transisi


Modulo 2 State 8421
0 0 q0 0000 (q0,0) = q0

1 1 q1 0001 q0 (q0,1) = q1

2 0 q0 0010 (q1,0) = q0

3 1 q1 0011 q1 (q1,1) = q1
N MOD 2

MESIN MOORE
Sehingga didapat :
M={Q,, , S, , }
Q = {q0, q1}  kolom ouput state
å = {0,1}  input berupa biner, maka 0 1
d = (q0,0)=q0, (q0,1)=q1, (q1,0)=q0, (q1,1)=q1
kolom transisi
S = q0  kolom output state yang pertama
D = {0,1}  kolom hasil modulo m
l = (q0) = 0, (q1) = 1
kolom hasil modulo m dan output state
N MOD 2

MESIN MOORE
d = (q0,0)=q0, (q0,1)=q1, (q1,0)=q0, (q1,1)=q1
kolom transisi
l = (q0) = 0, (q1) = 1
kolom hasil modulo m dan output state

0
1 1

q0/0 q1/1
0
N MOD 2

MESIN MOORE
Test :
7 Mod 2 = 1 7 binernya 0111
(q0, 0111) = (q0, 111)
= (q1, 11)
= (q1, 1)
= q1 0
1 1
=1
q0/0 q1/1
0
N MOD 2

MESIN MOORE
Test :
10 Mod 2 = 0 10 binernya 1010
(q0, 1010) = (q1, 010)
= (q0, 10)
= (q1, 0)
= q0 0
1 1
=0
q0/0 q1/1
0
MESIN MOORE
• Contoh 2 :
Buatlah mesin Moore untuk
menentukan n mod 3
N MOD 3

MESIN MOORE
• n mod 3 diinisialisasikan n mod m, jadi m = 3
• Isi kolom desimal dengan ketentuan
m x 2 = 3 x 2 = 6, jadi ada 6 desimal dan dimulai dari 0

Desimal Desimal Output Biner Transisi


Modulo 2 State 8421
0
1
2
3
4
5
N MOD 3

MESIN MOORE
• Isi kolom desimal modulo m atau desimal modulo 3

Desimal Desimal Output Biner Transisi


Modulo 3 State 8421
0 0
1 1
2 2
3 0
4 1
5 2
N MOD 3

MESIN MOORE
• Isi kolom output state secara berurutan dan bergantian,
bisa A B C A B C atau q0 q1 q3 q0 q1 q3
(tergantung hasil jenis desimal modulo 3)

Desimal Desimal Output Biner Transisi


Modulo 3 State 8421
0 0 q0
1 1 q1
2 2 q2
3 0 q0
4 1 q1
5 2 q2
N MOD 3

MESIN MOORE
• Isi kolom biner dengan konversi kolom desimal ke biner

Desimal Desimal Output Biner Transisi


Modulo 3 State 8421
0 0 q0 0000
1 1 q1 0001
2 2 q2 0010
3 0 q0 0011
4 1 q1 0100
5 2 q2 0101
N MOD 3

MESIN MOORE
• Isi kolom transisi
• Karena desimal ada 6 dan ouput ada 3, maka dibagi 2 bagian

Desimal Desimal Output Biner Transisi


Modulo 3 State 8421
0 0 q0 0000 (q0,0) = q0
q0
1 1 q1 0001 (q0,1) = q1
2 2 q2 0010 (q1,0) = q2
q1
3 0 q0 0011 (q1,1) = q0
4 1 q1 0100 (q2,0) = q1
q2
5 2 q2 0101 (q2,1) = q2
N MOD 3

MESIN MOORE
Sehingga didapat :
M={Q,, , S, , }
Q = {q0, q1, q2}  kolom ouput state
å = {0,1}  input berupa biner, maka 0 1
d = (q0,0)=q0, (q0,1)=q1, (q1,0)=q2, (q1,1)=q0, (q2,0)=q1,
(q2,1)=q2  kolom transisi
S = q0  kolom output state yang pertama
D = {0,1,2}  kolom hasil modulo m
l = (q0) = 0, (q1) = 1
(q2) = 2  kolom hasil modulo m dan output state
N MOD 3

MESIN MOORE
d = (q0,0)=q0, (q0,1)=q1, (q1,0)=q2, (q1,1)=q0, (q2,0)=q1,
(q2,1)=q2  kolom transisi
l = (q0) = 0, (q1) = 1, (q2) = 2  kolom hasil modulo m dan
output state
N MOD 3

MESIN MOORE
Test :
12 Mod 3 = 0 12 binernya 1100
(q0, 1100) = (q1, 100)
= (q0, 00)
= (q0, 0)
= q0 = 0
N MOD 3

MESIN MOORE
Test :
14 Mod 3 = 2 14 binernya 1110
(q0, 1110) = (q1,110)
= (q0, 10)
= (q1, 0)
= q2 = 2
MESIN MOORE
• Tugas :
Buatlah mesin Moore untuk
menentukan n mod 4 dan n mod 5
Tulis tabel, rumus M, dan FSA, lalu
cek 2x serta eqivalensi ke mesin
Mealy
Kerjakan sendiri!
MESIN MEALY
• Mesin Mealy 6 tupel, yaitu :
• M={Q,, , S, , }
Q : Himpunan State
 : Himpunan Simbol Input
 : Fungsi Transisi
S : Simbol State Awal
 : Himpunan Output
 : Fungsi Output untuk setiap transisi
MESIN MEALY
• Pada Mesin Moore Output berasosiasi dengan
State, tetapi pada Mesin Mealy output
berasosiasi dengan transisi, sehingga dalam
fungsi output :
(State,Input)=Output

• Tidak ada aturan yang jelas dalam membentuk


graph transisinya
EQI MESIN MOORE KE MEALY
• Eqivalensi mesin Moore ke mesin Mealy
adalah merubah mesin Moore menjadi mesin
Mealy dengan kemampuan yang sama
• Caranya :
1. menghapus label Output pada setiap state
2. menambahkan label Output pada setiap Input
EQI MESIN MOORE KE MEALY
Moore Mealy
1 1/1

q1/1 q1

(q1)=1 FO (q1,1)=1
(q1,1)=q1 FT (q1,1)=q1
EQI MESIN MOORE KE MEALY
MooreMealy

q1/0 1 q0 1/1

q1/1 q1

(q0)=0, (q1)=1 (q0,1)=1


(q0,1)=q1 (q0,1)=q1
N MOD 2

EQI MESIN MOORE KE MEALY


Contoh :
Diketahui Mesin Moore n Mod 2,
0
1 1

q0/0 q1/1
0

Buat mesin Mealy yang eqivalen


N MOD 2
EQI MESIN MOORE KE MEALY
Dari graph transisi ini
0
1 1

q0/0 q1/1
0
Diketahui :
(q0,0)=0 Mesin Mealy yang Eqivalen
(q0,1)=1 0/0
1/1
1/1
(q1,0)=0
q0 q1
(q1,1)=1 0/0
N MOD 3

EQI MESIN MOORE KE MEALY


Contoh :
Diketahui Mesin Moore n Mod 3,

Buat mesin Mealy yang eqivalen


N MOD 3
EQI MESIN MOORE KE MEALY
Dari graph transisi ini

Diketahui :

(q0,0)=0, (q0,1)=1, (q1,0)=2, (q1,1)=0 , (q2,0)=1,


(q2,1)=2
0/0
1/1 Mealy yang Eqivalen 0/2
Mesin 1/2

q0 q1 q2
1/0 0/1
PERBANDINGAN

Mesin Moore Mesin Mealy

Setiap dinyatakan sebagai nilai output Setiap transisi dinyatakan sebagai nilai
output

Output berubah pada suatu siklus Perubahan input dapat langsung


merubah output(mesin menjadi tidak
sinkron)
Memerlukan beberapa logika pada Bereaksi lebih cepat pada input
state untuk menjadi output
TERIMAKASIH

Anda mungkin juga menyukai