Some of my friends who are now lawyers were really bad at math in high-school, so I'm not sure that equating law to computer programs is how it works in practice.
It's not the math, it's logic. I see this parallel too -- legalese is incredibly dense because it is very specific, and its unreadability stems from (our) natural languages' disinclination towards specificity
To be fair, computer programming itself doesn't really require a lot of math knowledge. Conceptual understanding of the programs does. But Logic is something that is basically required in both fields, so it's natural to see some similarities.
The edge cases are also exactly when lawyers get involved. If the law is clear, there's not much work for a lawyer to do (you plead guilty, you settle the case, you don't sue in the first place, etc.). Dealing with ambiguity is the main skill of a lawyer.