Languages 2 nd Sem 2017 Lecture 2 1
Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat, dog, house Language: {cat, dog, house} Alphabet: 2 nd Sem 2017 Lecture 2 2
Languages are used to describe computation problems: Alphabet: 2 nd Sem 2017 Lecture 2 3
Alphabets and Strings An alphabet is a set of symbols Example Alphabet: A string is a sequence of symbols from the alphabet Example Strings 2 nd Sem 2017 Lecture 2 4
Decimal numbers alphabet Binary numbers alphabet 2 nd Sem 2017 Lecture 2 5
Unary numbers alphabet Unary number: Decimal number: 2 nd Sem 2017 Lecture 2 6
String Operations Concatenation 2 nd Sem 2017 Lecture 2 7
Reverse 2 nd Sem 2017 Lecture 2 8
String Length: Examples: 2 nd Sem 2017 Lecture 2 9
Length of Concatenation Example: 2 nd Sem 2017 Lecture 2 10
Empty String A string with no letters is denoted: Observations: 2 nd Sem 2017 Lecture 2 11
Substring of string: a subsequence of consecutive characters String 2 nd Sem 2017 Substring Lecture 2 12
Prefix and Suffix Prefixes Suffixes prefix suffix 2 nd Sem 2017 Lecture 2 13
Another Operation Example: Definition: 2 nd Sem 2017 Lecture 2 14
The * Operation : the set of all possible strings from alphabet 2 nd Sem 2017 Lecture 2 15
The + Operation : the set of all possible strings from alphabet except 2 nd Sem 2017 Lecture 2 16
Languages A language over alphabet is any subset of Examples: Language: 2 nd Sem 2017 Lecture 2 17
More Language Examples Alphabet An infinite language 2 nd Sem 2017 Lecture 2 18
Prime numbers Alphabet Language: 2 nd Sem 2017 Lecture 2 19
Even and odd numbers Alphabet 2 nd Sem 2017 Lecture 2 20
Unary Addition Alphabet: Language: 2 nd Sem 2017 Lecture 2 21
Squares Alphabet: Language: 2 nd Sem 2017 Lecture 2 22
Note that: Sets Set size String length 2 nd Sem 2017 Lecture 2 23
Operations on Languages The usual set operations Complement: 2 nd Sem 2017 Lecture 2 24
Reverse Definition: Examples: 2 nd Sem 2017 Lecture 2 25
Concatenation Definition: Example: 2 nd Sem 2017 Lecture 2 26
Another Operation Definition: Special case: 2 nd Sem 2017 Lecture 2 27
2 nd Sem 2017 Lecture 2 28
Star-Closure (Kleene *) All strings that can be constructed from Definition: Example: 2 nd Sem 2017 Lecture 2 29
Positive Closure Definition: Same with 2 nd Sem 2017 but without the Lecture 2 30