Presentation is loading. Please wait.

Presentation is loading. Please wait.

MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems.

Similar presentations


Presentation on theme: "MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems."— Presentation transcript:

1 MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems

2 Your Questions? Syllabus Yesterday's discussion Reading Assignments HW1 or HW2 Anything else Must not be a FSM

3 Responses to Reading Quiz 1 From #4: ℘ ( ∅ ) = { ∅ } (not ℘ ( ∅ ) = ∅ ) What is ℘ ( ℘ ( ∅ ))? From #4: {a, b} X {1, 2, 3} X ∅ = ∅ #10: (representing {1, 4, 9, 16, 25, 36, …} in the form: {x  A : P(x)} {x ∊ ℕ : x>0 ∧ ∃ y ∊ℕ (y*y = x)} Why not {x ∊ ℕ : x>0 ∧ sqrt(x) ∊ ℕ } ? From #15:  x  ℕ (  y  ℕ (y < x)). Why is this not satisfiable? (e, g, by x=3, y=2)

4 Responses to Reading Quiz 1 #16: Let ℕ be the set of nonnegative integers. Let A be the set of nonnegative integers x such that x  3 0. Show that | ℕ | = |A|. Define a function f : ℕ →A by f(n) = 3n. f is one-to-one: if f(n) = f(m), then 3n = 3m, so m=n. f is onto: Let k ∊ A. Then k = 3m for some m ∊ ℕ. So k = f(m).

5 Responses to Reading Quiz 1 #18: Prove by induction:  n>0 (n!  2 n-1 ). Why is the following "proof" of the induction step shaky at best, perhaps wrong? (n+1)!  2 n what we're trying to show (n+1)n!  2(2 n-1 ) definitions of ! And exponents ( n+1 )  2 induction hypothesis (n!  2 n-1 ) Since n is at least 1, this statement is true, therefore (n+1)!  2 n is true.

6 Relations on Strings: aaa is a substring of aaabbbaaa aaaaaa is not a substring of aaabbbaaa aaa is a proper substring of aaabbbaaa Every string is a substring of itself.  is a substring of every string. s is a prefix of t iff:  x   * (t = sx). s is a proper prefix of t iff: s is a prefix of t and s  t. Examples: The prefixes of abba are: , a, ab, abb, abba. The proper prefixes of abba are: , a, ab, abb. Every string is a prefix of itself.  is a prefix of every string. s is a suffix of t iff:  x   * (t = xs) then continue as above: proper suffix, self, 

7 Defining a Language A language is a (finite or infinite) set of strings over a finite alphabet . Examples: Let  = { a, b } Some languages over  : , {  }, { a, b }, { , a, aa, aaa, aaaa, aaaaa } If  is nonempty, the language  * contains an infinite number of strings, including: , a, b, ab, ababaa.

8 Example Language Definitions 1. L = {x  { a, b }* : all a ’s precede all b ’s} , a, aa, aabbb, and bb are in L. aba, ba, and abc are not in L. 2. L = {x :  y  { a, b }* : x = y a } Simple English description: 3. L = {x#y: x, y  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }* and, when x and y are viewed as the decimal representations of natural numbers, square(x) = y}. Examples: 3#9, 12#144, 3#8, 12, 12#12#12, # 4.L = { a n : n  0} uses replication, simpler description of L? 5.L = Ø = { } 6.L = {ε} Are the last two different languages?

9 Natural Languages are Tricky L = {w: w is a sentence in English}. Examples: Kerry hit the ball. Colorless green ideas sleep furiously. The window needs fixed. Ball the Stacy hit blue.

10 A Halting Problem Language L = {w: w is a Java program that, when given any finite input string, is guaranteed to halt}. Is this language well specified? Can we decide which strings L contains?

11 Languages and Prefixes What are the following languages: L = {w  { a, b }*: no prefix of w contains b } L = {w  { a, b }*: no prefix of w starts with a } L = {w  { a, b }*: every prefix of w starts with a }

12 Sets and Relations

13 Cardinality of a set. a natural number (if S is finite), “countably infinite” (if S has the same number of elements as there are integers), or “uncountably infinite” (if S has more elements than there are integers). The cardinality of every set we will consider is one of the following :

14 Sets of Sets The power set of S is the set of all subsets of S. Let S = {1, 2, 3}. Then: P (S) = { , {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.   P(S) is a partition of a set S iff: Every element of  is nonempty, Every pair of elements of  is disjoint, and the union of all the elements of  equals S. Some partitions of S: {{1}, {2, 3}} or {{1, 3}, {2}} or {{1, 2, 3}}. How many different partitions of S?

15 Closure A set S is closed under binary operation op iff  x,y  S ( x op y  S), closed under unary function f iff  x  S (f(x)  S) Examples ℕ + (the set of all positive integers) is closed under addition and multiplication but not negation, subtraction, or division. What is the closure of N+ under subtraction? Under division? The set of all finite sets is closed under union and intersection. Closed under infinite union? If S is not closed under unary function f, a closure of S is a set S' such that a)S is a subset of S' b)S' is closed under f c)No proper subset of S' contains S and is closed under f

16 Equivalence Relations A relation on a set A is any set of ordered pairs of elements of A. A relation R  A  A is an equivalence relation iff it is: reflexive, symmetric, and transitive. Examples of equivalence relations: Equality Lives-at-Same-Address-As Same-Length-As Contains the same number of a's as Show that ≡ ₃ is an equivalence relation


Download ppt "MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems."

Similar presentations


Ads by Google