SLIDE 1
Computability Douglas Cenzer University of Florida March 11, 2020 - - PowerPoint PPT Presentation
Computability Douglas Cenzer University of Florida March 11, 2020 - - PowerPoint PPT Presentation
Computability Douglas Cenzer University of Florida March 11, 2020 Introduction Let be a finite alphabet and let be the set of finite strings or words over . Introduction Let be a finite alphabet and let be the set of
SLIDE 2
SLIDE 3
Introduction
Let Σ be a finite alphabet and let Σ∗ be the set of finite strings or words over Σ. A function F : Σ∗ → Σ∗ (or in general F : (Σ∗)k → Σ∗) is computable if there is an algorithm or procedure for determining the output F(w1, . . . , wn) from the input − → w = (w1, . . . , wn).
SLIDE 4
Introduction
Let Σ be a finite alphabet and let Σ∗ be the set of finite strings or words over Σ. A function F : Σ∗ → Σ∗ (or in general F : (Σ∗)k → Σ∗) is computable if there is an algorithm or procedure for determining the output F(w1, . . . , wn) from the input − → w = (w1, . . . , wn). Frequently we are interested in functions over the set N of natural
- numbers. The number n may be represented in {0, 1}∗ in reverse
binary notation as n = e0e1 . . . ek−1ek, where n = k
i=1 ei2i.
The tally or unary representation of n is just 1n.
SLIDE 5
Introduction
Let Σ be a finite alphabet and let Σ∗ be the set of finite strings or words over Σ. A function F : Σ∗ → Σ∗ (or in general F : (Σ∗)k → Σ∗) is computable if there is an algorithm or procedure for determining the output F(w1, . . . , wn) from the input − → w = (w1, . . . , wn). Frequently we are interested in functions over the set N of natural
- numbers. The number n may be represented in {0, 1}∗ in reverse
binary notation as n = e0e1 . . . ek−1ek, where n = k
i=1 ei2i.
The tally or unary representation of n is just 1n.
Example
Basic computable functions include (i) the successor function S(x) = x + 1, (ii) the addition function +(x, y) = x + y, and (iii) the multiplication function ·(x, y) = x · y.
SLIDE 6
More Complicated Examples
Example
(i) The Division Algorithm demonstrates that the two functions that compute, for inputs a and b, the unique quotient q = q(a, b) and remainder r = r(a, b), with 0 ≤ r < a, such that b = qa + r, are both computable.
SLIDE 7
More Complicated Examples
Example
(i) The Division Algorithm demonstrates that the two functions that compute, for inputs a and b, the unique quotient q = q(a, b) and remainder r = r(a, b), with 0 ≤ r < a, such that b = qa + r, are both computable. (ii) The Euclidean Algorithm demonstrates that the function gcd(a, b) which computes the greatest common divisor of a and b is computable. It follows that least common multiple function lcm(a, b) = (a · b)/gcd(a, b) is also computable
SLIDE 8
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
SLIDE 9
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell;
SLIDE 10
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell;
SLIDE 11
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell; ◮ and move to an adjacent cell.
SLIDE 12
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell; ◮ and move to an adjacent cell. A program for such a machine is given by a finite set of states
SLIDE 13
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell; ◮ and move to an adjacent cell. A program for such a machine is given by a finite set of states and a transition function which describes the action taken in a given state when a certain symbol is scanned. Possible actions are ◮ writing a new symbol in the cell;
SLIDE 14
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell; ◮ and move to an adjacent cell. A program for such a machine is given by a finite set of states and a transition function which describes the action taken in a given state when a certain symbol is scanned. Possible actions are ◮ writing a new symbol in the cell; ◮ moving to an adjacent cell;
SLIDE 15
Turing Machines
A Turing machine consists of one or more infinite tapes with cells
- n which symbols from Σ may be written,
together with heads which can do the following ◮ read thecontents of a given cell; ◮ write a new symbol on the cell; ◮ and move to an adjacent cell. A program for such a machine is given by a finite set of states and a transition function which describes the action taken in a given state when a certain symbol is scanned. Possible actions are ◮ writing a new symbol in the cell; ◮ moving to an adjacent cell; ◮ switching to a new state.
SLIDE 16
Finite State Automata
A finite state automaton (FSA) is a simplified version of a Turing machine, and plays an important role in computer science.
SLIDE 17
Finite State Automata
A finite state automaton (FSA) is a simplified version of a Turing machine, and plays an important role in computer science. A finite state M automaton over a finite alphabet Σ (usually {0, 1}) is given by the following: ◮ A finite set of states Q = {q0, q1, . . . , qk} of states, including the initial state q0 and a set QF ⊆ Q of accepting states;
SLIDE 18
Finite State Automata
A finite state automaton (FSA) is a simplified version of a Turing machine, and plays an important role in computer science. A finite state M automaton over a finite alphabet Σ (usually {0, 1}) is given by the following: ◮ A finite set of states Q = {q0, q1, . . . , qk} of states, including the initial state q0 and a set QF ⊆ Q of accepting states; ◮ a transition function δ : Q × Σ → Q.
SLIDE 19
Finite State Automata
A finite state automaton (FSA) is a simplified version of a Turing machine, and plays an important role in computer science. A finite state M automaton over a finite alphabet Σ (usually {0, 1}) is given by the following: ◮ A finite set of states Q = {q0, q1, . . . , qk} of states, including the initial state q0 and a set QF ⊆ Q of accepting states; ◮ a transition function δ : Q × Σ → Q. ◮ There may also be an output function F : Q × Σ → Σ. In this case, M is said to be a transducer.
SLIDE 20
The action of an FSA
SLIDE 21
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
SLIDE 22
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0).
SLIDE 23
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an).
SLIDE 24
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an). ◮ The last Stage: M reads ak and halts in state sk+1. The input word w is accepted by M if sk+1 ∈ QF.
SLIDE 25
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an). ◮ The last Stage: M reads ak and halts in state sk+1. The input word w is accepted by M if sk+1 ∈ QF. If M is a transducer, then the output is M(w) = b0b1 . . . bk.
SLIDE 26
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an). ◮ The last Stage: M reads ak and halts in state sk+1. The input word w is accepted by M if sk+1 ∈ QF. If M is a transducer, then the output is M(w) = b0b1 . . . bk. A subset L of Σ∗ may be called a language.
SLIDE 27
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an). ◮ The last Stage: M reads ak and halts in state sk+1. The input word w is accepted by M if sk+1 ∈ QF. If M is a transducer, then the output is M(w) = b0b1 . . . bk. A subset L of Σ∗ may be called a language. The language L(M) ⊆ Σ∗ is the set of words accepted by M.
SLIDE 28
The action of an FSA
The action of a finite automaton M on input w = a0a1 . . . ak
- ccurs in stages.
◮ Stage 0: M scans a0 in state q0 and transitions to state s1 = δ(q0, a0), possibly writing b0 = F(q0, a0). ◮ Stage n: M scans an in state sn, transitions to state sn+1 = F(sn, an), and possibly writes bn = F(sn, an). ◮ The last Stage: M reads ak and halts in state sk+1. The input word w is accepted by M if sk+1 ∈ QF. If M is a transducer, then the output is M(w) = b0b1 . . . bk. A subset L of Σ∗ may be called a language. The language L(M) ⊆ Σ∗ is the set of words accepted by M. If L = L(M) for some FSA M, then L is said to be regular.
SLIDE 29
Example 1
Let M1 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if i = j qi if i = j, for i = 0, 1 and j = 0, 1.
SLIDE 30
Example 1
Let M1 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if i = j qi if i = j, for i = 0, 1 and j = 0, 1. Then L(M1) is the set of words which end in a 0.
SLIDE 31
Example 1
Let M1 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if i = j qi if i = j, for i = 0, 1 and j = 0, 1. Then L(M1) is the set of words which end in a 0.
q0 q1 1 1
SLIDE 32
Example 2
Let M2 be the machine, depicted by the state diagram below, with transition function
SLIDE 33
Example 2
Let M2 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if j = 0 qi if j = 1, for i = 0, 1.
SLIDE 34
Example 2
Let M2 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if j = 0 qi if j = 1, for i = 0, 1. Then L(M2) is the set of words with an even number of 0’s.
SLIDE 35
Example 2
Let M2 be the machine, depicted by the state diagram below, with transition function δ(qi, j) = q1−i if j = 0 qi if j = 1, for i = 0, 1. Then L(M2) is the set of words with an even number of 0’s.
q0 q1 1 1
SLIDE 36
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1.
SLIDE 37
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state.
SLIDE 38
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state. Since 2n − 1 has length n but S(2n − 1) = 2n has length n + 1, we will represent 2n − 1 by 1n0 so we can write the output.
SLIDE 39
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state. Since 2n − 1 has length n but S(2n − 1) = 2n has length n + 1, we will represent 2n − 1 by 1n0 so we can write the output. The edges in the state diagram below have labels of the form i : j, which means that i is an input bit and j is an output bit.
SLIDE 40
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state. Since 2n − 1 has length n but S(2n − 1) = 2n has length n + 1, we will represent 2n − 1 by 1n0 so we can write the output. The edges in the state diagram below have labels of the form i : j, which means that i is an input bit and j is an output bit. From state q0, M3 outputs (i + 1) mod 2 on input i and transitions to state q1−i. From state q1 on input i, M3 outputs i and remains in state q1.
SLIDE 41
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state. Since 2n − 1 has length n but S(2n − 1) = 2n has length n + 1, we will represent 2n − 1 by 1n0 so we can write the output. The edges in the state diagram below have labels of the form i : j, which means that i is an input bit and j is an output bit. From state q0, M3 outputs (i + 1) mod 2 on input i and transitions to state q1−i. From state q1 on input i, M3 outputs i and remains in state q1.
SLIDE 42
Example 3: The Successor Machine
The successor machine M3 computes S(x) = x + 1. State q0 is the carry state and state q1 is the no-carry state. Since 2n − 1 has length n but S(2n − 1) = 2n has length n + 1, we will represent 2n − 1 by 1n0 so we can write the output. The edges in the state diagram below have labels of the form i : j, which means that i is an input bit and j is an output bit. From state q0, M3 outputs (i + 1) mod 2 on input i and transitions to state q1−i. From state q1 on input i, M3 outputs i and remains in state q1.
q0 q1 0:1 0:0, 1:1 1:0
SLIDE 43
How it Works
We see that Me(x) + 1 by the following reasoning.
SLIDE 44
How it Works
We see that Me(x) + 1 by the following reasoning. ◮ Case 1: x contains a 0. Let i be least such that ai = 0. Then M will write i − 1 1’s and remain in state q0 until arriving at the i-th bit, which is a 0. Then it will output bi = 1 and transition to state q1. After that it will simply write bj = aj for all j > i.
SLIDE 45
How it Works
We see that Me(x) + 1 by the following reasoning. ◮ Case 1: x contains a 0. Let i be least such that ai = 0. Then M will write i − 1 1’s and remain in state q0 until arriving at the i-th bit, which is a 0. Then it will output bi = 1 and transition to state q1. After that it will simply write bj = aj for all j > i. For example, S(9) = 10 in binary becomes M3(1001) = 0101.
SLIDE 46
How it Works
We see that Me(x) + 1 by the following reasoning. ◮ Case 1: x contains a 0. Let i be least such that ai = 0. Then M will write i − 1 1’s and remain in state q0 until arriving at the i-th bit, which is a 0. Then it will output bi = 1 and transition to state q1. After that it will simply write bj = aj for all j > i. For example, S(9) = 10 in binary becomes M3(1001) = 0101. ◮ Case 2: If x consists of all 1’s, then M will write n 0’s and remain in state q0 until reaching the extra 0, when M will
- utput a final 1 and transition to q1.
SLIDE 47
How it Works
We see that Me(x) + 1 by the following reasoning. ◮ Case 1: x contains a 0. Let i be least such that ai = 0. Then M will write i − 1 1’s and remain in state q0 until arriving at the i-th bit, which is a 0. Then it will output bi = 1 and transition to state q1. After that it will simply write bj = aj for all j > i. For example, S(9) = 10 in binary becomes M3(1001) = 0101. ◮ Case 2: If x consists of all 1’s, then M will write n 0’s and remain in state q0 until reaching the extra 0, when M will
- utput a final 1 and transition to q1.