38
Turing Machine accepting {zz | z {a, b} } Tracing strings aabb & bb by Brian Morales

Turing Machine accepting { zz | z ∈ {a, b}∗}

  • Upload
    sook

  • View
    22

  • Download
    0

Embed Size (px)

DESCRIPTION

Turing Machine accepting { zz | z ∈ {a, b}∗} . Tracing strings aabb & bb by Brian Morales. let’s trace this TM on the string aabb to show rejection. Begin from the initial configuration:. q 0 ∆ aabb. ∆/∆, R  input symbol is ∆ / replace it with ∆ and move the state to the right. - PowerPoint PPT Presentation

Citation preview

Page 1: Turing Machine accepting { zz  | z ∈ {a, b}∗}

Turing Machine accepting{zz | z {a, b} } ∈ ∗Tracing strings aabb & bb

byBrian Morales

Page 2: Turing Machine accepting { zz  | z ∈ {a, b}∗}

let’s trace this TM on the string aabb to show rejection. Begin from the initial configuration:q0∆aabb

Page 3: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆/∆, R input symbol is ∆ / replace it with ∆ and move the state to the rightq0∆aabb Ⱶ ∆q1aabb

Page 4: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/A, R input symbol is a / replace it with A and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb

Page 5: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/a, R input symbol is a / replace it with a and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb

Page 6: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/b, R input symbol is b / replace it with b and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b

Page 7: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/b, R input symbol is b / replace it with b and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆

Page 8: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆/∆, L input symbol is ∆ / replace it with ∆ and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b

Page 9: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/B, L input symbol is b / replace it with B and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB

Page 10: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/b, L input symbol is b / replace it with b and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB

Page 11: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/a, L input symbol is a / replace it with a and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB

Page 12: Turing Machine accepting { zz  | z ∈ {a, b}∗}

A/A, R input symbol is A / replace it with A and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB

Page 13: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/A, R input symbol is a / replace it with A and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB

Page 14: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/b, R input symbol is b / replace it with b and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B

Page 15: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B/B, L input symbol is B / replace it with B and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB

Page 16: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/B, L input symbol is b / replace it with B and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB

Page 17: Turing Machine accepting { zz  | z ∈ {a, b}∗}

A/A, R input symbol is A / replace it with A and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB

Page 18: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B/B, L input symbol is B / replace it with B and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB

Page 19: Turing Machine accepting { zz  | z ∈ {a, b}∗}

A/a, L input symbol is A / replace it with a and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB

Page 20: Turing Machine accepting { zz  | z ∈ {a, b}∗}

A/a, L input symbol is A / replace it with a and move the state to the leftq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB Ⱶ q5∆aaBB

Page 21: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆/∆, R input symbol is ∆ / replace it with ∆ and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB Ⱶ q5∆aaBB Ⱶ ∆q6aaBB

Page 22: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/A, R input symbol is a / replace it with A and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB Ⱶ q5∆aaBB Ⱶ ∆q6aaBB Ⱶ ∆Aq8aBB

Page 23: Turing Machine accepting { zz  | z ∈ {a, b}∗}

a/a, R input symbol is a / replace it with a and move the state to the rightq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB Ⱶ q5∆aaBB Ⱶ ∆q6aaBB Ⱶ ∆Aq8aBB Ⱶ ∆Aaq8BB

Page 24: Turing Machine accepting { zz  | z ∈ {a, b}∗}

There is nowhere to go from q8 with input B, therefore the string aabb is rejected by this TMq0∆aabb Ⱶ ∆q1aabb Ⱶ ∆Aq2abb Ⱶ ∆Aaq2bb Ⱶ ∆Aabq2b Ⱶ ∆Aabbq2∆ Ⱶ ∆Aabq3b Ⱶ ∆Aaq4bB Ⱶ ∆Aq4abB Ⱶ ∆q4AabB Ⱶ ∆Aq1abB Ⱶ ∆AAq2bB Ⱶ ∆AAbq2B Ⱶ ∆AAq3bB Ⱶ ∆Aq4ABB Ⱶ ∆AAq1BB Ⱶ ∆Aq5ABB Ⱶ ∆q5AaBB Ⱶ q5∆aaBB Ⱶ ∆q6aaBB Ⱶ ∆Aq8aBB Ⱶ ∆Aaq8BB Ⱶ ∆AahrBB (reject)

Accept only if state ha is reached!

Page 25: Turing Machine accepting { zz  | z ∈ {a, b}∗}

let’s trace this TM on the string bb to show acceptance. Begin from the initial configuration:q0∆bb

Page 26: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆/∆, R input symbol is ∆ / replace it with ∆ and move the state to the rightq0∆bb Ⱶ ∆q1bb

Page 27: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/B, R input symbol is b / replace it with B and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b

Page 28: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b/b, R input symbol is b / replace it with b and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆

Page 29: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆ / ∆, L input symbol is ∆ / replace it with ∆ and move the state to the leftq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b

Page 30: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b / B, L input symbol is b / replace it with B and move the state to the leftq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB

Page 31: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B / B, R input symbol is B / replace it with B and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B

Page 32: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B / B, L input symbol is B / replace it with B and move the state to the leftq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB

Page 33: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B / b, L input symbol is B / replace it with b and move the state to the leftq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB

Page 34: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆ / ∆, R input symbol is ∆ / replace it with ∆ and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB Ⱶ ∆q6bB

Page 35: Turing Machine accepting { zz  | z ∈ {a, b}∗}

b / B, R input symbol is b / replace it with B and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB Ⱶ ∆q6bB Ⱶ ∆Bq7B

Page 36: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B / ∆, L input symbol is B / replace it with ∆ and move the state to the leftq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB Ⱶ ∆q6bB Ⱶ ∆Bq7B Ⱶ ∆q9B

Page 37: Turing Machine accepting { zz  | z ∈ {a, b}∗}

B / B, R input symbol is B / replace it with B and move the state to the rightq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB Ⱶ ∆q6bB Ⱶ ∆Bq7B Ⱶ ∆q9B Ⱶ ∆Bq6∆

Page 38: Turing Machine accepting { zz  | z ∈ {a, b}∗}

∆ / ∆, S input symbol is ∆ / replace it with ∆ and halt. String bb is accepted by this TMq0∆bb Ⱶ ∆q1bb Ⱶ ∆Bq2b Ⱶ ∆Bbq2∆ Ⱶ ∆Bq3b Ⱶ ∆q4BB Ⱶ ∆Bq1B Ⱶ ∆q5BB Ⱶ q5∆bB Ⱶ ∆q6bB Ⱶ ∆Bq7B Ⱶ ∆q9B Ⱶ ∆Bq6∆ Ⱶ ∆Bha∆ (accept)