Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Structures Li Tak Sing( 李德成 ) mt263f-11-12.ppt 1.

Similar presentations


Presentation on theme: "Discrete Structures Li Tak Sing( 李德成 ) mt263f-11-12.ppt 1."— Presentation transcript:

1 Discrete Structures Li Tak Sing( 李德成 ) mt263f-11-12.ppt 1

2 Counting Strings The set A* of all strings over a finite alphabet A is countably infinite. Proof. A* is the union of A 0, A 1,... Since each A n is finite, therefore the union of these finite sets are countable. 2

3 Uncountable sets Diagonalization  Let A be an alphabet with two or more symbols and let S o, S 1,..., S n,..., be countable listing of sequences of the form S n =(a no, a n1,....), where a ni  A. The sequences are listed as the rows of the following infinite matrix: 3

4 Then there is a sequence S=(b 0, b 1, b 2,..) over A that is not in the original list. We can construct S from the list of diagonal elements (a 00, a 11, a 22,...) by changing each element so that b n  a nn for each n. 4

5 Uncountability of the reals. 5

6 Limits on computability The set of programs for a programming language is countably infinite. Programs can be considers as strings over a particular set of alphabets, therefore, according to the countability of strings, programs are countabily infinite. 6

7 Not everything is computable We only have countable programs, therefore we can only generate countable number of results. For example, there are uncountable real numbers. So we cannot use programs to generate all the real numbers as we only have countable programs. 7

8 Higher cardinalities |A|<|power(A)| Proof. This is true for finite A. For infinite A, we see that for each element of A, say x, {x} is an element of A. So we can see that |A| is at lease less than or equal to |power(A)|. Would it be possible that |A|=|power(A)|? 8

9 Higher cardinalities Assume that that is the case, therefore there is a bijection between A and power(A). So each x in A is associated with a subset S x of A. Now, consider the subset: S={x  A|x  S x } There is an y such that S=S y Now, y  S y  y  S y and y  S y  y  S y Therefore, contradition and such bijection does not exist. Therefore |A|<|power(A)| 9

10 There are uncountably many languages over a finite alphabet A language is a subset of all the strings over a set of alphabets. So all the languages over a set of alphabets form the power set of all the strings over a set of alphabets. Since the set of all strings over a set of alphabets is countably infinite, the power set is uncountably infinite. 10

11 Examples 1.Show that the cardinality of the odd integers is the same as the cardinality of the integers. 2.Show that the set of even natural numbers have the same cardinality as the set Z of integers. 3.Prove that the open intervals of real numbers (1,2) and (4,10) have the same cardinality. 11

12 Solution 12

13 Solution 13

14 Construction Techniques Inductively Defined Sets  Basis: Specify one or more elements of s.  Induction: Give one or more rules to construct new elements of S from existing elements of S.  Closure: State that S consists exactly of the elements obtained by the basis and induction steps. 14

15 Examples Consider how to define the following sets inductively: 1.{4,2,0,-2...} 2.{2, 6,18, 54,….} 3.{4,-8, 16, -32,...} 4.{...,-6,-3,0,3,6,...} 15

16 Solution 16

17 Strings All strings over A*  Basis:  A*  Induction: if s  A* and a  A, then as  A*. 17

18 String examples Show how to generate the following set of strings inductively. 1.S={ab, aabb, aaabbb,....} 2.S={aba, aabaa, aaabaaa,.....} 3.S={ab, abab, ababab,...} 4.S={a m (bc) n |m,n  N} 18

19 Solution 19

20 Lists All lists over A  Basis: <>  lists(A).  Induction: If x  A and L  lists(A), then cons(x,L)  list(A). 20

21 Lists examples Write the inductive definiton for the sets: 1.C={L|L  lists({a,b}) where a's and b's alternate} 2.S={x|x  lists(N) and x has even length} 21

22 Solution 22

23 Binary trees All binary trees over A  Basis: <>  B.  Induction: if x  A and L,R  B, then tree(L,x,R)  B. 23

24 Binary trees Write an inductive definition for each of the following Binary trees 1.All binary trees over {a} 2.The set of binary trees over {a} where each node has two identical subtrees. 24

25 Solution 25


Download ppt "Discrete Structures Li Tak Sing( 李德成 ) mt263f-11-12.ppt 1."

Similar presentations


Ads by Google