Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some...

163
Computational Models– Lecture 7 Turing Machine – More Definition and Examples Notion of an Algorithm Hilbert’s Tenth Problem Decidability of DFAs and PDAs Questions Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Transcript of Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some...

Page 1: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Computational Models– Lecture 7

Turing Machine – More Definition and Examples

Notion of an Algorithm

Hilbert’s Tenth Problem

Decidability of DFAs and PDAs Questions

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Page 2: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Non-Deterministic Turing Machines(reminder)

Transition function:

δ : Q× Γ → P(Q× Γ× {L,R})

Computation is a tree.

Accepts if there is (∃) an accepting branch.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 3: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Non-Deterministic Turing Machines(reminder)

Transition function:

δ : Q× Γ → P(Q× Γ× {L,R})

Computation is a tree.

Accepts if there is (∃) an accepting branch.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 4: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Non-Deterministic Turing Machines(reminder)

Transition function:

δ : Q× Γ → P(Q× Γ× {L,R})

Computation is a tree.

Accepts if there is (∃) an accepting branch.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 5: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Equivalence

Theorem: A language is enumerable if and only ifthere is some non-deterministic Turing machine thataccepts it.

One direction is trivial.

To prove the other direction, we will show how toconvert a non-deterministic TM, N , into an equivalentdeterministic TM, D.

D will simulate N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 6: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Equivalence

Theorem: A language is enumerable if and only ifthere is some non-deterministic Turing machine thataccepts it.

One direction is trivial.

To prove the other direction, we will show how toconvert a non-deterministic TM, N , into an equivalentdeterministic TM, D.

D will simulate N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 7: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Equivalence

Theorem: A language is enumerable if and only ifthere is some non-deterministic Turing machine thataccepts it.

One direction is trivial.

To prove the other direction, we will show how toconvert a non-deterministic TM, N , into an equivalentdeterministic TM, D.

D will simulate N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 8: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Equivalence

Theorem: A language is enumerable if and only ifthere is some non-deterministic Turing machine thataccepts it.

One direction is trivial.

To prove the other direction, we will show how toconvert a non-deterministic TM, N , into an equivalentdeterministic TM, D.

D will simulate N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 9: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism

Basic idea:

D tries all possible branches

If D finds any accepting branch, it accepts.

If all branches reject, D rejects.

If all branches reject or loop, D loops.

Of course, D does not “know” this (loop) is thecase. It just “follows” N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 10: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism

Basic idea:

D tries all possible branches

If D finds any accepting branch, it accepts.

If all branches reject, D rejects.

If all branches reject or loop, D loops.

Of course, D does not “know” this (loop) is thecase. It just “follows” N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 11: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism

Basic idea:

D tries all possible branches

If D finds any accepting branch, it accepts.

If all branches reject, D rejects.

If all branches reject or loop, D loops.

Of course, D does not “know” this (loop) is thecase. It just “follows” N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 12: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism

Basic idea:

D tries all possible branches

If D finds any accepting branch, it accepts.

If all branches reject, D rejects.

If all branches reject or loop, D loops.

Of course, D does not “know” this (loop) is thecase. It just “follows” N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 13: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism

Basic idea:

D tries all possible branches

If D finds any accepting branch, it accepts.

If all branches reject, D rejects.

If all branches reject or loop, D loops.

Of course, D does not “know” this (loop) is thecase. It just “follows” N .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 14: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism (2)

11 ... ba ... 1 ...#

input tape(never altered)

simulationtape

addresstape

2 3 3

D has three tapes

the input tape is never altered

the simulation tape is a copy of N ’s tape

the address tape keeps track of D’s location inN ’s computation tree.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 15: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism (2)

11 ... ba ... 1 ...#

input tape(never altered)

simulationtape

addresstape

2 3 3

D has three tapes

the input tape is never altered

the simulation tape is a copy of N ’s tape

the address tape keeps track of D’s location inN ’s computation tree.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 16: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism (2)

11 ... ba ... 1 ...#

input tape(never altered)

simulationtape

addresstape

2 3 3

D has three tapes

the input tape is never altered

the simulation tape is a copy of N ’s tape

the address tape keeps track of D’s location inN ’s computation tree.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 17: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Simulating Non-Determinism (2)

11 ... ba ... 1 ...#

input tape(never altered)

simulationtape

addresstape

2 3 3

D has three tapes

the input tape is never altered

the simulation tape is a copy of N ’s tape

the address tape keeps track of D’s location inN ’s computation tree.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 18: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

DecidersDefinition: A non-deterministic TM is a decider if onall inputs, all branches halt (in either state qa or qr).

Definition (reminder): A language is decidable ifsome deterministic Turing machine decides it.

Theorem: A language is decidable if and only ifthere is a non-deterministic Turing machine thatdecides it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 19: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

DecidersDefinition: A non-deterministic TM is a decider if onall inputs, all branches halt (in either state qa or qr).

Definition (reminder): A language is decidable ifsome deterministic Turing machine decides it.

Theorem: A language is decidable if and only ifthere is a non-deterministic Turing machine thatdecides it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 20: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

DecidersDefinition: A non-deterministic TM is a decider if onall inputs, all branches halt (in either state qa or qr).

Definition (reminder): A language is decidable ifsome deterministic Turing machine decides it.

