Logic & Foundations

2,677 questions on Logic & Foundations, part of Mathematics & Statistics. Below are 12 of them in full, each answered in plain language.

Questions & explanations

1. Give an example of a language that is not context-free but satisfies the pumping lemma for context-free languages.

An example is L = {a^n b^n c^n d^n : n ≥ 0}? Actually, that language is not context-free but might satisfy the pumping lemma? A known example is the language L = {a^n b^n c^n : n ≥ 0} does not satisfy the pumping lemma as shown. But there are non-context-free languages that satisfy it, such as the language of all strings over {a,b,c} with equal numbers of a's, b's, and c's? That is not context-free but might satisfy the pumping lemma? Actually, it is known that the pumping lemma cannot prove non-context-freeness of all non-context-free languages. For instance, the language L = {a^n b^n c^n : n ≥ 0} is a classic example that fails the pumping lemma. A language that satisfies the pumping lemma but is not context-free is more complex; one example is the language L = {a^n b^n c^n d^n : n ≥ 0}? I think that also fails. Actually, a standard example is the language L = {a^n b^n c^n : n ≥ 0} ∪ {a^n b^n c^n d^n : n ≥ 0}? That might still fail. A known example is the language of all strings over {a,b,c} where the number of a's equals the number of b's equals the number of c's? That is not cont

2. Give an example of a set that is Σ3 but not Σ2.

Consider the set of indices of Turing machines that halt on all inputs (total functions) is Π2, not Σ2. For Σ3, consider the set of machines that halt on all but finitely many inputs? That is Σ2 as we said. A classic Σ3 set is the set of indices of machines that compute a total function which is eventually constant? That might be Σ3. Another: the set of machines that halt on infinitely many inputs is Π2? Actually, 'there exist infinitely many x such that machine halts on x' is Σ2 because it is 'for all y, there exists x > y such that machine halts on x'? That is Π2? Let's think: 'infinitely many' is Π2: 'for every number y, there exists x > y such that machine halts on x'. So it is Π2. So a Σ3 set would be something like: 'there exists a number y such that for all x > y, machine halts on x' is Σ2. So we need a higher level: the set of machines that compute a function that is not dominated by any computable function is Σ3. But for simplicity, the set of indices of machines that compute a total function which is eventually equal to the constant 0 function is Π2? Actually, it is Π2: 'fo

3. Explain how ultraproducts can show that a theory is not finitely axiomatizable.

Suppose a theory T is finitely axiomatizable. Then T is equivalent to a single sentence φ. Consider an ultraproduct of models of finite fragments of T that are not models of T. If T is not finitely axiomatizable, there is a family of structures M_i that satisfy every finite subset of T but not T itself. Take an ultraproduct of these M_i. By Łoś's theorem, the ultraproduct satisfies every finite subset, so it satisfies T? Actually, if T is not finitely axiomatizable, the ultraproduct might still satisfy T? Wait: if T is not finitely axiomatizable, there is no single sentence capturing it. But ultraproducts can be used to show that T is not finitely axiomatizable if there is an ultraproduct of models of finite subsets that does not satisfy T. For example, the theory of torsion-free abelian groups is not finitely axiomatizable because an ultraproduct of groups of bounded torsion can be torsion-free? Actually, a classic example: the theory of fields of characteristic 0 is not finitely axiomatizable because an ultraproduct of fields of characteristic p (p prime) can have characteristic 0,

4. Give an example of a set that is Δ3 according to Post's theorem.

By Post's theorem, Δ3 sets are those computable from 0'' (the second jump of the empty set). An example is the set of indices of Turing machines that compute a total function (the total function set) is Π2, but it is not Δ2 because it is not computable from 0'. However, it is computable from 0''? Actually, the total function set is Π2-complete, so it is not computable from 0' but is computable from 0''? Wait, Π2 sets are computable from 0''? Yes, because 0'' is Σ2-complete, and Π2 sets are also computable from 0''? Actually, every Π2 set is computable from 0''? Since 0'' is Σ2-complete, its complement is Π2-complete, so any Π2 set is computable from the complement of 0''? But the complement of 0'' is also computable from 0''? Actually, 0'' is not necessarily closed under complement, but the complement of 0'' is Π2 and is computable from 0''? Not necessarily. However, Post's theorem says Δ3 sets are those computable from 0''. The total function set is Π2, and it is not Δ2, but it might be Δ3? Actually, it is Π2, so it is computable from 0''? I think yes, because 0'' is Σ2-complete, an

5. For the same game, find a mixed-strategy Nash equilibrium where each player randomizes.

