120 likes | 295 Views
Strings and Languages. Jim Skon Mount Vernon Nazarene College. Sequences and Strings. alphabet - a set of symbols , denoted by string (or word) - a finite sequence of elements from example: = {a, b} possible strings include: a aa ab ba abaa bbb aaaa
E N D
Strings and Languages Jim Skon Mount Vernon Nazarene College Sets - Elementary Discrete Math
Sequences and Strings • alphabet - a set of symbols, denoted by • string (or word) - a finite sequence of elements from • example: • = {a, b} • possible strings include: • a aa ab ba abaa bbb aaaa • bbaa abab abbbababbbabbababa • "abba" is a string over • empty word - (lambda) • * is set of all words over • - * = {x | x is a word over } • - always includes • - * is always infinite if has elements • other interesting alphabets • - = {0, 1} (binary words) • - = {1} • - = {a,b,c,d, . . ., z} • word length • - number of symbols in word (or string) Sets - Elementary Discrete Math
n where n is an integer • - set of all strings of length n • - let ={0, 1}, find: • 1 • 2 • 3 • 0 • - let = {a, b, c} • For any n it must be true that n*. • - 1* • - 5* • - 65* Sets - Elementary Discrete Math
n where n is an integer • - set of all strings over with length at most n • - let = {0, 1}, find: • 1 • 2 • 0 • For any n it must be true that n*. • - 1* • - 4* • - 77* • For a given alphabet , what is the relationship • between n and n? (First think about 2 and 2) Sets - Elementary Discrete Math
Any subset of * is called a language over . • ex: let = {0,1} • L1 = {x | 2 length(x) 4 and x * } Sets - Elementary Discrete Math
L2 = {x | same number of 0s as 1s and x * } Sets - Elementary Discrete Math
L3 = {x | no leading zeros and x * } Sets - Elementary Discrete Math
n and nare languages over. Sets - Elementary Discrete Math
SET OPERATORS • Sets with no common elements are called disjoint • - If A B = Ø, then A and B are disjoint. • - ex: n and m are disjoint if n m. • Are n and n disjoint? • What about n and n+1? Sets - Elementary Discrete Math
SET OPERATORS • If A1, A2, . . . An are sets, and no two have a common element, then we say they are mutually disjoint. • Ai Aj = Ø for all i,j n and i j • ex: 0, 1, 2, 3 ,... are all mutually disjoint • 0, 1, 2, 3 ,... are these mutually disjoint? Sets - Elementary Discrete Math