Advanced Discrete Math - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Advanced Discrete Math

Description:

A language is a set of strings of symbols drawn from some ... Example: S = {a, b, ..., z}, L={x : x is a word in the Merriam-Webster unabridged dictionary} ... – PowerPoint PPT presentation

Number of Views:167
Avg rating:3.0/5.0
Slides: 17
Provided by: DuquesneU8
Category:

less

Transcript and Presenter's Notes

Title: Advanced Discrete Math


1
Advanced Discrete Math
  • Intro to Formal Languages

2
Languages
  • A language is a set of strings of symbols drawn
    from some finite set S called the alphabet
  • Example S 0,1, L x Î S x has an even
    number of 0s
  • Example S a, b, , z, Lx x is a word in
    the Merriam-Webster unabridged dictionary

3
Languages
  • Languages have many uses in computer science
  • Programming languages (e.g., Java)
  • Descriptions of sets (e.g., set of valid US
    telephone numbers)
  • Descriptions of expression syntax (e.g., the set
    of valid arithmetic expressions)

4
Languages
  • For a given alphabet S, how many different
    languages can be defined?
  • Let S represent the set of all strings (of any
    length) over S
  • The set of languages is the power set of S,
    written 2 S
  • This set is uncountably infinite!

5
Languages
  • If a finite set of rules is used to write down a
    description of a language, then the set of
    languages described is countably infinite
  • So we cant hope to come up with a set of rules
    to describe all languages!
  • However, certain sets of language-writing rules
    have interesting properties and are widely used

6
Language Classes
  • Regular languages widely used to represent
    syntax of strings (telephone numbers, arithmetic
    expressions, etc.)
  • Context-free languages most programming
    languages belong to this class
  • Recursive languages those sets that can be
    recognized by some computer program that always
    terminates

7
Regular Languages
  • A language over S is regular if it can be
    described using the following recursive rules
  • The empty set is a regular language
  • Any set a where a Î S is a regular language
  • The union or concatenation of two regular
    languages is a regular language
  • The Kleene star of a regular language is a
    regular language

8
Regular Languages
  • Concatenation of sets of strings is Cartesian
    product
  • a,bc,d ac, ad, bc, bd
  • Kleene star of a set is the set of all
    concatenations of the set with itself (including
    the set of no concatenations, producing empty
    string e)
  • a,b e, a, b, aa, ab,

9
Regular Languages
  • We can describe a regular language using a
    shorthand known as a regular expression
  • Dont use s for sets
  • Ex a represents a, e represents e
  • Ex a(bUc) represents the set a, ab, ac, abb,
    abc, acb, acc, abbb,

10
Regular Languages
  • Regular expressions are used widely in computer
    science
  • Support built in to Java 1.5, Perl, JavaScript,
  • System tools such as grep (generalized regular
    expression processor)
  • Emacs regexp searches

11
Regular Languages
  • A graphical representation of regular languages
    finite state automaton (FSA)

12
Regular Languages
  • Theorem (Kleene) a language is regular iff it is
    accepted by an FSA
  • Proof
  • There is a procedure that converts any regular
    expression w into a nondeterministic FSA that
    accepts L(w)
  • There is a procedure that converts any
    nondeterministic FSA to an FSA
  • There is a procedure that converts any FSA M to a
    regular expression representing L(M)

13
Regular Languages
  • Writing regular expressions
  • Often easiest to start with non-deterministic FSA
  • Follow procedure for converting to equivalent
    regular expression

14
Regular Languages
  • Many interesting languages are not regular
  • Set of bit strings having an equal number of 0s
    and 1s
  • Intuition cannot remember how many 0s have been
    seen with a finite number of states
  • Proving that a language is not regular formalizes
    this intuition Pumping lemma

15
Context-free Languages
  • A CFL is described using a grammar
  • A context-free grammar (CFG) consists of a set of
    replacement rules.
  • Left side of each rule is a single non-terminal
    symbol (symbol not in S)
  • Right side is a string of terminal symbols (in S)
    and nonterminals
  • One nonterminal is the start symbol

16
Context-free Languages
Write a Comment
User Comments (0)
About PowerShow.com