HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How can solutions of a Diophantine equation be expressed as a language?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
canhowexpressedlanguagesolutionsdiophantineequation

Problem

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?

Solution

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.

Context

StackExchange Computer Science Q#618, answer score: 5

Revisions (0)

No revisions yet.