All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The rule “certainty is not overruled by doubt” is included in most of the chapters of jurisprudence, and it is impossible to enumerate the issues related to it.
For example, if someone performed ablution, and then he doubts whether he invalidated his ablution or not; in this case, he acts according to certainty, which is that he is still in the state of purity, and he leaves the doubt.
Imam As-Suyooti mentioned this rule in Al-Ashbaah wan-Nathaa-ir and stated examples about it, whereupon he said:
“Rule two: Certainty is not overruled by doubt. The evidence for it is the saying of the Prophet : “If one of you feels disturbance in his stomach and doubts whether he has released some wind or not, then he should not leave the mosque unless he hears its sound or smells (its) odor.” [Muslim]
The Prophet also said: “When anyone of you is in doubt about his prayer and does not know how many he has prayed, three or four (Rak'ahs), then he should cast aside his doubt and base his prayer on what he is sure of.” [Muslim]” [End of quote from Al-Ashbaah wan-Nathaa-ir by As-Suyooti]
Allah knows best.