Questions tagged [regular-languages]

Questions about properties of the class of regular languages and individual languages.

The class of regular languages is the set of formal languages which is -- among other formalisms -- (equivalently) accepted by finite automata, generated by left- and right-linear grammars and described by regular expressions.

1821 questions
11
votes
0 answers

Regularity profiles

A standard exercise in formal language theory uses Lagrange's four-square theorem to construct a language $L$ such that $L$ isn't regular but $L^2$ is regular. (Let $A = \{ a^{n^2} : n \geq 0 \}$. Then $A$ isn't regular, but $A^4 = \{ a^n : n \geq 0…
Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
8
votes
1 answer

Is every $p$th word in a regular language regular?

Question Let $L$ be a regular language. Let's say we sort $L$ by length and then lexicographically; then let $L_p \subset L$ be every $p$th word in $L$ according to this sort. Is $L_p$ regular as well? Example For example, let's use $L = a^*b^* =…
Jake
  • 378
  • 1
  • 9
8
votes
1 answer

Proving that language is regular or not regular

Let $L$ be a regular language. Prove that: $L_{+--}=\left\{w: \exists_u |u|=2|w| \wedge wu\in L\right\}$ $L_{++-}=\left\{w: \exists_u 2|u|=|w| \wedge wu\in L \right\}$ $L_{-+-}=\left\{w:\exists_{u,v} |u|=|w|=|v| \wedge uwv\in L\right\}$ are…
xan
  • 203
  • 1
  • 5
7
votes
1 answer

Closure of regular languages are closed under certain cut operations

Let $f : \mathbb{N} \to \mathbb{N}$ be an integer function. For a language $L$, define $$f(L) = \{w \mid \exists x : |x| = f(|w|) \text{ and } wx \in L\}$$ For example, if $f(n) = n$ this is just the "halving" operation, and regular languages are…
MT_
  • 463
  • 2
  • 9
4
votes
1 answer

Using finite state machines for lexical analysis

I'm a high school student and I'm passionate about everything language related - lexers, parsers, compilers, interpreters and so on. Some time ago I've written a calculator in Python (now willing to use a better language), which uses the Shunting…
4
votes
1 answer

Practical Applications of regular grammars

A regular grammar is a mathematical object, $G$, with four components, $G = (N, Σ, P, S)$, where. $N$ is a nonempty, finite set of nonterminal symbols, $Σ$ is a finite set of terminal symbols , or alphabet, symbols, $P$ is a set of grammar rules,…
Arman Malekzadeh
  • 349
  • 6
  • 17
4
votes
1 answer

Regular language superset with exactly exponential size

Definitions Define the density $\rho_L$ of a language $L$ to be a function $\rho_L : \mathbb{N} \rightarrow \mathbb{N}$ where $\rho_L(n)$ is the number of words in $L$ of length $n$. Question Let $L \subseteq \Sigma^*$ be a regular language with…
Jake
  • 378
  • 1
  • 9
3
votes
1 answer

What is the meaning of a prefix-free language?

Tried a bunch of resources to read about it, still don't really get it. This is what Wikipedia says A prefix code is a type of code system (typically a variable-length code) distinguished by its possession of the "prefix property", which requires…
nikolaevra
  • 315
  • 3
  • 7
3
votes
1 answer

Concatenation property of regular languages

If L is the empty set and therefore a regular language, I know that L concatenated with sigma star is equal L; Are there any other languages that, when concatenated with sigma star will result in the same language?
O.A.
  • 223
  • 1
  • 6
3
votes
4 answers

Language where every prefix has almost equal a's and b's

Is the following language regular? $$L = \{x \in \{a, b\}^* \mid \text{in every prefix \(w\) of \(x\), } 0 \le |w|_a − |w|_b \le 2\}$$ If so, give a DFA for it with as few states as possible. If you claim that it is not regular give a pumping lemma…
3
votes
1 answer

How does the union of two machines which accept language of form $0^{mx+b}$ look like

I am doing Shai Simonson's course on Theory of computation. I am not able to understand part b of one of its problem sets. a. Prove that languages of form $0^{mx+b}$, where m and b are positive integer constants and x ranges from 0 to infinite, is…
Ayush
  • 117
  • 10
3
votes
1 answer

Why do we need Kleene Star when there is concatenation?

For an alphabet $A = \{ a_1, a_2..., a_n \}$, the set of regular langages $L_r$ on $A$ are recursively defined by closed union, concatenation, and Kleene star's operator. I understood that languages ($A^*$) and regular languages (a subset of $A^*$)…
rafoo
  • 165
  • 6
3
votes
1 answer

Why is $((aa)^*bb(aa)^*bb(aa)^*)^*$ of star-height 1

A generalized regular expression is like a regular expression but with one more operation allowed: complementation. The (generalized) star-height of a generalized regular expression is the maximal number of nested Kleene stars. The star-height of a…
Dabouliplop
  • 155
  • 8
3
votes
1 answer

k-basis representation of natural numbers

(This is the problem 1.56 from Michael Sipser' Introduction to the theory of computation ) Let $A_k(S)= \{ w |w \text{ is the k-basis representation}$ $\text{ without leading 0 of some natural number in the set S}\} $ Example : $A_2 (\{3,5\}) =…
tumasgiu
  • 131
  • 5
3
votes
2 answers

What's the true meaning of $(a + b)^\omega$ in regular expression

I'm starting to dabble in language theory, regular expression & infinite words. I'm not quite sure I completely get the meaning of this expression: $(a + b)^\omega$ $^w$ meaning infinite repetition, I'm not positive it's standard syntaxe or just…
1
2 3 4 5 6 7