A Psychopathological Approach to Safety Engineering in AI and AGI