Well said. Deterrence is undoubtedly a factor in some cases, but is hard to measure and perhaps less of a factor than many assume. A large number of violent crimes are committed against rival gang members who are assumed to be armed. In many other cases, criminals choose carefully, assess the likelihood of the victim being armed and able to overcome the element of surprise, and adjust tactics accordingly.
In still other cases, the attacker’s mental state is sufficiently altered by certain drugs or mental illnesses that no deterrent effect is achieved: Consider the many, many cases in which police officers are forced to shoot people who a) are not deterred by firearms and b) would likely not present the same threat if they were well.