Sunnan Abu Dawud Collection: ::Book Number 38:: Hadith # 4385
Narrated Ali ibn AbuTalib: Ibn Abbas said: A lunatic woman who had committed adultery was brought to Umar. He consulted the people and ordered that she should be stoned. Ali ibn AbuTalib passed by and said: What is the matter with this (woman)? They said: This is a lunatic woman belonging to a certain family. She has committed adultery. Umar has given orders that she should be stoned. He said: Take her back. He then came to him and said: Commander of the Faithful, do you not know that there are three people whose actions are not recorded: a lunatic till he is restored to reason, a sleeper till he awakes, and a boy till he reaches puberty? He said: Yes. He then asked: Why is it that this woman is being stoned? He said: There is nothing. He then said: Let her go. He (Umar) let her go and began to utter: Allah is most great.