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
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
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)
1 1 q1
2 0 q0
3 1 q1
N MOD 2
MESIN MOORE
• Isi kolom biner dengan konversi kolom desimal ke biner
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
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
MESIN MOORE
• Isi kolom desimal modulo m atau desimal modulo 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)
MESIN MOORE
• Isi kolom biner dengan konversi kolom desimal ke biner
MESIN MOORE
• Isi kolom transisi
• Karena desimal ada 6 dan ouput ada 3, maka dibagi 2 bagian
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
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
0
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
Diketahui :
q0 q1 q2
1/0 0/1
PERBANDINGAN
Setiap dinyatakan sebagai nilai output Setiap transisi dinyatakan sebagai nilai
output