start

3
1 Homework #6 (Models of Computation, Spring, 2001) Due: Section 1; March 29 Section 2; March 30 2. Let L be the language of the following grammar G 1 . Construct a regular grammar whose language is L R , i.e., the reversed language of L. Your grammar’s production rules should observe the restriction that the nonterminal symbol at the right side of each production rule, if any, should be located at the right end. You should also clearly show the procedure that you took to get your answer. G 1 : S aA | bB A bD | B aC | bE C aC | bE | D aE | bD | E aE | bD 3. Let L be the language of the following grammar G 1 . Construct a regular grammar whose language is the complement of L. You should also clearly show the procedure that you took to get your answer. 4. Let L’ be the language of grammar G 2 below and L be the language of grammar G 1 in problem 2 above. (a) Construct a context-free grammar whose language is L’L, the concatenation of the two languages. (b) Construct a context-free grammar whose language is L’ L, the union of the two languages. G2: S aA A Sb | b You should also clearly show the procedure that you took to get your answers. 1. Using the partition technique find the reduced DFA (i.e., the minimum state DFA that accepts the same language) of the following DFA. For your answer you should also show your partitioning record. start a a b b b a a a a a b b b b a b

Upload: cyrah

Post on 06-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

b. a. start. a. b. a. a. b. b. a. b. b. b. a. b. a. a. Homework #6 (Models of Computation, Spring, 2001) Due: Section 1; March 29 Section 2; March 30. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: start

1

Homework #6 (Models of Computation, Spring, 2001)Due: Section 1; March 29 Section 2; March 30

2. Let L be the language of the following grammar G1. Construct a regular grammar whose language is LR, i.e., the reversed language of L. Your grammar’s production rules should observe the restriction that the nonterminal symbol at the right side of each production rule, if any, should be located at the right end. You should also clearly show the procedure that you took to get your answer.

G1: S aA | bB A bD | B aC | bE C aC | bE | D aE | bD | E aE | bD

3. Let L be the language of the following grammar G1. Construct a regular grammar whose language is the complement of L. You should also clearly show the procedure that you took to get your answer.

4. Let L’ be the language of grammar G2 below and L be the language of grammar G1 in problem 2 above. (a) Construct a context-free grammar whose language is L’L, the concatenation of the two languages. (b) Construct a context-free grammar whose language is L’ L, the union of the two languages. G2: S aA A Sb | b You should also clearly show the procedure that you took to get your answers.

1. Using the partition technique find the reduced DFA (i.e., the minimum state DFA that accepts the same language) of the following DFA. For your answer you should also show your partitioning record.

start a

a b

b

b

a

aa

a

a

b

bb

b

ab

Page 2: start

2

5. Convert the following CFG G to another CFG G’ such that L(G) = L(G’) and G’ has the smallest possible number of

-production rules. You should also clearly show the procedure that you took to get your answer.

G: S ABCd | BEF A aA | B FGH | b C cC |

E a | F f | G Gg | H H h |

The following 2 problems are design applications of finite state automata.

6. Consider a toy shown in Figure 1 on the following page. A sequence of marbles is dropped in, each at gate A or B. Levers

x1 and x2 cause the marble to fall either to the left or right. Whenever a marble hit a lever, it causes the lever to change the

position so that the next marble to encounter the lever will take the opposite path. The figure shows the initial states of the

levers. Model this toy by a DFA. Design your machine such that it enters an accepting state when the last marble comes

out of exit D. Denote a marble put in at A by a 0 input, and a marble put in at B by a 1 input.

7. Historically, finite state automata were first used to model neuron (nerve cell) nets (see Figure 2 on the following page).

Each neuron has excitatory (empty circles in the figure) and inhibitory (filled circles) synapses. A neuron produces a 1-output

if the number of excitatory synapses with 1-inputs exceeds the number of inhibitory synapses with 1-inputs by at least the

threshold of the neuron (the number inside the triangle). Model the neuron net in Figure 2 in term of a DFA which enters an

accepting state if the neuron net’s output is 1. Assume that there is sufficient time for an input signal (either 1 or 0) to

propagate and let the network reach a stable configuration before another input comes. Further assume that initially the

values in y1, y2, and y3 are all 0.

Page 3: start

3

AB

C D

Figure 1

x2

x1

neuron netoutput

2

1

1

input

y1

y2

y3

Figure 2

1