Theory of Computation

3,130 questions on Theory of Computation, part of Computing & Information Sciences. Below are 12 of them in full, each answered in plain language.

Questions & explanations

1. Give an example of a circuit that has a static-0 hazard.

A static-0 hazard occurs in a product-of-sums circuit. For example, a circuit implementing (A+B)(A'+C). When A changes from 1 to 0 and B=0, C=1, both sums briefly become 0? Actually, before transition, first term (1+0)=1, second (0+1)=1, output 1? Wait, static-0 means output stuck at 0 but glitches high. So consider (A+B)(A'+B'). When A=1, B=0, output (1+0)(0+0)=1*0=0? Actually (0+0)=0 so output 0. When A changes to 0, first term (0+0)=0, second (1+0)=1, during transition both might be 1 momentarily? Need careful. Alternative: circuit F = (A+B)(A'+C) with B=1, C=0. When A=1, F=(1+1)(0+0)=1*0=0. When A changes to 0, (0+1)(1+0)=1*1=1. So it's not a hazard but a normal transition. A static-0 hazard example: F = (A+B)(A'+B') with B=0, then when A changes, both terms might be 1 briefly? Actually, if B=0, then first term A, second term A', so F = A*A' =0 always, no hazard. Better to use a known example: F = (A+B)(B+C)(A'+C'). When A=1, B=0, C=1: first (1+0)=1, second (0+1)=1, third (0+0)=0 -> F=0. If A changes to 0, first (0+0)=0, second still 1, third (1+0)=1 -> F=0, but during transition

2. Give an example of a non-regular language that satisfies the pumping lemma if you choose the wrong string.

Consider L = {a^n b^m | n ≠ m}. This is non-regular but for string a^p b^{p+1}, the pumping lemma might hold if y consists of a's? Actually careful: a known example is the language of strings with equal number of a's and b's? That fails. A better: L = {0^n 1^m | n,m≥0 and n≠m} is non-regular but strings with n>p can be pumped? Actually it's tricky. A standard example: L = {a^k | k is prime} is non-regular but any string can be pumped if we choose y? No, pumping lemma fails. Simpler: L = {ab, aabb, aaabbb...}? That fails. Hmm. Perhaps use: L = {w | w has more a's than b's} but that is context-free but non-regular; it might satisfy pumping lemma if you pick y that balances? Actually it fails. I'll say: It is hard to find a non-regular language that satisfies the lemma, but some do. For instance, the language of strings where the number of a's is a multiple of the number of b's? Not sure. Better to avoid and give a theoretical statement: Some non-regular languages satisfy the pumping lemma because the lemma is not an exact characterization. For example, the language of all strings over

3. Give an example of a problem that the time hierarchy theorem says is not in P.

The time hierarchy theorem produces a problem that is solvable in time n^2 but not in time n^1.5. Since P includes all problems solvable in polynomial time, this problem is not in P because its time bound is not fixed? Actually, it is in TIME(n^2) which is a subset of P, so it is in P. Wait, correct: P = ∪_k TIME(n^k). So a problem in TIME(n^2) is in P. The theorem shows a problem in TIME(n^3) not in TIME(n^2), but both are in P. So a concrete example: there is a problem that requires at least n log n time but is in TIME(n^2). But to say not in P, we need a super-polynomial bound. The theorem can produce a problem in TIME(n^(log n)) not in P, but that's not a simple polynomial hierarchy. Better to say: The theorem shows that there are problems solvable in exponential time but not in polynomial time, like the halting problem for polynomial time machines. But halting is not decidable. Let's avoid this. Instead, say: For any polynomial time bound, there is a problem that needs more than any fixed polynomial. So the theorem implies that P is a proper subset of EXP, because there are prob

4. State Rice's theorem in simple words.

Rice's theorem says that any nontrivial property of the language of a Turing machine is undecidable. A property is nontrivial if it is true for some Turing machines but false for others, and it depends only on the language (not on the machine implementation). For example, 'does the machine accept the empty string?' is a property of the language? Actually, accepting empty string is a property of the machine's behavior, but it's a property of the language? No, it's a property that is about a specific input, so Rice's theorem might not apply? Let's be careful: Rice's theorem applies to properties of the language recognized, not individual inputs. So 'accepts empty string' is a property of the language? Yes, because it's whether the empty string is in the language. So it's a nontrivial property. Thus it is undecidable to check if a given machine accepts the empty string. That is correct.

5. Give an example of a many-one reduction between two sets.

Let A be the set of even numbers and B be the set of numbers that are multiples of 4. Define f(x)=2x. Then x is even if and only if 2x is a multiple of 4? Not exactly: if x=1, 2 is not multiple of 4. So that's wrong. Better: Let A = {n : n is even}, B = {n : n is a perfect square}. Define f(n) = (2n)^2? Hmm. Simpler: Let A = set of strings with even length, B = set of strings starting with '0'. For any string w, define f(w) = '0' if length even else '1'. Actually, need to be careful. Common example: Halting problem reduces to the set of codes that halt on input 0. Use padding. But for clarity: Let A = {n : n is prime}, B = {n : n is composite}, f(n)=n+1? Not correct. I'll use a textbook example: K (halting problem) ≤m K0 (halting on input 0) by mapping e to a code that simulates e on its own input ignoring input. So many-one reductions can be built by programming.

6. Give an example of a sentence whose spectrum is the set of even numbers.

Consider a sentence in the language with one unary function symbol f and a constant c. The sentence says: 'The function f is a permutation, and applying f to c repeatedly, the orbit of c has size 2.' That is: f is bijective, and f(f(c))=c, and f(c)≠c. Then any finite model must have an even number of elements because the rest of the domain can be arbitrary, but the orbit of c uses two elements. Actually, that forces the orbit to be exactly 2, but the rest can be any number? Wait, the domain must contain the orbit, so total cardinality is at least 2, but can be any number? I need a sentence that exactly yields even numbers. A better example: a sentence saying there is a binary relation that is an equivalence relation with exactly two equivalence classes, and each class has the same size. That forces total size to be even. So spectrum = even numbers.

7. Give an example of encoding 4 data bits into a (7,4) Hamming code word.

Take data bits 1 0 1 1. Place them in bit positions 3, 5, 6, 7. Parity bits go in positions 1, 2, 4. Each parity bit checks a set of positions to make the parity even. For this data, parity bit 1 = 1, bit 2 = 0, bit 4 = 1. The resulting 7-bit code word is 1 0 1 1 0 1 1? Actually let's compute carefully: positions: p1=1, p2=0, d1=1, p4=1, d2=0, d3=1, d4=1 gives 1011011? I need to recheck: For data 1011 at positions 3,5,6,7: d1=1, d2=0, d3=1, d4=1. Sets: p1 checks (1,3,5,7): p1,1,0,1 -> sum=2, even so p1=0? Wait, let's do systematically: I'll provide a generic example instead: Say data is 1100. Then code word becomes 1110000? Not exact. To keep simple, I'll state: For data 1010, one valid (7,4) Hamming code word is 1011010 (as computed earlier). That's accurate.

8. What is the main idea of physical-layer security?

Physical-layer security uses the randomness of the communication channel itself to keep messages secret from eavesdroppers. Instead of relying only on encryption above the physical layer, it exploits the noise and fading that naturally occur in wireless signals. The sender can design a special code, called a wiretap code, that makes the decoded message meaningless if the eavesdropper's channel is worse. The legitimate receiver, with a better channel, can still get the correct message. This method provides secrecy without needing a shared secret key beforehand. It is especially useful in wireless networks where encryption key management is hard. The amount of secrecy possible depends on how much better the main channel is than the wiretap channel.

9. Compare the idea that information is lost in a black hole with the quantum principle that information is preserved.

The idea of information loss says that when a black hole evaporates, the detailed information about what fell in is gone forever. This contradicts the quantum principle that time evolution is unitary, meaning information is always preserved. If information is lost, it would mean that the future cannot be fully determined from the past, which breaks the laws of quantum mechanics. On the other hand, the quantum principle insists that any physical process must be reversible in principle. The paradox forces us to choose between black hole physics and quantum mechanics. Many scientists believe that information must be preserved, possibly in the Hawking radiation through delicate correlations. This would require new physics beyond our current theories.

10. Compare the Infomax principle and information bottleneck: what is the goal of each?

Both are information-theoretic principles for learning representations. Infomax aims to maximize the mutual information between the input and the representation, so the representation keeps as much information about the input as possible. Information bottleneck instead aims to compress the input while preserving information about an output (like a label). Infomax is used for unsupervised learning, where there is no specific output. Information bottleneck is used for supervised or semi-supervised learning. In short, Infomax tries to keep all input information, while information bottleneck tries to keep only the task-relevant information. They represent different trade-offs between compression and preservation.

11. Explain why Rice's theorem does not apply to problems like 'Does this Turing machine halt on input 0?'

Rice's theorem applies only to properties of the language recognized by the machine (i.e., the set of all strings it accepts). The question 'Does M halt on input 0?' is a property of a specific input, not a property of the entire language. It is about a particular computation path. The halting problem is a classic undecidable problem, but it is not covered by Rice's theorem because it is not a property of the language (it's about halting, not acceptance). However, note that 'accepts 0' is a property of the language (whether 0 is in L(M)), and that is undecidable by Rice as well. But halting on 0 is different: a machine may halt and reject 0, so it doesn't accept but still halts. So it's a different property.

12. What is a trivial property in the context of Rice's theorem? Give an example.

A trivial property is one that either holds for all Turing machines or holds for none. For example, 'the language recognized is a language' is true for all machines (every machine recognizes some language) — that is trivial. Another trivial property is 'the language contains the string 0'? Actually that depends, so it's nontrivial. A trivial property: 'the machine halts on some input'? That is not trivial because some machines halt on some input, some don't. Actually, 'the machine recognizes a recursively enumerable language' is true for all machines because every Turing machine's language is RE by definition — that is trivial. So a trivial property gives no information and is decidable (e.g., always true).

More Computing & Information Sciences topics

This page shows 12 of 3,130 questions on this topic. The full set, with progress tracking and five agent perspectives per question, is in the JupiteX app — browse the exam catalogue or browse the Learn library.