Theorem: A language is decidable if and only ifthere is a non-deterministic Turing machine thatdecides it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 21: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

EnumeratorsA language is enumerable if it is accepted by someTuring machine.But why enumerable?

1 010

aaabba

Definition: An enumerator is a TM with a printer.

TM sends strings to printer

may create infinite list of strings

TM enumerates a language – all strings produced.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.7

Page 22: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

EnumeratorsA language is enumerable if it is accepted by someTuring machine.But why enumerable?

1 010

aaabba

Definition: An enumerator is a TM with a printer.

TM sends strings to printer

may create infinite list of strings

TM enumerates a language – all strings produced.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.7

Page 23: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

EnumeratorsA language is enumerable if it is accepted by someTuring machine.But why enumerable?

1 010

aaabba

Definition: An enumerator is a TM with a printer.

TM sends strings to printer

may create infinite list of strings

TM enumerates a language – all strings produced.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.7

Page 24: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremTheorem: A language is accepted by some Turingmachine if and only if some enumerator enumerates it.

Will show

If E enumerates language A, then some TM Maccepts A.

If M accepts A, then some enumerator Eenumerates it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 25: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremTheorem: A language is accepted by some Turingmachine if and only if some enumerator enumerates it.

Will show

If E enumerates language A, then some TM Maccepts A.

If M accepts A, then some enumerator Eenumerates it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 26: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If E enumerates language A, then some TMM accepts A.

On input w, TM M

Runs E. Every time E outputs a string v, Mcompares it to w.

If v = w, M accept.

If v 6= w, M continues running E.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 27: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If E enumerates language A, then some TMM accepts A.

On input w, TM M

Runs E. Every time E outputs a string v, Mcompares it to w.

If v = w, M accept.

If v 6= w, M continues running E.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 28: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If E enumerates language A, then some TMM accepts A.

On input w, TM M

Runs E. Every time E outputs a string v, Mcompares it to w.

If v = w, M accept.

If v 6= w, M continues running E.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 29: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If E enumerates language A, then some TMM accepts A.

On input w, TM M

Runs E. Every time E outputs a string v, Mcompares it to w.

If v = w, M accept.

If v 6= w, M continues running E.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 30: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If M accepts A, then some enumerator Eenumerates it.

Let s1, s2, s3, . . . is a list of all strings in Σ∗ (e.g.strings in lexicographic order).The enumerator, E

repeat the following for i = 1, 2, 3, . . .

run M for i steps on each input s1, s2, . . . , si.

if any computation accepts, print out thecorresponding s. ♣

Note that with this procedure, each output isduplicated infinitely often.

Think how can this duplication be avoided?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 31: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If M accepts A, then some enumerator Eenumerates it.

Let s1, s2, s3, . . . is a list of all strings in Σ∗ (e.g.strings in lexicographic order).The enumerator, E

repeat the following for i = 1, 2, 3, . . .

run M for i steps on each input s1, s2, . . . , si.

if any computation accepts, print out thecorresponding s. ♣

Note that with this procedure, each output isduplicated infinitely often.

Think how can this duplication be avoided?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 32: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If M accepts A, then some enumerator Eenumerates it.

Let s1, s2, s3, . . . is a list of all strings in Σ∗ (e.g.strings in lexicographic order).The enumerator, E

repeat the following for i = 1, 2, 3, . . .

run M for i steps on each input s1, s2, . . . , si.

if any computation accepts, print out thecorresponding s. ♣

Note that with this procedure, each output isduplicated infinitely often.

Think how can this duplication be avoided?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 33: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If M accepts A, then some enumerator Eenumerates it.

Let s1, s2, s3, . . . is a list of all strings in Σ∗ (e.g.strings in lexicographic order).The enumerator, E

repeat the following for i = 1, 2, 3, . . .

run M for i steps on each input s1, s2, . . . , si.

if any computation accepts, print out thecorresponding s. ♣

Note that with this procedure, each output isduplicated infinitely often.

Think how can this duplication be avoided?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 34: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

TheoremClaim: If M accepts A, then some enumerator Eenumerates it.

Let s1, s2, s3, . . . is a list of all strings in Σ∗ (e.g.strings in lexicographic order).The enumerator, E

repeat the following for i = 1, 2, 3, . . .

run M for i steps on each input s1, s2, . . . , si.

if any computation accepts, print out thecorresponding s. ♣

Note that with this procedure, each output isduplicated infinitely often.

Think how can this duplication be avoided?Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 35: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability

Decidability is a stronger notion thanenumerability.

If a language L is decidable then clearly it isenumerable (the other dirction does not hold, aswe’ll show in a couple of lectures).

It is also clear that if L is decidable then so is L,and thus L is also enumerable.

Let RE denote the class of enumerablelanguages, and let coRE denote the class oflanguages whose complement is enumerable.

Let R denote the class of decidable languages.Then what we just saw is R ⊆ RE ∩ coRE .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 36: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability

Decidability is a stronger notion thanenumerability.

If a language L is decidable then clearly it isenumerable (the other dirction does not hold, aswe’ll show in a couple of lectures).

It is also clear that if L is decidable then so is L,and thus L is also enumerable.

Let RE denote the class of enumerablelanguages, and let coRE denote the class oflanguages whose complement is enumerable.

