第1頁共6頁 自動機理論與正規語言 期中考試 系級: 座號: 姓名: 一、 是非題(30%) ( ) 1. Let F denote a function, S1 be the domain of F, and S2 be its range. If the domain of F is all of S1, then F is a total function on S1. ( ) 2. A walk is a path in which no edge is repeated, and a path is simple if no vertex is repeated. ( ) 3. A deterministic automation is one in which each move is uniquely determined by the current configuration. ( ) 4. Compared to an accepter, a transducer is a more general automation, capable of producing strings of symbols as output. ( ) 5. A string in a language L will be called a sentence of L. ( ) 6. If functions f and g have the same order of magnitude, then f (n) ( g (n)) . ( ) 7. O(n) O(n) 2O(n) . ( ) 8. A language L is called regular if and only if there exists some non-deterministic finite accepter M such the L = L(M). ( ) 9. The transition function of a non-deterministic finite accepter (nfa) should be a total function. ( ) 10. The transition function of a non-deterministic finite accepter (nfa) is defined as : Q 2 Q . ( ) 11. Digital computers are completely nondeterministic. ( ) 12. Language L {a n : n 0} {b n a : n 1} can be accepted by an four state nfa. ( ) 13. Two finite accepters are said to be equivalent if they both accept the same language. ( ) 14. The language accepted by a deterministic finite accepter (dfa) M (Q, , , q0 , F ) is L(M ) {w * : * (q0 , w) F} . ( ) 15. , , and a are all regular expressions. These are called primitive regular expressions. ( ) 16. Let r be a regular expression, then L(r) is a regular language. 1 第2頁共6頁 ( ) 17. Let L be a regular language, then there exists a regular expression r such that L=L(r). ( ) 18. A grammar G (V , T , S , P) is said to be right-linear if all producations are of the form A xB , A x , where A, B V , and x T * . ( ) 19. Regular grammars should be linear. ( ) 20. Let G be a right-linear grammar, then L(G) is a regular language. ( ) 21. A generalized transition graph is a transition graph whose edges are labeled with regular expressions. ( ) 22. The family of regular languages is closed under union, intersection, concatenation, complementation, and star-closure. ( ) 23. The family of regular languages is closed under reversal, difference, right quotient, and homomorphism. ( ) 24. If L is a language on , then its homomorphic image is defined as h( L) {h( w) : w L} . ( ) 25. Let L1 and L2 be a language on the same alphabet, then right quotient of L1 with L2 is defined as L1 L2 {x : xy L2 for some y L1} . ( ) 26. A regular language is given in a standard representation if and only if it is described by a finite automaton, a regular expression, or a regular grammar. ( ) 27. A context-free grammar G (V , T , S , P) is said to be a simple grammar if all its productions are of the form A ax , where AV , a T , and x T * . ( ) 28. If every grammar that generates a context-free language L is ambiguous, then the language is called inherently ambiguous. ( ) 29. Language L {a n b m c k : n 2m k , n, m, k 0} is not context-free. ( ) 30. A grammar G (V , T , S , P) is said to be contest-free if all productions in P have the form A x , where AV and x (V T ) * . 二、 請寫出下列 grammars 所產生出的 languages。(9%) 1. (3%)The grammar G ({S},{a, b}, S , P) , with productions S aSa , S bSb , S . Ans: 2. (3%)The grammar G ({S , A, B},{a, b}, S , P) , with productions S aAB , A bBb , B A| . Ans: 2 第3頁共6頁 系級: 3. 座號: 姓名: (3%) The grammar G ({S , A, B},{a, b}, S , P) , with productions S Aab , A Aab | B , B a . Ans: 三、 (10%)針對下列各 regular languages,請寫出適當的 left-linear grammars。 1.(5%) L {w : na (w) and nb (w) are both even} Ans: 2.(5%) L(aa * (ab a)*) Ans: 四、 (4%)請寫出下列 finite automata 所能接受的 language。 a, b b q1 q0 b q2 a a Ans: 五、 (8%)請寫出下列 regular languages 的 regular expressions。 1. (4%) L a n b m : (n m) is even Ans: 3 2. (4%) L(r ) w {0,1}* : w contains an even number of 0' s 第4頁共6頁 Ans: 六、 (8%)請畫出可接受下列語言的 transition graph。(不可以畫 generalized transition graph) 1. (4%) L(( a b) * b(a bb)*) Ans: 2. (4%) L w : na (w) nb (w) Ans: 七、 (4%) Let L1 L(a * baa*) and L2 L(aba*) . Find L1 L2 . Ans: 八、 (5%) 給定一 grammar G ({S , A, B},{a, b}, S , P) , with productions S aAB , A bBb , B A | 。請畫出 string abbbb 的 derivation tree. Ans: 4 第5頁共6頁 系級: 座號: 姓名: 九、 (6%)針對下列各 languages,請寫出適當的 context-free grammars。 1. (3%) L {a n b m | 2n m 3n, n, m 0} Ans: 2. (3%) L {w {a, b}* : na (w) nb (w) and na (v) nb (v), where v is any prefix of w} Ans: 十、 (16%)下列証明請任選二題做做看,答題時請註明題號。(請一定只選二題, 每多做一題扣 5%)。 1. Please show that if L1 and L2 are regular languages, then so is L1 L2 . 2. Let G (V , , S , P) be a right-linear grammar, the L(G) is a regular language. 3. Procedure: nfa-to-dfa 4. A pumping lemma: Let L be an infinite regular language. Then these exists some positive integer m such that any w L with | w | m can be decomposed as w xyz , with | xy | m , and | y | 1 , such theat wi xy i z is also in L for all i 0,1,2,3,... . 5 第6頁共6頁 6