In the United States, where execution is popular, people are oddly squeamish about executing criminals who are insane or mentally deficient. It's said that they might not understand what's happening to them. Surely this is muddled thinking.
The sort of punishment we apply to children is intended to teach them not to repeat the offence: if the child doesn't understand and doesn't learn, the punishment is ineffective and pointless.
But execution is a treatment, not a punishment. It works by physically preventing the criminal from repeating the crime. It's equally effective whether he understands it or not.
It's quite ludicrous that murderers should be claiming insanity in order to escape execution. Murderers are executed (in some countries) because they're a danger to the public as long as they're alive, but they're no longer a danger when they're dead. Does anyone believe that an insane murderer is a lesser danger than a sane one?