160 likes | 252 Views
MA/CSSE 474. Theory of Computation. Functions, Closure, Decision Problems. Your Questions?. Syllabus Yesterday's discussion Reading Assignments HW1 or HW2 Anything else. Must not be a FSM. Responses to Reading Quiz 1. From #4: ℘(∅) = { ∅ } (not ℘(∅) = ∅ ) What is ℘(℘(∅))?
E N D
MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems
Your Questions? • Syllabus • Yesterday's discussion • Reading Assignments • HW1 or HW2 • Anything else Must not be a FSM
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: {xA : 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)
Responses to Reading Quiz 1 #16: Let ℕ be the set of nonnegative integers. Let A be the set of nonnegative integers x such that x3 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).
Responses to Reading Quiz 1 #18: Prove by induction:n>0 (n! 2n-1). Why is the following "proof" of the induction step shaky at best, perhaps wrong? (n+1)! 2n what we're trying to show (n+1)n! 2(2n-1)definitions of ! And exponents (n+1) 2 induction hypothesis (n! 2n-1) Since n is at least 1, this statement is true, therefore (n+1)! 2n is true.
Relations on Strings: • aaa is a substring of aaabbbaaa • aaaaaa is not a substring of aaabbbaaa • aaa is a proper substringof aaabbbaaa • Every string is a substring of itself. • is a substring of every string. • s is a prefix of tiff: x * (t = sx). • s is a proper prefixof tiff: 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 tiff: x * (t = xs) then continue as above: proper suffix, self,
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.
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 = ya} 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, # • L = {an : n 0} uses replication, simpler description of L? • L = Ø = { } • L = {ε} Are the last two different languages?
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.
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?
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}
Cardinality of a set. The cardinality of every set we will consider is one of the following : • 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).
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?
Closure • A set S is closed under binary operation opiff x,yS ( x op y S) ,closed under unary function f iff xS (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 closureof S is a set S' such that S is a subset of S' S' is closed under f No proper subset of S' contains S and is closed under f
Equivalence Relations A relation on a set A is any set of ordered pairs of elements of A. A relation RAA 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