DSAAT BLOG ( GROUP 4 )
Regular Expression and its Closure Properties
First of all let's see What is Regular Expression ?
- A regular expression can also be described as a sequence of pattern that defines a string. And these expressions are used to match character combinations in strings.
- The languages accepted by finite automata are referred to as Regular languages. String searching algorithm used this pattern to find the operations on a string.
Above we use a term "Automata" so now question arises What is automata ?
The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined sequence of operations automatically.- Theory of automata is a theoretical branch of computer science and mathematical. It is the study of abstract machines and the computation problems that can be solved using these machines. The abstract machine is called the automata.
- Union
The Union of two regular expressions is also a regular expression.
L1 U L2 = { s | s is in L1 or s is in L2 }
Example :-
L1 = {an | n > O} and L2 = {bn | n > O}
L3 = L1 U L2 = {an U bn | n > O} is also regular expression.
- Intersection
If L1 and L2 are two regular languages then their intersection is also an intersection.
L1 ⋂ L2 = { st | s is in L1 and t is in L2 }
Example :-
L1= {am bn | n > 0 and m > O} and
L2= {am bn U bn am | n > 0 and m > O}
L3 = L1 ∩ L2 = {am bn | n > 0 and m > O} are also regular expression.
- Kleen Closure
If L is a regular language then its Kleen closure L1* will also be a regular language. The iteration (or closure) of a regular expression is also a regular expression.
L* = Zero or more occurence of language L
Example :-
L1 = (a U b )
L1* = (a U b)*
Note that a* means zero or more occurrence of a in the string while a+ means that one or more occurrence of a in the string. That means a* denotes language L = {є , a, aa, aaa, ….} and a+ represents language L = {a, aa, aaa, ….}. And also note that there can be more than one regular expression for a given set of strings.
- Concatenation
Example :-If L1 and If L2 are two regular languages, their concatenation L1.L2 will also be regular.
- Complement
If L(G) is a regular language, its complement L'(G) will also be regular. Complement of a language can be found by subtracting strings which are in L(G) from all possible strings.
Example
L(G) = {an | n > 3} L'(G) = {an | n <= 3}
- Reversal
If L = { 0 , 01 , 100 } is regualr then = { 0 , 10 , 001 } will also be regular.
- Homomorphism
- Inverse Homomorphism
R.E. = 1 + 2 + 3 1 or 2 or 3
R.E. = ^ ab
R.E. = abb + a + b + bba abb or a or b or bba
R.E. = 0* closure of 0
R.E. = 1^+
6) Write the regular expression for the language accepting all the string which are starting with 1 and ending with 0, over ∑ = {0, 1}.
Solution :
In a regular expression, the first symbol should be 1, and the last symbol should be 0. The r.e. is as follows:
R.E. = 1(1+0)*0
7) Write the regular expression for the language starting with a but not having consecutive b's.
Solution :
The regular expression has to be built for the language:
L = { a , aba , aab , aba , aaa , abab , .... }
The regular expression for the above language is:
R.E. = { a + ab }*
8) Write the regular expression for the language over ∑ = {0} having even length of the string.
Solution :
The regular expression has to be built for the language :
L = { ε , 00 , 0000 , 000000 , ....... }
The regular expression for the above language is:
R = (00)*
By This we conclude our Blog. Hope you enjoy reading. Thank You.
Comments
Post a Comment