Regular expressions or Regex is a search pattern for strings defined by a sequence of characters.

learn more… | top users | synonyms

7
votes
2answers
4k views

Express y in terms of x

Question: $$ \text{It is given that } y= \frac{3a+2}{2a-4} \text{and }x= \frac{a+3}{a+8} \\ $$ $$ \text{Express } y \text{ in terms of } x. $$ From using $x$ to solve for $a$, I discovered that $$...
7
votes
1answer
1k views

Freshening up on discrete math (regular expressions)

I'm trying to freshen myself up on discrete math( I forgot a lot). I know this is a trivial question and not worth your time. But I forgot how to solve problems involving formal language theory. For ...
6
votes
1answer
2k views

Is one regular language subset of another?

Let $L_1$ and $L_2$ be two regular languages given as regular expressions (in this type of tasks it often happens that $L_1 \subseteq L_2$, but vice versa it is false). Is there a nice way to ...
6
votes
0answers
153 views

How to write a regular expression?

I am trying to write a regular expression for the set of all strings in Σ* that starts with an even number of b's and contains at most two a's. The language contains only a's and b'. This is what I ...
5
votes
4answers
136 views

How does one show that these two expressions are the same?

I tried to compute the value of $\sin 75^\circ$ using the sine of standard values $(30^\circ, 45^\circ...)$ and did it by two ways. One, by expanding $\sin (45^\circ+30^\circ)$ and the other by ...
5
votes
1answer
85 views

Proving that all equivalent regular expressions are reachable via algebraic laws

Given a set of laws for regular expressions, for example (ripped from this document): $$ \begin{array}{llll} \text{1.} & (A|B)|C = A|(B|C) &\qquad& \text{(associativity of choice)}\\ \...
5
votes
0answers
11 views

Solving the equation X = AX + B of languages for X [duplicate]

I'm currently working on the following problem for my computer theory class. It goes as follows: Let $A$ and $B$ be regular expressions. Show then that $A^* B$ is the solution of $X = AX + B$. ...
4
votes
5answers
87 views

Expression for a bounded function

I have a bounded function, $$ y= \begin{cases} 1 & \text{if $x>1$} \\ x & \text{if $0\leq x\leq 1$}\\ 0 &\text{if $x < 0$} \end{cases} $$ Does anyone ...
4
votes
1answer
529 views

Regular Expression Proof

I am trying to prove the following statement: If $S$ and $T$ are any regular expressions over a 1-letter alphabet and if $n$ is a natural, then the languages $(ST)^n$ and $S^nT^n$ are equal.
4
votes
3answers
117 views

Number of sequences that contain a given “run”

Consider sequences of numbers 0, 1, 2 with length n. There are $3^n$ such sequences. I want to know how many sequences there are that contain a k-run of 1's followed by 2. As a regular expression: ...
4
votes
1answer
44 views

Why is $\left\{a\right\}^*\cap L(A)=\emptyset$? where $\delta(q,a)=q$

I am trying to solve this particular problem from Automata Theory by Ullman, Hopcroft, it is as shown below : Let $A$ be a $DFA$ and $a$ be a particular input symbol of $A$, such that for all states $...
4
votes
2answers
183 views

Is this proof using the pumping lemma correct?

I have this proof and it goes like this: We have a language $L = \{\text{w element of } \{0,1\}^* \mid w = (00)^n1^m \text{ for } n > m \}$. Then, the following proof is given: There is a $p$ (...
4
votes
1answer
58 views

Finding a general formula for a regular expression

I need to find the general formula for the regular expression $(S+T)^n$ where $S$ and $T$ are arbitrary regular expressions over a one-letter alphabet and $n$ is an arbitrary natural The general ...
3
votes
2answers
85 views

Regular expressions, is it always true that (r+s)*=r*+s*?

I'm really confused about this, can some one please help me understand this better. If r and s are regular expressions then is it always true that (r+s)=r+s*? Are r and s sets and does the plus ...
3
votes
2answers
194 views

Combinatorics problem involving a regular expression

If formal definition of a regular expression is required, please comment and I'll add it. I was given the assignment of determining how many words of length $n$ can be produced from a regular ...
3
votes
1answer
152 views

NFA to DFA and Regular Expression

The truth is that my teacher gave us a homework, and I wanted to ask you if I did this right. What I have to do is answer the following questions given the following NFA. Why is this an NFA? What ...
3
votes
2answers
3k views

How can concatenating empty sets (languages) result in a set containing empty string?

In the book "Introduction to the Theory of Computation" by Michael Sipser, in the section 1.3 Regular Expressions: The symbol ε represents the emty string, which may be a valid element of a language: ...
3
votes
2answers
148 views

Basic regular expressions problem

I'm in an intro to CS theory class learning about regular expressions. I was wondering if people could give me hints as to whether I'm on the right track for these problems. I hope this particular ...
3
votes
1answer
41 views

Finding the mistake in a new way of generating FSMs from regular expressions

As described e.g. here (see pp. 2-3) a final state machine can be easily constructed from a regular expression. For the union of to expressions $e + f$ I need to look at the original way of ...
3
votes
1answer
23 views

Language of binary multiplications relation.

Given $\Sigma = \lbrace 0, 1 \rbrace$ and $L \subseteq (\Sigma \times \Sigma \times \Sigma)^*$. Let $first(w), second(w), third(w)$ be word from $(\Sigma \times \Sigma \times \Sigma)^*$ limited to ...
3
votes
2answers
66 views

A Regular Expression for all strings that…

I got a problem I have to solve, the problem says that given an alphabet $\Sigma = \{a, b, c\}$ I have to build a regular expression that describes the string with: An even number of a's. A 4k + 1 ...
3
votes
1answer
86 views

$L=${$a^nb^nc^n : n \geq 0 $} CFG Recognizing

Suppose $L=${$a^nb^nc^n : n \geq 0 $} and I. $h(L), h(a)=a, h(b)=bb, h(c)=b$ II. $L^R$ III. $L^*$ IV. $h(L), h(a)=a, h(b)=bb, h(c)=a$ Why just I is a CFG and other is not? anyone can help me to ...
3
votes
2answers
1k views

Finite state machine

I am doing discrete math, and we are studying Finite State Machines. But i am a little confuse on how to do this. Here is a question, Write a regular expression for the language, and define a finite ...
3
votes
1answer
58 views

Equivalence of two regular expression

I have a quick question to ask. So I am trying to come up with a regular epxression which represent a language over {a,b} that contains at least one 'b' in it. I came up with this: $$(a| b)^*b(a| b)...
3
votes
1answer
76 views

Regular expression for language

Let's have a language $L=\{\omega\in\{a,b,c\}^* | \omega $ contains $ab$ and does not contain $ba\}$ make a regular expression for this language. I've ended up with this one $$(a^*(b^*+(cc^{*}a^*))^*)...
3
votes
1answer
56 views

Regarding regular expression. why do the following strings not exist in the expression.

Let L be the language defined by the regular expression: (a U b U c)((ab U ac U b)*(a U b) U (aa)*) the answer book says that 'aaaa' and 'aaaaaa' do not belong to L. I can show that aaaa and aaaaaa ...
2
votes
3answers
105 views

Create a formal regular expressions that accepts all strings of 1 and 0 that do not contain 101

I'm working through a textbook on automata theory and I'm stuck on this regular expression problem. Create a regular expression for the following language: The set of all strings that do not contain ...
2
votes
4answers
76 views

Why are complex numbers allowed to be combine like this?

The problem This expression is meant to be simplified. Why does it make sense to write $$\frac{1}{1-6i} - \frac{1}{1+6i} = \frac{1+6i−(1−6i)}{(1−6i)(1+6i)} \quad ?$$ How can the rules followed here ...
2
votes
1answer
78 views

examples of “interesting” star-free languages

Can you point me to some examples (preferably known ones from the literature, but this is not crucial) of "interesting" / non-trivial star-free languages? I'm trying to get some intuitive sense of ...
2
votes
1answer
191 views

regex for binary string which doesnt contain 11110

Here's my attempt, although I'm not sure if i missed any edge cases: $(0,10,110,1110)^*(1)^*$ it seems to work for any random string i test in a regex program, but is this correct?
2
votes
2answers
34 views

How to prove that $R_1(R_2R_1)^* = (R_1R_2)^*R_1$; Theory of computation

I need a formal proof for this property (or hints): Let $R_1$ and $R_2$ be to regular expressions : $R_1(R_2 R_1)^* = (R_1 R_2)^*R_1$ I don't know if the way I'm solving the problem is totally fine, ...
2
votes
3answers
104 views

regular language proof, a language partial to a regular one

So, I've been trying to solve a question I got and I think I'm correct but I'm not positive. Is the language {w| www belongs to L' and L' is regular} regular? I couldnt find any way to prove it isnt ...
2
votes
1answer
32 views

Determine string is even length with regular expression

There is a set of strings of even length over $\{k,l,m\}$ that contain exactly one $k$. And I try to write its regular expression. I think it can be in that format: ...
2
votes
1answer
35 views

What is the best way of resolving an expression with square roots in denominator?

I was resolving the following question from my textbook: Write each of the following expressions as a single fraction, simplifying your answer where possible: $4 - \frac{1}{\sqrt{12}} + \...
2
votes
3answers
74 views

The number of elements in a set

I have a small task, part of my homework, which tends to confuse me because of its simplicity. It makes me think that I am missing something. I have to find the number of elements in the set {w | w ∈ ...
2
votes
1answer
39 views

Equivalence of regular expression

Let $ A = \{a,b\}$ be an alphabet. Please hint me with show, that this regexes are equivalent. That means, we should show that: $L(e_1 )= L(e_2)$ 1) $(a^*b)^*a^* = (a+b^*)^*$ 2) $(a+b^*)^* = (a^*b^*...
2
votes
1answer
191 views

Find regular expression for a given language

I need to find a regular expression for the following language: $$ \Sigma = {\{a,b,c}\} $$ define $L$ to be the language of all words over $\Sigma$ that contain the substring $aba$ odd number of times....
2
votes
2answers
52 views

Regular Expressions Help [duplicate]

I need a little help with Regular Expressions. The allowed operations are obviously + (union) , * (Kleene star) and concatenation. I have to write Regex for the following 2 examples. I have tried a ...
2
votes
1answer
2k views

Complement of a regular expression?

What is the regex for the complement of $r = b^*(ab + a^* + abb(b^+))^*$ ? I am thinking $(a+b)^*(abb)^+a^* $ since anything that contains $abb$ and is not followed by $b$'s would not be accepted ...
2
votes
1answer
2k views

Proof of Equivalence of NFA and DFA, quick question about the setup

I am looking at the proof of equivalence of non determinstic finite automata(NFA) and deterministc finite automata(DFA). I am have a small quesion about the construction: Let $M=(Q,\Sigma,s,F,\...
2
votes
1answer
326 views

L is language generated by the context free grammar G = (V, $\Sigma$, P, S)

L is language generated by the context free grammar G = (V, $\Sigma$, P, S), where $\Sigma$ = {a,b,c}, V = {S, A, B}, and the production set P is: S -> aSb | A A -> cAb | B B -> cb My question is, ...
2
votes
2answers
78 views

For the language $\{w \mid w \in \Sigma^*, w \neq \lambda\}$, is the following regular expression correct?

For the language $\{w \mid w \in \Sigma^*, w \neq \lambda\}$, is the following regular expression correct? $(a+b)^+$ . Which is $(a+b)$ to the power of $+$ which I think accepts all combinations of $...
2
votes
1answer
249 views

Constructing finite state automata corresponding to regular expressions. Are my solutions correct?

I have drawn my answers in paint, are they correct? (4c) For the alphabet {0, 1} construct finite state automata corresponding to each of the following regular expressions: (i) 0 My Answer 4ci (ii) ...
2
votes
0answers
29 views

Regular Expressions with Repetition

I'm learning about regular expressions and how they represent regular languages of an alphabet. Conceptually, I'm having trouble imagining what a regular expression would look like, representing a ...
2
votes
0answers
99 views

Regular expression for string's of a's and b's beginning with b and not having two consecutive a's

Question: Write a regular expression for the following language: "All strings of a's and b's in ∑* beginning with b and not having two consecutive a's. A textbook says the answer is (b+ba)*. Shouldn'...
2
votes
1answer
38 views

Finding regular expressions for which a given Turing machine halts and accepts, halts and rejects, and diverges.

Consider the Turing machine M = (Q,Σ,Γ,δ,q,F) F = {t} Q = {q,r,s,t,v,x} Σ = {a,b,c} Γ = {B,a,b,c} δ = [q,a,q,a,R] [q,b,q,b,R] [q,c,v,b,R] [q,B,r,B,L] [r,a,s,B,L] [r,b,s,B,L] [r,c,s,B,L] [s,a,x,a,...
2
votes
0answers
37 views

Regular expressions and equality

Is the equality true or false? $(r^*s^*)=(r+s)^*$ My Approach: Assume the alphabet used is {0,1}$^*$ Equality is false: If r = 0 and s = 1 Then if 0101 $∈$ $(0 + 1)^*$ this is true because $(...
2
votes
0answers
55 views

how to covert regular expression in simplest form?

I have made this expression from nfa (NFA to regular expression) : (a+ab+aa*b)*(a+a*a) but at book answers it is written like this : (a+aa*b)*(a*a) I am thinking that the my answer is same as book ...
2
votes
2answers
207 views

Regular Expression Notation

I'm doing a theory of computation course and can't for the life of me find any good resource that will tell me how a regular expression such as (a+b)* converts to set form. I've thought of a binary ...
2
votes
1answer
136 views

Build regular expression from language

I have the following language: L = {w $\in$ {a,b}* | aa is not part of w}. I have to construct a regular grammar from this language and I thought about first finding the regular expression from the ...