Surely any language with a finite longest word can be made regular by having an automaton with paths to 26 states for all letters then having each of those states go to another 26 states etc with states going to a looping non final state whenever there are no possible words to be made beginning the the letters you have already gone through. Then make every state that ends on a word final.
Tag: regular
Regular expression for set of strings with no two consecutive 1’s?
I’m having trouble figuring out a regular expression over the alphabet {0,1} that contains all strings with no TWO consecutive 1’s.
I’m also wondering if there is a pattern that could be extended to three consecutive 1s. etc…
Would something like this be correct?
(0 U (10))* U (0 U (10))* 1
Space efficient representation of Regular graphs
Let $ G$ be a $ k$ regular graph (each vertex have a degreee $ k$ ). It is trivial to store the graph in $ O(\log n)$ space or words such that $ j$ th neighbour of any vertex can be found in $ O(\log n)$ time. Assume that neighbours of each vertex are ordered.
Note that $ k=O(\log n)$
Is there an representation of graph $ G$ that takes $ o(nk)$ space in words such that query can be solved in $ O(1)$
If R is a regular language, is R³ = R o R o R also regular?
My understanding of a regular language is that for a language to be formal, it must be able to be represented by a DFA or NFA. To prove a language is not regular you can use the pumping lemma to get a contradiction.
I am trying to figure out whether R³ or R o R o R is regular if R is also regular.
My understanding of the definition of R o R is that it is kind of a transitive mapping of R?
And I think if R o R is regular then R o R o R is also regular, so I need to prove R o R is regular which really means that I am trying to prove that regular languages are transitive?
I am not sure how I would go about doing this as I am a little confused how regular languages and transitivity relate – as I have only worked with relations for transitivity.
Is {a^n: n is a product of exactly two primes} regular?
I am struggling to prove the following question.
$ L_1 = \{a^n: n \text{ is a product of exactly two primes}\}$
I feel like the language is not regular but I am having trouble proving it. I tried using pumping lemma but got stuck at the end. Here’s how I did it:
Assume that the language is regular and $ m$ is a constant of Pumping Lemma. Now let $ w = a^M$ where $ M > m$ and $ M$ is a coprime number. Clearly $ w$ is in the language and $ w > m$ .
Now let $ y=a^j$ where $ j$ is between $ 1$ and $ m$ , with $ xy \leq m$ and $ y \geq 1$ .
This is where I am getting stuck. I feel like we should pump up but I don’t know by “how much”. Also, I feel like I have to know what is the next coprime number after $ M$ , but can’t figure it out.
Is L2 = {a^n n is a product of one of more primes} regular?
I am having a hard time proving the following with pumping lemma: Is L2 = {a^n n is a product of one of more primes} regular?
Here’s what I have so far:

Suppose L is regular, and let m be the constant pumping lemma.

Let then w = a^m where m is a product of at least one prime number, therefore w is in the language L2 and w >= m.

Then w = xyz, where xy <= m and y >=1

Then y = a^j where j>=1
This is where I’m not sure what to do: Pumping down we get w2 = a^(mj)
I don’t know where to keep going from here since I don’t even know if pumping down is the right thing to do.
Expresion regular numeros con un decimal JavaScript
Dado un texto con las siguientes líneas:
1 01/01/2018 Temperatura mínima a 1.5m (ºC) 11,4 1 02/01/2018 Temperatura mínima a 1.5m (ºC) 13,8 1 03/01/2018 Temperatura mínima a 1.5m (ºC) 13,9 1 04/01/2018 Temperatura mínima a 1.5m (ºC) 13,5 1 05/01/2018 Temperatura mínima a 1.5m (ºC) 4,2 1 06/01/2018 Temperatura mínima a 1.5m (ºC) 4,1 1 07/01/2018 Temperatura mínima a 1.5m (ºC) 4,4 1 08/01/2018 Temperatura mínima a 1.5m (ºC) 7,1 1 09/01/2018 Temperatura mínima a 1.5m (ºC) 9 1 10/01/2018 Temperatura mínima a 1.5m (ºC) 6,7
Necesito una expresión regular utilizando referencias inversas para obtener la última columna, la de los números.
Un patrón parecido al siguiente:
(Temperatura\smínima\sa\s1.5m\s\(ºC\)).*((\w\w,\w))
Did I prove the language is not regular?
I am trying to prove the following language that is not regular.
I used Pumping Lemma proof and my proof goes as follows:
Assume that L is regular and let p be the constant of PumpingLemma.
This is where I am not sure if I picked the right “w”.
There exists w = $ a^pbc^p$ (where n=p and m=1). Clearly w is inside the language and its length is larger than p.
we now have $ y=a^j$ where j is between 1 and p. w = xyz, m $ \ge$ xy and y $ \ge$ 1. $ wi = xy^iz$
Pumping down we get (i=0): w = a^{(pk)}bc^{p} and since our condition for L to be regular is $ k=n^m$ we get by substituting. => $ p = pk$ which is not true (contradiction). Thus L is not regular.
Algorithm to Minimize a Regular Expression
I am referring to regular expressions with alphabet {$ 0$ , $ 1$ }. We want to minimize them so that they have the least possible number of symbols and operators. Is there an algorithm to do this?
For instance, what is done on this page in the accepted answer:
https://stackoverflow.com/questions/35112630/minimizespecificregularexpression
Is there a formal algorithm to explain the process that the answer went through?
Proving a language is Not Regular without using Pumping Lemma?
I was wondering how one would go about proving a language is Not Regular without using the traditional pumping lemma contradiction.
L = { 1^k 0^n 1^n 0^k  k >= 0, n >= 0}
I’ve seen a method before where you would Intersect this language with another one and show that the result is Not regular. But I’m lost on what to intersect it with.