
Set Operations and Properties with Language Examples
Explore set operations like union, intersection, complement, and their properties alongside examples. Learn about the language set, including natural and programming languages. Discover Kleene closure and string concepts with practical examples.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Lecture2 Operation on set
Basic operation on set 1- Union A B =def { x| x A or x B} 2- Intersection A B =def { x| x A and x B} 3- Difference A B =def { x| x A and x B} 4- Complement A = { x| x A, x U } A = U A
Properties of sets 1. Idempotent Laws (a) X X = X, (b) X X = X 2. Commutative Laws (a) X Y = Y X, (b) X Y = Y X 3. Associative Laws (a) (X Y) Z = X (Y Z), (b) (X Y) Z = X (Y Z) 4. Distributive Laws (a) X (Y Z) = (X Y) (X Z), (b) X (Y Z) = (X Y) (X Z)
5. Identity Laws (a) X = X, (b) X = , (c) X U = U, (d) X U = X 6. Complement Laws (a) X X = U, (b) X X = , (c) (X ) = X (d) X Y = X Y 7. DeMorgan s Laws (a) (X Y) = X Y , (b) (X Y) = X Y
Language: language is the set of all strings of terminal symbols character from alphabet. Types of language 1-Natural language: (e.g.: English, Arabic): It has alphabet:={a, b, c, .z}From these alphabetic we make sentences that belong to the language. 2- Programming language: (e.g.: Cobol, Pascal):It has alphabetic: ={a,b,c,.z , A,B,C,..Z , ?, /, - ,\.} From these alphabetic we make sentences that belong to programming language.
) ( ) ( ) ( Sentences words letters , ) ( entities . ) ( , ) ( grammar Sentences . , Alphabet ( ) , ) ( Set of alphabet . ={a,b,c, ..z} = { 0,1} ={ ......... , , , } grammar
Examples: Let ={x}, be set of alphabet of one letter x. L1={x,xx,xxx,xxxx, } We can write this in an alternate form: L1 = {xn, for n=1,2,3, .} Ex: If a = xx and b = xxx then find a.b , b.a a.b = xxxxx b.a = xxxxx Ex: If a=xx and b=xxx then ab=xxxxx by concatenation a&b Ex: L2={x,xxx,xxxxx, ..} ={xodd} If a = xxx and b = xxxxx are accepted But the catenation of a and b not in L2 Ab = xxxxxxxx Ex: L = { all positive real number } L = { 0.4,0.5,0.1,0.99}
String : : Windows , computer , #1$ , 123 , "mohammed" Length of string string Examples a= windows then length (a) =7 b= xxx then length (b) =3 c= 428 then length (c) =3
Kleene closur Also called (kleene star OR closure) * 0 n 1 n : :+ Examples *= { , x,xx,xxx,xxxx, } += { x,xx,xxx,xxxx, } Ex: If = {0,1}, then *= { , 0,1,00,01,11,111,000, } += { 0,1,00,11,010,000, } Ex : if S = {aa , b}, then S*={ , b,aa,aab,baa,aaaa,aabb,baab,bbaa,bbbb,aaaab,aabaa, }
Example: if = ( the empty set), the * = { }. Ex: If = {a,b,c}, then * = { , a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc, aaa...} Example: {"ab","c"}*= { , "ab", "c", "abab", "abc", "cab", "cc", "ababab", "ababc", "abcab", "abcc", "cabab", "cabc", "ccab", "ccc", ...}. Example : {"a", "b", "c"}+= { "a", "b", "c", "aa", "ab", "ac", "ba", "bb", "bc", "ca", "cb", "cc", "aaa", "aab", ...}. Example : {"a", "b", "c"}*= { , "a", "b", "c", "aa", "ab", "ac", "ba", "bb", "bc", "ca", "cb", "cc", "aaa", "aab", ...}.