The terms "not guilty by reason of insanity" and "not competent to stand trial" have been popularised by television courtroom dramas. But what exactly do these terms mean, and do they have a role in real-life courtrooms?