1 / 55

Languages and Finite Automata

Languages and Finite Automata. or how to talk to machines. Languages. A language is a set of strings String: A sequence of letters (a word) Examples: “cat”, “dog”, “house”, … Defined over an alphabet: set of symbols (letters). Alphabets and Strings. We will use small alphabets Strings.

reese
Download Presentation

Languages and Finite Automata

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Languages and Finite Automata or how to talk to machines...

  2. Languages • A language is a set of strings • String: • A sequence of letters (a word) • Examples: “cat”, “dog”, “house”, … • Defined over an alphabet: • set of symbols (letters)

  3. Alphabets and Strings • We will use small alphabets • Strings

  4. String Operations • Concatenation • Reverse

  5. String Length • Length: • Examples:

  6. Recursive Definition of Length • For any letter: • For any string : • Example:

  7. Length of Concatenation • Example:

  8. Proof of Concatenation Length • Claim: • Proof: • By induction on the length • Induction basis: • is only one symbol • From definition of length:

  9. Inductive hypothesis: • for all with • Inductive step: • we will prove • for

  10. Inductive Step • Write , where • From definition of length: • From inductive hypothesis: • Thus:

  11. Empty String • A string with no letters: • Observations:

  12. Substring • Definition: • A substring of a string is any sequence of consecutive characters • Example: Substrings

  13. Prefix and Suffix • Prefixes Suffixes prefix suffix

  14. Another Operation • Example: • Definition • for any :

  15. The * Operation • : the set of all possible strings from • alphabet • Example:

  16. Language • A language is any subset of • Examples: • A string is called “sentence”

  17. Another Example • An infinite language

  18. Operations on Languages • The usual set operations • Complement:

  19. Reverse • Definition: • Examples:

  20. Concatenation • Definition: • Example:

  21. Another Operation • Definition: • Example: • Special case:

  22. Example

  23. Star-Closure (Kleene *) • Definition: • Example:

  24. Positive Closure • Definition:

  25. Finite Automata Input String Output Finite Automaton String

  26. Finite Accepter Input String Output “Accept” or “Reject” Finite Automaton

  27. Transition Graph Abba -Finite Accepter initial state final state “accept” transition state

  28. Initial Configuration Input String

  29. Reading the Input

  30. Output: “accept”

  31. Rejection

  32. Output: “reject”

  33. Formalities • Deterministic Finite Accepter (DFA) : set of states : input alphabet : transition function : initial state : set of final states

  34. Input Aplhabet

  35. Set of States

  36. Initial State

  37. Set of Final States

  38. Transition Function

  39. Transition Function

  40. Extended Transition Function

  41. Recursive Definition

  42. Languages Accepted by DFAs • Take DFA • Definition: • The language accepted by • contains all input strings accepted by • In other words: • = { strings that drive to a final state}

  43. Example accept

  44. Another Example accept accept accept

  45. Formally • For a DFA • Language accepted by : alphabet transition function initial state final states

  46. Observation • Language accepted by : • Language rejected by :

More Related