Smith Normal Form Theorem