Let R denote the class of decidable languages.Then what we just saw is R ⊆ RE ∩ coRE .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 37: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability

Decidability is a stronger notion thanenumerability.

If a language L is decidable then clearly it isenumerable (the other dirction does not hold, aswe’ll show in a couple of lectures).

It is also clear that if L is decidable then so is L,and thus L is also enumerable.

Let RE denote the class of enumerablelanguages, and let coRE denote the class oflanguages whose complement is enumerable.

Let R denote the class of decidable languages.Then what we just saw is R ⊆ RE ∩ coRE .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 38: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability

Decidability is a stronger notion thanenumerability.

If a language L is decidable then clearly it isenumerable (the other dirction does not hold, aswe’ll show in a couple of lectures).

It is also clear that if L is decidable then so is L,and thus L is also enumerable.

Let RE denote the class of enumerablelanguages, and let coRE denote the class oflanguages whose complement is enumerable.

Let R denote the class of decidable languages.Then what we just saw is R ⊆ RE ∩ coRE .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 39: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability

Decidability is a stronger notion thanenumerability.

If a language L is decidable then clearly it isenumerable (the other dirction does not hold, aswe’ll show in a couple of lectures).

It is also clear that if L is decidable then so is L,and thus L is also enumerable.

Let RE denote the class of enumerablelanguages, and let coRE denote the class oflanguages whose complement is enumerable.

Let R denote the class of decidable languages.Then what we just saw is R ⊆ RE ∩ coRE .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 40: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability (2)

Theorem: R=RE ∩ coRE .Proof: We should prove the ⊇ direction. Namely ifL ∈ RE ∩ coRE , then L ∈ R.

In other words, if both L and its complement areenumerable, then L is decidable.Let M1 be a TM that accepts L.Let M2 be a TM that accepts L.We describe a TM, M , that decides L.On input x, M runs M1 and M2 in parallel.If M1 accepts, M accepts.If M2 accepts, M rejects.Should now show that indeed M decides L.Not too hard... ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 41: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability (2)

Theorem: R=RE ∩ coRE .Proof: We should prove the ⊇ direction. Namely ifL ∈ RE ∩ coRE , then L ∈ R.In other words, if both L and its complement areenumerable, then L is decidable.

Let M1 be a TM that accepts L.Let M2 be a TM that accepts L.We describe a TM, M , that decides L.On input x, M runs M1 and M2 in parallel.If M1 accepts, M accepts.If M2 accepts, M rejects.Should now show that indeed M decides L.Not too hard... ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 42: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability (2)

Theorem: R=RE ∩ coRE .Proof: We should prove the ⊇ direction. Namely ifL ∈ RE ∩ coRE , then L ∈ R.In other words, if both L and its complement areenumerable, then L is decidable.Let M1 be a TM that accepts L.Let M2 be a TM that accepts L.We describe a TM, M , that decides L.

On input x, M runs M1 and M2 in parallel.If M1 accepts, M accepts.If M2 accepts, M rejects.Should now show that indeed M decides L.Not too hard... ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 43: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability (2)

Theorem: R=RE ∩ coRE .Proof: We should prove the ⊇ direction. Namely ifL ∈ RE ∩ coRE , then L ∈ R.In other words, if both L and its complement areenumerable, then L is decidable.Let M1 be a TM that accepts L.Let M2 be a TM that accepts L.We describe a TM, M , that decides L.On input x, M runs M1 and M2 in parallel.If M1 accepts, M accepts.If M2 accepts, M rejects.

Should now show that indeed M decides L.Not too hard... ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 44: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability vs. Enumerability (2)

Theorem: R=RE ∩ coRE .Proof: We should prove the ⊇ direction. Namely ifL ∈ RE ∩ coRE , then L ∈ R.In other words, if both L and its complement areenumerable, then L is decidable.Let M1 be a TM that accepts L.Let M2 be a TM that accepts L.We describe a TM, M , that decides L.On input x, M runs M1 and M2 in parallel.If M1 accepts, M accepts.If M2 accepts, M rejects.Should now show that indeed M decides L.Not too hard... ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 45: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some Perspective

Many models have been proposed forgeneral-purpose computation.

Remarkably, all “reasonable” models areequivalent to Turing machines.

All “reasonable” programming languages (e.g.Java, Pascal, C, Scheme, Mathematica, Maple, Cobol,. . . )are equivalent.

The notion of an algorithm ismodel-independent!

We don’t really care about Turing machines perse, we care about understanding computation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 46: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some Perspective

Many models have been proposed forgeneral-purpose computation.

Remarkably, all “reasonable” models areequivalent to Turing machines.

All “reasonable” programming languages (e.g.Java, Pascal, C, Scheme, Mathematica, Maple, Cobol,. . . )are equivalent.

The notion of an algorithm ismodel-independent!

We don’t really care about Turing machines perse, we care about understanding computation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 47: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some Perspective

Many models have been proposed forgeneral-purpose computation.

Remarkably, all “reasonable” models areequivalent to Turing machines.

All “reasonable” programming languages (e.g.Java, Pascal, C, Scheme, Mathematica, Maple, Cobol,. . . )are equivalent.

The notion of an algorithm ismodel-independent!

We don’t really care about Turing machines perse, we care about understanding computation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 48: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some Perspective

