Automata And Formal Languages
Automata And Formal Languages
Jump to year
Paper 1, Section I, F
commentLet be the partial function on variables that is computed by the th machine (or the empty function if does not encode a machine).
Define the halting set .
Given , what is a many-one reduction of to ?
State the theorem and use it to show that a subset of is recursively enumerable if and only if .
Give an example of a set with but .
[You may assume that is recursively enumerable and that .]
Paper 1, Section II, F
commentFor give the definition of a partial recursive function in terms of basic functions, composition, recursion and minimisation.
Show that the following partial functions from to are partial recursive: (i) (ii) (iii)
Which of these can be defined without using minimisation?
What is the class of functions that can be defined using only basic functions and composition? [Hint: See which functions you can obtain and then show that these form a class that is closed with respect to the above.]
Show directly that every function in this class is computable.
Paper 2, Section I, F
commentAssuming the definition of a deterministic finite-state automaton (DFA) , what is the extended transition function for ? Also assuming the definition of a nondeterministic finite-state automaton (NFA) , what is in this case?
Define the languages accepted by and , respectively, in terms of .
Given an NFA as above, describe the subset construction and show that the resulting DFA accepts the same language as . If has one accept state then how many does have?
Paper 3, Section I, F
commentDefine a regular expression and explain how this gives rise to a language .
Define a deterministic finite-state automaton and the language that it accepts.
State the relationship between languages obtained from regular expressions and languages accepted by deterministic finite-state automata.
Let and be regular languages. Is always regular? What about ?
Now suppose that are regular languages. Is the countable union always regular? What about the countable intersection ?
Paper 3, Section II,
commentSuppose that is a context-free grammar without -productions. Given a derivation of some word in the language of , describe a parse tree for this derivation.
State and prove the pumping lemma for . How would your proof differ if you did not assume that was in Chomsky normal form, but merely that has no - or unit productions?
For the alphabet of terminal symbols, state whether the following languages over are context free, giving reasons for your answer. (i) , (ii) , (iii) .
Paper 4, Section I,
commentState the pumping lemma for regular languages.
Which of the following languages over the alphabet are regular?
(i) .
(ii) where is the reverse of the word .
(iii) does not contain the subwords 01 or 10.
Paper 1, Section I,
commentDefine an alphabet , a word over and a language over .
What is a regular expression and how does this give rise to a language
Given any alphabet , show that there exist languages over which are not equal to for any regular expression . [You are not required to exhibit a specific .]
Paper 1, Section II, F
comment(a) Define a register machine, a sequence of instructions for a register machine and a partial computable function. How do we encode a register machine?
(b) What is a partial recursive function? Show that a partial computable function is partial recursive. [You may assume that for a given machine with a given number of inputs, the function outputting its state in terms of the inputs and the time is recursive.]
(c) (i) Let be the partial function defined as follows: if codes a register machine and the ensuing partial function is defined at , set . Otherwise set . Is a partial computable function?
(ii) Let be the partial function defined as follows: if codes a register machine and the ensuing partial function is defined at , set . Otherwise, set if is odd and let be undefined if is even. Is a partial computable function?
Paper 2, Section I, F
commentAssuming the definition of a partial recursive function from to , what is a recursive subset of ? What is a recursively enumerable subset of ?
Show that a subset is recursive if and only if and are recursively enumerable.
Are the following subsets of recursive?
(i) codes a program and halts at some stage .
(ii) codes a program and halts within 100 steps .
Paper 3, Section I, F
commentDefine a context-free grammar , a sentence of and the language generated by .
For the alphabet , which of the following languages over are contextfree? (i) ,
(ii) .
[You may assume standard results without proof if clearly stated.]
Paper 3, Section II, F
commentGive the definition of a deterministic finite state automaton and of a regular language.
State and prove the pumping lemma for regular languages.
Let be the subset of consisting of the powers of 2 .
If we write the elements of in base 2 (with no preceding zeros), is a regular language over ?
Now suppose we write the elements of in base 10 (again with no preceding zeros). Show that is not a regular language over . [Hint: Give a proof by contradiction; use the above lemma to obtain a sequence of powers of 2, then consider for and a suitable fixed d.]
Paper 4, Section I,
commentDefine what it means for a context-free grammar (CFG) to be in Chomsky normal form .
Describe without proof each stage in the process of converting a CFG into an equivalent CFG which is in CNF. For each of these stages, when are the nonterminals left unchanged? What about the terminals and the generated language ?
Give an example of a CFG whose generated language is infinite and equal to .
Paper 1, Section I, H
comment(a) State the pumping lemma for context-free languages (CFLs).
(b) Which of the following are CFLs? Justify your answers.
(i) , where is the reverse of the word .
(ii) is a prime .
(iii) and .
(c) Let and be CFLs. Show that the concatenation is also a CFL.
Paper 1, Section II, H
commentLet be a deterministic finite-state automaton (DFA). Define what it means for two states of to be equivalent. Define the minimal DFA for .
Let be a DFA with no inaccessible states, and suppose that is another DFA on the same alphabet as and for which . Show that has at least as many states as . [You may use results from the course as long as you state them clearly.]
Construct a minimal DFA (that is, one with the smallest possible number of states) over the alphabet which accepts precisely the set of binary numbers which are multiples of 7. You may have leading zeros in your inputs (e.g.: 00101). Prove that your DFA is minimal by finding a distinguishing word for each pair of states.
Paper 2, Section I, H
comment(a) Define a recursive set and a recursively enumerable (r.e.) set. Prove that is recursive if and only if both and are r.e. sets.
(b) Let for some fixed and some fixed register machine code . Show that for some fixed register machine code . Hence show that is an r.e. set.
(c) Show that the function defined below is primitive recursive.
[Any use of Church's thesis in your answers should be explicitly stated. In this question denotes the set of non-negative integers.]
Paper 3, Section I,
comment(a) Define what it means for a context-free grammar (CFG) to be in Chomsky normal form (CNF). Can a CFG in CNF ever define a language containing ? If denotes the result of converting an arbitrary CFG into one in CNF, state the relationship between and .
(b) Let be a CFG in CNF. Give an algorithm that, on input of any word on the terminals of , decides if or not. Explain why your algorithm works.
(c) Convert the following CFG into a grammar in CNF:
Does in this case? Justify your answer.
Paper 3, Section II, 12H
comment(a) State the theorem and the recursion theorem.
(b) State and prove Rice's theorem.
(c) Show that if is partial recursive, then there is some such that
(d) Show there exists some such that has exactly elements.
(e) Given , is it possible to compute whether or not the number of elements of is a (finite) perfect square? Justify your answer.
[In this question denotes the set of non-negative integers. Any use of Church's thesis in your answers should be explicitly stated.]
Paper 4, Section I,
comment(a) Which of the following are regular languages? Justify your answers.
(i) .
(ii) contains an odd number of 's and an even number of 's .
(iii) contains no more than 7 consecutive 0 's .
(b) Consider the language over alphabet defined via
Show that satisfies the pumping lemma for regular languages but is not a regular language itself.
Paper 1, Section I, G
comment(a) State the pumping lemma for context-free languages (CFLs).
(b) Which of the following are CFLs? Justify your answers.
(i)
(ii) and
(iii)
(c) Let be a CFL. Show that is also a CFL.
Paper 1, Section II, G
comment(a) Define the halting set . Prove that is recursively enumerable, but not recursive.
(b) Given , define a many-one reduction of to . Show that if is recursively enumerable and , then is also recursively enumerable.
(c) Show that each of the functions and are both partial recursive and total, by building them up as partial recursive functions.
(d) Let . We define the set via
(i) Show that both and .
(ii) Using the above, or otherwise, give an explicit example of a subset of for which neither nor are recursively enumerable.
(iii) For every , show that if and then .
[Note that we define . Any use of Church's thesis in your answers should be explicitly stated.]
Paper 2, Section I, G
comment(a) Let be a nondeterministic finite-state automaton with -transitions -NFA). Define the deterministic finite-state automaton (DFA) obtained from via the subset construction with -transitions.
(b) Let and be as above. By inducting on lengths of words, prove that
(c) Deduce that .
Paper 3, Section I, G
comment(a) Define what it means for a context-free grammar (CFG) to be in Chomsky normal form ( .
(b) Give an algorithm for converting a CFG into a corresponding CFG in CNF satisfying . [You need only outline the steps, without proof.]
(c) Convert the following :
into a grammar in CNF.
Paper 3, Section II, G
comment(a) State and prove the pumping lemma for regular languages.
(b) Let be a minimal deterministic finite-state automaton whose language is finite. Let be the transition diagram of , and suppose there exists a non-empty closed path in starting and ending at state .
(i) Show that there is no path in from to any accept state of .
(ii) Show that there is no path in from to any other state of .
Paper 4, Section I, 4G
comment(a) State the theorem, the recursion theorem, and Rice's theorem.
(b) Show that if is partial recursive, then there is some such that
(c) By considering the partial function given by
show there exists some such that has exactly elements.
(d) Given , is it possible to compute whether or not has exactly 9 elements? Justify your answer.
[Note that we define . Any use of Church's thesis in your answers should be explicitly stated.]
Paper 1, Section I,
comment(a) Prove that every regular language is also a context-free language (CFL).
(b) Show that, for any fixed , the set of regular expressions over the alphabet is a CFL, but not a regular language.
Paper 1, Section II,
comment(a) Give an encoding to integers of all deterministic finite-state automata (DFAs). [Here the alphabet of each such DFA is always taken from the set , and the states for each such DFA are always taken from the set
(b) Show that the set of codes for which the corresponding DFA accepts a finite language is recursive. Moreover, if the language is finite, show that we can compute its size from .
Paper 2, Section I,
comment(a) Give explicit examples, with justification, of a language over some finite alphabet which is:
(i) context-free, but not regular;
(ii) recursive, but not context-free.
(b) Give explicit examples, with justification, of a subset of which is:
(i) recursively enumerable, but not recursive;
(ii) neither recursively enumerable, nor having recursively enumerable complement in .
Paper 3, Section I, 4H
comment(a) Define what it means for a context-free grammar (CFG) to be in Chomsky normal form (CNF). Give an example, with justification, of a context-free language (CFL) which is not defined by any CFG in CNF.
(b) Show that the intersection of two CFLs need not be a CFL.
(c) Let be a CFL over an alphabet . Show that need not be a CFL.
Paper 3, Section II, Automata and formal languages
comment(a) Given , define a many-one reduction of to . Show that if is recursively enumerable (r.e.) and then is also recursively enumerable.
(b) State the theorem, and use it to prove that a set is r.e. if and only if .
(c) Consider the sets of integers defined via
Show that .
Paper 4, Section I,
comment(a) Describe the process for converting a deterministic finite-state automaton into a regular expression defining the same language, . [You need only outline the steps, without proof, but you should clearly define all terminology you introduce.]
(b) Consider the language over the alphabet defined via
Show that satisfies the pumping lemma for regular languages but is not a regular language itself.
Paper 1, Section I,
commentState the pumping lemma for context-free languages (CFLs). Which of the following are CFLs? Justify your answers.
(i) .
(ii) .
(iii) is a prime .
Let be CFLs. Show that is also a CFL.
Paper 1, Section II, F
comment(a) Define a recursive set and a recursively enumerable (r.e.) set. Prove that is recursive if and only if both and are r.e.
(b) Define the halting set . Prove that is r.e. but not recursive.
(c) Let be r.e. sets. Prove that and are r.e. Show by an example that the union of infinitely many r.e. sets need not be r.e.
(d) Let be a recursive set and a (total) recursive function. Prove that the set is r.e. Is it necessarily recursive? Justify your answer.
[Any use of Church's thesis in your answer should be explicitly stated.]
Paper 2, Section ,
comment(a) Which of the following are regular languages? Justify your answers.
(i) is a nonempty string of alternating 's and 's .
(ii) .
(b) Write down a nondeterministic finite-state automaton with -transitions which accepts the language given by the regular expression . Describe in words what this language is.
(c) Is the following language regular? Justify your answer.
Paper 3, Section I,
comment(a) Define what it means for a context-free grammar (CFG) to be in Chomsky normal form (CNF). Can a CFG in CNF ever define a language containing ? If denotes the result of converting an arbitrary CFG into one in CNF, state the relationship between and .
(b) Let be a CFG in CNF, and let be a word of length . Show that every derivation of in requires precisely steps. Using this, give an algorithm that, on input of any word on the terminals of , decides if or not.
(c) Convert the following CFG into a grammar in CNF:
Does in this case? Justify your answer.
Paper 3, Section II, F
comment(a) Let be a deterministic finite-state automaton. Define the extended transition function , and the language accepted by , denoted . Let , and . Prove that .
(b) Let where , and let .
(i) Show that there exist such that , where we interpret as if .
(ii) Show that .
(iii) Show that for all .
(c) Prove the following version of the pumping lemma. Suppose , with . Then can be broken up into three words such that , and for all , the word is also in .
(d) Hence show that
(i) if contains a word of length at least , then it contains infinitely many words;
(ii) if , then it contains a word of length less than ;
(iii) if contains all words in of length less than , then .
Paper 4, Section I,
comment(a) Construct a register machine to compute the function . State the relationship between partial recursive functions and partial computable functions. Show that the function is partial recursive.
(b) State Rice's theorem. Show that the set is recursively enumerable but not recursive.