Computability Douglas Cenzer University of Florida March 11, 2020 - - PowerPoint PPT Presentation

computability
SMART_READER_LITE
LIVE PREVIEW

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-1
SLIDE 1

Computability

Douglas Cenzer University of Florida March 11, 2020

slide-2
SLIDE 2

Introduction

Let Σ be a finite alphabet and let Σ∗ be the set of finite strings or words over Σ.

slide-3
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SLIDE 20

The action of an FSA

slide-21
SLIDE 21

The action of an FSA

The action of a finite automaton M on input w = a0a1 . . . ak

  • ccurs in stages.
slide-22
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
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
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
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
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
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
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
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
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
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
SLIDE 32

Example 2

Let M2 be the machine, depicted by the state diagram below, with transition function

slide-33
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
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
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
SLIDE 36

Example 3: The Successor Machine

The successor machine M3 computes S(x) = x + 1.

slide-37
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
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
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
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
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
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
SLIDE 43

How it Works

We see that Me(x) + 1 by the following reasoning.

slide-44
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
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
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
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.

For example, S(3) = 4 in binary becomes M3(11) = 001.