How can I continue to find a regular expression?

In summary,The language $\{0^{m}1^{n}:m+n \geq 2\}$ is regular.To make words with length greater than 2,we concatenate an arbitrary number of zeroes to the left side of each of the possible words and an arbitrary number of ones on the right side.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! :)
I have a question:
Suppose that $\Sigma=\{0,1\}$.Is the language $\{0^{m}1^{n}:m+n \geq 2\}$ regular?
I tried to find a regular expression.I checked the case $m+n=2$ and I found that the possible words are $00,01,11$ .But..how can I continue? :confused:
 
Technology news on Phys.org
  • #2
Re: How can I continue?

evinda said:
Hello! :)
I have a question:
Suppose that $\Sigma=\{0,1\}$.Is the language $\{0^{m}1^{n}:m+n \geq 2\}$ regular?
I tried to find a regular expression.I checked the case $m+n=2$ and I found that the possible words are $00,01,11$ .But..how can I continue? :confused:

Perhaps you can concatenate an arbitrary number of zeroes to the left side of each of those possible words?
And also concatenate an arbitrary number of ones on the right side?
 
  • #3
Re: How can I continue?

I like Serena said:
Perhaps you can concatenate an arbitrary number of zeroes to the left side of each of those possible words?
And also concatenate an arbitrary number of ones on the right side?

So,you mean that the regular expression is
$$ \{0^{*} \cdot 00 \cdot 1^{*}|0^{*} \cdot 01 \cdot 1^{*}|0^{*} \cdot 11 \cdot 1^{*}\}$$
?
 
  • #4
Re: How can I continue?

evinda said:
So,you mean that the regular expression is
$$ \{0^{*} \cdot 00 \cdot 1^{*}|0^{*} \cdot 01 \cdot 1^{*}|0^{*} \cdot 11 \cdot 1^{*}\}$$
?

We'll have to verify! (Wondering)
All words in the regular expression should be contained in the language, and conversely all words in the language should match with the regular expression.

Are all words formed by the regular expression part of the language?

For the other direction, suppose we pick m=0, that is, no zeroes, are all words with only $1$'s matched by the regular expression?
How about m=1, m=2, and m>2?
 
  • #5
Re: How can I continue?

I like Serena said:
We'll have to verify! (Wondering)
All words in the regular expression should be contained in the language, and conversely all words in the language should match with the regular expression.

Are all words formed by the regular expression part of the language?
Since,each word has at least 2 symbols and the sequence of $0$ precedes the sequence of $1$,all words formed by the regular expression are part of the language.Or am I wrong? :confused:

I like Serena said:
For the other direction, suppose we pick m=0, that is, no zeroes, are all words with only $1$'s matched by the regular expression?
How about m=1, m=2, and m>2?

When $m=0$,we get a sequence only of $1$'s,from $0^{*} \cdot 11 \cdot 1^{*}$,for $m=1$ we get a word from $0^{*} \cdot 01 \cdot 1^{*}$ or from $0^{*} \cdot 11 \cdot 1^{*}$, for $m \geq 2$ we get a word from $0^{*} \cdot 00 \cdot 1^{*} $ or from $0^{*} \cdot 01 \cdot 1^{*}$ or from $0^{*} \cdot 11 \cdot 1^{*}$ .

So,the expression is correct?? :confused:
 
  • #6
Re: How can I continue?

evinda said:
Since,each word has at least 2 symbols and the sequence of $0$ precedes the sequence of $1$,all words formed by the regular expression are part of the language.Or am I wrong? :confused:
When $m=0$,we get a sequence only of $1$'s,from $0^{*} \cdot 11 \cdot 1^{*}$,for $m=1$ we get a word from $0^{*} \cdot 01 \cdot 1^{*}$ or from $0^{*} \cdot 11 \cdot 1^{*}$, for $m \geq 2$ we get a word from $0^{*} \cdot 00 \cdot 1^{*} $ or from $0^{*} \cdot 01 \cdot 1^{*}$ or from $0^{*} \cdot 11 \cdot 1^{*}$ .

So,the expression is correct?? :confused:

Without the :confused: sentences it is all correct. :p
 
  • #7
Re: How can I continue?

I like Serena said:
Without the :confused: sentences it is all correct. :p

Great! ;)

So,could I write it like that?
The possible words with length 2 are $00,01,11$.
To have words with length greater than 2,we concatenate an arbitrary number of zeroes to the left side of each of those possible words and an arbitrary number of ones on the right side.So,the expression is $\{0^{*} \cdot 00 \cdot 1^{*}|0^{*} \cdot 01 \cdot 1^{*}| 0^{*}\cdot 11 \cdot 1^{*} \}$ and then I will show that it is valid?
 
  • #8
Re: How can I continue?

evinda said:
Great! ;)

So,could I write it like that?
The possible words with length 2 are $00,01,11$.
To have words with length greater than 2,we concatenate an arbitrary number of zeroes to the left side of each of those possible words and an arbitrary number of ones on the right side.So,the expression is $\{0^{*} \cdot 00 \cdot 1^{*}|0^{*} \cdot 01 \cdot 1^{*}| 0^{*}\cdot 11 \cdot 1^{*} \}$ and then I will show that it is valid?

Yep! (Whew)
 
  • #9
Re: How can I continue?

I like Serena said:
Yep! (Whew)

Nice!Thank you very much for your help! :)
 

Related to How can I continue to find a regular expression?

1. How do I create a regular expression?

To create a regular expression, you can use a variety of programming languages such as JavaScript, Python, or Perl. Each language has its own syntax for creating regular expressions, but they all involve using specific characters and symbols to define patterns in a string of text.

2. What is the purpose of regular expressions?

The purpose of regular expressions is to search, validate, and manipulate text data. They allow you to find specific patterns and characters within a larger string of text, which can be useful for tasks such as data cleaning, form validation, and text parsing.

3. How can I test my regular expression?

There are various online tools and resources available to test your regular expressions. One popular tool is Regex101, which allows you to input your regular expression and test it against different strings of text to see if it matches the desired pattern.

4. Can regular expressions be used in all programming languages?

Yes, regular expressions can be used in most programming languages, including JavaScript, Python, Java, C++, and more. However, the syntax and functionality may differ slightly between languages, so it's important to consult the documentation for the specific language you are using.

5. How can I improve my skills in using regular expressions?

Practice and experimentation are key to improving your skills in using regular expressions. You can also find tutorials, online courses, and books that provide in-depth explanations and examples of regular expressions. Additionally, joining online communities and forums can help you learn from others and troubleshoot any issues you may encounter.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
812
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
11
Views
835
  • Programming and Computer Science
Replies
10
Views
7K
  • Programming and Computer Science
Replies
13
Views
4K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
0
Views
800
Back
Top