Bring “justice for all” to the legal system by requiring specific CONCRETE examples and counterexamples of where laws would apply. No more weird corner cases leading to bizarre and unfair legal outcomes, thanks to bringing the computer programming concept of “unit testing” to the legal world!


Laws are often worded in an extremely confusing fashion, and the exact implications of all corner cases of a law are rarely considered when it is written.

The issue:

Sometimes, the “legally correct” (letter of the law) outcome of a case is either unclear or is even in obvious contradiction to the actual intent of the lawmakers.

Here are a few examples where confusion has arisen:

The “felony murder rule”:

  • A getaway driver for a bank robbery might be found guilty of murder if their unarmed accomplice is shot by the bank security guard. This is probably not really the intended severity of sentencing.

The “three strikes” law (which incarcerates a three-time felon for life):

  • Depending on the state, the third “strike” is sometimes allowed to be a non-violent one: someone who had committed two robberies at age 20, and then—40 years later—was driving 101 MPH on a deserted highway at 3:00 AM could presumably be sent to prison for life for speeding.

The Second Amendment in the U.S. Bill of Rights:

  • Details as to what weaponry is covered would have been informative: does the “right to bear arms” apply to all guns? Most guns? Ninja stars? Nunchucks? Knives that fold? A cannon from the Civil War? The current regulation surrounding these items is highly arbitrary, and varies on a state-by-state basis.

As you can see, these examples underscore the need for specific, concrete examples and counterexamples for each law.


Each new law should be accompanied by the following:

  • 10 example situations where the law would apply
  • 10 counterexamples where it would initially seem to apply, but actually is not intended to.

This is similar to the computer programming concept of “unit testing” (Figure 1).

Fig. 1: A programmer who was writing a “fast square root” function might add code like this to “assert” that certain conditions occur—if any of these situations are violated, then the programmer knows they messed up their square-root-calculating code.

Applying the same “unit test” idea from the computer programming world to the legal system results in the list in Figure 2.

Fig. 2: These “counterexamples” would be situations in which extenuating circumstances make a law not apply even though it would according to the letter of the law. A link to the 1884 cannibalism case is here.


This is sort of similar to the legal concept of “precedent” (i.e. a current case should have the same outcome as any identical previous cases)—but here we’re writing the “precedent” cases beforehand. (Instead of waiting for some unlucky individual to be a “test case” for a law.)

PROS: Would require almost no work to come up with 20 scenarios for each new law. A good project for a congressional intern!

CONS: Odd scenarios might arise if the counterexamples were themselves ill-formed. For example: “a man who says he is a werewolf should not be found guilty of murders committed during the full moon.” Superficially perhaps reasonable, but obviously problematic if the individual is not actually a werewolf—according to the example above, the law would consider claiming to be a werewolf to be a sufficient excuse!

Supplemental material: the verbatim text from the images in figures 1 and 2:

assert: fast_square_root(0)    = 0

assert: fast_square_root(2)    ≈ 1.4142

assert: fast_square_root(16)   = 4

assert: fast_square_root(25.5) ≈ 5.0498

assert (≠): A survivor of a plane crash wanders out from the desert and takes a bottle of water from a convenience store, but has no money and thus cannot pay: This will be considered NOT shoplifting due to the immediate need for survival.

assert (≠): On a hot summer day, an individual finds some small children in a car with rolled-up windows. They seem to be about to die of heatstroke. The individual breaks the car window in order to rescue them: This will be considered NOT vandalism.

assert (≠): Survivors of a shipwreck resort to cannibalism of a fellow survivor who fell into a coma: This will be considered NOT murder (this is a real case from 1884).

assert (≠): A shipwrecked survivor is hunted for sport by the eccentric owner of the island he is shipwrecked on, who wishes to hunt the “most dangerous game of all,” but is then himself fed to his own hunting dogs by the survivor: This will be considered NOT manslaughter.