7

I was given the question

Where does the following language fit in the Chomsky hierarchy?

Nonnegative solutions $(x,y)$ to the Diophantine equation $3x-y=1$.

I understand languages like $L = \{ 0^n1^n \mid n \ge 1\}$, but this language confuses me. What do the words in the language look like? How could I represent it using a grammar or regular expression?

Kaveh
  • 22,661
  • 4
  • 53
  • 113
justausr
  • 435
  • 5
  • 11

3 Answers3

5

The first thing you'll want to do is look at the phrase itself, and ignore all the references to languages for a moment.

So, what are the non-negative solutions to the diophantine equation $3x-y=1$? If we fix some $x$, then $y = 3x-1$. This means that the set of solutions is $\{ (x, 3x-1)\ |\ x > 0 \}$ (note that $x=0$ yields a negative $y$, and a positive $x$ yields a positive $y$).

Now, we can associate a string with any non-negative number pair $(x, y)$: for instance, $(100, 299)$ can be associated with the string (100, 299). If we apply this to every pair in the set, the resulting set of strings is the language of this set. Note that the question does not really make it clear how to associate a string with a solution, but I'm pretty sure they mean the above.

Now all you have to do is figure out in which level of the Chomsky Hierarchy this language falls. As I have a mild suspicion that this is a homework question, I'll not immediately spill the beans. If you can confirm this is not a homework question and you still need help, I'll edit the answer in.

Alex ten Brink
  • 9,206
  • 3
  • 36
  • 63
5

The problem statement is indeed incomplete, but when you see this, you can safely assume that “representing integers in decimal notation” or “representing integers in binary notation” was meant.


So here, if we assume binary notation, the alphabet is contains 5 characters: 0, 1, (, ) and ,. If we assume decimal notation, the alphabet would additionally contain the digits 2 through 9.

The language in question is a subset of the language matched by the regular expression $\mathtt{(}(0|1)^*\mathtt{,}(0|1)^*\mathtt{)}$ (going with binary notation). If we assumed the simpler case of the equation $2x-y=0$, then the language would be all pairs of numbers $(x,y)$ such that $y = 2x$. In binary, this means $y$ is $x$ with an additional 0 at the end. In other words, the language would consist of words of the form ($x$,$x$0). Where does this fit in the Chomsky hierarchy?

Here, we have a more complicated example: you have to recognize whether $y = 3x-1$. How do binary (or decimal) expansions of $x$ and $y$ compare when $y=3x-11$?

Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184
1

The question is not complete, since a language is a set of words, not pairs. If you encode it as $x\$y$ where $x,y$ are in binary, it is context-sensitive but not context-free (see Gilles's answer), if you encode it as $x\$y^R$ it is context-free but not regular (exercise), if you suitably intersperse bits of $x$ and $y$, it is regular! See here.

sdcvvc
  • 3,511
  • 19
  • 28