Question 2 (10%) Write a grammar for each of the following languages. Note that N represents the set of natural numbers N = { 0 , 1 , 2 , 3 , . . . } .
(a) { bb, bbbb, bbbbbb, . . . } = { ( bb ) ^n +1 | n ∈ N }
(b) { a, ba, bba, bbba, . . . } = { b ^n a | n ∈ N }
Question 2 (10%) Write a grammar for each of the following languages. Note that N represents...
[Easy] Theoretical Computer Science Find a grammar for the following languages: (a) Set of binary numerals that represent odd natural numbers (b) Set of binary numerals that represent even natural numbers
Question 3 Give a context-free grammar for each of the following languages over = {a,b,c}. 1. {a^jen: n >0}. 2. {animck : k=n+m} 3. Strings of a's and b's that contain twice as many a's as b's (for example, aba).
Part C Only Let Σ = {a,b}. For each of the following languages, find a grammar that generates it. (a) Li {a"6" : n > 0,m< n}. (b) L2 = {ang 2n: n > 2). (c) L3 {an+35" : n > 2}.
In each of the following, find a Chomsky Normal Form (CNF) grammar equivalent to the given context-free grammar (CFG). 1. SaA Sab A+ ab | BA ASD BaS b 2. SAIC A → AaB AaC | B | a B Bb Cb (→ cclc 3. S → SabA; AAA bc | Bc; B → Aab | BS a
Question 5 10 pts Select all the statements below which are true: The grammar below is CS. SaSa bb O Any CS language is RE. The language L = {a”b"c" : n > 1}is CF. The language L = {wwR : w€ {a, b}" } is DCF, CF, CS, REC, and RE. There are languages which are not accepted by TMs. Any REC language is accepted by some Decider (a TM that halts for every input).
Define a context-free grammar that generates exactly each of the following languages. For consistency, please use S for the start variable in all three grammars 1. A- E 10,1) the middle symbol in is 0 and is odd)
1. Write regular expressions to capture the following regular languages: (a) The set of binary strings which have a 1 in every even position. (Note: odd positions may be either 0 or 1.) (b) The set of binary strings that do not contain 011 as a substring. (c) Comments in Pascal. These are delimited by (* and *) or by { and }, and can contain anything in between; they are NOT allowed to nest, however. 2. Write a DFA...
3) Construct a regular expression defining each of the following languages over the alphabet {a, b}. (a) L = {aab, ba, bb, baab}; (b) The language of all strings containing exactly two b's. (c) The language of all strings containing at least one a and at least one b. (d) The language of all strings that do not end with ba. (e) The language of all strings that do not containing the substring bb. (f) The language of all strings...
1. The following is the extensive-form representation (omitting payoffs) of a game: ·N = {1, 2, 3): . H = 10, A, B, C. Ay, An, Ayy, Ayr, Any, Ann. Ba, Bb. Bc,CY.CN,CYY, CYN,CNY, CNN): ·Z = {Ayy, Ayn, Any, Ann, Ba, Bb. Bc, CYy, CYN,CNY, CNN): (1) Draw the corresponding game tree of the game; (8 points) (2) Write down the sets of strategies for each player; (7 points) (3) Suppose the information sets in this game are: (0),...
2. To find a Chomsky normal form for the following grammar (10 points) STR T - aTbab R RIA first note that we don't need to add a new production S' Sto the grammar because s does not appear on the right hand side of any productions in the grammar. Next, since we have a A-production in the grammar R - A, so we use the technique in question #6 to remove the production. Afterward the grammar becomes SLT TR...