 so far we have defined alphabets strings some string operations and then we have defined formally a language we have given some examples of language also. So next we will discuss some properties of languages some properties we have already discussed for example, the usual satirical properties which respect to the union intersection complement difference etcetera hold even in the context of languages. So, we are interested in some other properties with respect to the newly introduced operations concatenation cling closure and positive closure. We find that concatenation of languages associative we have already shown it that means if l 1, l 2 and l 3 are languages then l 1 concatenation l 2, l 3 is equivalent to l 1 concatenation l 2 and concatenation l 3. We have already shown it now we know that concatenation of strings is not commutative in general that is why concatenation of languages is also not commutative that means for two languages l 1 and l 2 we cannot say that l 1 concatenation l 2 is equal to l 2 concatenation l 1 they are not identical because in general we know that if x and y are two strings then x concatenation y is not identical to y concatenation x they are not identical and hence l 1 concatenation l 2 is not equivalent to l 2 concatenation l 1. Then it is very easy to see that if l is any language then if it is concatenated with the language containing singleton epsilon from both side left side and right side then it is equal to l because every string when concatenated with epsilon from left or right give the string itself that is if x is a string then epsilon x equal to x epsilon is equal to x. Therefore every string if l is a language every string the language whatever it may be so if you concatenate with epsilon from both side you give the string itself therefore the language is not going to be changed. Hence we get l epsilon equal to epsilon l equal to l then if we concatenate language with the empty set phi from both side l phi or phi l it is going to give phi. So you can prove it suppose that l phi is not equal to phi then there must be a string which will belong to l phi. Therefore we can write x as x 1 x 2 for some strings x 1 belonging to l and then x 2 belonging to phi this is the definition of your concatenation. But phi in the empty set there cannot be any string that belongs to phi. So therefore our original assumption that x belongs to l phi must belong. So therefore l phi must be empty. Similarly you can show that x also does not belong to there cannot be any string x belong to phi l and hence the result l phi equal to phi l equal to phi it must be an empty set. Let us see some distributive properties for example we can show that l 1 concatenation with l 2 union l 3 is equal to l 1 l 2 union l 1 l 3 that means concatenation distributes over union. Similarly l 1 union l 2 concatenation l 3 is equal to l 1 l 3 union l 2 l 3 let us give a proof of the second one proof of the first one is exactly similar to the second one. So suppose also what we are going to show is that l 1 union l 2 concatenation l 3 equal to l 1 l 3 union l 2 now suppose string x belongs to l 1 union l 2 l 3. So in short check is this implies that we can write x as x 1 x 2 for some x 1 belonging to l 1 l 2 l 1 union l 2 and some x 2 belonging to l 3 this implies x equal to x 1 x 2 for some x 1 belonging to l 1 or x 1 belonging to l 2 since x 1 belongs to l 1 or l 2 and for some x 2 belonging to l 3. Now this implies x equal to x 1 x 2 for some x 1 belonging to l 1 and x 2 belonging to l 3 or x 1 belonging to l 2 and x 2 belonging to l 3. Now from this according to definition you can say that x equal to or x belongs to l 1 l 1 l 3 or x belongs to l 2 l 3. So this implies that x belongs to l 1 l 3 union l 2 l 3. So this one way is quite clear now let us show the other part the converse part suppose x belongs to l 1 l 3 union l 2 l 3 now this implies x belongs to so this implies x belongs to l 1 l 3 or x belongs to l 2 l 3 that means we can write x as some x 3 x 4 such that x 3 belongs to l 1 or x 3 belongs to l 1 or x 3 belongs to l 2 and x 4 belongs to l 3. So according to definition we can write it like this therefore we can write that x belongs to since x 3 belongs to l 1 or x 3 belongs to l 2 and x 4 belongs to l 3. Therefore we can say that x belongs to l 1 union l 2 and concatenation with l 3 hence l 1 union l 2 from this 2 can say that l 1 union l 2 l 3 equal to l 1 l 3 union l 2 l 3. So hence the proof let us see some more properties so all these properties are numbered so there are 6 properties in the sequence. So if l 1 is subset of l 2 and l 3 is subset of l 4 then l 1 concatenation l 3 a subset of l 2 l 4 is easy to prove similarly the other few results are also easy to prove say property 7 is 5 star is singleton epsilon say cling closure of singleton epsilon is equal to singleton epsilon and if epsilon belongs to l then l star equal to l plus is a positive closure that means cling closure equal to positive closure if epsilon belongs to l. So next property is l star l equal to l l star equal to l plus we will just provide the proof of this we are going to give proof of l l star equal to l star l equal to l star l plus suppose x belongs to l star l then we can write x as some y z we can write that x equal to y z for some y belonging to l star and z belonging to l but since y belongs to l star this implies that this y can be written as y 1 y 2 some y n with y i belonging to l. So this for all i we can write y as y 1 y 2 up to y n for some y i belong to l therefore x can be written as y z which is equal to y 1 y 2 up to y n concatenation with z which is nothing but y 1 then y 2 concatenation with y n and z but this belongs to l l star according to the definition the converse is exactly similar that means l star l equal to l l star further when x belongs to l star l as above we have x equal to y 1 y 2 up to y 1 z is clearly in l plus. So this belongs to in l plus on the other hand x belongs to l plus implies that x equal to x 1 x 2 up to m up to x m with m greater than equal to 1. So this is the definition of positive closure and here every x i belongs to l for all i now let us write x z as x 1 x 2 up to say x m minus 1 so that we can write x as x dash x m. So this x we can write as x dash m here note that x dash belongs to l star by definition particularly when m equal to 1 if m equal to 1 then x dash equal to epsilon because whenever m equal to 1 it goes from there is no string. So it is the epsilon thus x belongs to l star l therefore l plus is equal to l star l. So this is the proof for the property now let us see l star whole star equal to l star. So we can use similar concepts to prove this property and some other similar properties for example l star l star equal to l star l 1 l 2 star computation with l 1 is equal to l 1 computation with l 2 l 1 star thus give a proof for this property. So we want to prove that l 1 l 2 whole star l 1 equal to l 1 l 2 l 1 whole star first let string x belongs to l 1 l 2 star l 1 then we can write x as concombination of two strings y z where y belongs to or we can say that y where y can be written as y 1 y 2 I have to say some y n this belongs to l 1 l 2 star and z belongs to l 1. Now in this case where y equal to y 1 y 2 y n which belongs to l 1 l 2 star every y i belong to l 1 l 2 is a concombination of a string from l 1 and another string from l 2. Now each y i as you said can be written the form u i some string from l 1 and v i some string for v 2 some string from l 2 that means u i belongs to l 1 and v i belongs to l 2. Now you know that the string v i u i plus 1 belongs to l 2 l 1 so it is quite clear that u i belongs to l 1 and v i belongs to l 2 therefore v i and u i plus 1 must belong to l 2 l 1. Now we can write x as y z which is equal to y 1 y 2 to y n z which is nothing but u 1 v 1 because y 1 can be written as u 1 v 1 y 2 can be written as u 2 v 2 and so on up to u n v n then z. Now this can be written as u 1 since it avoids concombination of a string so u 1 v 1 u 2 v 2 u 3 and so on up to v n so u 1 v 1 u 2 v 2 u 3 u n v n z now v 1 u 2 v 2 u 3 is all belongs to l 2 l 1 eventually the v n z belongs to l 2 l 1 since z belongs to l 1 and v n belongs to l 2. So therefore again u 1 belongs to l 1 so therefore this belongs to l 1 concombination l 2 l 1 star because there is a concombination from a string from concombination of strings from l 2 l 1. Therefore we starting from x belongs to l 1 l 2 star l 1 we have found that x belongs to l 1 l 2 l 1 star. Similarly we can show the converse that means if x belongs to l 1 concombination l 2 l 1 star it will belong to l 1 l 2 star concombination l 1. Therefore the property l 1 l 2 star concombination with l 1 is equivalent to l 1 l 2 l 1 whole star whole is good. Let us see some more properties l 1 union l 2 star equal to l 1 star l 2 star whole star this proof for this can be taken as an exercise. So far we have provided many properties so up to 14 properties of languages similarly one can produce many other properties using the various operations. Now we will see how languages can be represented using finite information that means finite representation of languages. We are mainly interested in a finite representation of a language. If a person is proficient in a particular language it does not mean that he produce all the sentences of the language. Basically what we expect is that using a finite amount of information one should be able to validate or construct different strings in the language. That means by giving a finite amount of information all the strings of a language shall be enumerated or validated. For example if you see the case of a compiler the compiler can validate any program which is nothing but a string from a program language using only a finitely many instructions incorporated in it. So let us have a look at the languages for which finite representation is possible. Given an alphabet sigma the languages with single string x and phi can have finite representation. For example suppose for a language containing a single string x so x is a finite representation and for a empty set so empty set itself is a finite representation and any finite language can also be given a finite representation simply by enumerating all the strings in it. So those are the finite representations for the different languages. Therefore the giving finite representation for infinite language is a non trivial problem. In the language finite we can always enumerate the strings and which will be a finite representation for the language. So let us see how to give a finite representation for an infinite language. So in this context the operations on languages may be helpful. We will see that various operations that we have discussed so far may be used to give this kind of representation. For example using clean star operation we can have finite representation for some infinite languages. For example you consider the language say the language L which is the empty string epsilon then suppose AB, AB, AB, AB, AB, AB, AB, AB, AB and so on. That means the repetition those strings we are conducting AB with AB finitely many times. Now we can find this language or this language can be constructed as a clean closure of the language say AB. That means we consider language AB and take the clean closure of it we get this language L. Suppose this L1 we see that L1 star is exactly L. That means this infinite language can be represented as a clean closure of this language L1. Now if we have this if we represent this language as simply AB then clean closure of this is nothing but the language L. So, that is how we represent infinite language using finite information. Now to give finite representation for languages one way first look at the individual languages namely the phi singleton epsilon and A because we cannot divide those languages further these are the basis elements. The singleton A for every A belong to sigma these are all basis elements. Suppose one to construct the language containing the singleton X for some string X belong to sigma star. We can use the operation concatenation order basis elements. Just as an example suppose you have X equal to AB that means the language AB containing the string only AB. So, this is the language L. So, what we can do is that we can consider the language containing singleton A is a basis element then singleton B. Then we concatenate these two languages A and B we get a language containing only the only string AB then again concatenate with A. So, this will give the language containing the single string AB. Therefore, this language can be constructed by taking concatenation of three languages which are the basis elements. Any finite language over sigma say X 1, X 2 up to X and over X its X i is a string over sigma star can be obtained by considering the union of this singleton elements X 1 union X 2 and so on. That means we can consider the operations cling closure concatenation and union to apply on the basis elements to construct any kind of languages. Now, we look at the aspects of considering operations over basis elements to represent a language. This is one of the aspects but there are many other aspects to give finite representation. We will consider those aspects later on. Now, the class of languages that we get by applying union concatenation and cling closure for finitely many times on the basis elements is known as regular languages. The corresponding finite representation are known as regular expressions. Now, let us define regular expressions over an alphabet sigma recursively as follows. We consider phi epsilon and a for every a beyond the sigma to be regular expressions representing the languages phi the singleton epsilon and a respectively. That means if we have phi we say there is a regular expression and this represents a language phi. If we have the regular expression sigma epsilon then this represents the language containing a singleton epsilon and for every element a a belonging to sigma for any element a belonging to sigma a is a regular expression and it denotes or represents the language containing a single string of length 1 which is a itself. So, this is the basis case for the definition of regular expressions. Now, if r and s are regular expressions representing the languages capital R and capital S respectively then so are the following r plus s representing the language r union s then r concatenation s or simply r s represent the language r concatenation s and r star represent the language capital r star. In a regular expression we keep a minimum number of parenthesis which are required to avoid ambiguity in expressions. For example, if r plus s t is a regular expression then actually this represents the language r union s concatenation or r union s concatenation t. So, in this case we have some precedence rule normally cling closure as more precedence highest precedence then we have the precedence for concatenation and then for union. Therefore, in this case so this language can be even by the regular expression r plus s t because in this case the concatenation has highest precedence and then we have the precedence for union. And if r is a regular expression then the language represent by r is noted by l r. So, if phi is a regular expression then we write that l phi the language represent by phi is phi similarly epsilon is a regular expression l of epsilon is the single term epsilon similarly l of a is a itself. Similarly, if r is a regular expression the corresponding regular expression l r may be some set capital r and so on. And language l is said to be regular if there is a regular expression r such that l equal to l r because we get the regular expression by applying finitely many operations from union concatenation and cling closure over the basis elements and that is how we define a regular language. So, a regular language over alphabet sigma is the one that can be obtained from the empty set single term epsilon and a for single term a for every a beyond the sigma by finitely many applications of union concatenation and cling closure. And the smallest class of languages over an alphabet sigma which contains phi single term epsilon single term a and is closed with respect to union concatenation and cling closure is a class of all regular languages over sigma. So, this can be seen from the definition. Now, let us give some examples of regular expressions and how can we construct regular expressions. So, already we have seen that the language phi single term epsilon and single term a for every a beyond the sigma they are all finite chance and are regular consider a to the n for n greater than equal to 0. So, this set this set is regular as it can be written by the regular expression a star because. So, a star basically it represents applying a cling closure to the language a. So, if we apply this cling closure to this a the language contain a single term a then we get epsilon a a a and so on. So, this is nothing but a to the n n greater than or equal to 0 when equal to 0 it will get epsilon when n equal to 1 we get a when n equal to 2 we get a a and so on. So, therefore, a to the n can be written by using a star and hence this set is a regular set similarly sigma star the set of all strings over an alphabet sigma is regular for instance if sigma is the set containing a 1 a 2 to a n and sigma star can be written as a 1 plus a 2 plus a 3 plus a n whole star. For example, if sigma equal to say a b then sigma star equal to a or b whole star. So, you can depend like this therefore, sigma star is a regular set. Let us consider the language the set of all strings over a b which contain a b as a substring. I can show that this set is a regular set for instance we can write this set as all the strings x when to a b star such that a b is a substring of x and then this can be written as y a b z for some y z belonging to sigma star. So, here y and z may be any string from a b. So, any string from a b can be written as a b whole star and this also a b whole star. So, we can write this as a concatenation of three languages is a b a b star and a b star. Now this can be written as a plus b whole star a b a plus b star. So, this is a regular expression for the given for the given language and hence this set is regular. Let us consider language over 0 1 that contains 0 1 or 1 0 as substring. This can also be shown to be regular because you can write it as the set of all string x such that 0 1 is substring of x union all string over x such that 1 0 is substring of x. Now this can be written as some y 0 1 z for some y z belonging to sigma star union u 1 0 v for some u v belonging to sigma star. This is nothing but sigma star 0 1 sigma star because y z may be anything from sigma star union sigma star 1 0 sigma star because u v may be anything from sigma star. Therefore, this is a regular expression because sigma star 0 1 and 1 0 are regular and we have expressed this language L using operations concatenation closure concatenation and union over the regular sets sigma star 0 1 and 1 0. Therefore, this L must be a regular set. So, in fact we can write it as 0 plus 1 star with sigma star 0 1 0 plus 1 star plus which means union 0 plus 1 star 1 0 0 plus 1 star. So, this is a regular expression representing the given language L. Similarly, the set of all strings over a b which do not contain a b is a substring 1 can easily see that this can be written as b to the m a to the m for some m n greater than equal to 0 because a b cannot occur as substring. Therefore, if any b occurs it must precede any occurrence of b's. Therefore, this can be written as a regular expression which is nothing which is b star a star. Therefore, this language the set of all strings over a b which do not contain a b substring can be written by the regular expression b star a star and hence this is a regular language. Similarly, we can construct regular expressions for many other languages. For example, just consider the alphabet 0 1 the set of all strings over this alphabet where number of say 1's is at least 2. That means there are at least 2 occurrence of 1 in every string in the language. Just define a language like this the set of all strings containing over 0 1 where the number of 1's is at least 1. So, since at least 2 so since 1 must occur at least 2 times but before that there may be any string over 0 1 depending by x before the first occurrence of 1 1 after that also there may be any string over 0 1 which depends as y then the second 1 and after the second 1 again we have string over 0 1 which contain any numbers of 0's and 1's. So, therefore, a typical string in the language can be written by x 1 y 1 z and here x y z may be any string over 0 1. Therefore, the corresponding regular expression will be 0 plus 1 star which is basically x then 1 again 0 plus 1 star again 1 this 0 plus 1 star represents this y and finally for just again 0 plus 1 star. So, this 1 and this 1 represents that at least 2 1's will be there in any string and other than this 2 there may be any string over 0 1 in any other places. So, this is a regular expression for the given language L. Similarly, if we define a language over the same alphabet suppose set of all strings over 0 1 having at most 2 occurrences of 1. So, this 1 was for at least 2 occurrence of 1's at least 2 occurrence, but not for the language where we have say at most 2 occurrence of 1's. In such a case there can be at most 2 occurrences of 1's. So, therefore, before this 1 there may be any string of over 0's and 1's sorry any string of 0's, but there cannot be any 1 after this again we may have any string of 0's and then we can have it is again 1 more 1 and after that also we can have any occurrence of 0's strings of 0's. So, there will be 2 occurrence of 1's this is the string for exactly 2 occurrence of 1's the set of all strings over 0 1 which have exactly 2 occurrence of 1's. So, if we should have at most 2 occurrence of 1's then we should incorporate the case where the strings of the form where there is at least at most 1 1 0 star 0 star and only strings of 0's. So, this will cover the case where there is no 1's this regular expression cover the case where there is only 1 1 and this will cover the case where there is at most 2 1's. So, this may the union of all these 3 hence since we can express it using this regular expression therefore, the language is a regular 1. Now, just consider the language the set of all strings over a b which contain odd number of a's. Now, it is easy to see that it can be represented as a regular form x belong to a b star such that number of occurrence of a's in x is equal to twice and plus 1 for some n, but writing a regular expression for this language is little bit tricky. So, we will postpone it to a later point where we construct a regular grammar for the language. So, regular grammar is another representation of finite expression for a language. So, even though it is tricky to write a regular expression it is very easy to write a regular grammar or construct a regular grammar for a given language. So, regular grammar is a tool to generate exactly the class of regular languages. Then again consider the set of all strings over a b which contain odd number of a's and even number of b's. Again we can write this set in set below form as x belong to a b star such that numbers of a's in x equal to y's and plus 1 then odd for some n and numbers of b's in x equal to twice m for some m. Writing a regular expression for this language is more trickier than the previous example and we can use some other tool like say finite automata to construct this kind of or to accept this kind of languages. This again finite one is yet again another tool to represent regular languages. Now, let us see the equivalence of regular expressions. We say that two regular expressions r 1 and r 2 as equivalent if they represent the same language and we denote it like r 1 equivalent to r 2. We use this symbol to represent the equivalence of two regular expressions. So, this means that l of r 1 is equal to l of r 2. Let us consider the regular expressions 1 0 plus 1 whole star and 1 0 star 1 star star which can show that these two regular expressions are equivalent from property 14 that we have already discussed regarding a property of languages is nothing but l 1 union l 2 star equal to l 1 star l 2 star whole star. So, it is a property 14 that we have already discussed for languages. So, if you consider property 14 then assuming l 1 to be 1 0 and l 2 to be 1 we get exactly 1 0 union 1 whole star to be equal to 1 0 star 1 star whole star. Now, since 1 0 and 1 represent the regular languages 1 0 singleton 1 0 and singleton 1 respectively from the above equation we get that 1 0 plus 1 whole star is exactly equivalent to 1 0 star 1 star whole star. So, we can use the properties of languages to show that the corresponding regular expressions are equivalent. That means this properties holds good for all languages since those properties hold good for all languages by specializing those properties to regular languages and in turn replacing by the corresponding regular expressions we get the following identities for regular expressions r epsilon is equivalent to epsilon r is equivalent to r. That means we have considered the property l 1 concatenation with epsilon is equivalent to or equal to epsilon concatenation with l 1 which is exactly l 1. So, if l 1 suppose r is a regulation for l 1 and epsilon is a regulation for a singleton epsilon this is equivalent to singleton epsilon and the corresponding regulation for l 1 is r this is equivalent to r. So, this equivalence we have got from the properties of this language. Similarly, by replacing the language by regular expressions in the properties of languages we get different kinds of equivalence for regular expressions. For example, say r 1 r 2 is not equivalent to r 1 r 2 r 1 in general. Similarly, r 1 concatenation r 2 r 3 not equivalent to or equivalent to r 2 r 1 r 2 concatenation r 3 r 5 is equivalent to 5 r is equivalent to 5 r is epsilon and so on. We can just reproduce these properties from the this equivalence of regular expressions from the properties of languages. Just consider this identity of regular expressions. We can use or prove this identity by using the equivalence of regular expressions. For example, say b plus s star b star plus epsilon b is equivalent to b plus s star b star plus b plus epsilon b is equivalent to b plus s star b star b plus b star b. So, in this case simply this b plus we have concatenate s star b star and concatenate epsilon we have got this result. Similarly, this b is concatenate this term and this term. Now, this can be written as b plus s star b plus hence this can be written as b plus s star b plus because b plus b is subset of b plus s star b plus. So, therefore, we have got the first one b plus s star b star plus epsilon b is equivalent to b plus s star b plus we have got. Similarly, one can observe that b b star s star plus epsilon b plus can be equivalent to b star s star b plus. Similarly, we can show that these two regular expressions are equivalent by using the following step. So, in the first step we have got from this expression this equivalence expression from this. We can use a regular expression properties to get eventually this expression and finally, this can be written as b plus 1 star. Now, if l is dependent by a regular expression r that is l r equal to r then we may simply use r instead of l r to indicate the language. So, for given a language say l r say r is a regular expression we know that l r is the corresponding language dependent by r, but simply we can sometimes write r to dependent language itself. So, this sort of notation for dependent language for language dependent by a regular expression r.