the prayer as Zuhr, then it is Zuhr, and the doubt thereafter has no effect. It has been versified:
Doubt after an act has been completed has no effect;
So too when doubts become frequent. (1)
Similarly, if after finishing the prayer one doubts whether he performed one prostration or two, this has no effect.
There is an important issue here: what if one intends to perform the obligatory prayer of the time without specifying which prayer it is? This occurs often. For example, a person comes for the Zuhr prayer, finds the people praying, and joins them at that time, without bringing to mind whether it is Zuhr, Fajr, Asr, Maghrib, or Isha. Rather, he only has in mind that it is the obligatory prayer of the time.
According to the madhhab, this is not sufficient for him, because he must specify either Zuhr, Asr, Maghrib, Isha, or Subh.
There is, however, a narration from Ahmad that if he intends the obligatory prayer of the time, it is sufficient. Ibn Rajab mentioned it in Jamiʿ al-ʿUlum wa al-Hikam, and some of the scholars of the madhhab preferred this view. (2)
This is the only view people can reasonably act upon, for a person often does not recall which particular prayer it is, though his intention is that it is the obligatory prayer of the time.
Issue: A man ends the Zuhr prayer after two rakʿahs, thinking it to be Fajr, then remembers. Should he complete two more rakʿahs, or begin the prayer anew?