1 / 78

Languages

Languages. Languages. A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:. Alphabets and Strings. We will use small alphabets: Strings. String Operations. Concatenation. Reverse. String Length.

Download Presentation

Languages

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

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

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

  4. String Operations Concatenation

  5. Reverse

  6. String Length • Length: • Examples:

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

  8. Length of Concatenation • Example:

  9. Proof of Concatenation Length • Claim: • Proof: By induction on the length • Induction basis: • From definition of length:

  10. Inductive hypothesis: • for • Inductive step: we will prove • for

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

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

  13. Substring • Substring of string: • a subsequence of consecutive characters • String Substring

  14. Prefix and Suffix • Prefixes Suffixes prefix suffix

  15. Another Operation • Example: • Definition:

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

  17. The + Operation : the set of all possible strings from alphabet except

  18. Language • A language is any subset of • Example: • Languages:

  19. Another Example • An infinite language

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

  21. Reverse • Definition: • Examples:

  22. Concatenation • Definition: • Example:

  23. Another Operation • Definition: • Special case:

  24. More Examples

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

  26. Positive Closure • Definition:

  27. Finite Automata

  28. Finite Automaton Input String Output Finite Automaton String

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

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

  31. Initial Configuration Input String

  32. Reading the Input

  33. Output: “accept”

  34. Rejection

  35. Output: “reject”

  36. Another Example

  37. Output: “accept”

  38. Rejection

More Related