Download presentation
Presentation is loading. Please wait.
Published byMadeleine Chapman Modified over 9 years ago
1
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012
2
2 Countable Sets Based on course materials by Prof. Costas Busch
3
3 Infinite sets are either: Countable Uncountable
4
4 Countable set: There is a one to one correspondence between elements of the set and positive integers
5
5 Example: Even integers: The set of even integers is countable Positive integers: Correspondence: corresponds to
6
6 Example:The set of rational numbers is countable Rational numbers:
7
7 Naive Approach Rational numbers: Positive integers: Correspondence: Doesn’t work: we will never count numbers with nominator 2
8
8 Better Approach
9
9
10
10
11
11
12
12
13
13
14
14 Rational Numbers: Correspondence: Positive Integers:
15
15 We proved: the set of rational numbers is countable by giving an enumeration procedure
16
16 Definition An enumeration procedure for is a Turing machine that generates any string of in finite number of steps. Let be a set of strings
17
17 Enumeration Machine for Finite time: strings output
18
18 Enumeration Machine Configuration Time 0 Time
19
19 Time
20
20 A set is countable if there is an enumeration procedure for it
21
21 Example: The set of all strings is countable. We will describe the enumeration procedure.
22
22 Naive procedure: Produce the strings in lexicographic order: Doesn’t work! Strings starting with will never be produced.
23
23 Better procedure: Proper Order Produce all strings of length 1 Produce all strings of length 2..........
24
24 Produce strings: Length 2 Length 3 Length 1 Proper Order
25
25 Theorem: The set of all Turing Machines is countable. Proof: Find an enumeration procedure for the set of Turing Machine strings. Any Turing machine is a finite string Encoded with a sequence of 0’s and 1’s.
26
26 1. Generate the next string of 0’s and 1’s in proper order 2. Check if the string defines a Turing Machine if YES: print string on output if NO: ignore string Enumeration Procedure: Repeat
27
27 Uncountable Sets
28
28 A set is uncountable if it is not countable Definition:
29
29 Theorem: Let be an infinite countable set. The powerset of is uncountable. The power set of natural numbers has the same cardinality as the set of real numbers. (Using the Cantor–Bernstein–Schröder theorem, it is easy to prove that there exists a bijection between the set of reals and the power set of the natural numbers).
30
30 Proof: Since is countable, we can write Element of
31
31 Elements of the powerset have the form:
32
32 We encode each element of the power set with a string of 0’s and 1’s * Powerset element Encoding *Cantor’s diagonal argument
33
33 Let’s assume the contrary, that the powerset is countable. We can enumerate the elements of the powerset.
34
34 Powerset element Encoding
35
35 Take the powerset element whose bits are the complements of the diagonal.
36
36 New element: (Diagonal complement)
37
37 The new element must be some This is impossible: The i-th bit must be the complement of itself.
38
38 We have contradiction! Therefore the powerset is uncountable.
39
39 Theorem: Let be an infinite countable set. The powerset of is uncountable.
40
40 Application: Languages Alphabet: Set of Strings: infinite and countable Powerset: all languages uncountable
41
41 Languages: uncountable Turing machines: countable There are infinitely many more languages than Turing machines!
42
42 There are some languages not accepted by Turing Machines. These languages cannot be described by algorithms.
43
43 Recursively Enumerable Languages and Recursive Languages
44
44 Definition: A language is recursively enumerable if some Turing machine accepts it.
45
45 For a string : Let be a recursively enumerable language and be the Turing Machine that accepts it. ifthen halts in a final state ifthen halts in some state or loops forever
46
46 Definition: A language is recursive if some Turing machine accepts it and halts on any input string. In other words: A language is recursive if there is a membership algorithm for it
47
47 For a string : Let be a recursive language and be the Turing Machine that accepts it. ifthen halts in a final state. ifthen halts in a non-final state.
48
48 We will prove: 1. There is a specific language which is not recursively enumerable. 2. There is a specific language which is recursively enumerable but not recursive.
49
49 Recursive Recursively Enumerable Non Recursively Enumerable
50
50 First we prove: If a language is recursive then there is an enumeration procedure for it. A language is recursively enumerable if and only if there is an enumeration procedure for it.
51
51 Theorem: if a language is recursive then there is an enumeration procedure for it.
52
52 Proof: Enumeration Machine Accepts Enumerates all strings of input alphabet
53
53 Enumeration procedure Repeat: generates a string checks if YES: print to output NO: ignore End of proof
54
54 Theorem: if language is recursively enumerable then there is an enumeration procedure for it.
55
55 Proof: Enumeration Machine Accepts Enumerates all strings of input alphabet
56
56 Enumeration procedure Repeat: generates a string checks if YES: print to output NO: ignore NAIVE APPROACH Problem: If machine may loop forever
57
57 executes first step on BETTER APPROACH generates second string executes first step on second step on generates first string
58
58 Generates third string executes first step on second step on third step on And so on............
59
59 1 Move 2 3
60
60 If for string machine halts in a final state then it prints on the output. End of proof
61
61 Theorem: If for language there is an enumeration procedure then is recursively enumerable.
62
62 Proof: Input Tape Enumerator for Compare Machine that accepts
63
63 Turing machine that accepts Repeat: Using the enumerator, generate the next string of For input string Compare generated string with If same, accept and exit loop End of proof
64
64 This is not a membership algorithm. Why? Question: Answer: The enumeration procedure may not produce strings in proper order
65
65 We have shown: A language is recursively enumerable if and only if there is an enumeration procedure for it.
66
66 A Language which is not Recursively Enumerable
67
67 We search for a language that is not Recursively Enumerable. This language is not accepted by any Turing Machine.
68
68 Consider alphabet Strings:
69
69 Consider Turing Machines that accept languages over alphabet They are countable:
70
70 Example language accepted by Alternative representation
71
71
72
72 Consider the language consists of the 1’s on the diagonal
73
73
74
74 Consider the language consists from of 0’s on the diagonal
75
75
76
76 Theorem: Language is not recursively enumerable.
77
77 Proof: is recursively enumerable Assume on the contrary that There must exist some machine that accepts
78
78 Question:
79
79 Answer:
80
80 Question:
81
81 Answer:
82
82 Question:
83
83 Answer:
84
84 Similarly: for any Because either: or
85
85 Therefore the machine cannot exist CONTRADICTION!!! The language is not recursively enumerable. End of proof
86
86 Observation: There is no algorithm that describes (otherwise it would be accepted by a Turing Machine)
87
87 A Language which is Recursively Enumerable and not Recursive
88
88 We want to find a language which There is a Turing Machine that accepts the language The machine doesn’t necessarily halt on any input Is recursively enumerable But not recursive
89
89 We will prove that the language Is recursively enumerable but not recursive.
90
90 The language Theorem: is recursively enumerable
91
91 Proof: We will give a Turing Machine that accepts
92
92 Turing Machine that accepts For any input string Write Find Turing machine (using the enumeration procedure for Turing Machines) Simulate on input If accepts, then accept End of proof
93
93 Observation: Recursively enumerable Not recursively enumerable (Thus, not recursive)
94
94 Theorem: The language is not recursive.
95
95 Proof: Assume on the contrary that is recursive. Then is recursive: Take the Turing Machine that accepts halts on any input If accepts then reject If rejects then accept
96
96 Therefore: recursive But we know: not recursively enumerable thus, not recursive CONTRADICTION! Therefore, is not recursive End of proof
97
97 Recursive Recursively Enumerable Non Recursively Enumerable
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.