Certain laws are very cut-and-dry (speeding for instance) and perhaps laws could be proven on a functional basis.
You could even make it axiomatic from the constitution and declaration of independence.
Of course, you'd need to define the axiomatic meaning of things like 'the right of the people to keep and bear arms shall not be infringed' - which is hard to do even with such simple language.
And then after loading the axioms, you'd spend a lifetime going through errors in the existing laws.
Ha! No.
* do you want to give an exemption for speeding for, say, ambulances? So how do you define "ambulance"? Do you have to be registered to drive an ambulance? What defines the "duty of an ambulance" (or are they allowed to speed no matter what). What about a van carrying an organ to be donated?
* What if I have my sick child in the car and I'm rushing them to the hospital because it's faster than waiting for an ambulance? Is it right that I can be arrested and convicted for that? I think that would be a perversion of the spirit of any just law.
* What if I'm being chased by a maniac relative who wants to kill me? Can I speed then to drive away from them? Do I have to believe my life is in danger? How do you define that?
* Let's pretend I'm driving along and some other vehicle is about to move into my lane and crash into me because they are stupid and don't see me, and let's pretend that if I speed up a little bit (over the speed limit) and am able to get in front of them and avoid an accident. Should I be convictable for speeding even though I sped to prevent an accident?
Sure, these are all edge cases and there are loads of cases where it is clear cut, but you have to write a law that can handle the edge cases. Without accepting the vagueness of human life, you'll wind up with an unfair conviction that is horrible.
So, no exemptions for anyone, but then part of the cost of running an ambulance service is paying speeding fines regularly. Given the cost of ambulance services without that, the additional expense is lost in the noise, making it obviously a good choice to speed when useful (for ambulances).
Trying to figure out after the fact whether someone had a good reason to break the law (and therefore shouldn't be penalized) is one of the things that complicates legal systems enormously. Instead, we should write the law clearly and specify the penalties for breaking it directly, and let those who have the best information about the situation, the potential lawbreaker(s), choose whether it is worth breaking the law in a given instance.