Many models have been proposed forgeneral-purpose computation.

Remarkably, all “reasonable” models areequivalent to Turing machines.

All “reasonable” programming languages (e.g.Java, Pascal, C, Scheme, Mathematica, Maple, Cobol,. . . )are equivalent.

The notion of an algorithm ismodel-independent!

We don’t really care about Turing machines perse, we care about understanding computation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 49: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some Perspective

Many models have been proposed forgeneral-purpose computation.

Remarkably, all “reasonable” models areequivalent to Turing machines.

All “reasonable” programming languages (e.g.Java, Pascal, C, Scheme, Mathematica, Maple, Cobol,. . . )are equivalent.

The notion of an algorithm is model-independent!

We don’t really care about Turing machines perse, we care about understanding computation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 50: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informally

a recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 51: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipe

a procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 52: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedure

a computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 53: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer program

who cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 54: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 55: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,

notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 56: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), but

not precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 57: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th century

informal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 58: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,

still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 59: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

What is an Algorithm?

Informallya recipea procedurea computer programwho cares? I know it when I see it _

Historically,notion has long history in Mathematics(starting with Euclid’s gcd algorithm), butnot precisely defined until 20th centuryinformal notions rarely questioned,still, they were insufficient

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 60: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Dilbert’s Problems

Too much beer last night? These are D. Hilbert’sproblems, not Dilbert’s problems, we are supposed totalk about...

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 61: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Dilbert’s Problems

Too much beer last night? These are D. Hilbert’sproblems, not Dilbert’s problems, we are supposed totalk about...

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 62: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s 10th ProblemIn 1900, David Hilbert delivered a now-famousaddress at the International Congress ofMathematicians in Paris, France.

Presented 23 central mathematical problems

challenge for the next (20th) century

the 10th problem directly concerned algorithms

In November 2003, significantprogress made on the 6th problem.

But it is the 10th problem we careabout. Will start with some background.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 63: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s 10th ProblemIn 1900, David Hilbert delivered a now-famousaddress at the International Congress ofMathematicians in Paris, France.

Presented 23 central mathematical problems

challenge for the next (20th) century

the 10th problem directly concerned algorithms

In November 2003, significantprogress made on the 6th problem.

But it is the 10th problem we careabout. Will start with some background.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 64: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s 10th ProblemIn 1900, David Hilbert delivered a now-famousaddress at the International Congress ofMathematicians in Paris, France.

Presented 23 central mathematical problems

challenge for the next (20th) century

the 10th problem directly concerned algorithms

In November 2003, significantprogress made on the 6th problem.

But it is the 10th problem we careabout. Will start with some background.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 65: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s 10th ProblemIn 1900, David Hilbert delivered a now-famousaddress at the International Congress ofMathematicians in Paris, France.

Presented 23 central mathematical problems

challenge for the next (20th) century

the 10th problem directly concerned algorithms

In November 2003, significantprogress made on the 6th problem.

But it is the 10th problem we careabout. Will start with some background.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 66: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s 10th ProblemIn 1900, David Hilbert delivered a now-famousaddress at the International Congress ofMathematicians in Paris, France.

Presented 23 central mathematical problems

challenge for the next (20th) century

the 10th problem directly concerned algorithms

In November 2003, significantprogress made on the 6th problem.

But it is the 10th problem we careabout. Will start with some background.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 67: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 68: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 69: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 70: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 71: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 72: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Polynomials

A term is a product of variables and a constantcoefficient, e.g. 6x3yz2.

A polynomial is a sum of terms, e.g.6x3yz2 + 3xy2 − x3 − 10 .

A root of a polynomial is an assignment of valuesto variables so that the polynomial equals zero.

For example, x = 5, y = 3, and z = 0 is a root ofthe polynomial above.

Here, we are interested in integral roots, namelyan assignment of integers to all variables.

