Download presentation

Presentation is loading. Please wait.

Published bySilas Stidman Modified over 3 years ago

1
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Languages: Finite State Machines Chapter 6 problemsstrings (languages) machines answers

2
Discrete Math by R.S. Chang, Dept. CSIE, NDHU2 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings : a nonempty finite set of symbols, collectively called an alphabet. {0,1,2,11} or {a,b bb} is not considered as an alphabet. That is, juxtaposition of symbols is not included in an alphabet.

3
Discrete Math by R.S. Chang, Dept. CSIE, NDHU3 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

4
Discrete Math by R.S. Chang, Dept. CSIE, NDHU4 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings L={x n |x=01,n in N} y recognizer of L yes, y in L no

5
Discrete Math by R.S. Chang, Dept. CSIE, NDHU5 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

6
Discrete Math by R.S. Chang, Dept. CSIE, NDHU6 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

7
Discrete Math by R.S. Chang, Dept. CSIE, NDHU7 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

8
Discrete Math by R.S. Chang, Dept. CSIE, NDHU8 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

9
Discrete Math by R.S. Chang, Dept. CSIE, NDHU9 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

10
Discrete Math by R.S. Chang, Dept. CSIE, NDHU10 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings

11
Discrete Math by R.S. Chang, Dept. CSIE, NDHU11 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings Which languages in the above examples are harder to recognize? recursively defined sets

12
Discrete Math by R.S. Chang, Dept. CSIE, NDHU12 Chapter 6 Languages: Finite State Machines 6.1 Language: The Set Theory of Strings Which one is harder, xx or xx R ? If x=x R, x is called a palindrome. (noon, madam, did,...) 6.16

13
Discrete Math by R.S. Chang, Dept. CSIE, NDHU13 Chapter 6 Languages: Finite State Machines 6.2 Finite State Machines: A First Encounter c A vending machine: 20c for cola (C), root beer(RB) and accepting 5c, 10c, and 25c, and returning the necessary changes Purchase root beer (white button) Purchase cola (black button)

14
Discrete Math by R.S. Chang, Dept. CSIE, NDHU14 Chapter 6 Languages: Finite State Machines 6.2 Finite State Machines: A First Encounter The major features of such a machine: (1) in only one of finitely many states at a given time (state set S) (2) accept as input only a finite number of symbols (input alphabet set I) (3) state transition function depending on input and current state ( is the next state function) (4) finite set of output alphabet set O (optional) ( is the output function) (5) deterministic (vs. nondeterministic)

15
Discrete Math by R.S. Chang, Dept. CSIE, NDHU15 Chapter 6 Languages: Finite State Machines 6.2 Finite State Machines: A First Encounter (or use final states set F instead of O) Ex. 6.17 state transition table s0s0 s1s1 s2s2 start 0,0 1,0 0,0 1,1 0,0 state transition diagram

16
Discrete Math by R.S. Chang, Dept. CSIE, NDHU16 Chapter 6 Languages: Finite State Machines 6.2 Finite State Machines: A First Encounter language A={x|x in {0,1}* and has at least 1 0's} s0s0 s1s1 1,0 start 0,1 1,1 x x is in A if the output contains 1's. s0s0 s1s1 1 0 0101 x start x is in A if the machine stays at s 1 when the input is consumed. final state

17
Discrete Math by R.S. Chang, Dept. CSIE, NDHU17 Chapter 6 Languages: Finite State Machines 6.2 Finite State Machines: A First Encounter Ex. 6.19 Design a 1-bit binary adder. s0s0 s1s1 start 00,0 01,1 10,1 01,0 10,0 11,1 11,0 00,1 state to remember a carry

18
Discrete Math by R.S. Chang, Dept. CSIE, NDHU18 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter sequence recognizer Ex. 6.20 Construct a machine that recognizes each occurrence of the sequence 111 as it is encountered in any input string of {0,1}*. For example, input 1110101111, the output should be 0010000011. s0s0 s1s1 s2s2 start 0,0 1,0 1,1 0,0 s3s3 1,1 a minimal machine (3 states)

19
Discrete Math by R.S. Chang, Dept. CSIE, NDHU19 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter Ex. 6.21 recognize the occurrences of 111 that end in a position that is a multiple of three. (input 1110111, output 0010000) s0s0 s1s1 s2s2 s3s3 s4s4 start 1,0 1,1 0,0 1,0 0,0 1,0 used to consume extra symbols before counting

20
Discrete Math by R.S. Chang, Dept. CSIE, NDHU20 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter Ex. 6.23 Languages that cannot be recognized by a finite state machine. A={0 i 1 i | i is a positive integer} Assume there is a FSM that recognizes A with n states. s 0 s 1 s 2... s i... s j... s n-1 start transition for x= 0 n 1 n by the pigeonhole principle, this cycle must exist If x is recognized, then 0 n-(j-i+1) 1 n would also be recognized. Therefore, such FSM cannot exist.

21
Discrete Math by R.S. Chang, Dept. CSIE, NDHU21 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter k-unit delay machines Ex. 6.25 1-unit delay machine s0s0 s1s1 s2s2 start 0,0 1,0 0,1 1,0 0,0 1,1 remembering 0 remembering 1

22
Discrete Math by R.S. Chang, Dept. CSIE, NDHU22 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter Ex. 6.25 2-unit delay machine s3s3 s4s4 s5s5 s6s6 s1s1 s2s2 s0s0 start 0,0 1,0 0,0 1,0 0,0 1,0 1,1 1,0 0,1 0,0 1,1 1,0 0,0

23
Discrete Math by R.S. Chang, Dept. CSIE, NDHU23 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter Def. 6.14 (a) reachable v(s i,x)=s j (b) transient state v(s,x)=s implies x=, s 2 is the only transient state. s0s0 s2s2 s1s1 s3s3 s4s4 s5s5 s7s7 s6s6 0,0 0,1 1,0 1,1 0,1 1,0 0,0 1,1 0,1 1,1 0,0 1,0 1,1 0,0 0,1 (c) sink state v(s,x)=s for all x s 3 is the only sink (d) submachine (e) strongly connected for any s i,s j, s i is reachable from s j a strongly connected submachine

24
Discrete Math by R.S. Chang, Dept. CSIE, NDHU24 Chapter 6 Languages: Finite State Machines 6.3 Finite State Machines: A Second Encounter Ex. 6.26v w 0 1 s 0 s 6 s 1 0 1 s 1 s 5 s 0 0 1 s 2 s 1 s 2 0 1 s 3 s 4 s 0 0 1 s 4 s 2 s 1 0 1 s 5 s 3 s 5 0 1 s 6 s 3 s 6 0 1 Find a transfer sequence from s 0 to s 2. s0s0 s1s1 s6s6 s6s6 s5s5 s5s5 s3s3 s3s3 s0s0 s0s0 s1s1 s2s2 s4s4 0 0 0 0 1 1 1 1 01 10

25
Discrete Math by R.S. Chang, Dept. CSIE, NDHU25 Chapter 6 Languages: Finite State Machines Exercise: P291: 16 P298: 6 P305: 4,6

Similar presentations

OK

DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.

DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on self awareness and values Ppt on work and energy class 9th Ppt on south african culture today Ppt on dry cell and wet cell phone Ppt on 10 sikh gurus name Ppt on environmental chemistry class 11 Ppt on sanskritization in india Ppt on natural resources and conservation jobs Ppt on teamviewer 8 Ppt on review of related literature format