P, NP, PS, and NPS
By Muhannad Harrim
Class P
 P is the complexity class containing decision problems which
can be solved by a Deterministic Turing machine (DTM) using a
polynomial amount of computation time, or polynomial time.
 P is often taken to be the class of computational problems
which are "efficiently solvable" or "tractable“.
 But P also contains problems which are intractable in practical
terms; for example, some require at least n¹ºººººº operations
Deterministic Turing machine (DTM)
DTM is:
 A Turing machine model (basic symbol-manipulating
device which, despite its simplicity, can be adapted
to simulate the logic of any computer).
 Consists of a finite state control, a read/write head,
and a tape made up of a two-way infinite sequence
of tape squares (or cells).
Deterministic Turing machine (DTM)
Deterministic Turing machine (DTM)
 Hopcroft and Ullman define a one-tape Turing
machine formula: M=(Q, Γ, b, ∑, δ, qo, F) where:
 Q is a finite set of states
 Γ is a finite set of the tape alphabet/symbols
 b is the blank symbol (the only symbol allowed to occur on the tape
infinitely often at any step during the computation) - Delimiter
 Σ, a subset of Γ not including b is the set of input symbols
 δ = Q x Γ  Q x Γ x {L,R} is a partial function called the transition
function, where L is left shift, R is right shift.
 qo is the initial state
 F is the set of final or accepting states
Deterministic Turing machine (DTM)
 A DTM program M with alphabet ∑ accepts
any x: x є ∑* iff M halts in the acceptance
final state (qY) when applied input x.
 The language LM recognized by the
program M as the following:
LM = { x є ∑* : M accepts x }
Class P & DTM
A formal definition for Class P with respect to
DTM would be given as follows:
P = { L: there is a polynomial time DTM
program M for which L = LM }
Class P & DTM
Conclusion:
A decision problem π belongs to P under the
encoding scheme e if L(π, e) belongs to P,
that is if there is a polynomial time DTM that
solves π under encoding scheme e.
Class NP
The class NP is defined informally to be the class of
all decision problems π which, under reasonable
encoding schemes, can be solved “verified” by
polynomial time using Non-Deterministic Turing
machines (NDTM).
- Polynomial time verifiability doesn’t imply
polynomial time solvability.
Nondeterministic Turing machine
(NDTM)
NDTM model has exactly the same structure
of DTM except it’s featured with a guessing
module that has its own write only head.
The guessing module’s main purpose is
providing the means for writing down the
“guess” into the tape.
Nondeterministic Turing machine
(NDTM)
Nondeterministic Turing machine
(NDTM)
NDTM is also specified exactly the same way
as DTM with respect to tape alphabet, input
alphabet, blank symbol, states set, initial and
final states, and the transition function.
However, It differs from DTM in the
computation process, where in NDTM it
takes two stages: the guessing and the
checking.
Nondeterministic Turing machine
(NDTM)
If NDTM program stops at a qY then, then the
computation is considered as an accepting
computation.
Otherwise, All other computations (halting or
not) are considered to be a non-accepting
computation.
Nondeterministic Turing machine
(NDTM)
Also, a NDTM will have an infinite number of
possible computations for a given input
string x.
NDTM accepts x iff at least one of the
possible structures (computations) is an
accepting one.
LM = { x є ∑* : M accepts x }
Class NP and NDTM
A formal definition for Class NP in respect to
NDTM :
NP = { L : there is a polynomial time NDTM
program M for which LM = L }
Class NP and NDTM
Conclusion :
A decision problem π belongs to NP under
the encoding scheme e if L(π, e) belongs to
NP, that is if there is a polynomial time NDTM
that “solves” (verifies) π under encoding
scheme e.
Class P and Class NP
Class P and Class NP
A controversial question:
Is P = NP ?
Polynomial Space (PS)
 The emphasis on the computation resources
is usually on the time used to perform the
computation process (especially when
measuring a performance issue or
complexity).
 However, the amount of space required is
