This is actually basically the philosopher HLA Hart’s theory of what law is.