Fiqh-us-Sunnah Volume 3, Zakaat and Fasting, Fiqh 3.114A.

Section : Essential elements of fasting, the fast of the insane.

Fasting is not obligatory for the insane because of their inability to understand what they are doing. ‘Ali reported that the Prophet, upon whom be peace, said: “The pen is raised for three groups [of people] – that is, they will not be responsible for their actions: the insane until they become sane, those who are sleeping until they awaken, and the young until they reach puberty.” This is related by Ahmad, Abu Dawud, and at-Tirmizhi.