• Tidak ada hasil yang ditemukan

ICS-252 Discrete Structure II

N/A
N/A
Protected

Academic year: 2019

Membagikan "ICS-252 Discrete Structure II"

Copied!
7
0
0

Teks penuh

(1)

ICS-252 Discrete Structure II

Lecture 9

Assistant Professor, Department of Computer Science &

Engineering, University of Hail, KSA.

Email: s hagahmoodi@uoh edu sa

Email: s.hagahmoodi@uoh.edu.sa

ICS‐252       Dr. Salah Omer, Assistant 

Professor, CSSE, University  of  Hail. 

Outlines

Finite state machines with output

Finite state machines with output

Finite state machines with no output

DFA

NDFA

DMA 796 813

DMA 796-813

(2)

Finite-State Machines with Output

Finite-State Machines with Output:A finite state machine

(FSM) is an abstract model of a machine with a primitive (sometimes read-only) internal memory. These are FSM that produce output. FSM are used extensively in many areas including electrical engineering linguistics computer areas including electrical engineering, linguistics computer science, philosophy, biology, mathematics and logic. In computer science, finite state machines are widely used in modeling of application behavior, design of hardware digital systems, software engineering, compilers, network

protocols, and the study of computation and languages.

Definition:A finite-state machine M = {S I O f g s0} consists

Definition:A finite state machine M {S, I, O, f, g, s0} consists of a finite set S of states, a finite input alphabet I, a finite output alphabet O, a transition function f that assigns to each state and input pair a new state, an output function g

3 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

Finite-State Machines with Output

That assigns to each state and input pair an output, and an initial state s0.

Example: The state table shown in table describes a finite

state machine with S ={s0 , s1,s2 , s3 } , I = {0,1}, O={0,1}. The values of the transition function f and the values of the output function g are shown in table. Draw the state

diagram from this state table.

(3)

Finite-State Machines with Output

Solution: see the state diagram at page DMA- 799.

Example:Draw the state table from the state diagram

obtained in the above example.

S0

S1

S3

start

5 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

S2

Finite-State Machines with No Output

One of the most important application of finite-state machines is in language recognition. This application plays a

fundamental role in the design and construction of

compilers for programming languages. It does not have any output

output.

Definition:Suppose that A and B are subsets of V*, where V

is a vocabulary. The concatenation of A and B, denoted by AB, is the set of all strings of the form xy, where x is a string in A and y is a string in B.

Example: Let A= {0, 11} and B= {1, 10, 110}, Find AB and BA Solution: AB= {01, 010, 0110, 111, 1110, 11110} and

BA={10, 111, 100, 1011, 1100, 11011}

(4)

Finite-State Machines with No Output

= {111, 1100, 1001, 10000, 0011, 00100, 00001, 000000 }

7 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

Deterministic Finite-State Automata

(DFA)

Definition:A finite-state machine with no output is called

finite-state automata. It also called deterministic finite-state automata (DFA). A DFA M=(S, I, f, s0, F ) consists of a finite set S of states, a finite input alphabet I, a transition finite set S of states, a finite input alphabet I, a transition function f that assigns a next state to every pair of state and input (so that f: S x I -> S), an initial or start state s0, and a subset F of S consisting of final state. We can represent finite-state automata using either state tables or state diagram. Final states are indicated in state diagrams by using double circles.

Example 4:Construct the state diagram for the finite-state

(5)

Deterministic Finite-State Automata

(DFA)

Solution:State diagram is shown in figure 1 at page

DMA-806.

Language recognition by DFA: A string x is said to be

i d t d b th hi M (S I f F) if recognized or accepted by the machine M= (S, I, f, s0, F) if it takes the initial state s0to the final state, that is, f(s0, x) is a state in F. The language recognized or accepted by the machine M, denoted by L(M), is the set of all strings that are recognized by M. Two finite-state automata are called equivalent if they recognize the same language.

E l D t i th l i d b th fi it

Example:Determine the languages recognized by the

finite-state automata M1, M2, M3 in figure 2 at page 807.

9 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

Deterministic Finite-State Automata

(DFA)

Solution:M1) In M1 the final state is S0, The only strings that

take S0to itself are those consisting of {}, or more

consecutive 1s. Hence, L(M1)= { ,1, 11, 111, 1111…..} or string of zero or more consecutive 0s. In addition the only

t i th t t k S t S t i f

λ

strings that takes S0 to S3are a string of zero or more consecutive 0s, followed by 10, Hence, L(M3)={0n, 0n10x |

n= 0,1,2,….. And x is any string with combination of 0 and 1}

(6)

Non Deterministic Finite-State Automata

(NDFA)

Non deterministic finite-state of automata (NDFA):In DFA

for each pair of state and input value there is a unique next state given by the transition function. But in NDFA there may be several possible next states for each pair of input may be several possible next states for each pair of input value and state.

Definition:A NDFA M= (S, I, f, s0, F) consists of a set S of

states, an input alphabet I, a transition function f that assigns a set of states to each pair of state and input (so that f: S x I -> P(S)), a starting state s0,and a subset F of S consisting of the final states.

consisting of the final states.

Example 9: Find the state diagram for the NDFA with the

state table shown in table 2 (at page DMA-812). The final states are s2and s3.

11 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

Non Deterministic Finite-State Automata

(NDFA)

Solution:See figure 6 at page DMA-812.

Example 10:Find the state table for the NDFA with the state

diagram shown in figure 7.

(7)

Home Work

Question 1: construct a DFA that recognized each of these

languages.

a) The set of bit strings that begin with two 0s.

b) The set of bit strings that contain two consecutive 0s.

c) The set of bit strings that do not contain two consecutive 0s. d) The set of bit strings that end with two 0s.

e) The set of bit strings that contain at least two 0s.

Question 2: Let A={0,11}, and B={00, 01}. Find each of these

sets.

a) AB, b) BA, c) A2 d) B3

Question 3:solve questions from 16-22 at page DMA-814-815.

Question 4:solve questions from 43-49 at page DMA-816.

13 ICS‐252       Dr. Salah Omer, Assistant Professor, CSSE, University  of  Hail. 

Thank you for your Attention.

14

Gambar

table 1 (see at page DMA- 806).

Referensi

Dokumen terkait

Istilah BIOS pertama kali muncul dalam sistem operasi CP/M, yang merupakan bagian dari CP/M yang dimuat pada saat proses booting dimulai yang berhadapan secara langsung

Clinical Profile of Extrapulmonary Tuberculosis Among TB-HIV Patients in Cipto Mangunkusumo Hospital.. Gurmeet Singh 1 , Anna Uyainah 1 , Evy Yunihastuti 2 , Darma

Remember: The interview isn’t just a chance for the interviewers to determine if they want to hire you — it’s also an opportunity for you to determine if this is the company

MESIR To JAKARTA By Air & Sea Freight LCL & FCL MYANMAR To JAKARTA By Air & Sea Freight LCL & FCL NEPAL To JAKARTA By Air & Sea Freight LCL & FCL NORWEGIA

Skripsi ini disusun untuk memenuhi salah satu syarat dalam menempuh ujian akhir Program Studi S1 Keperawatan Fakultas Ilmu Kesehatan di Universitas Muhammadiyah

Panitia Seleksi Nasional Masuk Perguruan Tinggi Negeri (SNMPTN) Universitas Negeri. Yogyakarta memberikan penghargaan dan mengucapkan terima kasih, kepada

Pada grafik briket yang memiliki durasi pembakaran terlama adalah briket dengan ukuran partikel 60 mesh dengan tekanan press sebesar 2 MPa.. Berdasarkan hasil uji

Untuk kendala cuaca pada saat kegiatan pembelajaran di luar ruangan atau di luar lingkungan sekolah, di TK Alam Ar- Rayyan Malang ini guru mengantisipasi hal tersebut dengan