Let Player1 choose A with probability p, B with 1-p. Player2 chooses A with q, B with 1-q. For Player1 to be indifferent, expected payoff from A equals from B: 2q + 0(1-q) = 3q + 1(1-q) => 2q = 3q+1-q => 2q = 2q+1 => 0=1, impossible. So no mixed equilibrium? Actually, recalc: A: 2q + 0(1-q)=2q; B: 3q+1(1-q)=2q+1. So 2q=2q+1 gives no solution. Wait, check payoffs: (B,A) is (3,0) and (B,B) is (1,1). So B gives 3q+1(1-q)=2q+1. So indifference requires 2q=2q+1, impossible. So no mixed equilibrium either? Actually, there is a mixed equilibrium if we consider that Player1 can also be indifferent with probabilities that make Player2 indifferent. Let's solve properly: Player2's payoffs: if Player2 plays A: 2p+0(1-p)=2p; if B: 3p+1(1-p)=2p+1. So indifference: 2p=2p+1, impossible. So no mixed equilibrium. So this game has no Nash equilibrium in pure or mixed? But Nash theorem says every finite game has at least one Nash equilibrium. Let's check: maybe I mis-specified payoffs. Actually, typical game like this has a mixed equilibrium. Let me recalc: Player1's payoff matrix: row player. (A,A):2,

6. Give an example of a set that is hyperarithmetical but not arithmetical.

