SlideShare a Scribd company logo
18.404/6.840 Lecture 21
Last time:
- Log-space reducibility
- L = NL? question
- is NL-complete
- is NL-complete
- NL = coNL (unfinished)
Today: (Sipser §9.1)
- Finish NL = coNL
- Time and Space Hierarchy Theorems
1
Theorem (Immerman-Szelepcsényi): NL = coNL
Proof: Show NL
Defn: NTM computes function if for all
1) All branches of on halt with on the tape or reject.
2) Some branch of on does not reject.
Let
Let YES}
Let
= Reachable nodes
= # reachable
YES, if has a path from to
NO, if not
Theorem: If some NL-machine (log-space NTM)
computes , then some NL-machine computes .
Proof: “On input
1. Let
2. For each node
3. If YES, then
4. If NO, then continue
5. Output ”
Next: Converse of above
𝐺
𝑠
𝑅
𝑐=¿𝑅∨¿
NL = coNL (part 1/4)
Check-in 21.1
Check-in 21.1
Let be the graph below.
What is the value of ?
(a) 2 (e) 6
(b) 3 (f) 7
(c) 4 (g) 8
(d) 5 (h) 9
𝑠
𝐺=¿
2
NL = coNL (part 2/4) – key idea
Theorem: If some NL-machine computes , then some NL-machine computes .
Proof: “On input where has nodes
1. Compute
2.
3. For each node
4. Nondeterministically go to (p) or (n)
(p) Nondeterministically pick a path from to of length .
If fail, then reject.
If , then output YES, else set .
(n) Skip and continue.
5. If then reject.
6. Output NO.” [found all reachable nodes and none were }
𝐺
𝑠
𝑅
𝑐=¿𝑅∨¿
3
NL = coNL (part 2/4) – key idea
SIMPLIFIED!!
Theorem: If some NL-machine computes , then some NL-machine computes .
Proof: “On input where has nodes
1. Compute
2.
3. For each node
4. Nondeterministically pick a path from of length .
If it ends at then output YES and stop.
If it ends at , set .
5. If then reject.
6. Output NO.” [found all reachable nodes and none were }
𝐺
𝑠
𝑅
𝑐=¿𝑅∨¿
4
NL = coNL (part 3/4)
Theorem: If some NL-machine computes , then some NL-machine computes .
Proof: “On input
1. Compute
2.
3. For each node
4. Nondeterministically go to (p) or (n)
(p) Nondeterministically pick a path from to of length .
If fail, then reject.
If , then output YES, else set .
(n) Skip and continue.
5. If then reject.
6. Output NO” [found all reachable nodes and none were }
𝐺
𝑠
𝑅𝑑
𝑐𝑑=¿𝑅𝑑∨¿
Let
Let YES}
Let
YES, if has a path to of length
NO, if not
5
NL = coNL (part 4/4)
Theorem: If some NL-machine computes , then some NL-machine computes .
Proof: “On input
1. Compute
2.
3. For each node
4. Nondeterministically go to (p) or (n)
(p) Nondeterministically pick a path from to of length .
If fail, then reject.
If has an edge to , then output YES, else set .
(n) Skip and continue.
5. If then reject.
6. Output NO.” [found all reachable nodes
and none had an edge to }
𝐺
𝑠
𝑅𝑑
𝑐𝑑+1=¿ 𝑅𝑑+1∨¿
𝑅𝑑+ 1
𝑐𝑑=¿𝑅𝑑∨¿
Corollary: Some NL-machine computes from .
Hence NL
“On input
1. .
2. Compute each from for to .
3. Accept if = NO.
4. Reject if = YES.”
6
L NL P NP PSPACE
Review: Major Complexity Classes
≠
Today
The time and space hierarchy theorems show that
if a TM is given more time (or space) then it can do more.*
* certain restrictions apply.
For example:
TIME TIME [ means proper subset ]
SPACE SPACE
7
Space Hierarchy Theorem (1/2)
Theorem: For any (where satisfies a technical condition)
there is a language where requires space, i.e,
1) is decidable in space, and
2) is not decidable in space
On other words, SPACE SPACE
Notation: SPACEsome TM decides in space
SPACE
SPACE
𝐴
Proof outline: (Diagonalization)
Give TM where
1) runs in space
2) ensures that for
every TM that runs in space.
Let .
8
Goal: Exhibit SPACE but SPACE
Give where and
1) runs in space
2) ensures that
for every TM that runs in space.
“On input
1. Mark off tape cells where .
If ever try to use more tape, reject.
2. If for some TM , reject.
3. Simulate* on for steps
Accept if rejects,
Reject if accepts or hasn’t halted.”
*Note: can simulate with a constant factor
space overhead.
Space Hierarchy Theorem (2/2)
Issues:
1. What if runs in space but has
a big constant? Then won’t have space
to simulate when is small.
FIX: simulate on infinitely many .
2. What if loops? [ must always halt]
FIX: Stop if it runs for steps.
3. How to compute ?
FIX: Assume is space constructible,
i.e., can compute within space.
Nice functions like , , , , , …
are all space constructible.
Mark off
tape
⋯ 𝑤 ⋯ #
𝑤=010110⋯10100000
〈 𝑀〉
𝑛
𝑓 (𝑛)
𝐷
Hide me →
Check-in 21.2
Check-in 21.2
What happens when we run on input ?
a) It loops
b) It accepts
c) It rejects
d) We get a contradiction
e) Smoke comes out
9
Time Hierarchy Theorem (1/2)
Theorem: For any where is time constructible
there is a language where requires time, i.e,
1) is decidable in time, and
2) is not decidable in time
On other words, TIME TIME
Proof outline: Give TM where
1) runs in time
2) ensures that for every TM that runs in time .
Let .
10
Goal: Exhibit TIME but TIME
where
1) runs in time
2) ensures that for every TM
that runs in time.
“On input
1. Compute .
2. If for some TM , reject.
3. Simulate* on for steps.
Accept if rejects,
Reject if accepts or hasn’t halted.”
*Note: can simulate with a log factor
time overhead due to the step counter.
Time Hierarchy Theorem (2/2)
Why do we lose a factor of ?
must halt within time.
To do so, counts the number of steps it uses and
stops if the limit is exceeded. The counter has
size and is stored on the tape.
It must be kept near the current head location.
Cost of moving it adds a overhead factor. So to
halt within time, stops when the counter reaches
.
11
L NL P NP PSPACE
Recap: Separating Complexity Classes
≠
Space Hierarchy Theorem
NL SPACE SPACE PSPACE
Check-in 21.3
Check-in 21.3
Consider these two famous unsolved questions:
1. Does L = P?
2. Does P = PSPACE?
What do the hierarchy theorems tell us about
these questions?
a) Nothing
b) At least one of these has answer “NO”
c) At least one of these has answer “YES”
12
Quick review of today
1. Finish NL = coNL
2. Space hierarchy theorem
3. Time hierarchy theorem
13
MIT OpenCourseWare
https://ocw.mit.edu
18.404J Theory of Computation
Fall 2020
For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.

More Related Content

PPTX
Lecture-12-CS345A-2023 of Design and Analysis
PPTX
Mar25.pptx
PPT
Turing machine power point presentations
PPTX
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
PDF
Time Complexity of Algorithm (Analysis).pdf
PDF
Data Structure & Algorithms - Mathematical
PPTX
Dynamic Programming - Laughlin Lunch and Learn
PPT
Lecture-12-CS345A-2023 of Design and Analysis
Mar25.pptx
Turing machine power point presentations
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
Time Complexity of Algorithm (Analysis).pdf
Data Structure & Algorithms - Mathematical
Dynamic Programming - Laughlin Lunch and Learn

Similar to Finite automata and formal language lecture note (20)

PPTX
shell and merge sort
 
PDF
Recurrent Neural Networks II (D2L3 Deep Learning for Speech and Language UPC ...
PPTX
Lecture 11.2 : sorting
PPTX
Linear Programming- Leacture-16-lp1.pptx
PPT
Shell sort[1]
PPT
Iteration
PPT
UNIT-V.ppt
PPTX
NP completeness
PDF
Anu DAA i1t unit
PDF
PPTX
algorothm,
PPTX
Algorothm,
ODP
Simulation-based optimization: Upper Confidence Tree and Direct Policy Search
PPTX
TheoryOfComputaionNonDeterministic1.pptx
PDF
Formal language & automata theory
PDF
lecture1 .pdf introduction to algorithms
PPT
Design and analysis of algorithm in Computer Science
PPT
2010 3-24 cryptography stamatiou
PPTX
Data Structures and Algorithms for placements
PPTX
Class 16: Making Loops
shell and merge sort
 
Recurrent Neural Networks II (D2L3 Deep Learning for Speech and Language UPC ...
Lecture 11.2 : sorting
Linear Programming- Leacture-16-lp1.pptx
Shell sort[1]
Iteration
UNIT-V.ppt
NP completeness
Anu DAA i1t unit
algorothm,
Algorothm,
Simulation-based optimization: Upper Confidence Tree and Direct Policy Search
TheoryOfComputaionNonDeterministic1.pptx
Formal language & automata theory
lecture1 .pdf introduction to algorithms
Design and analysis of algorithm in Computer Science
2010 3-24 cryptography stamatiou
Data Structures and Algorithms for placements
Class 16: Making Loops
Ad

More from wazakerforazkar (6)

PPTX
Professional ethics in Artificial intelligence
PPTX
التعلم النشط والذاتي والتعاوني والاستراتيجيات
PPT
التعلم النشط والاستراتيجيات والعصف الذهني
PDF
Presentation[1]---------------------.pdf
PDF
Project Presentation-----------------.pdf
PDF
Professional Ethics------------------.pdf
Professional ethics in Artificial intelligence
التعلم النشط والذاتي والتعاوني والاستراتيجيات
التعلم النشط والاستراتيجيات والعصف الذهني
Presentation[1]---------------------.pdf
Project Presentation-----------------.pdf
Professional Ethics------------------.pdf
Ad

Recently uploaded (20)

PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Trump Administration's workforce development strategy
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PDF
Classroom Observation Tools for Teachers
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Complications of Minimal Access Surgery at WLH
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
IGGE1 Understanding the Self1234567891011
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
Introduction to Building Materials
PPTX
Final Presentation General Medicine 03-08-2024.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Trump Administration's workforce development strategy
Indian roads congress 037 - 2012 Flexible pavement
Digestion and Absorption of Carbohydrates, Proteina and Fats
Classroom Observation Tools for Teachers
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Complications of Minimal Access Surgery at WLH
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Chinmaya Tiranga quiz Grand Finale.pdf
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Orientation - ARALprogram of Deped to the Parents.pptx
IGGE1 Understanding the Self1234567891011
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Introduction to Building Materials
Final Presentation General Medicine 03-08-2024.pptx

Finite automata and formal language lecture note

  • 1. 18.404/6.840 Lecture 21 Last time: - Log-space reducibility - L = NL? question - is NL-complete - is NL-complete - NL = coNL (unfinished) Today: (Sipser §9.1) - Finish NL = coNL - Time and Space Hierarchy Theorems 1
  • 2. Theorem (Immerman-Szelepcsényi): NL = coNL Proof: Show NL Defn: NTM computes function if for all 1) All branches of on halt with on the tape or reject. 2) Some branch of on does not reject. Let Let YES} Let = Reachable nodes = # reachable YES, if has a path from to NO, if not Theorem: If some NL-machine (log-space NTM) computes , then some NL-machine computes . Proof: “On input 1. Let 2. For each node 3. If YES, then 4. If NO, then continue 5. Output ” Next: Converse of above 𝐺 𝑠 𝑅 𝑐=¿𝑅∨¿ NL = coNL (part 1/4) Check-in 21.1 Check-in 21.1 Let be the graph below. What is the value of ? (a) 2 (e) 6 (b) 3 (f) 7 (c) 4 (g) 8 (d) 5 (h) 9 𝑠 𝐺=¿ 2
  • 3. NL = coNL (part 2/4) – key idea Theorem: If some NL-machine computes , then some NL-machine computes . Proof: “On input where has nodes 1. Compute 2. 3. For each node 4. Nondeterministically go to (p) or (n) (p) Nondeterministically pick a path from to of length . If fail, then reject. If , then output YES, else set . (n) Skip and continue. 5. If then reject. 6. Output NO.” [found all reachable nodes and none were } 𝐺 𝑠 𝑅 𝑐=¿𝑅∨¿ 3
  • 4. NL = coNL (part 2/4) – key idea SIMPLIFIED!! Theorem: If some NL-machine computes , then some NL-machine computes . Proof: “On input where has nodes 1. Compute 2. 3. For each node 4. Nondeterministically pick a path from of length . If it ends at then output YES and stop. If it ends at , set . 5. If then reject. 6. Output NO.” [found all reachable nodes and none were } 𝐺 𝑠 𝑅 𝑐=¿𝑅∨¿ 4
  • 5. NL = coNL (part 3/4) Theorem: If some NL-machine computes , then some NL-machine computes . Proof: “On input 1. Compute 2. 3. For each node 4. Nondeterministically go to (p) or (n) (p) Nondeterministically pick a path from to of length . If fail, then reject. If , then output YES, else set . (n) Skip and continue. 5. If then reject. 6. Output NO” [found all reachable nodes and none were } 𝐺 𝑠 𝑅𝑑 𝑐𝑑=¿𝑅𝑑∨¿ Let Let YES} Let YES, if has a path to of length NO, if not 5
  • 6. NL = coNL (part 4/4) Theorem: If some NL-machine computes , then some NL-machine computes . Proof: “On input 1. Compute 2. 3. For each node 4. Nondeterministically go to (p) or (n) (p) Nondeterministically pick a path from to of length . If fail, then reject. If has an edge to , then output YES, else set . (n) Skip and continue. 5. If then reject. 6. Output NO.” [found all reachable nodes and none had an edge to } 𝐺 𝑠 𝑅𝑑 𝑐𝑑+1=¿ 𝑅𝑑+1∨¿ 𝑅𝑑+ 1 𝑐𝑑=¿𝑅𝑑∨¿ Corollary: Some NL-machine computes from . Hence NL “On input 1. . 2. Compute each from for to . 3. Accept if = NO. 4. Reject if = YES.” 6
  • 7. L NL P NP PSPACE Review: Major Complexity Classes ≠ Today The time and space hierarchy theorems show that if a TM is given more time (or space) then it can do more.* * certain restrictions apply. For example: TIME TIME [ means proper subset ] SPACE SPACE 7
  • 8. Space Hierarchy Theorem (1/2) Theorem: For any (where satisfies a technical condition) there is a language where requires space, i.e, 1) is decidable in space, and 2) is not decidable in space On other words, SPACE SPACE Notation: SPACEsome TM decides in space SPACE SPACE 𝐴 Proof outline: (Diagonalization) Give TM where 1) runs in space 2) ensures that for every TM that runs in space. Let . 8
  • 9. Goal: Exhibit SPACE but SPACE Give where and 1) runs in space 2) ensures that for every TM that runs in space. “On input 1. Mark off tape cells where . If ever try to use more tape, reject. 2. If for some TM , reject. 3. Simulate* on for steps Accept if rejects, Reject if accepts or hasn’t halted.” *Note: can simulate with a constant factor space overhead. Space Hierarchy Theorem (2/2) Issues: 1. What if runs in space but has a big constant? Then won’t have space to simulate when is small. FIX: simulate on infinitely many . 2. What if loops? [ must always halt] FIX: Stop if it runs for steps. 3. How to compute ? FIX: Assume is space constructible, i.e., can compute within space. Nice functions like , , , , , … are all space constructible. Mark off tape ⋯ 𝑤 ⋯ # 𝑤=010110⋯10100000 〈 𝑀〉 𝑛 𝑓 (𝑛) 𝐷 Hide me → Check-in 21.2 Check-in 21.2 What happens when we run on input ? a) It loops b) It accepts c) It rejects d) We get a contradiction e) Smoke comes out 9
  • 10. Time Hierarchy Theorem (1/2) Theorem: For any where is time constructible there is a language where requires time, i.e, 1) is decidable in time, and 2) is not decidable in time On other words, TIME TIME Proof outline: Give TM where 1) runs in time 2) ensures that for every TM that runs in time . Let . 10
  • 11. Goal: Exhibit TIME but TIME where 1) runs in time 2) ensures that for every TM that runs in time. “On input 1. Compute . 2. If for some TM , reject. 3. Simulate* on for steps. Accept if rejects, Reject if accepts or hasn’t halted.” *Note: can simulate with a log factor time overhead due to the step counter. Time Hierarchy Theorem (2/2) Why do we lose a factor of ? must halt within time. To do so, counts the number of steps it uses and stops if the limit is exceeded. The counter has size and is stored on the tape. It must be kept near the current head location. Cost of moving it adds a overhead factor. So to halt within time, stops when the counter reaches . 11
  • 12. L NL P NP PSPACE Recap: Separating Complexity Classes ≠ Space Hierarchy Theorem NL SPACE SPACE PSPACE Check-in 21.3 Check-in 21.3 Consider these two famous unsolved questions: 1. Does L = P? 2. Does P = PSPACE? What do the hierarchy theorems tell us about these questions? a) Nothing b) At least one of these has answer “NO” c) At least one of these has answer “YES” 12
  • 13. Quick review of today 1. Finish NL = coNL 2. Space hierarchy theorem 3. Time hierarchy theorem 13
  • 14. MIT OpenCourseWare https://ocw.mit.edu 18.404J Theory of Computation Fall 2020 For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.