often just as important ( called the space
requirement ).
Polynomial Space (PS)
In any Turing machine:
– the time used is the number of steps taken before
halting or entering a final state.
– The space required is defined as the number of
distinct tape squares (cells) “visited” by the
read/write head.
Polynomial Space (PS)
Proof
Since the time taken to visit all cells < = the time used, then
the number of cells visited < = the time used.
 the number of cells visited cannot be more than the steps of
computation
This implies:
Any Polynomial Solvable in polynomial time, It’s
solvable in polynomial space.
Polynomial Space (PS)
Although all problems solvable in polynomial
time can be solved in polynomial space, it is
still a controversial and unresolved question
whether there exist problems solvable in
polynomial space which cannot be solved in
polynomial time.
- This is so difficult to conclude since all problems in NP,
including P and NP-C problems are solved in both polynomial
space and polynomial time.
Polynomial Space (PS)
 PS
is the class of all languages recognizable by
polynomial space bounded DTM that halts
on all inputs.
i.e. All and Only the languages that are LM
for some polynomial space bounded DTM M.
Nondeterministic Polynomial Space
(NPS)
 NPS
is the class of all languages recognizable by
polynomial space bounded NDTM that halts
on at least one of the possible input
structures.
i.e. All and Only the languages that are LM
for some polynomial space
bounded NDTM M.
PS and NPS
Evidently, PS є NPS, since every DTM is
technically NDTM.
However, The surprising result is that:
PS = NPS
PS and NPS
Theorem
If M is a polynomial-space bounded TM
(deterministic or nondeterministic), and p(n)
is its polynomial space bound, then there is a
constant c such that if M accepts its input w
of length n, it does so within c1 + p(n) moves
PS and NPS
Proof
The essential idea is that M must repeat an ID (cell index) before
making more than c1 + p(n) moves
Having a constant c implies that there is a limited number of ID’s if
already there is a limited space used in the TM.
Let t be the number of tape symbols of M
Let s be the number of states of M
Then the number of different ID’s of M when only p(n) tape cells are
visited is at most s x p(n) x t p(n)
PS and NPS
if c = t + s, then the binomial expansion of
(t + s)1 + p(n) is t1+ p(n) + (1 + p(n)) s t p(n) + …
In the expression, notice that the underlined
term is at least as large as s p(n) t p(n)
This proves that c1 + p(n) is at least equal to
the number of possible ID’s of M
PS and NPS
M accepts w of length n with sequence of
moves that doesn’t repeat any ID
So  M accepts inputs by a sequence of
moves that is less or equal to the number of
distinct ID’s, which is c1 + p(n)
PS and NPS
Savitch’s Theorem
PS = NPS
PS and NPS
To be more accurate
Savitch’s Theorem states that any
p(n)-space NDTM can be converted to a
p2(n)-space DTM
one of the earliest results on space complexity
PS and NPS
Proof
The core of the proof lies on simulating a
NDTM that has a polynomial space bound
p(n) into a DTM with polynomial space bound
of complexity O( p2(n) )
PS and NPS
This is done through a recursive program that
tries to test whether a NDTM N can move
from ID I to ID J in at most m moves
Let’s have a function called reach(I, J, m)
that decides if I can yield to J in m moves
PS and NPS
PS and NPS
PS and NPS
Assumptions
– If NDTM N accepts, it does it within c1 + p(n) steps
– Given input w of length n
– DTM D discovers what N does with input w by
calling the function reach(I0,J,m) recursively where:
 I0 is the initial ID of N with input w
 J is any accepting ID that uses at most p(n) tape cells
 m = c1 + p(n)
PS and NPS
the recursive function imposes that there will never be
more than log2 m recursive calls that are active
simultaneously
i.e one with m/2, one with m/4, … , down to 1
 So, the upper bound of the number of stack
frames is no more than log2(m) on the stack
 log2(m) is O( p(n) )
PS and NPS
 So, D contains at most log2(m) stack frames = (O( pn ))
 The stack frames themselves require log2(m) space,
the reason is that the two ID’s each require only 1+p(n)
cells to write down m, and m in binary requires log2
c1 + p(n)  log2(m) = (O( pn ))
 The total space required in D to simulate N is
log2
2(m)  which is also O( p2(n) )
PS and NPS
 The space bound of complexity O( p2(n) ) is
polynomial iff p(n) is polynomial
 p(n) is polynomial
 Then there is a polynomial space bound
DTM that corresponds to a polynomial space
bound NDTM
PS and NPS
 So, after all:
PS = NPS
PS and NPS
At the End, we conclude that:
PS and NPS

More Related Content

PPTX
NP completeness
PPT
Turing machine
PDF
UNIT-V.pdf daa unit material 5 th unit ppt
PPTX
lec2cct computational cmplexity theory.pptx
DOCX
Introduction to complexity theory assignment
PDF
Fractal dimension versus Computational Complexity
PPTX
NP-Completeness - II
PPT
timecomplexity.ppt
NP completeness
Turing machine
UNIT-V.pdf daa unit material 5 th unit ppt
lec2cct computational cmplexity theory.pptx
Introduction to complexity theory assignment
Fractal dimension versus Computational Complexity
NP-Completeness - II
timecomplexity.ppt

Similar to P-NP-and-the-Polynomial-Space.ppt (20)

DOC
Time and space complexity
PPTX
DAA_Hard_Problems_(4th_Sem).pptxxxxxxxxx
PPT
2009 CSBB LAB 新生訓練
PDF
QB104545.pdf
PDF
9. chapter 8 np hard and np complete problems
PDF
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
PPTX
PDF
Formal Languages and Automata Theory unit 5
PPT
PDF
Basic_concepts_NP_Hard_NP_Complete.pdf
PPT
Turing machine power point presentations
PPT
2010 3-24 cryptography stamatiou
PDF
practice-final-soln.pdf
PPTX
Lower bound theory Np hard & Np completeness
PDF
L1_TMs_Primitive_Godel.pdf Theory of com
PPTX
FOrmalLanguage and Automata -undecidability.pptx
PPT
Np completeness h4
PPTX
01 - DAA - PPT.pptx
Time and space complexity
DAA_Hard_Problems_(4th_Sem).pptxxxxxxxxx
2009 CSBB LAB 新生訓練
QB104545.pdf
9. chapter 8 np hard and np complete problems
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
Formal Languages and Automata Theory unit 5
Basic_concepts_NP_Hard_NP_Complete.pdf
Turing machine power point presentations
2010 3-24 cryptography stamatiou
practice-final-soln.pdf
Lower bound theory Np hard & Np completeness
L1_TMs_Primitive_Godel.pdf Theory of com
FOrmalLanguage and Automata -undecidability.pptx
Np completeness h4
01 - DAA - PPT.pptx
Ad

Recently uploaded (20)

PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
How to Odoo 19 Installation on Ubuntu - CandidRoot
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Lecture 5 Software Requirement Engineering
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Microsoft Office 365 Crack Download Free
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Computer Software - Technology and Livelihood Education
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Practical Indispensable Project Management Tips for Delivering Successful Exp...
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
How to Odoo 19 Installation on Ubuntu - CandidRoot
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Trending Python Topics for Data Visualization in 2025
GSA Content Generator Crack (2025 Latest)
Lecture 5 Software Requirement Engineering
Full-Stack Developer Courses That Actually Land You Jobs
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
MCP Security Tutorial - Beginner to Advanced
Microsoft Office 365 Crack Download Free
BoxLang Dynamic AWS Lambda - Japan Edition
CCleaner 6.39.11548 Crack 2025 License Key
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
CNN LeNet5 Architecture: Neural Networks
iTop VPN Crack Latest Version Full Key 2025
Computer Software - Technology and Livelihood Education
Ad

P-NP-and-the-Polynomial-Space.ppt

  • 1. P, NP, PS, and NPS By Muhannad Harrim
  • 2. Class P  P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine (DTM) using a polynomial amount of computation time, or polynomial time.  P is often taken to be the class of computational problems which are "efficiently solvable" or "tractable“.  But P also contains problems which are intractable in practical terms; for example, some require at least n¹ºººººº operations
  • 3. Deterministic Turing machine (DTM) DTM is:  A Turing machine model (basic symbol-manipulating device which, despite its simplicity, can be adapted to simulate the logic of any computer).  Consists of a finite state control, a read/write head, and a tape made up of a two-way infinite sequence of tape squares (or cells).
  • 5. Deterministic Turing machine (DTM)  Hopcroft and Ullman define a one-tape Turing machine formula: M=(Q, Γ, b, ∑, δ, qo, F) where:  Q is a finite set of states  Γ is a finite set of the tape alphabet/symbols  b is the blank symbol (the only symbol allowed to occur on the tape infinitely often at any step during the computation) - Delimiter  Σ, a subset of Γ not including b is the set of input symbols  δ = Q x Γ  Q x Γ x {L,R} is a partial function called the transition function, where L is left shift, R is right shift.  qo is the initial state  F is the set of final or accepting states
  • 6. Deterministic Turing machine (DTM)  A DTM program M with alphabet ∑ accepts any x: x є ∑* iff M halts in the acceptance final state (qY) when applied input x.  The language LM recognized by the program M as the following: LM = { x є ∑* : M accepts x }
  • 7. Class P & DTM A formal definition for Class P with respect to DTM would be given as follows: P = { L: there is a polynomial time DTM program M for which L = LM }
  • 8. Class P & DTM Conclusion: A decision problem π belongs to P under the encoding scheme e if L(π, e) belongs to P, that is if there is a polynomial time DTM that solves π under encoding scheme e.
  • 9. Class NP The class NP is defined informally to be the class of all decision problems π which, under reasonable encoding schemes, can be solved “verified” by polynomial time using Non-Deterministic Turing machines (NDTM). - Polynomial time verifiability doesn’t imply polynomial time solvability.
  • 10. Nondeterministic Turing machine (NDTM) NDTM model has exactly the same structure of DTM except it’s featured with a guessing module that has its own write only head. The guessing module’s main purpose is providing the means for writing down the “guess” into the tape.
  • 12. Nondeterministic Turing machine (NDTM) NDTM is also specified exactly the same way as DTM with respect to tape alphabet, input alphabet, blank symbol, states set, initial and final states, and the transition function. However, It differs from DTM in the computation process, where in NDTM it takes two stages: the guessing and the checking.
  • 13. Nondeterministic Turing machine (NDTM) If NDTM program stops at a qY then, then the computation is considered as an accepting computation. Otherwise, All other computations (halting or not) are considered to be a non-accepting computation.
  • 14. Nondeterministic Turing machine (NDTM) Also, a NDTM will have an infinite number of possible computations for a given input string x. NDTM accepts x iff at least one of the possible structures (computations) is an accepting one. LM = { x є ∑* : M accepts x }
  • 15. Class NP and NDTM A formal definition for Class NP in respect to NDTM : NP = { L : there is a polynomial time NDTM program M for which LM = L }
  • 16. Class NP and NDTM Conclusion : A decision problem π belongs to NP under the encoding scheme e if L(π, e) belongs to NP, that is if there is a polynomial time NDTM that “solves” (verifies) π under encoding scheme e.
  • 17. Class P and Class NP
  • 18. Class P and Class NP A controversial question: Is P = NP ?
  • 19. Polynomial Space (PS)  The emphasis on the computation resources is usually on the time used to perform the computation process (especially when measuring a performance issue or complexity).  However, the amount of space required is often just as important ( called the space requirement ).
  • 20. Polynomial Space (PS) In any Turing machine: – the time used is the number of steps taken before halting or entering a final state. – The space required is defined as the number of distinct tape squares (cells) “visited” by the read/write head.
  • 21. Polynomial Space (PS) Proof Since the time taken to visit all cells < = the time used, then the number of cells visited < = the time used.  the number of cells visited cannot be more than the steps of computation This implies: Any Polynomial Solvable in polynomial time, It’s solvable in polynomial space.
  • 22. Polynomial Space (PS) Although all problems solvable in polynomial time can be solved in polynomial space, it is still a controversial and unresolved question whether there exist problems solvable in polynomial space which cannot be solved in polynomial time. - This is so difficult to conclude since all problems in NP, including P and NP-C problems are solved in both polynomial space and polynomial time.
  • 23. Polynomial Space (PS)  PS is the class of all languages recognizable by polynomial space bounded DTM that halts on all inputs. i.e. All and Only the languages that are LM for some polynomial space bounded DTM M.
  • 24. Nondeterministic Polynomial Space (NPS)  NPS is the class of all languages recognizable by polynomial space bounded NDTM that halts on at least one of the possible input structures. i.e. All and Only the languages that are LM for some polynomial space bounded NDTM M.
  • 25. PS and NPS Evidently, PS є NPS, since every DTM is technically NDTM. However, The surprising result is that: PS = NPS
  • 26. PS and NPS Theorem If M is a polynomial-space bounded TM (deterministic or nondeterministic), and p(n) is its polynomial space bound, then there is a constant c such that if M accepts its input w of length n, it does so within c1 + p(n) moves
  • 27. PS and NPS Proof The essential idea is that M must repeat an ID (cell index) before making more than c1 + p(n) moves Having a constant c implies that there is a limited number of ID’s if already there is a limited space used in the TM. Let t be the number of tape symbols of M Let s be the number of states of M Then the number of different ID’s of M when only p(n) tape cells are visited is at most s x p(n) x t p(n)
  • 28. PS and NPS if c = t + s, then the binomial expansion of (t + s)1 + p(n) is t1+ p(n) + (1 + p(n)) s t p(n) + … In the expression, notice that the underlined term is at least as large as s p(n) t p(n) This proves that c1 + p(n) is at least equal to the number of possible ID’s of M
  • 29. PS and NPS M accepts w of length n with sequence of moves that doesn’t repeat any ID So  M accepts inputs by a sequence of moves that is less or equal to the number of distinct ID’s, which is c1 + p(n)
  • 30. PS and NPS Savitch’s Theorem PS = NPS
  • 31. PS and NPS To be more accurate Savitch’s Theorem states that any p(n)-space NDTM can be converted to a p2(n)-space DTM one of the earliest results on space complexity
  • 32. PS and NPS Proof The core of the proof lies on simulating a NDTM that has a polynomial space bound p(n) into a DTM with polynomial space bound of complexity O( p2(n) )
  • 33. PS and NPS This is done through a recursive program that tries to test whether a NDTM N can move from ID I to ID J in at most m moves Let’s have a function called reach(I, J, m) that decides if I can yield to J in m moves
  • 36. PS and NPS Assumptions – If NDTM N accepts, it does it within c1 + p(n) steps – Given input w of length n – DTM D discovers what N does with input w by calling the function reach(I0,J,m) recursively where:  I0 is the initial ID of N with input w  J is any accepting ID that uses at most p(n) tape cells  m = c1 + p(n)
  • 37. PS and NPS the recursive function imposes that there will never be more than log2 m recursive calls that are active simultaneously i.e one with m/2, one with m/4, … , down to 1  So, the upper bound of the number of stack frames is no more than log2(m) on the stack  log2(m) is O( p(n) )
  • 38. PS and NPS  So, D contains at most log2(m) stack frames = (O( pn ))  The stack frames themselves require log2(m) space, the reason is that the two ID’s each require only 1+p(n) cells to write down m, and m in binary requires log2 c1 + p(n)  log2(m) = (O( pn ))  The total space required in D to simulate N is log2 2(m)  which is also O( p2(n) )
  • 39. PS and NPS  The space bound of complexity O( p2(n) ) is polynomial iff p(n) is polynomial  p(n) is polynomial  Then there is a polynomial space bound DTM that corresponds to a polynomial space bound NDTM
  • 40. PS and NPS  So, after all: PS = NPS
  • 41. PS and NPS At the End, we conclude that: