Prescribed Punishments (Kitab Al-Hudud)
Dawud :: Book 38 : Hadith 4387
Narrated Ali ibn AbuTalib:
Ibn Abbas said: A lunatic woman passed by Ali ibn AbuTalib. He then mentioned the rest of the tradition to the same effect as Uthman mentioned. This version has: Do you not remember that the Apostle of Allah (peace_be_upon_him) has said: There are three whose actions are not recorded: a lunatic whose mind is deranged till he is restored to consciousness, a sleeper till he awakes, and a boy till he reaches puberty?