SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
Modeling Computation - 12                                                     CSC1001 Discrete Mathematics                1

 CHAPTER
                                                การคํานวณตามแบบจําลอง
   12                                             (Modeling Computation)

  1      Finite-State Machines
1. Finite-State Machines with Output
 Definition 1

 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 that assigns to each state and input pair an output, and an initial state s0.

Show the table of finite-state machine for a vending machine (State table)




Show the directed graph of finite-state machine for a vending machine (State diagram)




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                      เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
2       CSC1001 Discrete Mathematics                                                 12 - Modeling Computation


Example 1 (5 points) Construct the state diagram for the finite-state machine with the state table.




Example 2 (5 points) Construct the state diagram for the finite-state machine with the state table.




Example 3 (5 points) Construct the state diagram for the finite-state machine with the state table.




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Modeling Computation - 12                                                CSC1001 Discrete Mathematics            3
Example 4 (5 points) Construct the state table for the finite-state machine with the state diagram.




Example 5 (5 points) Construct the state table for the finite-state machine with the state diagram.




Example 6 (5 points) Construct the state table for the finite-state machine with the state diagram.




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
4         CSC1001 Discrete Mathematics                                                     12 - Modeling Computation


2. Finite-State Machines with No Output
    Definition 2

    A finite-state automaton M = (S, I, f, s0, F) consists of a 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 × I S), an initial
    or start state s0, and a subset F of S consisting of final (or accepting states).

Example 7 (5 points) Construct the state diagram for the finite-state automaton M = (S, I, f, s0, F), where S =
{s0, s1, s2, s3}, I = {0, 1}, F = {s0, s3}, and the transition function f is given in Table.
                                              Answer




Example 8 (5 points) Construct deterministic finite-state automata that recognize each of these languages.
(This is the solutions of an example)
1) The set of bit strings that begin with two 0s




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




3) The set of bit strings that do not contain two consecutive 0s




4) The set of bit strings that end with two 0s




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                      เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Modeling Computation - 12                                                CSC1001 Discrete Mathematics            5
5) The set of bit strings that contain at least two 0s




Example 9 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings
beginning with 01.




Example 10 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings
that end with 10.




Example 11 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings
that contain the string 101.




Example 12 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings
that do not contain three consecutive 0s.




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
6         CSC1001 Discrete Mathematics                                                12 - Modeling Computation


    2       Finite-State Machines
1. Regular Expressions
    Definition 1

    The regular expressions over a set I are defined recursively by:
     the symbol ∅ is a regular expression;
     the symbol λ is a regular expression;
     the symbol x is a regular expression whenever x ∈ I ;
     the symbols (AB), (A ∪ B), and A* are regular expressions whenever A and B are regular expressions.

Each regular expression represents a set specified by these rules:
       ∅ represents the empty set, that is, the set with no strings;
       λ represents the set {λ}, which is the set containing the empty string;
       x represents the set {x} containing the string with one symbol x;
       (AB) represents the concatenation of the sets represented by A and by B;
       (A ∪ B) represents the union of the sets represented by A and by B;
       A* represents the Kleene closure of the set represented by A.
Example of regular expression




Example 13 (11 points) Describe in words the strings in each of these regular sets.
1) 1*0
2) 1*00*
3) 111 ∪ 001
4) (1 ∪ 00)*
5) (00*1)*
6) (0 ∪ 1)(0 ∪ 1)*00
7) 001*
8) (01)*
9) 01 ∪ 001*
10) 0(11 ∪ 0)*
11) (101*)*

มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                              เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Modeling Computation - 12                                               CSC1001 Discrete Mathematics             7
Example 14 (8 points) Determine whether 0101 belongs to each of these regular sets.
1) 01*0*
2) 0(11) * (01) *
3) 0(10)*1*
4) 0*10(0 ∪ 1)
5) (01)*(11)*
6) 0*(10 ∪ 11)*
7) 0*(10)*11
8) 01(01 ∪ 0)1*
Example 15 (8 points) Determine whether 1011 belongs to each of these regular sets.
1) 10*1*
2) 0*(10 ∪ 11)*
3) 1(01)*1*
4) 1*01(0 ∪ 1)
5) (10)*(11)*
6) 1(00)*(11)*
7) (10)*1011
8) (1 ∪ 00)(01 ∪ 0)1*
Example 16 (10 points) Express each of these sets using a regular expression.
1) The set consisting of the strings 0, 11, and 010
2) The set of strings of three 0s followed by two or more 0s
3) The set of strings of odd length
4) The set of strings that contain exactly one 1
5) The set of strings ending in 1 and not containing 000
6) The set containing all strings with zero, one, or two bits
7) The set of strings of two 0s, followed by zero or more 1s, and ending with a 0
8) The set of strings with every 1 followed by two 0s
9) The set of strings ending in 00 and not containing 11
10) The set of strings containing an even number of 1s




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี

Mais conteúdo relacionado

Mais procurados

Flipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflopsFlipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflopsstudent
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson MethodJigisha Dabhi
 
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORMZ TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORMTowfeeq Umar
 
uses of leflace transformation in the field of civil engineering by Engr mesb...
uses of leflace transformation in the field of civil engineering by Engr mesb...uses of leflace transformation in the field of civil engineering by Engr mesb...
uses of leflace transformation in the field of civil engineering by Engr mesb...MIsbahUllahEngr
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsSSE_AndyLi
 
Series solutions at ordinary point and regular singular point
Series solutions at ordinary point and regular singular pointSeries solutions at ordinary point and regular singular point
Series solutions at ordinary point and regular singular pointvaibhav tailor
 
Laplace Transform And Its Applications
Laplace Transform And Its ApplicationsLaplace Transform And Its Applications
Laplace Transform And Its ApplicationsSmit Shah
 
inverse z-transform ppt
inverse z-transform pptinverse z-transform ppt
inverse z-transform pptmihir jain
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systemsLee Chadwick
 
Logic gates ppt
Logic gates pptLogic gates ppt
Logic gates pptparassini
 
Digital logic circuits important question and answers for 5 units
Digital logic circuits important question and answers for 5 unitsDigital logic circuits important question and answers for 5 units
Digital logic circuits important question and answers for 5 unitsLekashri Subramanian
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with typesRavinder Rautela
 
Transformasi 2 Dimensi
Transformasi 2 DimensiTransformasi 2 Dimensi
Transformasi 2 DimensiFarichah Riha
 
Innerproductspaces 151013072051-lva1-app6892 (1)
Innerproductspaces 151013072051-lva1-app6892 (1)Innerproductspaces 151013072051-lva1-app6892 (1)
Innerproductspaces 151013072051-lva1-app6892 (1)Himanshi Upadhyay
 

Mais procurados (20)

Home work II
Home work IIHome work II
Home work II
 
Flipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflopsFlipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflops
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson Method
 
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORMZ TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
 
uses of leflace transformation in the field of civil engineering by Engr mesb...
uses of leflace transformation in the field of civil engineering by Engr mesb...uses of leflace transformation in the field of civil engineering by Engr mesb...
uses of leflace transformation in the field of civil engineering by Engr mesb...
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
Series solutions at ordinary point and regular singular point
Series solutions at ordinary point and regular singular pointSeries solutions at ordinary point and regular singular point
Series solutions at ordinary point and regular singular point
 
Laplace Transform And Its Applications
Laplace Transform And Its ApplicationsLaplace Transform And Its Applications
Laplace Transform And Its Applications
 
Unit 1(stld)
Unit 1(stld)Unit 1(stld)
Unit 1(stld)
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
 
inverse z-transform ppt
inverse z-transform pptinverse z-transform ppt
inverse z-transform ppt
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 
Logic gates ppt
Logic gates pptLogic gates ppt
Logic gates ppt
 
Digital logic circuits important question and answers for 5 units
Digital logic circuits important question and answers for 5 unitsDigital logic circuits important question and answers for 5 units
Digital logic circuits important question and answers for 5 units
 
Numerical method (curve fitting)
Numerical method (curve fitting)Numerical method (curve fitting)
Numerical method (curve fitting)
 
Lagrange’s interpolation formula
Lagrange’s interpolation formulaLagrange’s interpolation formula
Lagrange’s interpolation formula
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with types
 
Dft
DftDft
Dft
 
Transformasi 2 Dimensi
Transformasi 2 DimensiTransformasi 2 Dimensi
Transformasi 2 Dimensi
 
Innerproductspaces 151013072051-lva1-app6892 (1)
Innerproductspaces 151013072051-lva1-app6892 (1)Innerproductspaces 151013072051-lva1-app6892 (1)
Innerproductspaces 151013072051-lva1-app6892 (1)
 

Semelhante a Discrete-Chapter 12 Modeling Computation

General pipeline concepts
General pipeline conceptsGeneral pipeline concepts
General pipeline conceptsPrasenjit Dey
 
On the Principle of Optimality for Linear Stochastic Dynamic System
On the Principle of Optimality for Linear Stochastic Dynamic System On the Principle of Optimality for Linear Stochastic Dynamic System
On the Principle of Optimality for Linear Stochastic Dynamic System ijfcstjournal
 
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...Alexander Litvinenko
 
UNIT-II : SEQUENTIAL CIRCUIT DESIGN
UNIT-II  : SEQUENTIAL CIRCUIT DESIGN UNIT-II  : SEQUENTIAL CIRCUIT DESIGN
UNIT-II : SEQUENTIAL CIRCUIT DESIGN Dr.YNM
 
UNIT-II -DIGITAL SYSTEM DESIGN
UNIT-II -DIGITAL SYSTEM DESIGNUNIT-II -DIGITAL SYSTEM DESIGN
UNIT-II -DIGITAL SYSTEM DESIGNDr.YNM
 
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...IJECEIAES
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpExcel Homework Help
 
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]
Digital Signals and System (October  – 2016) [Revised Syllabus | Question Paper]Digital Signals and System (October  – 2016) [Revised Syllabus | Question Paper]
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]Mumbai B.Sc.IT Study
 
Modern Control System (BE)
Modern Control System (BE)Modern Control System (BE)
Modern Control System (BE)PRABHAHARAN429
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...ieijjournal
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...ieijjournal
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 

Semelhante a Discrete-Chapter 12 Modeling Computation (20)

QB104541.pdf
QB104541.pdfQB104541.pdf
QB104541.pdf
 
Discrete-Chapter 01 Sets
Discrete-Chapter 01 SetsDiscrete-Chapter 01 Sets
Discrete-Chapter 01 Sets
 
General pipeline concepts
General pipeline conceptsGeneral pipeline concepts
General pipeline concepts
 
On the Principle of Optimality for Linear Stochastic Dynamic System
On the Principle of Optimality for Linear Stochastic Dynamic System On the Principle of Optimality for Linear Stochastic Dynamic System
On the Principle of Optimality for Linear Stochastic Dynamic System
 
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
 
UNIT-II : SEQUENTIAL CIRCUIT DESIGN
UNIT-II  : SEQUENTIAL CIRCUIT DESIGN UNIT-II  : SEQUENTIAL CIRCUIT DESIGN
UNIT-II : SEQUENTIAL CIRCUIT DESIGN
 
UNIT-II -DIGITAL SYSTEM DESIGN
UNIT-II -DIGITAL SYSTEM DESIGNUNIT-II -DIGITAL SYSTEM DESIGN
UNIT-II -DIGITAL SYSTEM DESIGN
 
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...
A simple multi-stable chaotic jerk system with two saddle-foci equilibrium po...
 
4th Semester Electronic and Communication Engineering (2013-June) Question Pa...
4th Semester Electronic and Communication Engineering (2013-June) Question Pa...4th Semester Electronic and Communication Engineering (2013-June) Question Pa...
4th Semester Electronic and Communication Engineering (2013-June) Question Pa...
 
Seattle.Slides.7
Seattle.Slides.7Seattle.Slides.7
Seattle.Slides.7
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
Assignment 2 solution acs
Assignment 2 solution acsAssignment 2 solution acs
Assignment 2 solution acs
 
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]
Digital Signals and System (October  – 2016) [Revised Syllabus | Question Paper]Digital Signals and System (October  – 2016) [Revised Syllabus | Question Paper]
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]
 
Modern Control System (BE)
Modern Control System (BE)Modern Control System (BE)
Modern Control System (BE)
 
exam1 unsolved
exam1 unsolvedexam1 unsolved
exam1 unsolved
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
10_rnn.pdf
10_rnn.pdf10_rnn.pdf
10_rnn.pdf
 

Mais de Wongyos Keardsri

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramWongyos Keardsri
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsWongyos Keardsri
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingWongyos Keardsri
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemWongyos Keardsri
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIDiscrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIDiscrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IDiscrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IWongyos Keardsri
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsWongyos Keardsri
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsWongyos Keardsri
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityWongyos Keardsri
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 CountingWongyos Keardsri
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsWongyos Keardsri
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIWongyos Keardsri
 
Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IWongyos Keardsri
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesWongyos Keardsri
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesWongyos Keardsri
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowWongyos Keardsri
 

Mais de Wongyos Keardsri (20)

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master Program
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applications
 
IP address anonymization
IP address anonymizationIP address anonymization
IP address anonymization
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script Programming
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating System
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming Language
 
Discrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIDiscrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part III
 
Discrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIDiscrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part II
 
Discrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IDiscrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part I
 
Discrete-Chapter 10 Trees
Discrete-Chapter 10 TreesDiscrete-Chapter 10 Trees
Discrete-Chapter 10 Trees
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 Algorithms
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 Relations
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 Probability
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 Counting
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and Proofs
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part II
 
Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part I
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 Matrices
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and Sequences
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindow
 

Discrete-Chapter 12 Modeling Computation

  • 1. Modeling Computation - 12 CSC1001 Discrete Mathematics 1 CHAPTER การคํานวณตามแบบจําลอง 12 (Modeling Computation) 1 Finite-State Machines 1. Finite-State Machines with Output Definition 1 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 that assigns to each state and input pair an output, and an initial state s0. Show the table of finite-state machine for a vending machine (State table) Show the directed graph of finite-state machine for a vending machine (State diagram) มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 2. 2 CSC1001 Discrete Mathematics 12 - Modeling Computation Example 1 (5 points) Construct the state diagram for the finite-state machine with the state table. Example 2 (5 points) Construct the state diagram for the finite-state machine with the state table. Example 3 (5 points) Construct the state diagram for the finite-state machine with the state table. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 3. Modeling Computation - 12 CSC1001 Discrete Mathematics 3 Example 4 (5 points) Construct the state table for the finite-state machine with the state diagram. Example 5 (5 points) Construct the state table for the finite-state machine with the state diagram. Example 6 (5 points) Construct the state table for the finite-state machine with the state diagram. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 4. 4 CSC1001 Discrete Mathematics 12 - Modeling Computation 2. Finite-State Machines with No Output Definition 2 A finite-state automaton M = (S, I, f, s0, F) consists of a 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 × I S), an initial or start state s0, and a subset F of S consisting of final (or accepting states). Example 7 (5 points) Construct the state diagram for the finite-state automaton M = (S, I, f, s0, F), where S = {s0, s1, s2, s3}, I = {0, 1}, F = {s0, s3}, and the transition function f is given in Table. Answer Example 8 (5 points) Construct deterministic finite-state automata that recognize each of these languages. (This is the solutions of an example) 1) The set of bit strings that begin with two 0s 2) The set of bit strings that contain two consecutive 0s 3) The set of bit strings that do not contain two consecutive 0s 4) The set of bit strings that end with two 0s มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 5. Modeling Computation - 12 CSC1001 Discrete Mathematics 5 5) The set of bit strings that contain at least two 0s Example 9 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings beginning with 01. Example 10 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings that end with 10. Example 11 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings that contain the string 101. Example 12 (5 points) Construct a deterministic finite-state automaton that recognizes the set of all bit strings that do not contain three consecutive 0s. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 6. 6 CSC1001 Discrete Mathematics 12 - Modeling Computation 2 Finite-State Machines 1. Regular Expressions Definition 1 The regular expressions over a set I are defined recursively by: the symbol ∅ is a regular expression; the symbol λ is a regular expression; the symbol x is a regular expression whenever x ∈ I ; the symbols (AB), (A ∪ B), and A* are regular expressions whenever A and B are regular expressions. Each regular expression represents a set specified by these rules: ∅ represents the empty set, that is, the set with no strings; λ represents the set {λ}, which is the set containing the empty string; x represents the set {x} containing the string with one symbol x; (AB) represents the concatenation of the sets represented by A and by B; (A ∪ B) represents the union of the sets represented by A and by B; A* represents the Kleene closure of the set represented by A. Example of regular expression Example 13 (11 points) Describe in words the strings in each of these regular sets. 1) 1*0 2) 1*00* 3) 111 ∪ 001 4) (1 ∪ 00)* 5) (00*1)* 6) (0 ∪ 1)(0 ∪ 1)*00 7) 001* 8) (01)* 9) 01 ∪ 001* 10) 0(11 ∪ 0)* 11) (101*)* มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 7. Modeling Computation - 12 CSC1001 Discrete Mathematics 7 Example 14 (8 points) Determine whether 0101 belongs to each of these regular sets. 1) 01*0* 2) 0(11) * (01) * 3) 0(10)*1* 4) 0*10(0 ∪ 1) 5) (01)*(11)* 6) 0*(10 ∪ 11)* 7) 0*(10)*11 8) 01(01 ∪ 0)1* Example 15 (8 points) Determine whether 1011 belongs to each of these regular sets. 1) 10*1* 2) 0*(10 ∪ 11)* 3) 1(01)*1* 4) 1*01(0 ∪ 1) 5) (10)*(11)* 6) 1(00)*(11)* 7) (10)*1011 8) (1 ∪ 00)(01 ∪ 0)1* Example 16 (10 points) Express each of these sets using a regular expression. 1) The set consisting of the strings 0, 11, and 010 2) The set of strings of three 0s followed by two or more 0s 3) The set of strings of odd length 4) The set of strings that contain exactly one 1 5) The set of strings ending in 1 and not containing 000 6) The set containing all strings with zero, one, or two bits 7) The set of strings of two 0s, followed by zero or more 1s, and ending with a 0 8) The set of strings with every 1 followed by two 0s 9) The set of strings ending in 00 and not containing 11 10) The set of strings containing an even number of 1s มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี