Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
RP (complexity)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Randomized polynomial time class of computational complexity theory}} In [[computational complexity theory]], '''randomized polynomial time''' ('''RP''') is the [[complexity class]] of problems for which a [[probabilistic Turing machine]] exists with these properties: {|class="wikitable" style="float:right;text-align:center;margin-left:1em" !colspan="3"|RP algorithm (1 run) |- ! {{diagonal split header |2=Answer produced |1=Correct<br/>answer}} ! {{yes}} ! {{no}} |- ! {{yes}} | β₯ 1/2 | β€ 1/2 |- ! {{no}} | 0 | 1 |- !colspan="3"|RP algorithm (''n'' runs) |- ! {{diagonal split header |2=Answer produced |1=Correct<br/>answer}} ! {{yes}} ! {{no}} |- ! {{yes}} | β₯ 1 β 2<sup>β''n''</sup> | β€ 2<sup>β''n''</sup> |- ! {{no}} | 0 | 1 |- !colspan="3"|co-RP algorithm (1 run) |- ! {{diagonal split header |2=Answer produced |1=Correct<br/>answer}} ! {{yes}} ! {{no}} |- ! {{yes}} | 1 | 0 |- ! {{no}} | β€ 1/2 | β₯ 1/2 |} * It always runs in polynomial time in the input size * If the correct answer is NO, it always returns NO * If the correct answer is YES, then it returns YES with probability at least 1/2 (otherwise, it returns NO). In other words, the [[algorithm]] is allowed to flip a truly random coin while it is running. The only case in which the algorithm can return YES is if the actual answer is YES; therefore if the algorithm terminates and produces YES, then the correct answer is definitely YES; however, the algorithm can terminate with NO ''regardless'' of the actual answer. That is, if the algorithm returns NO, it might be wrong. Some authors call this class '''R''', although this name is more commonly used for the class of [[recursive language]]s. If the correct answer is YES and the algorithm is run ''n'' times with the result of each run [[Statistical independence|statistically independent]] of the others, then it will return YES at least once with probability at least {{math|1 β 2<sup>β''n''</sup>}}. So if the algorithm is run 100 times, then the chance of it giving the wrong answer every time is lower than the chance that cosmic rays corrupted the memory of the computer running the algorithm.<ref>This comparison is attributed to [[Michael O. Rabin]] on p. 252 of {{citation|contribution=Classifying Problems into Complexity Classes|first=William|last=Gasarch|url=http://www.cs.umd.edu/~gasarch/COURSES/452/F14/mysurvey.pdf|pages=239β292| author1-link=William Gasarch | title=Advances in Computers, Vol. 95|editor-first=Atif|editor-last=Memon|publisher=Academic Press|year=2014}}.</ref> In this sense, if a source of random numbers is available, most algorithms in '''RP''' are highly practical. The fraction 1/2 in the definition is arbitrary. The set '''RP''' will contain exactly the same problems, even if the 1/2 is replaced by any constant nonzero probability less than 1; here constant means independent of the input to the algorithm. == Formal definition == A language ''L'' is in '''RP''' if and only if there exists a [[probabilistic Turing machine]] ''M'', such that * ''M'' runs for polynomial time on all inputs * For all ''x'' in ''L'', ''M'' outputs 1 with probability greater than or equal to 1/2 * For all ''x'' not in ''L'', ''M'' outputs 0 Alternatively, '''RP''' can be defined using only deterministic Turing machines. A language ''L'' is in '''RP''' if and only if there exists a polynomial ''p'' and deterministic Turing machine ''M'', such that * ''M'' runs for polynomial time p on all inputs * For all ''x'' in ''L'', the fraction of strings ''y'' of length ''p''(|''x''|) which satisfy {{tmath|1=M(x,y) = 1}} is greater than or equal to 1/2 * For all ''x'' not in ''L'', and all strings ''y'' of length ''p''(|''x''|), {{tmath|1=M(x,y) = 0}} In this definition, the string ''y'' corresponds to the output of the random coin flips that the probabilistic Turing machine would have made. For some applications this definition is preferable since it does not mention probabilistic Turing machines. == Related complexity classes == [[File:Randomised Complexity Classes 2.svg|alt=Diagram of randomised complexity classes|thumb|upright=1.25|RP in relation to other probabilistic complexity classes ([[ZPP (complexity)|ZPP]], co-RP, [[BPP (complexity)|BPP]], [[BQP]], [[PP (complexity)|PP]]), which generalise [[P (complexity)|P]] within [[PSPACE]]. It is unknown if any of these containments are strict.]] The definition of '''RP''' says that a YES-answer is always right and that a NO-answer might be wrong, as a YES-instance can return a NO-answer. The complexity class '''co-RP''' is the complement, where a YES-answer might be wrong while a NO-answer is always right. The class '''[[Bounded-error probabilistic polynomial|BPP]]''' describes algorithms that can give incorrect answers on both YES and NO instances, and thus contains both '''RP''' and '''co-RP'''. The intersection of the sets '''RP''' and '''co-RP''' is called '''[[ZPP (complexity)|ZPP]]'''. Just as '''RP''' may be called '''R''', some authors use the name '''co-R''' rather than '''co-RP'''. == Connection to P and NP == {{unsolved|computer science|{{tmath|1= \mathsf P \overset{?}{=} \mathsf{RP} }}}} '''[[P (complexity)|P]]''' is a subset of '''RP''', which is a subset of '''[[NP (complexity)|NP]]'''. Similarly, '''P''' is a subset of '''co-RP''' which is a subset of '''[[co-NP]]'''. It is not known whether these inclusions are strict. However, if the commonly believed conjecture '''P''' = '''BPP''' is true, then '''RP''', '''co-RP''', and '''P''' collapse (are all equal). Assuming in addition that [[P = NP problem|'''P''' β '''NP''']], this then implies that '''RP''' is strictly contained in '''NP'''. It is not known whether '''RP''' = '''co-RP''', or whether '''RP''' is a subset of the intersection of '''NP''' and '''co-NP''', though this would be implied by '''P''' = '''BPP'''. A natural example of a problem in '''co-RP''' currently not known to be in '''P''' is [[Polynomial identity testing|Polynomial Identity Testing]], the problem of deciding whether a given multivariate arithmetic expression over the integers is the zero-polynomial. For instance, {{nowrap|''x''Β·''x'' β ''y''Β·''y'' β (''x'' + ''y'')Β·(''x'' β ''y'')}} is the zero-polynomial while {{nowrap|''x''Β·''x'' + ''y''Β·''y''}} is not. An alternative characterization of '''RP''' that is sometimes easier to use is the set of problems recognizable by [[nondeterministic Turing machine]]s where the machine accepts if and only if at least some constant fraction of the computation paths, independent of the input size, accept. '''NP''' on the other hand, needs only one accepting path, which could constitute an exponentially small fraction of the paths. This characterization makes the fact that '''RP''' is a subset of '''NP''' obvious. ==See also== *[[Randomized algorithm]] * '''[[BPP (complexity)|BPP]]''' * '''[[ZPP (complexity)|ZPP]]''' ==References== {{reflist}} {{refimprove|date=October 2014}} == External links== *[https://complexityzoo.net/Complexity_Zoo:R#rp RP at the Complexity Zoo] {{ComplexityClasses}} [[Category:Probabilistic complexity classes]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:ComplexityClasses
(
edit
)
Template:Diagonal split header
(
edit
)
Template:Math
(
edit
)
Template:No
(
edit
)
Template:Nowrap
(
edit
)
Template:Refimprove
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Tmath
(
edit
)
Template:Unsolved
(
edit
)
Template:Yes
(
edit
)