csc312 automata theory lecture # 2 languages. courtesy costas busch - rpi2 alphabets: an alphabet is...

Download CSC312 Automata Theory Lecture # 2 Languages. Courtesy Costas Busch - RPI2 Alphabets: An alphabet is a finite set of symbols, usually letters, digits,

Post on 12-Jan-2016

218 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

  • CSC312Automata Theory

    Lecture # 2Languages

  • Courtesy Costas Busch - RPI*Alphabets: An alphabet is a finite set of symbols, usually letters, digits, and punctuations. Valid/In-valid alphabets: An alphabet may contain letters consisting of group of symbols for example = {a, ba, bab, d}.Remarks: While defining an alphabet of letters consisting of more than one symbols, no letter should be started with the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in a letter of same alphabet.Valid alphabet :Invalid alphabet :

    Alphabets and Strings

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*String or word: A finite sequence of letters/alphabetsExamples: cat, dog, house, read Defined over an alphabet:

    Alphabets and Strings

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Alphabets and StringsWe will use small alphabets:

    Strings

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*String OperationsConcatenationLet we have following stringsReverse

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*String Length

    Length:

    Examples:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Length of Concatenation

    Example:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Empty StringA string with no letters: Observations:

    Note-1: A language that does not contain any word at all is denoted by or { }. This language doesnt contain any word not even the NULL string. i.e. { } {}

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Empty StringNote-2: Suppose a language L doesnt contain NULL then L = L + but L L + {}.

    Important : NULL is identity element with respect to concatenation.

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*SubstringSubstring of string: a subsequence of consecutive characters

    String Substring

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Prefix and Suffix Let the string is Prefixes Suffixes

    prefixsuffix

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Another Operation

    - w repeated n time; that is,

    Example:

    Definition:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*The * Operation : the set of all possible strings from alphabet , called closure of alphabets also known as Kleene star operator or Kleene star closure.

    i.e. infinitely many words each of finite length.

    Courtesy Costas Busch - RPI

  • *The + Operation : the set of all possible strings from alphabet except , also known as Kleene plus operator.

    Note : are infinite

  • Courtesy Costas Busch - RPI*LanguagesA language is a set of strings ORA language is any subset of , usually denoted by L. It may be finite or infinite. Example:

    Languages:

    If a string w is in L, we say that w is a sentence of L.

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Note that:SetsSet sizeSet sizeString length

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Another Example

    An infinite language

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Operations on LanguagesThe usual set operations

    Complement:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*ReverseDefinition:

    Examples:

    ConcatenationDefinition:

    Examples:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Another OperationDefinition:

    L concatenated with itself n times.

    Special case:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*More Examples

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Star-Closure (Kleene *)

    Definition:

    Example:

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Positive Closure

    Definition:

    Note: L+ includes if and only if L includes

    Courtesy Costas Busch - RPI

  • Courtesy Costas Busch - RPI*Lexicographical OrderAssume that the symbols in are themselves ordered. Definition: A set of strings is in lexicographical order if The strings are grouped first according to their length. Then, within each group, the strings are ordered alphabetically according to the ordering of the symbols.

    Courtesy Costas Busch - RPI

  • Ex: Let the alphabet beThe set of all strings in Lexicographical order is, a, b, aa, ab, ba, bb, aaa, ., bbb, aaaa, , bbbb, . Courtesy Costas Busch - RPI*Lexicographical Order

    Courtesy Costas Busch - RPI

    *