Hadith 12.2
Marriage
Ali reported God’s Messenger as saying, “There are three whose actions are not recorded:
a sleeper till he awakes, a boy till he reaches puberty, and an idiot till he is restored to reason.” Tirmidhi and Abu Dawud transmitted it. Darimi transmitted it on the authority of 'A’isha, and Ibn Majah on the authority of both (i.e. ‘Ali and ‘A’isha’)
وَعَنْ عَلِيٍّ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ:
رُفِعَ الْقَلَمُ عَنْ ثَلَاثَةٍ: عَنِ النَّائِمِ حَتَّى يَسْتَيْقِظَ وَعَنِ الصَّبِيِّ حَتَّى يَبْلُغَ وَعَنِ الْمَعْتُوهِ حَتَّى يعقل
Hadith gradings, numbering and translations can differ between editions. For legal rulings or detailed interpretation, consult qualified scholarship and the referenced edition.