formal languages, automata and models of computationand ... · formal languages, automata and...
TRANSCRIPT
CDT314CDT314
FABER
Formal Languages, Automata and Models of Computationand Models of Computation
L t 1 I tLecture 1 - Intro
School of Innovation, Design and Engineering Mälardalen UniversityMälardalen University
2013
1
Content
AdminstriviaMathematical PreliminariesMathematical PreliminariesCountable Sets (Uppräkneliga mängder)Uncountable sets (Överuppräkneliga mängder)
2
Lecturer & Examiner
Gordana Dodig-Crnkovic
Course Assistant
Stefan BygdeStefan Bygde
3
Course Home PageCourse Home Page
http://www.idt.mdh.se/kurser/cd5560/
i it h l l !visit home page regularly!
4
Software Tool for Automata and Languages
JFLAP (http://www.jflap.org/)
JFLAP is software for experimenting with formal languages topics including o a a guages top cs c ud gnondeterministic finite automata, nondeterministic pushdown automata, multi-tape Turing machines, several types of grammars, parsing, and L-systems. Also JFLAP allows one toAlso, JFLAP allows one to experiment with construction proofs from one form to another, such as converting an NFA to a DFA to a minimal state DFA to a regular expression or regular grammar
5
Video Resources 1
Lennart Salling, Uppsala Universityhttp://www math uu se/ salling/AUTOMATA DV/index htmlhttp://www.math.uu.se/~salling/AUTOMATA_DV/index.htmlIntroduction – automata theoryhttp://www.youtube.com/watch?feature=player_embedded&v=LDRNUWrRRzw
Program, strings, integers and integer functions http://www.youtube.com/watch?v=5ncgZ73yQko
htt // t b / t h?f t l b dd d& 5 Z73 Qk I thhttp://www.youtube.com/watch?feature=player_embedded&v=5ncgZ73yQko Is there any function that cannot be computed by an algorithm/a program?
http://www.youtube.com/embed/acsUNSkzUgg?hl=en&fs=1 Infinities
6
Video Resources 2
Lennart Salling, Uppsala Universityhttp://www.youtube.com/user/swedishSalt/videos
www.youtube.com/watch?v=MzDG34w0LLA&feature=player_embedded SubsetConstruction
http://www.youtube.com/watch?v=RYNN-tb9WxI&feature=related Regular Expression to NFA
http://www.youtube.com/watch?v=shN_kHBFOUE&feature=related Regular Expression to FA
http://www.youtube.com/watch?v=dlH2pIndNrU&feature=related Regular Expression to DFA
http://www youtube com/embed/2abHjjS8Tqc?hl=sv&fs=1 Halting problemhttp://www.youtube.com/embed/2abHjjS8Tqc?hl=sv&fs=1 Halting problem
http://www.youtube.com/embed/y-zMnV3G9pg?hl=sv&fs=1 Rice’s problem
http://www.youtube.com/watch?v=WMN_wz-b3K0&feature=related Accept and decide (TM)
http://www.youtube.com/embed/WMN_wz-b3K0?hl=sv&fs=1 Accept and decide
7
Videos on Computing in General
htt // t b / t h? 5 O3NYJl0 G t P i i l f C ti P t Jhttp://www.youtube.com/watch?v=5a_pO3NYJl0 Great Principles of Computing - Peter J. Denning
http://www.youtube.com/watch?v=60P7717-XOQ&feature=related Stephen Wolfram: Computing a theory of everything
http://www youtube com/watch?v=cCdbZqI1r7I&feature=related Computing Beyond Turinghttp://www.youtube.com/watch?v=cCdbZqI1r7I&feature=related Computing Beyond Turing -Jeff Hawkins
8
How Much Work in This Course?
20 hours a week for this type of course20 hours a week for this type of course (norm)
4 hours lectures4 hours lectures2 hours exercises
14 hours own work a week!14 hours own work a week!
9
Course LiteratureBooks
Linz An Introduction to Formal Languages and Automata Jones &Linz, An Introduction to Formal Languages and Automata, Jones & Bartlett 2012 (used for lectures & exercises)
Alternative in SwedishAlternative in SwedishSalling: Formella språk, automater och beräkningar, 2001
Compendia
REGULAR LANGUAGESREGULAR LANGUAGESCONTEXT FREE LANGUAGESRECURSIVELY ENUMERABLE LANGUAGES
10
Why Theory of Computation?
1. A real computer can be modelled by a mathematical object: a theoretical computertheoretical computer.
2. A formal language is a set of strings, and can represent a computational problem.
3 A f l l b d ib d i diff3. A formal language can be described in many different ways that ultimately prove to be identical.
4. Simulation: the relative power of computing models can be b d th ith hi h d l i l tbased on the ease with which one model can simulate another.
11
Why Theory of Computation?
5 Robustness of a general computational model5. Robustness of a general computational model. 6. The Church-Turing thesis: "everything algorithmically
computable is computable by a Turing machine."7 Study of non determinism: languages can be described by the7. Study of non-determinism: languages can be described by the
existence or no-nexistence of computational paths. 8. Understanding unsolvability: for some computational problems
there is no corresponding algorithm that will unerringly solvethere is no corresponding algorithm that will unerringly solve them.
12
Practical Applications1. Efficient compilation of computer languages2. String search3. Investigation of the limits of computation,
recognizing difficult/unsolvable problems4. Applications to other areas:pp
– circuit verification– economics and game theory (finite automata as strategy
models in decision-making);models in decision making); – theoretical biology (L-systems as models of organism
growth) computer graphics (L systems)– computer graphics (L-systems)
– linguistics (modelling by grammars)
13
Algorithms and Automatizing of Mathematics
History•Euclid's attempt to axiomatize geometry
(Archimedes realized, during his own efforts to define the area of a planar figure, that Euclid's attempt had failed and that additional postulates were needed. )
•Leibniz's (1646 - 1716) dream reasoning as calculus - "Characteristica Universalis" aiming at:
" l th d i hi h ll t th f th ld b d d t"a general method in which all truths of the reason would be reduced to a kind of calculation. At the same time this would be a sort of universal language or script, but infinitely different from all those projected hitherto; for the symbols and even the words in it would direct reason; and errors, except those of fact, would ; , p ,be mere mistakes in calculation.“
•de Morgan, Boole, Frege, Russell, Whitehead: Mathematics as a branch
14
of symbolic logic
1900 Hilberts program for axiomatization of mathematics, redefined " f" b l l i i ll diff"proof" to become a completely rigorous notion, totally different from the psycho/sociological "A proof is something that convinces other mathematicians.“ He confirms the prediction Leibniz made, that "the symbols would direct reason"that the symbols would direct reason
1880 -1936 first programming languages
1931 Gödels incompleteness theorems
1936 Turing machine (showed to be equivalent with recursive1936 Turing machine (showed to be equivalent with recursive functions). TM as ultimate model of computation
1950 Finite automata1950 Finite automata
1956 Language/automata hierarchy
15
Formalization of Mathematics
Every mathematical truth expressed in a formal y planguage is consisting of
• a fixed alphabet of admissible symbols, and
• explicit rules of syntax for combining those symbolsexplicit rules of syntax for combining those symbols into meaningful words and sentences
Gödel's two incompleteness theorems of mathematical logic show limitations of allGödel s two incompleteness theorems of mathematical logic show limitations of all but the most trivial axiomatic systems. The theorems are widely interpreted as showing that Hilbert's program to find a complete and consistent set of axioms for all of mathematics is impossible, thus giving a negative answer to Hilbert's second problem
16
problem.
Hilbert’s program
The main goal of Hilbert's program was to provide secure foundations for all mathematics In particular this should include:foundations for all mathematics. In particular this should include:A formalization of all mathematics; in other words all mathematical statements should be written in a precise formal language and manipulated according to well defined ruleslanguage, and manipulated according to well defined rules. Completeness: a proof that all true mathematical statements can be proved in the formalism. Consistency: a proof that no contradiction can be obtained inConsistency: a proof that no contradiction can be obtained in the formalism of mathematics. This consistency proof should preferably use only "finitistic" reasoning about finite mathematical objectsmathematical objects. Decidability: there should be an algorithm for deciding the truth or falsity of any mathematical statement.
17
Hilbert’s program
Gödel showed that most of the goals of Hilbert's program were impossible to achieve. His second incompleteness theorem stated that any consistent theory powerful enough to encode y y p gaddition and multiplication of integers cannot prove its own consistency. This wipes out most of Hilbert's program as follows:
It is not possible to formalize all of mathematics as any attempt atIt is not possible to formalize all of mathematics, as any attempt at such a formalism will omit some true mathematical statements.
The most interesting mathematical theories are not complete. A theory such as Peano arithmetic cannot prove its own
consistency.
18
Turing’s Contribution
Turing used a Universal Turing machine (UTM) to prove an incompleteness theorem even more powerful p p pthan Gödel’s because it destroyed not one but two of Hilbert's dreams:
1 Finding a finite list of axioms from which all1. Finding a finite list of axioms from which all mathematical truths can be deduced
2 S l i th t h id bl ("d i i2. Solving the entscheidungsproblem, ("decision problem“) by producing a "fully automatic procedure" f d idi h th i iti ( t ) ifor deciding whether a given proposition (sentence) is true or false.
19
Mathematical Preliminaries
Based on C Busch, RPI, Models of Computation
20
• Sets
• Functions• Functions
• Relations
• Proof Techniques
• Set Cardinality and Infinities• Set Cardinality and Infinities
• Uncomputability
21
SETS
A set is a collection of elements
}3,2,1{=A
},,,{ airplanebicyclebustrainB =
We write
A∈1 A∈1
Bship∉22
p
Set Representations
C = { a, b, c, d, e, f, g, h, i, j, k }
C = { a, b, …, k } finite set
S = { 2 4 6 } i fi it tS = { 2, 4, 6, … }
S = { j : j > 0 and j = 2k for some k>0 }
infinite set
S = { j : j > 0, and j = 2k for some k>0 }
S = { j : j is nonnegative and even }23
S = { j : j is nonnegative and even }
A = { 1, 2, 3, 4, 5 }A { 1, 2, 3, 4, 5 }
U
A681 2 3
4 578
59
10
Universal Set: All possible elements
24
U = { 1 , … , 10 }
Set OperationspA = { 1, 2, 3 } B = { 2, 3, 4, 5}
A B• Union
A U B = { 1, 2, 3, 4, 5 }
A B
{ }
• Intersection
A B { 2 3 }
U
A B = { 2, 3 }
• Difference
U
A - B = { 1 }
B A { 4 5 } A-B
25
B - A = { 4, 5 } A B
• ComplementComplement
Universal set = {1, …, 7}
A = { 1, 2, 3 } A = { 4, 5, 6, 7}
46
A A1
23
5
6A
5 7
A A26
A = A
{ even integers } = { odd integers }
Integers
6
15even
odd
024
6
3
5
73 7
27
DeMorgan’s Laws
A U B = A BU
A B = A U B
U
28
Empty Null Set:Empty, Null Set:
= { }
S U = S= Universal Set
S =
S = S
U
S - = S
- S =29
S
SubsetSubset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }A B
U
Proper Subset: A B
UB
A
30
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}{ } { }
A B = U
AA B
31
Set Cardinality
For finite sets
A { 2 5 7 }A = { 2, 5, 7 }
|A| = 3
32
PowersetsPowersets
A powerset is a set of sets
S = { a, b, c }
Powerset of S = the set of all the subsets of S
2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }{ , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
Ob ti | 2S | 2|S| ( 8 23 )33
Observation: | 2S | = 2|S| ( 8 = 23 )
Cartesian Product
A = { 2, 4 } B = { 2, 3, 5 }
A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) }
|A X B| |A| |B||A X B| = |A| |B|
Generalizes to more than two sets
34A X B X … X Z
PROOF TECHNIQUESPROOF TECHNIQUES
• Proof by construction
P f b i d ti• Proof by induction
• Proof by contradiction• Proof by contradiction
35
Proof by Construction, An ExampleProof by Construction, An Example
We define a graph to be k-regular
if every node in the graph has degree k.
Theorem For each even number n > 2 there existsTheorem. For each even number n > 2 there exists
3-regular graph with n nodes. 23
1
3
1 2
40
50
363
n = 4 n = 6
Proof by Construction
Construct a graph G = (V, E) with n > 2 nodes.
V= { 0 1 n 1 }V= { 0, 1, …, n-1 }
E = { {i i+1} | for 0 ≤ i ≤ n-2} ∪ {{n-1 0}} (*)E { {i, i+1} | for 0 ≤ i ≤ n 2} ∪ {{n 1,0}} ( )
∪ {{i, i+n/2 } | for 0 ≤ i ≤ n/2 –1} (**)
The nodes of this graph can be written consecutively around the circle.
(*) edges between adjacent pairs of nodes
(**) edges between nodes on opposite sides37
( ) edges between nodes on opposite sidesEND OF PROOF
Inductive ProofInductive Proof
W h t t t P P PWe have statements P1, P2, P3, …
If we knowIf we know
• for some k that P1, P2, …, Pk are true
• for any n ≥ k that
P1, P2, …, Pn imply Pn+1P1, P2, …, Pn imply Pn+1
Then
38Every Pi is true
Proof by InductionProof by Induction
• Inductive basis• Inductive basis
Find P1, P2, …, Pk which are true
• Inductive hypothesis
Let’s assume P1 P2 P are trueLet s assume P1, P2, …, Pn are true,
for any n ≥ k
• Inductive step
Show that Pn+1 is true39
Show that Pn+1 is true
Proof by Construction, An Example
Theorem A binary tree of height n
has at most 2n leaves.
Proof
let L(i) be the number of leaves at level i
L(0) = 1
L(3) 840
L(3) = 8
We want to show: L(i) ≤ 2iWe want to show: L(i) ≤ 2
• Inductive basis
L(0) = 1 (the root node)( ) ( )
• Inductive hypothesis
Let’s assume L(i) ≤ 2i for all i = 0, 1, …, n
• Induction stepp
we need to show that L(n + 1) ≤ 2n+1
41
Induction Step
L lhypothesis: L(n) ≤ 2n
Leveln
n+1
42
Induction Step
hypothesis: L(n) ≤ 2n
Leveln hypothesis: L(n) ≤ 2nn
n+1n+1
L(n+1) ≤ 2 * L(n) ≤ 2 * 2n = 2n+1
43END OF PROOF
Proof by induction, An Example:
Cardinality of a power setCardinality of a power setLet S be a finite set with N elements. Then the power set of S (that is the set of all subsets of S ) contains 2^NS (that is the set of all subsets of S ) contains 2 N elements. In other words, S has 2^N subsets. This statement can be proved by induction. We can see that it is t f N 0 1 2 3 b i titrue for N=0,1,2,3 by examination.
44The notation 2^N means 2 to the power N, i.e., the product of N factors all of which equal 2. 2^0 is defined to be 1.
Cardinality of a power set
Let S be a set with N elements. For the induction step suppose that the statement is true for a set with N-1suppose that the statement is true for a set with N-1elements. Remove element x from S to obtain a set T with N-1 elements. There are two types of subsets of S: those th t t i d th th t d t t i Th l ttthat contain x and those that do not contain x. The latter are subsets of T, of which there are 2^ N-1.
Every subset P of S that does contain x can be obtained from a subset Q of T by adding x. The set Q is simply the set P with x removed There is a unique and distinct set Qset P with x removed. There is a unique and distinct set Qfor each set P, and every subset Q of T gives rise to a unique and distinct subset P of S. There are 2^ (N-1)
b t f S th t t i f t t l f 2^ (N 1) 2^ (N 1)45
subsets of S that contain x, for a total of 2^ (N-1) + 2^ (N-1)= 2^ N subsets of S.
Proof by Induction Cardinality of Power Set An Example:Proof by Induction. Cardinality of Power Set An Example:
Induktionsbevis: Potensmängdens kardinalitet
Påstående: En mängd med n elementPåstående: En mängd med n element har 2n delmängder
The claim: A set with n elements has 2n subsets
Kontroll/Check
• Tomma mängden {} (med noll element) har bara en delmängd: {}.
• Empty set {} (zero elements) has only one subset: {}. 20=1
• Mängden {a} (med ett element) har två delmängder: {} och {a}
• Set {a} (with one element) has two subsets: {} and {a} 21=2
46
Påstående: En mängd med n element har 2n delmängder
Proposition: A set with n elements has 2n subsets
Kontroll/CheckKontroll/Check• Mängden {a, b} (med två element) har fyra delmängder:
{}, {a}, {b} och {a,b}
• Set {a, b} (with two elements) has four subsets: {}, {a}, {b} och {a,b} 22=4
• Mängden {a b c} (med tre element) har åtta delmängder:Mängden {a, b, c} (med tre element) har åtta delmängder: {}, {a}, {b}, {c} och {a,b}, {a,c}, {b,c}, {a,b,c}
S t { b } ( ith th l t ) h i ht b t• Set {a, b, c} (with three elements) has eight subsets: {}, {a}, {b}, {c} och {a,b}, {a,c}, {b,c}, {a,b,c} 23=8
Påstående stämmer så här långt.
47The proposition is correct this far.
BasstegBassteg
Enklaste fallet är en mängd med noll element (det finns å 0bara en sådan), som har 20 = 1 delmängder.
Base caseBase case
The simplest case is the set with 0 elements (there is just one such set), that has 20 = 1 subsets.
48
InduktionsstegInduktionsstegAntag att påståendet gäller för alla mängder med k
element, dvs antag att varje mängd med k element har 2k delmängder.
Visa att påståendet i så fall också gäller för alla mängder d k 1 l t d i tt j ä d d k 1med k+1 element, dvs visa att varje mängd med k+1
element har 2k+1 delmängder.
Induktion stepAssume that the claim is valid for all sets with k
elements i e that every set with k elements has 2kelements, i.e. that every set with k elements has 2subsets.
Show that this implies that the proposition is true for every
49
Show that this implies that the proposition is true for every set with k+1 element, that is show that each set with k+1 elements has 2k+1 subsets.
Ta en godtycklig mängd med k+1 element. Delmängderna till mängden kan delas upp i två sorter:1. Delmängder som inte innehåller element nr k+1: En sådan delmängd är en delmängd till mängden med de k första g g gelementen, och delmängder till en mängd med k element finns det (enligt antagandet) 2k stycken.
Let us take an arbitrary set with k+1 elements Subsets of that setLet us take an arbitrary set with k+1 elements. Subsets of that set can be of two kinds:1. Subsets that do not contain the element nr k+1: that is a subset of a set with k first elements and there are 2k subsets of a set withof a set with k first elements, and there are 2k subsets of a set with k element (according to the inductive hypothesis).
12
3
k-1
k k+1….
50
4
2. Delmängder som innehåller element nr k+1: En sådan delmängd kan man skapa genom att ta en delmängd som inte innehåller element nr k+1 och lägga till detta element. Eftersom det finns 2k delmängder utan element nr k+1 kan man även skapa 2k delmängder med detta element.
T t lt h 2k 2k 2 2k 2k+1 d l ä d till d b t kt dTotalt har man 2k + 2k = 2. 2k= 2k+1 delmängder till den betraktade mängden.
2 Subsets that contain the element nr k+1: Such a subset can be2. Subsets that contain the element nr k+1: Such a subset can be created by adding the element nr k+1 to those subsets that do not contain it. As there are 2k subsets without the element nr k+1 there will be 2k subsets with that elementbe 2k subsets with that element.
In total, there are 2k + 2k = 2 . 2k = 2k+1 subsets.
51END OF PROOF
P f b C t di tiProof by Contradiction
We want to prove that a statement P is true
• we assume that P is false
• then we arrive at a conclusionthen we arrive at a conclusion that contradicts our assumptions
• therefore statement P must be true• therefore, statement P must be true
52
Proof by Contradiction, An Example
Theorem is not rational22
ProofAssume by contradiction that it is rational
= n/m
n and m have no common factors
2
We will show that this is impossible
53
= n/m 2 m2 = n22
Th f 2 in is even
Therefore, n2 is evenn = 2 k
2 m2 = 4k2 m2 = 2k2m is even
m = 2 pThus, m and n have common factor 2
Contradiction!
54END OF PROOF
Countable SetsCountable Sets
55
Infinite sets are eitherCountable or Uncountable
56
Countable set
There is a one to one correspondencebetween elements of the set and natural numbers
57
We started with the natural numbers, thenf• add infinitely many negative whole numbers to get the
integers, • then add infinitely many rational fractions to get thethen add infinitely many rational fractions to get the rationals
Each infinite addition seem to increase di lit |N| < |Z| < |Q|cardinality: |N| < |Z| < |Q|
B t i thi t ? NO!But is this true? NO!
58
Example The set of integers is countable
Integers: K,2,2,1,1,0 −−
g
g
Correspondence:Correspondence:
Natural numbers: K,4,3,2,1,0
oddnnevennnnf 2/)1(;2/)( { +−=59
oddnnevennnnf 2/)1(;2/)( { +
Example The set of rational numbersa p eis countable
Positive Rational numbers:
K,87,
43,
21
Rational numbers: 842
60
Naive Idea111
Rational numbers: K,3
,2
,1
Correspondence:
Natural numbers: K,3,2,1
Doesn’t work!
we will never count 22261
numbers with nominator 2:K,
3,
2,
1
Better Approach
1 1 1 1 ...1 2 3 4
2 2 212
22
32 ...
13
23 ...
1 24
Rows: constant numerator (täljare)
Columns: constant denominator
621...
1 1 1 111
21
31
41 ...
2 2 2 ...1 2 3
13
23 ...
1 2
4631
4 ...
We proved:
the set of rational numbers is countableb d ibi ti dby describing an enumeration procedure
64
Definitions
A language is a set of stringsA language is a set of strings.
A string is a sequence of symbolsdefined over an alphabet:
A string is a sequence of symbols
{ }zcba ,,,, K=Σ
An alphabet is a set of symbols.
65
Definition
Let S be a set.
A i d f i
Let S be a set.
An enumeration procedure for S is analgorithm that generatesall elements of S one by one.
66
A set is countable if there is an
Observation
A set is countable if there is anenumeration procedure for it.
67
Example
The set of all finite strings of symbolsis countable.+},,{ cba is countable. },,{ cba
W ill d ib th ti dProofWe will describe the enumeration procedure.(Constructive proof)
68
Naive procedure:Naive procedure:
Produce the strings in lexicographic order:
aaaaaa
......aaaa......
Doesn’t work!Strings starting ith ill ne er be prod cedb
69
Strings starting with will never be produced. b
Better procedure: Proper Order
1. Produce all strings of length 1g g2. Produce all strings of length 23 Produce all strings of length 33. Produce all strings of length 34. Produce all strings of length 4..........
70
length 1abcaaab
Produce strings in
abacba
Proper Order bbbc
length 2
cacbccccaaaaab length 3
71
aabaac......
length 3
Theorem
The set of all finite strings is countable.
Proof Any finite string can be encodedwith a binary string of 0’s and 1’s.
Find an enumeration procedure f th t f fi it t ifor the set of finite strings.
72
Produce strings in Proper Order
0 0String = program Natural number
length 101
01
length 2
0001
234length 2 10
11
45
length 3000001….
67….
73
….
PROGRAM = STRING (syntactic way)
PROGRAM = FUNCTION Ν→Ν (semantic way)
PROGRAMstring string
natural naturalPROGRAM
natural number
n∈Ν
natural number
n∈Ν
74
Uncountable SetsUncountable Sets
75
Definition
A set is uncountable if it is not countable.
76
Theorem
The set of all infinite strings is uncountable.
Proof�
We assume we have
Proof�(by contradiction)
an enumeration procedure for the set of infinite strings.for the set of infinite strings.
77
Cantor’s diagonal argument
Infinite string EncodingInfinite string
0w ...00b 01b 02b=
1w ...10b 11b 12b=1w
w
...10b
b11b
b12b
b2w ...20b 21b 22b=
78... ... ... ... ...
Cantor’s diagonal argument
We can construct a new string wthat is missing in our enumeration!
Conclusion
The set of all infinite strings is uncountable!u cou ab e
79
An infinite string can be seen as FUNCTION Ν→Ν (n:th output is n:th bit in the string)output is n:th bit in the string)
Conclusion
There are some integer functions thatthat cannot be described by finite stringsthat cannot be described by finite strings (programs/algorithms).
80
Example of uncountable infinite sets
Th
Example of uncountable infinite sets
Theorem
Let be an infinite countable setSLet be an infinite countable set.
Th f i blS2 S
S
The powerset of is uncountable.S2 S
81
P fProof
Since is countable we can writeSSince is countable, we can write S
},,,{ 321 KsssS = },,,{ 321
82
Elements of the powerset have the form:Elements of the powerset have the form:
},{ 31 ss
},,,{ 10975 ssss
……
83
We encode each element of the power setwith a binary string of 0’s and 1’swith a binary string of 0 s and 1 s
Encoding
1s 2s 3s 4sPowersetelement
g
...
1 0 0 0}{ 1s ...
0 1 1 0},{ 32 ss ...
1 0 1 1},,{ 431 sss ...84
1 0 1 1},,{ 431 sss ...
Let’s assume (by contradiction) that the powerset is countable.
we can enumerateThen:we can enumerate the elements of the powerset
85
Powerset Encoding
1 0 0 0 0element Encoding
p ...1 0 0 0 0
0 0 0
1p ...
1 1 0 0 02p ...
1 1 0 1 03p ...
1 1 0 0 14p ...
86...
Take the powerset elementwhose bits are the complements pin the diagonal
87
1 0 0 0 0 ...1p
1 1 0 0 0
1p
p 1 1 0 0 0 ...2p
1 1 0 1 0 ...3p
1 1 0 0 1 ...4p
New element: K001188(binary complement of diagonal)
The new element must be some ipThe new element must be someof the powerset
ip
However, that’s impossible:
f d fi iti f p
th i th bit f t b
from definition of ip
pthe i-th bit of must be the complement of itself
ip
Contradiction!89
Si h t di tiSince we have a contradiction:
The powerset of is uncountable S2 S
90END OF PROOF
E l Al h b t }{ baAn Application: Languages
Example Alphabet : },{ baThe set of all finite strings:The set of all finite strings:
},,,,,,,,,{},{ * KaabaaabbbaabaababaS λ==
infinite and countable
}}}{{}{}{{2 aababaabaaS λ=
The powerset of contains all languages:S}},,,}{,{},{},{{2 Kaababaabaaλ
1L 2L 3L 4L L
91uncountable infinite
Finite strings (algorithms): countableLanguages (power set of strings): uncountableLanguages (power set of strings): uncountable
There are infinitely many more languagesth fi it t ithan finite strings.
92
Conclusion
There are some languagesThere are some languages that cannot be described by finite strings (algorithms)(algorithms).
93
Number Sets
http://thinkzone.wlonk.com/Numbers/NumberSets.htm
94Alan Turing 'On computable numbers, with an application to the Entscheidungsproblem' from Proceedings of the London Mathematical Society, (Ser. 2, Vol. 42, 1937)
Number Sets
95http://www.tutornext.com/math/number-system.html
Number Sets
96http://mathequality.wordpress.com/2011/08/02/creating-a-number-set-venn-diagram-poster/
Cardinality - KardinaltalCardinality - Kardinaltal
Cardinality is a measure of the size of a set.Kardinaltal är mått på storleken av mängder.
Cardinality of a finite set is simply its number ofCardinality of a finite set is simply its number of elements. Kardinaltalet för en ändlig mängd är helt enkelt antalet element i mängden. g
Two sets have the same cardinality if there exist bijection between them.Två mängder är lika mäktiga om man kan para ihop elementen i den enaTvå mängder är lika mäktiga om man kan para ihop elementen i den ena mängden med elementen i den andra på ett uttömmande sätt, dvs det finns en bijektion mellan dem.
97
Cardinality - Kardinaltaly
C di lit b li d t i fi it t E S tCardinality can be generalized to infinite sets. E.g. Sets of positive integers and set of integers have the same cardinality.Kardinaltal kan generaliseras till oändliga mängder. Till exempel är mängden av positiva heltal och mängden av heltal lika mäktiga (har samma kardinaltal).
However, real numbers cannot be mapped to integers in that way. Cardinality of reals is bigger than cardinality of integerscardinality of integers.Däremot kan man inte para ihop alla reella tal med heltalen på detta sätt. Mängden av reella tal har större mäktighet än mängden av heltal.
98
Cardinality - KardinaltalCardinality Kardinaltal
Man kan införa kardinaltal på ett sådant sätt att två mängder har samma kardinaltal om och endast om de har samma mäktighet. T ex kallas kardinaltalet som hör till de hela talen för ℵ0 (alef 0, alef är den första bokstaven i det hebreiska alfabetet).
Dessa oändliga kardinaltal kallas transfinita kardinaltal.
99
Mer om oändligheter…More about Infinty
Georg Cantor utvecklade i slutet av 1800-talet matematikens logiska
More about Infinty
Georg Cantor utvecklade i slutet av 1800 talet matematikens logiska grund, mängdläran.
Den enklaste, "minsta", oändligheten kallade han ℵ0. , , g 0
Det är den uppräkningsbara oändliga mängdens (exempelvis mängden av alla heltal) kardinaltalet.
Kardinaltalet av mängden punkter på en linje, och även punkterna på ett plan och i en kropp, kallade Cantor ℵ1.
Fanns det större oändligheter?
100
Ja! Cantor kunde visa att antalet funktioner på en li j ”ä ä dli ” ä kt å li jlinje var ”ännu oändligare” än punkterna på linjen, och han kallade den mängden ℵ2.
Cantor fann att det gick att räkna med kardinaltalen precis som med vanliga tal, men räknereglerna blev något enahanda..
ℵ + 1 ℵ ℵ +ℵ ℵ ℵ ℵ ℵℵ0 + 1= ℵ0 ℵ0 +ℵ0 = ℵ0 ℵ0 · ℵ0 = ℵ0.
101
Men vid exponering hände det något:
ℵ0ℵ0 (ℵ0 upphöjt till ℵ0) = ℵ1ℵ0 (ℵ0 upphöjt till ℵ0) ℵ1.
M llt i d d t i ttMer generellt visade det sig att
2 ℵn (2 upphöjt till ℵn) = ℵn+1
Det innebar att det fanns oändligt många oändligheter, den ena mäktigare än den andra!
102
M d t kli äk t tt d t i t f åMen var det verkligen säkert att det inte fanns någon oändlighet mellan den uppräkningsbara och punkterna på linjen? Cantor försökte bevisa den så kallade k ti h tkontinuumhypotesen.
Cantor: two different infinities ℵ0 and ℵ1Ca o o d e e es ℵ0 a d ℵ1http://www.ii.com/math/ch/#cardinalsContinuum Hypothesis: ℵ0 < ℵ1 = 2 ℵ0
Se även:http://www nyteknik se/pub/ipsart asp?art id=26484http://www.nyteknik.se/pub/ipsart.asp?art_id 26484
103
Course materials based onCourse materials based on
1. Peter Linz, An Introduction to Formal Languages and Automata
2. http://www.cs.rpi.edu/courses/fall00/modcomp3/Models of Computation C BuschModels of Computation, C Busch
3. Lenart Salling, Formella språk, automater och beräkningar
4. http://www.cs.duke.edu/~rodger Mathematical Foundations of Computer Science; Susan H Rodger; Duke UniversitySusan H. Rodger; Duke University
5. Rich Elaine, Automata, Computability and Complexity: Theory and Applications, Prentice Hall
104