It is a fascinating idea indeed.
While Leibniz is widely known for his mathematics and philosophy, one of his lesser known ideas was the relation between law and computation.
There is a small research community around it today. Look up Computational Law and Computational Contracts if you are interested.