0

I have an idea regarding whether this language is finite or not, but for some reason I am still having some issues regarding exactly grasping what makes a language finite or infinite. I know that basically a language such as $0^*$ is obviously infinite since there can be any nonnegative number of $0$'s. However, is a language such as $(0 \cup 1)((0 \cup 1)^p)((0 \cup 1)^p)(0 \cup 1))$ also infinite? Technically, there can be any number of $0 \cup 1$ as it matters on the $p$ value, but I am also under the impression that there can only be so many values for $p$ and therefore the language is indeed finite. Can anyone explain as to why the language is either finite or infinite? I have read other examples but get a little confused when the language is in the gray area. Thanks!

Raphael
  • 73,212
  • 30
  • 182
  • 400

2 Answers2

4

(0 U 1)((0 U 1)^p)((0 U 1)^p)(0U1)) is not a language, but a regular expression. Moreover, to be well-defined, you must specify what $p$ is.

Is $p$ a specific value? Then, this expression generates a finite number of words -> it generates a finite language.

But maybe you look at the language generated by the above expression for any p? then, there will be infinitely many generated words.

you need to tell us what is $p$ and what is the language under consideration.

Ran G.
  • 20,884
  • 3
  • 61
  • 117
0

what makes a language finite or infinite

That's pretty clear by definition. In general, it's (algorithmically) impossible to tell from some description. There are also examples that are deliberately obscure so students have to think.

as it matters on the p value

Exactly. Regular expressions do, syntactically, not allow for integer variables. So you have to consider a fixed (if arbitrary) value for p.

when the language is in the gray area

There is no gray area; the question you ask is ill-posed is all. What is the exact definition of the language?

Raphael
  • 73,212
  • 30
  • 182
  • 400