The set of indices of computable well-orderings (i.e., the set of e such that the eth partial computable function defines a well-ordering of natural numbers) is Π1^1 complete and hence not hyperarithmetical. An example of a hyperarithmetical but not arithmetical set is the set of true Π1^0 sentences of arithmetic? Actually, the set of true Π1^0 sentences is Π1^0 complete and arithmetical. A better example: the set of indices of computable ordinals (i.e., the set of notations in Kleene's O) is Π1^1 complete. A hyperarithmetical non-arithmetical set is the set of indices of computable well-orderings of length less than ω^CK? That is still complicated. Simpler: the Turing jump of the halting problem, 0'', is arithmetical (Σ2^0). Actually, the hyperarithmetical hierarchy includes sets like the set of true Σ1^1 sentences? That is not hyperarithmetical. Let me correct: The set of all indices of computable ordinals (a subset of O) is hyperarithmetical? No, O is Π1^1 complete. A specific example: the set of all numbers that are in the hyperarithmetical hierarchy at level ω? Actually, the set

7. Give an example of a non-regular language that satisfies the pumping lemma (i.e., the pumping lemma cannot prove it non-regular).

Consider L = {0^n1^m : n,m ≥ 0 and n≠m} ∪ {0^n1^n : n≥0}. This language is actually not regular, but it satisfies the pumping lemma. For any string s, if s is of the form 0^n1^n, pumping might keep it in L? Actually, a known example is L = {0^i1^j : i ≠ j} ∪ {0^k1^k : k≥0}? Wait, a classic example is L = {0^n1^n : n≥0} ∪ {0^n1^{2n} : n≥0}? No, that might be context-free. A simpler one: L = {0^n1^m : n,m ≥ 0 and n≠m} is not regular but satisfies the pumping lemma? Actually, it is known that the pumping lemma cannot prove non-regularity of all non-regular languages. For instance, the language L = {0^n1^m : n,m ≥ 0 and n≠m} is not regular but satisfies the pumping lemma with p=2? Let's check: any string of length ≥2 can be pumped? Possibly. But a standard example is L = {0^n1^m : n,m ≥ 0 and n≠m}? Actually, that language is regular? No, it's not regular because its complement includes {0^n1^n}. However, the pumping lemma might still hold. A known example is L = {0^n1^n : n≥0} ∪ {0^n1^{2n} : n≥0}? That is context-free but not regular, and it satisfies the pumping lemma? I think a better

8. Prove the deduction theorem for a simple case: show that if A ⊢ B, then ⊢ A → B, using a Hilbert system with modus ponens and the axiom A → (B → A).

Assume A ⊢ B, so there is a derivation of B from A. We need to show ⊢ A → B. Base case: if B is an axiom, then B is a theorem, and from axiom A → (B → A) we get A → B? Actually, we need a different axiom: (A → (B → C)) → ((A → B) → (A → C)). For base case, if B is an axiom, we have ⊢ B, then by axiom A → (B → A) we get ⊢ A → B? Wait, that gives A → (B → A), not A → B. Correct: from ⊢ B, we use the rule that if ⊢ B then ⊢ A → B (by the axiom schema? Actually, we need the axiom A → (B → A) and modus ponens: from ⊢ B and ⊢ B → (A → B) (which is an instance of the axiom with B and A swapped? The axiom is A → (B → A). So we need to derive B → (A → B) from that? This is messy. Simpler: use the deduction theorem itself as a metatheorem. For a concrete proof, we can show: if B is an axiom, then ⊢ A → B because A → B is an instance of the axiom schema? No, the axiom schema is A → (B → A), not A → B. Actually, we can use the fact that if ⊢ B, then ⊢ A → B by the rule of necessitation? In Hilbert systems, we have the axiom A → (B → A) and then from ⊢ B we get ⊢ A → B by applying modus ponens wi

9. Give an example of a Skolem hull in the field of real numbers.

Consider the real numbers as a structure in the language of ordered fields. Add Skolem functions for all formulas. For example, for the formula ∃y (y^2 = x) when x≥0, we can add a Skolem function sqrt(x) that returns the nonnegative square root. The Skolem hull of the empty set is the set of all numbers that can be obtained from the constants (0,1) by repeatedly applying the Skolem functions. This includes all algebraic numbers, since they are definable. In fact, the Skolem hull of the empty set is the field of algebraic real numbers, which is an elementary substructure of ℝ? Actually, it is not elementary because the real numbers have properties like 'every positive number has a square root' but the algebraic numbers also satisfy that? Wait, the algebraic numbers are not elementary equivalent to ℝ because ℝ is not algebraically closed? Actually, the algebraic reals are real closed, and the theory of real closed fields is complete, so they are elementarily equivalent. So the Skolem hull of ∅ in ℝ is the real algebraic numbers, which is an elementary substructure.

10. Give an example of a Σ₂ set that is not Σ₁.

A classic example is the set of indices of Turing machines that halt on infinitely many inputs. This set is Σ₂ because it can be defined as: { e | ∀x ∃y (Turing machine e halts on input y and y > x) }. The quantifier pattern is ∀∃, which is Π₂? Wait: 'halts on infinitely many inputs' is Π₂? Actually, 'for every x there exists y > x such that machine e halts on y' is ∀∃, so it's Π₂. A Σ₂ set would be ∃∀. For example, the set of indices of Turing machines that halt on all inputs is Π₂? That's ∀∃? Actually, 'halts on all inputs' is ∀x ∃s (machine e halts on x in s steps) which is Π₂. So a Σ₂ set is like { e | ∃x ∀y (machine e does not halt on y when y < x) }? That's not standard. Better: The set of indices that are not in the halting problem is Π₁. The set of indices that are in the halting problem is Σ₁. So a Σ₂ set is the complement of a Π₂ set. Example: The set of indices of Turing machines that halt on some input is Σ₁. The set of indices that halt on all inputs is Π₂. So the complement (not halt on all inputs) is Σ₂.

11. Prove the formula 'P implies P' in a Hilbert calculus using the axioms (A1) 'A implies (B implies A)' and (A2) '(A implies (B implies C)) implies ((A implies B) implies (A implies C))'.

We want to prove 'P implies P'. First, use axiom A1 with A = P and B = P, giving 'P implies (P implies P)'. Next, use axiom A2 with A = P, B = P, C = P, giving '(P implies (P implies P)) implies ((P implies P) implies (P implies P))'. Then apply modus ponens to the previous two formulas to get '(P implies P) implies (P implies P)'. Finally, apply modus ponens again with this formula and the earlier 'P implies (P implies P)'? Wait, that's not correct. Actually, we need a different approach. A standard proof: 1. 'P implies ((P implies P) implies P)' by A1 with A=P, B=(P implies P). 2. '(P implies ((P implies P) implies P)) implies ((P implies (P implies P)) implies (P implies P))' by A2 with A=P, B=(P implies P), C=P. 3. From 1 and 2 by modus ponens: '(P implies (P implies P)) implies (P implies P)'. 4. 'P implies (P implies P)' by A1 with A=P, B=P. 5. From 3 and 4 by modus ponens: 'P implies P'.

12. For the language L = {w in {0,1}* : w has an even number of 0s}, how many equivalence classes does the Myhill-Nerode relation have?

The Myhill-Nerode relation for this language has two equivalence classes. One class contains strings with an even number of 0s, and the other contains strings with an odd number of 0s. For any two strings in the same class, adding any suffix will keep the resulting string in L if and only if the original string was in L? Actually, the definition: two strings x and y are equivalent if for all suffixes z, xz is in L exactly when yz is in L. Here, if x and y both have even number of 0s, then xz is in L iff z has even number of 0s? Wait, careful: L is the set of strings with even total 0s. So xz is in L iff (number of 0s in x + number of 0s in z) is even. If x and y have the same parity of 0s, then for any z, xz in L iff yz in L. So there are exactly two classes: even parity and odd parity. Thus the minimal DFA has two states.

More Mathematics &amp; Statistics topics

This page shows 12 of 2,677 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.