AI can evolve to feel guilt—but only in certain social environments

Guilt is a highly advantageous quality for society as a whole. It might not prevent initial wrongdoings, but guilt allows humans to judge their own prior judgments as harmful and prevents them from happening again. The internal distress caused by feelings of guilt often—but not always—results in the person taking on some kind of penance to relieve themselves from internal turmoil. This might be something as simple as admitting their wrongdoing to others and taking on a slight stigma of someone who is morally corrupt. This upfront cost might be initially painful, but can relieve further guilt and lead to better cooperation for the group in the future.