  The Petz recovery channel plays an important role in quantum information
science as an operation that approximately reverses the effect of a quantum
channel. The pretty good measurement is a special case of the Petz recovery
channel, and it allows for near-optimal state discrimination. A hurdle to the
experimental realization of these vaunted theoretical tools is the lack of a
systematic and efficient method to implement them. This paper sets out to
rectify this lack: using the recently developed tools of quantum singular value
transformation and oblivious amplitude amplification, we provide a quantum
algorithm to implement the Petz recovery channel when given the ability to
perform the channel that one wishes to reverse. Moreover, we prove that, in
some sense, our quantum algorithm's usage of the channel implementation cannot
be improved by more than a quadratic factor. Our quantum algorithm also
provides a procedure to perform pretty good measurements when given multiple
copies of the states that one is trying to distinguish.
