Red, theory; black, fact.
4-04-2018: In my treatment of evil and criminality so far, I have tried to show that they sub serve either dispersal or preemptive population reduction, both valuable biological processes that tend to prolong the survival of species.
The algorithms for achieving these ends would have been created over time by some form of evolution, with probably a large component coming from a hypothetical, fast form of evolution I call post-zygotic gamete selection (PGS), where gametes -- individual cells -- are effectively the units of selection. In general, the smaller the unit of selection, the faster the adaptation. PGS may have accelerated evolution to the point where it could be detected by simple record-keeping technologies, which may have led to the first record-keeping peoples eventually realizing that "someone is looking out for us," leading to the invention of monotheism.
The genetically inherited parts of our behavior enter consciousness as emotions, and can therefore be easily identified. The main outlines of civilization are probably due to the inherited behavior component, and not to the reasoning, conscious mind, which is often just a detail-handler. How could civilization rest on a process that can't even remember what happened last weekend?
Thus, humans have a dual input to behavior, emotion and reason. The above arguments show that evil and criminality come from the emotional input. Yet the entire deterrence theory of justice assumes the opposite, by giving the person a logical choice: "You do this, we do that, and you won't like it. So you don't do this, right?"
I'm not so sure. People commit crimes for emotional reasons. As usual, the criminal's reasoning faculties are just an after-the-decision detail handler. The direction that this detail handler then takes is fascinatingly monstrous, but this does not mean that crime begins in reason.
Conclusion: the deterrence theory of justice is based on a category error.
Religion, with its emphasis on emotion, was all the formal "law enforcement system" anyone needed up until only about 200 years ago, at the industrial revolution. We may be able to go beyond where religion takes us by means of a disease model of criminality.
It does make some sense to lock criminals up, because with less freedom they cannot physically commit as many crimes. Many prisons become dungeons, however, because of the public's desire for revenge. However, all revenge-seeking belongs to the dispersal/depopulation dynamic and is thus part of the problem. A desire for revenge may follow a crime very predictably, but logically, it is a non-sequitur.
4-30-2018: A more nuanced theory of crime prevention is possible, where logical and technological constraints on behavior complement efforts to reduce the motivation for committing crimes at the source: the individual's perception of the fairness of society. However, I originally wrote as I did because I don't think that the former is the squeaky wheel at the moment.