# What Does it Mean to Solve a Problem?

At the tail end of CS103, we talk about decidable and recognizable (R and RE) languages as a way of talking about problems that are beyond the capacity of computers to solve. I’ve typically framed the discussion of these languages in terms of trying to answer this overarching question:

What problems can be solved by a computer?

Since CS103 stresses mathematical rigor, I usually introduce this question less as a concrete mathematical goal and more as a framework for thinking about compution. In order to rigorously answer this question, we nee definitions of “problem,” “computer,” and “solve.” In formal language theory, problems are modeled by languages and computers are modeled by Turing machines. The idea of “solving” a problem can then be formulated in terms of decidability and recognizability, along with a ton of other solution strategies that we don’t explore in the course (e.g. co-recognizability).

To help students get why it’s so important to have a formal definition of what it means to solve a problem, I’ve added in this question to the problem set, which connect the earlier material on implications to the later material on computability:

Let $L$ be a language over $\Sigma$ and $M$ be a TM with input alphabet $\Sigma$. Below are three properties that may hold for $M$:

1. $M$ halts on all inputs.
2. For any string $w \in \Sigma^*$, if $M$ accepts $w$, then $w \in L$.
3. For any string $w \in \Sigma^*$, if $M$ rejects $w$, then $w \notin L$.

At some level, for a TM to claim to solve a problem, it should have at least some of these properties. Interestingly, though, just having two of these properties doesn’t say much.

1. Prove that if $L$ is any language over $\Sigma$, then there is a TM $M$ that satisfies properties (1) and (2).
2. Prove that if $L$ is any language over $\Sigma$, then there is a TM $M$ that satisfies properties (1) and (3).
3. Prove that if $L$ is any language over $\Sigma$, then there is a TM $M$ that satisfies properties (2) and (3).
4. Suppose that $L$ is a language over $\Sigma$ for which there is a TM $M$ that satisfies properties (1), (2), and (3). What can you say about $L$? Prove it.

Many students, upon reading this problem, think that they must have misread something, since it looks like it suggests that all languages are decidable or something along those lines. Working out why exactly this isn’t the case is trickier and forces students to read the properties closely to determine what they mean.

These questions also segue nicely into questions about sound and complete approximations to problems. Many students ask whether, if a language is undecidable, there’s still a way to build a TM that gets the right answer “most of the time,” for some definition of “most of the time,” or that gets an “approximately” correct answer. This question shows that it’s always possible to find a decidable subset or superset of any given language (though not a particularly useful one), and is a great launching point for a further discussion of the topic.