The legal code can never include every sensible prior and so forth.

There's a general principle that "diminished capacity" (age, impairment, etc.) means that the "offender" isn't responsible (or at least not to the same degree). They don't have to write that into every statute.

Cheers,
Scott.