Some polynomials have integral roots, somedon’t (e.g. x2 − 2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 73: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth Problem

The Problem: Devise an algorithm that tests whether apolynomial has an integral root.

Actually, what he said (translated from German) was

“to devise a process according to which itcan be determined by a finite number ofoperations”.

Note that

Hilbert explicitly asks that algorithm be“devised”

apparently Hilbert assumes that such an algorithmmust exist, and someone “only” need find it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.18

Page 74: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth Problem

The Problem: Devise an algorithm that tests whether apolynomial has an integral root.

Actually, what he said (translated from German) was

“to devise a process according to which itcan be determined by a finite number ofoperations”.

Note that

Hilbert explicitly asks that algorithm be“devised”

apparently Hilbert assumes that such an algorithmmust exist, and someone “only” need find it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.18

Page 75: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth ProblemWe now know no algorithm exists for this task.

Mathematicians of 1900 could not have provedthis, because they didn’t have a formal notion ofan algorithm.

Intuitive notions work fine for constructingalgorithms (we know one when we see it).

Formal notions are required to show that noalgorithm exists.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 76: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth ProblemWe now know no algorithm exists for this task.

Mathematicians of 1900 could not have provedthis, because they didn’t have a formal notion ofan algorithm.

Intuitive notions work fine for constructingalgorithms (we know one when we see it).

Formal notions are required to show that noalgorithm exists.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 77: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth ProblemWe now know no algorithm exists for this task.

Mathematicians of 1900 could not have provedthis, because they didn’t have a formal notion ofan algorithm.

Intuitive notions work fine for constructingalgorithms (we know one when we see it).

Formal notions are required to show that noalgorithm exists.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 78: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth ProblemWe now know no algorithm exists for this task.

Mathematicians of 1900 could not have provedthis, because they didn’t have a formal notion ofan algorithm.

Intuitive notions work fine for constructingalgorithms (we know one when we see it).

Formal notions are required to show that noalgorithm exists.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 79: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 80: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 81: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 82: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 83: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 84: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Church-Turing Thesis

Formal notions appeared in 1936:

λ-calculus of Alonzo Church

Turing machines of Alan Turing

Recursive functions of Stephen Kleene

Correspondence systems of Emil Post

These definitions look very different and havevery different characteristics, yet they areprovably equivalent.

Church-Turing Thesis:

“The intuitive notion of algorithms equalsTuring machine algorithms”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 85: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Hilbert’s Tenth Problem

In 1970, 23 years old Yuri Matijasevic̆, building onwork of Martin Davis, Hilary Putnam, and JuliaRobinson, proved that no algorithm exists for testingwhether a polynomial has integral roots(a survey of the proof)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.21

Page 86: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Reformulating Hilbert’s Tenth Problem

Consider the language:

D = {p | p is a polynomial with an integral root}

Hilbert’s tenth problem asks whether this language isdecidable.

We now know it is not decidable, but it is enumerable!

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 87: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Reformulating Hilbert’s Tenth Problem

Consider the language:

D = {p | p is a polynomial with an integral root}

Hilbert’s tenth problem asks whether this language isdecidable.

We now know it is not decidable, but it is enumerable!

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 88: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Reformulating Hilbert’s Tenth Problem

Consider the language:

D = {p | p is a polynomial with an integral root}

Hilbert’s tenth problem asks whether this language isdecidable.

We now know it is not decidable, but it is enumerable!

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 89: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials

Consider the simpler language:

D1 = {p | p is a polynomial over x with an integral root}

Here is a Turing machine that accepts D1.On input p,

evaluate p with x set successively to0, 1,−1, 2,−2, . . ..

if p evaluates to zero, accept.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 90: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials

Consider the simpler language:

D1 = {p | p is a polynomial over x with an integral root}

Here is a Turing machine that accepts D1.

On input p,

evaluate p with x set successively to0, 1,−1, 2,−2, . . ..

if p evaluates to zero, accept.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 91: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials

Consider the simpler language:

D1 = {p | p is a polynomial over x with an integral root}

Here is a Turing machine that accepts D1.On input p,

evaluate p with x set successively to0, 1,−1, 2,−2, . . ..

if p evaluates to zero, accept.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 92: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (2)

D1 = {p | p is a polynomial over x with an integral root}

Note that

If p has an integral root, the machine accepts.

If not, M1 loops.

M1 is an acceptor, but not a decider.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 93: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (2)

D1 = {p | p is a polynomial over x with an integral root}

Note that

If p has an integral root, the machine accepts.

If not, M1 loops.

M1 is an acceptor, but not a decider.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 94: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (2)

D1 = {p | p is a polynomial over x with an integral root}

Note that

If p has an integral root, the machine accepts.

If not, M1 loops.

M1 is an acceptor, but not a decider.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 95: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (2)

D1 = {p | p is a polynomial over x with an integral root}

Note that

If p has an integral root, the machine accepts.

If not, M1 loops.

M1 is an acceptor, but not a decider.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 96: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (3)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.25

Page 97: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (4)

In fact, D1 is decidable.

Can show that all real roots of p[x] lie inside interval

( −|kcmax/c1|, |kcmax/c1| ) ,

where k is number of terms, cmax is max coefficient,and c1 is high-order coefficient.

By Matijasevic̆ theorem, such effective bounds onrange of real roots cannot be computed formultivariable polynomials.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.26

Page 98: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Univariate Polynomials (4)

In fact, D1 is decidable.

Can show that all real roots of p[x] lie inside interval

( −|kcmax/c1|, |kcmax/c1| ) ,

where k is number of terms, cmax is max coefficient,and c1 is high-order coefficient.

By Matijasevic̆ theorem, such effective bounds onrange of real roots cannot be computed formultivariable polynomials.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.26

Page 99: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 100: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 101: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 102: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 103: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 104: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Wild ModelsWhat about “unreasonable” models of computation?Consider MUntel’s ℵ-AXP c© processor (to be releasedXMAS 2003).

Like a Turing machine, except

Takes first step in 1 second.

Takes second step in 1/2 second.

Takes i-th step in 2−i seconds . . .

After 2 seconds, the ℵ-AXP c© decides any enumerablelanguage!

Question: Does the ℵ-AXP c© invalidate theChurch-Turing Thesis?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 105: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Input to a Turing machine is a string of symbols.

But we want algorithms that work on graphs,matrices, polynomials, Turing machines, etc.

Need to choose an encoding for objects.

Can often be done in many reasonable ways.

Sometimes distinguish between X , the object,and 〈X〉, its encoding.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 106: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Input to a Turing machine is a string of symbols.

But we want algorithms that work on graphs,matrices, polynomials, Turing machines, etc.

Need to choose an encoding for objects.

Can often be done in many reasonable ways.

Sometimes distinguish between X , the object,and 〈X〉, its encoding.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 107: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Input to a Turing machine is a string of symbols.

But we want algorithms that work on graphs,matrices, polynomials, Turing machines, etc.

Need to choose an encoding for objects.

Can often be done in many reasonable ways.

Sometimes distinguish between X , the object,and 〈X〉, its encoding.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 108: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Input to a Turing machine is a string of symbols.

But we want algorithms that work on graphs,matrices, polynomials, Turing machines, etc.

Need to choose an encoding for objects.

Can often be done in many reasonable ways.

Sometimes distinguish between X , the object,and 〈X〉, its encoding.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 109: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Input to a Turing machine is a string of symbols.

But we want algorithms that work on graphs,matrices, polynomials, Turing machines, etc.

Need to choose an encoding for objects.

Can often be done in many reasonable ways.

Sometimes distinguish between X , the object,and 〈X〉, its encoding.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 110: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Encoding

Consider strings representing undirected graphs.

A graph is connected if every node can be reachedfrom any other node by traveling along edges.

Define the language:

A = {〈G〉 | G is a connected undirected graph}

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.29

Page 111: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

High-Level Description

High-level description of a machine that decides

A = {〈G〉 | G is a connected undirected graph}

On input 〈G〉, encoding of graph G

select first node of G and mark it.

repeat until no new nodes marked:

For each node in G, mark if attached by an edgeto a node already marked.

scan nodes of G to determine whether they are allmarked. If so, accept, otherwise reject.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 112: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

High-Level Description

High-level description of a machine that decides

A = {〈G〉 | G is a connected undirected graph}

On input 〈G〉, encoding of graph G

select first node of G and mark it.

repeat until no new nodes marked:

For each node in G, mark if attached by an edgeto a node already marked.

scan nodes of G to determine whether they are allmarked. If so, accept, otherwise reject.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 113: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

High-Level Description

High-level description of a machine that decides

A = {〈G〉 | G is a connected undirected graph}

On input 〈G〉, encoding of graph G

select first node of G and mark it.

repeat until no new nodes marked:

For each node in G, mark if attached by an edgeto a node already marked.

scan nodes of G to determine whether they are allmarked. If so, accept, otherwise reject.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 114: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

High-Level Description

High-level description of a machine that decides

A = {〈G〉 | G is a connected undirected graph}

On input 〈G〉, encoding of graph G

select first node of G and mark it.

repeat until no new nodes marked:

For each node in G, mark if attached by an edgeto a node already marked.

scan nodes of G to determine whether they are allmarked. If so, accept, otherwise reject.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 115: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Some DetailsQuestion: How is G encoded?

14

23

G <G>

(1,2,3,4)((1,2),(2,3),(3,1),(1,4))

vertexes edges

Answer: List of nodes, followed by list of edges.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.31

Page 116: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 117: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 118: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 119: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 120: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 121: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

More Details

On input M checks that input is valid graph encoding

two lists

first is list of numbers

second is list of pairs

first list contains no duplicates (elementdistinctness subroutine)

every node in second list appears in first

Now ready to start “step one”.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 122: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 123: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 124: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 125: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 126: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 127: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 128: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 129: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 130: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Detailed AlgorithmOn input 〈G〉, encoding of graph G

1. mark first node with a dot on leftmost digit.

2. loop:

Scans list and “underlines” undotted node n1.

M rescans and “underlines” dotted node n2.

M scans edges.

M tests each edge if it is (n1, n2).

If so, dot n1, remove underlines, goto Step 2.

If not, check next edge. When no more edges, move

underline to next dotted n2.

when no more dotted vertexes, move underlines: new n1 is

next undotted node and new n1 is first dotted node. Repeat

Step 2. When no more undotted nodes, go to Step 3.

3. M scans the list of nodes. If all dotted, accept, otherwise reject.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 131: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Languages

Question: Why study decidability?

Good for improving your imagination.

Some of the most beautiful and importantmathematics of the 20th century, and you canactually understand it!

Your boss (who never took this course...) ordersyou to solve Hilbert’s 10th, or else.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 132: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Languages

Question: Why study decidability?

Good for improving your imagination.

Some of the most beautiful and importantmathematics of the 20th century, and you canactually understand it!

Your boss (who never took this course...) ordersyou to solve Hilbert’s 10th, or else.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 133: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Languages

Question: Why study decidability?

Good for improving your imagination.

Some of the most beautiful and importantmathematics of the 20th century, and you canactually understand it!

Your boss (who never took this course...) ordersyou to solve Hilbert’s 10th, or else.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 134: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Examples of Decidable Languages

Finite automata problems can be reformulated aslanguages.

Does DFA, B, accept input string w?

Consider the language:

ADFA = {〈B,w〉 | B is a DFA that accepts w}

The following are equivalent:

B accepts w

〈B,w〉 ∈ ADFA

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 135: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Examples of Decidable Languages

Finite automata problems can be reformulated aslanguages.

Does DFA, B, accept input string w?

Consider the language:

ADFA = {〈B,w〉 | B is a DFA that accepts w}

The following are equivalent:

B accepts w

〈B,w〉 ∈ ADFA

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 136: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Examples of Decidable Languages

Finite automata problems can be reformulated aslanguages.

Does DFA, B, accept input string w?

Consider the language:

ADFA = {〈B,w〉 | B is a DFA that accepts w}

The following are equivalent:

B accepts w

〈B,w〉 ∈ ADFA

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 137: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Acceptance

Theorem: ADFA is a decidable language.

Proof: On input 〈B,w〉, where B is a DFA and w astring:

1. Simulate B on input w

2. if simulation ends in accepting state, accept,otherwise reject. ♣

Remarks

“where” clause means scan and check condition.

B represented by a list of (Q, Σ, δ, q0, F ).

simulation straightforward.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.36

Page 138: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Acceptance

Theorem: ADFA is a decidable language.

Proof: On input 〈B,w〉, where B is a DFA and w astring:

1. Simulate B on input w

2. if simulation ends in accepting state, accept,otherwise reject. ♣

Remarks

“where” clause means scan and check condition.

B represented by a list of (Q, Σ, δ, q0, F ).

simulation straightforward.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.36

Page 139: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Acceptance

Theorem: ADFA is a decidable language.

Proof: On input 〈B,w〉, where B is a DFA and w astring:

1. Simulate B on input w

2. if simulation ends in accepting state, accept,otherwise reject. ♣

Remarks

“where” clause means scan and check condition.

B represented by a list of (Q, Σ, δ, q0, F ).

simulation straightforward.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.36

Page 140: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of NFA Acceptance

Does an NFA accept a string?

ANFA = {〈B,w〉|B is an NFA that accepts w}

Theorem: ANFA is a decidable language.

On input 〈B,w〉, where B is an NFA and w a string:

1. Convert the NFA B into equivalent DFA C .

2. Run previous TM on input 〈C,w〉.

3. if that TM accepts, accept, otherwise reject. ♣

Note use of subroutine (2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.37

Page 141: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of NFA Acceptance

Does an NFA accept a string?

ANFA = {〈B,w〉|B is an NFA that accepts w}

Theorem: ANFA is a decidable language.

On input 〈B,w〉, where B is an NFA and w a string:

1. Convert the NFA B into equivalent DFA C .

2. Run previous TM on input 〈C,w〉.

3. if that TM accepts, accept, otherwise reject. ♣

Note use of subroutine (2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.37

Page 142: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of NFA Acceptance

Does an NFA accept a string?

ANFA = {〈B,w〉|B is an NFA that accepts w}

Theorem: ANFA is a decidable language.

On input 〈B,w〉, where B is an NFA and w a string:

1. Convert the NFA B into equivalent DFA C .

2. Run previous TM on input 〈C,w〉.

3. if that TM accepts, accept, otherwise reject. ♣

Note use of subroutine (2).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.37

Page 143: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Reg. Exp. Generation

Does a regular expression generate a string?

AREX = {〈R,w〉 | R is a regular expression

that generates w}

Theorem: AREX is a decidable language.

On input 〈R,w〉, where R is a regular expression andw a string:

1. Convert regular expression R into DFA C .

2. Run earlier TM on input 〈C,w〉.

3. If that TM accepts, accept, otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 144: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Reg. Exp. Generation

Does a regular expression generate a string?

AREX = {〈R,w〉 | R is a regular expression

that generates w}

Theorem: AREX is a decidable language.

On input 〈R,w〉, where R is a regular expression andw a string:

1. Convert regular expression R into DFA C .

2. Run earlier TM on input 〈C,w〉.

3. If that TM accepts, accept, otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 145: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of Reg. Exp. Generation

Does a regular expression generate a string?

AREX = {〈R,w〉 | R is a regular expression

that generates w}

Theorem: AREX is a decidable language.

On input 〈R,w〉, where R is a regular expression andw a string:

1. Convert regular expression R into DFA C .

2. Run earlier TM on input 〈C,w〉.

3. If that TM accepts, accept, otherwise reject. ♣Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 146: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Emptiness

Does a DFA accept the empty language, ∅?

Define EDFA = {〈A〉|A is a DFA and L(A) = ∅}

Theorem: EDFA is a decidable language.On input 〈A〉, where A is a DFA:

1. Mark the start state of A.

2. Repeat until no new states are marked:

3. Mark any state that has a transition coming into it from any

already marked state.

4. If no accept state is marked, accept, otherwise reject. ♣

This TM actually just tests whether any accepting state is

reachable from initial state (a reachability problem in digraphs).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 147: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Emptiness

Does a DFA accept the empty language, ∅?

Define EDFA = {〈A〉|A is a DFA and L(A) = ∅}

Theorem: EDFA is a decidable language.

On input 〈A〉, where A is a DFA:

1. Mark the start state of A.

2. Repeat until no new states are marked:

3. Mark any state that has a transition coming into it from any

already marked state.

4. If no accept state is marked, accept, otherwise reject. ♣

This TM actually just tests whether any accepting state is

reachable from initial state (a reachability problem in digraphs).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 148: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFA Emptiness

Does a DFA accept the empty language, ∅?

Define EDFA = {〈A〉|A is a DFA and L(A) = ∅}

Theorem: EDFA is a decidable language.On input 〈A〉, where A is a DFA:

1. Mark the start state of A.

2. Repeat until no new states are marked:

3. Mark any state that has a transition coming into it from any

already marked state.

4. If no accept state is marked, accept, otherwise reject. ♣

This TM actually just tests whether any accepting state is

reachable from initial state (a reachability problem in digraphs).Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 149: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFAs Equivalence

EQDFA = {〈A,B〉 | A,B are DFAs and L(A) = L(B)}

Theorem: EQDFA is a decidable language.We construct a new DFA C from A and B, such thatC accepts only string accepted by A or by B, but notboth. In other wordsL(C) =

(

L(A) ∩ L(B))

∪(

L(A) ∩ L(B))

.

L(C) is symmetric difference of L(A) and L(B)

use construction used for regular languagetheorems

construction can be expressed as a TM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 150: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFAs Equivalence

EQDFA = {〈A,B〉 | A,B are DFAs and L(A) = L(B)}

Theorem: EQDFA is a decidable language.

We construct a new DFA C from A and B, such thatC accepts only string accepted by A or by B, but notboth. In other wordsL(C) =

(

L(A) ∩ L(B))

∪(

L(A) ∩ L(B))

.

L(C) is symmetric difference of L(A) and L(B)

use construction used for regular languagetheorems

construction can be expressed as a TM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 151: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of DFAs Equivalence

EQDFA = {〈A,B〉 | A,B are DFAs and L(A) = L(B)}

Theorem: EQDFA is a decidable language.We construct a new DFA C from A and B, such thatC accepts only string accepted by A or by B, but notboth. In other wordsL(C) =

(

L(A) ∩ L(B))

∪(

L(A) ∩ L(B))

.

L(C) is symmetric difference of L(A) and L(B)

use construction used for regular languagetheorems

construction can be expressed as a TM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 152: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

DFA Equivalence (continued)

Theorem: EQDFA is a decidable language.

On input 〈A.B〉, where A,B are DFAs:

1. Construct DFA, C , as described.

2. Run previous “emptyness” TM on input 〈C〉.

3. If that TM accepts, accept, otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.41

Page 153: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

DFA Equivalence (continued)

Theorem: EQDFA is a decidable language.

On input 〈A.B〉, where A,B are DFAs:

1. Construct DFA, C , as described.

2. Run previous “emptyness” TM on input 〈C〉.

3. If that TM accepts, accept, otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.41

Page 154: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation

Does a CFG generate a given string?

DefineACFG = {〈G,w〉 | string w is generated by CFG G}

Theorem: The language ACFG is decidable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.42

Page 155: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (2)

Does a CFG generate a given string?

Initial Idea: Design a TM, M , to try all derivations.

Problem: M accepts, but does not decide. (why?)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 156: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (2)

Does a CFG generate a given string?

Initial Idea: Design a TM, M , to try all derivations.

Problem: M accepts, but does not decide. (why?)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 157: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (2)

Does a CFG generate a given string?

Initial Idea: Design a TM, M , to try all derivations.

Problem: M accepts, but does not decide. (why?)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 158: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Lemma: If G is in Chomsky normal form, |w| = n,and w is generated by G, then w has a derivation oflength 2n− 1 or less.

We won’t prove this (go ahead — try it at home!).

Algorithm’s idea:

First, convert G to Chomsky normal form.

Now need only consider a finite number ofderivations – those of length 2n− 1 or less.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 159: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Lemma: If G is in Chomsky normal form, |w| = n,and w is generated by G, then w has a derivation oflength 2n− 1 or less.

We won’t prove this (go ahead — try it at home!).

Algorithm’s idea:

First, convert G to Chomsky normal form.

Now need only consider a finite number ofderivations – those of length 2n− 1 or less.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 160: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Lemma: If G is in Chomsky normal form, |w| = n,and w is generated by G, then w has a derivation oflength 2n− 1 or less.

We won’t prove this (go ahead — try it at home!).

Algorithm’s idea:

First, convert G to Chomsky normal form.

Now need only consider a finite number ofderivations – those of length 2n− 1 or less.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 161: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Theorem: ACFG is a decidable language.

On input 〈G,w〉, where G is a grammar and w astring,

1. Convert G to Chomsky normal form.

2. List all derivations with 2n− 1 steps, weren = |w|.

3. If any generates w, accept, otherwise reject. ♣

Remarks:

related to problem of compiling prog. languages

would you want to use this algorithm at work?

every theorem about CFLs is also about PDAs.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.45

Page 162: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Theorem: ACFG is a decidable language.

On input 〈G,w〉, where G is a grammar and w astring,

1. Convert G to Chomsky normal form.

2. List all derivations with 2n− 1 steps, weren = |w|.

3. If any generates w, accept, otherwise reject. ♣

Remarks:

related to problem of compiling prog. languages

would you want to use this algorithm at work?

every theorem about CFLs is also about PDAs.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.45

Page 163: Turing Machine – More Definition and Examples Notion of an ...bchor/CM/Compute7.pdf · some deterministic Turing machine decides it. Theorem: A language is decidable if and only

Decidability of CFG Generation (3)

Theorem: ACFG is a decidable language.

On input 〈G,w〉, where G is a grammar and w astring,

1. Convert G to Chomsky normal form.

2. List all derivations with 2n− 1 steps, weren = |w|.

3. If any generates w, accept, otherwise reject. ♣

Remarks:

related to problem of compiling prog. languages

would you want to use this algorithm at work?

every theorem about CFLs is also about PDAs.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.45