1 / 32

Introduction

Introduction. What lies ahead : formalization of computation various models of computation (increasing difficulty/power) what can / cannot be done ?. Introduction. What lies ahead : formalization of computation various models of computation (increasing difficulty/power)

haparicio
Download Presentation

Introduction

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. Introduction • What lies ahead : • formalization of computation • various models of computation (increasing difficulty/power) • what can / cannot be done ?

  2. Introduction • What lies ahead : • formalization of computation • various models of computation (increasing difficulty/power) • what can / cannot be done ? • Motivation ?

  3. Discrete Math • Models are mathematical • need basic discrete math knowledge [Part I of the book] • we will go over Sections 1.5, 2.4, and 2.5 • Notation in the book • A’ is the complement of a set A • N is the set of natural numbers (these slides use N) • Quiz

  4. [Section 1.5] Languages

  5. [Section 1.5] Languages A language is a set of strings involving symbols from some alphabet. An alphabet is a finite set of symbols, typically denoted by . Examples :

  6. [Section 1.5] Languages A language is a set of strings involving symbols from some alphabet. An alphabet is a finite set of symbols, typically denoted by . A string over  is a finite (possibly empty) sequence of elements of . Examples of strings over {0,1} : These are not strings over {0,1} :

  7. [Section 1.5] Languages A language is a set of strings involving symbols from some alphabet. An alphabet is a finite set of symbols, typically denoted by . A string over  is a finite (possibly empty) sequence of elements of . denotes the null string – the empty sequence of elem. of . If x is a string over , |x| denotes the length of x, i.e. the number of symbols of the alphabet in the string.

  8. [Section 1.5] Languages * denotes the language of all strings over . Examples :

  9. [Section 1.5] Languages * denotes the language of all strings over . A language over  is a subset of *. Examples : What are the sizes of these languages ?

  10. [Section 1.5] Operations on languages • Set operations : • union L1[ L2 • intersection L1Å L2 • difference L1 - L2 • complement L’ =

  11. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • Examples :

  12. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • for an integer k, xk is the concatenation of k copies of x • Examples :

  13. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • for an integer k, xk is the concatenation of k copies of x • x is a substring of y iff there exist w,z2* such that y = wxz • Examples :

  14. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • for an integer k, xk is the concatenation of k copies of x • x is a substring of y iff there exist w,z2* such that y = wxz • x is a prefix of y iff there exists z2* such that y = xz • Examples :

  15. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • for an integer k, xk is the concatenation of k copies of x • x is a substring of y iff there exist w,z2* such that y = wxz • x is a prefix of y iff there exists z2* such that y = xz • x is a suffix of y iff there exists z2* such that y = zx • Examples :

  16. [Section 1.5] Operations on languages Operations on strings • Let x,y 2*. • xy is the concatenation of x and y • for an integer k, xk is the concatenation of k copies of x • x is a substring of y iff there exist w,z2* such that y = wxz • x is a prefix of y iff there exists z2* such that y = xz • x is a suffix of y iff there exists z2* such that y = zx • xr is the reverse of x iff xr is “x written backwards” • Examples :

  17. [Section 1.5] Operations on languages Operations on strings extended to languages • Let L, L1, L2µ*. • L1L2 is the concatenation of languages L1L2, i.e. • L1L2 = { xy | x 2 L1, y 2 L2 } • Examples :

  18. [Section 1.5] Operations on languages Operations on strings extended to languages • Let L, L1, L2µ*. • L1L2 is the concatenation of languages L1L2, i.e. • L1L2 = { xy | x 2 L1, y 2 L2 } • - for an integer k, Lk is the concatenation of k copies of L • Examples :

  19. [Section 1.5] Operations on languages Operations on strings extended to languages • Let L, L1, L2µ*. • L1L2 is the concatenation of languages L1L2, i.e. • L1L2 = { xy | x 2 L1, y 2 L2 } • for an integer k, Lk is the concatenation of k copies of L • L* = [k=0…1Lk (this operation is called Kleene’s star) • Examples :

  20. [Section 1.5] Operations on languages Operations on strings extended to languages • Let L, L1, L2µ*. • L1L2 is the concatenation of languages L1L2, i.e. • L1L2 = { xy | x 2 L1, y 2 L2 } • for an integer k, Lk is the concatenation of k copies of L • L* = [k=0…1Lk (this operation is called Kleene’s star) • L+ = [k=1…1Lk • Examples :

  21. [Section 1.5] Operations on languages Operations on strings extended to languages • Let L, L1, L2µ*. • L1L2 is the concatenation of languages L1L2, i.e. • L1L2 = { xy | x 2 L1, y 2 L2 } • for an integer k, Lk is the concatenation of k copies of L • L* = [k=0…1Lk (this operation is called Kleene’s star) • L+ = [k=1…1Lk • Lr is the reverse of L, i.e. Lr = { xr | x 2 L } • Examples :

  22. [Section 2.4] Recursive Definitions • A well-known recursive definition : • 1) 0! = 1 • for every n 2 N, (n+1)! = (n+1) . n! • Compute 5!

  23. [Section 2.4] Recursive Definitions Recursive definition of *

  24. [Section 2.4] Recursive Definitions Recursive definition of the length of a string

  25. [Section 2.4] Recursive Definitions Recursive definition of the reverse of a string Compute (abcb)r.

  26. [Section 2.4] Recursive Definitions Recursive definition of a language A palindrome is a string that reads the same forward and backward. Examples :

  27. [Section 2.4] Recursive Definitions Recursive definition of a language A palindrome is a string that reads the same forward and backward. abpal is the language of all palindromes over {a,b}. Recursive definition of abpal 1) 2abpal 2) for every w 2abpal and  2{a,b},  w 2abpal 3) nothing else is in abpal Is the definition correct ?

  28. [Section 2.4] Recursive Definitions Recursive definition of a language L0=1µ {0,1}* : 1) 2 L0=1 2) for every x 2 L0=1, 0x1, 1x0, 01x, 10x, x01, and x10 2 L0=1 3) no other strings are in L0=1 Can you describe L0=1 in words ?

  29. [Section 2.5] Structural Induction We will prove that every string z in the (corrected) language L0=1 contains the same number of zeros and ones.

  30. Mathematical Induction We proved : L0=1µ { z | z 2 {0,1}* and #0’s in z = #1’s in z } To prove equality, we need to say that every string z with the same number of 0’s and 1’s can be generated by rules 1)-3).

  31. Mathematical Induction We proved : L0=1µ { z | z 2 {0,1}* and #0’s in z = #1’s in z } To prove equality, we need to say that every string z with the same number of 0’s and 1’s can be generated by rules 1)-3).

  32. Another Exercise Recursive definition of a language La ¸ bµ {a,b}* : 1) a 2 La ¸ b 2) for every x 2 La ¸ b, ax 2 La ¸ b 3) for every x,y 2 La ¸ b, bxy, xby, and xyb 2 La ¸ b 4) no other strings are in La ¸ b

More Related