Created
March 16, 2016 14:15
-
-
Save gabriel-fallen/5f8ea78dcec02056c3b2 to your computer and use it in GitHub Desktop.
Euclid's algorithm proof in Isabelle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theory GCD | |
imports Main | |
begin | |
fun gcd :: "nat ⇒ nat ⇒ nat" where | |
"gcd m 0 = m" | | |
"gcd m n = gcd n (m mod n)" | |
theorem gcd_dvd_both: "(gcd m n dvd m) ∧ (gcd m n dvd n)" | |
apply (induct_tac m n rule: "gcd.induct") | |
apply (case_tac "n = 0") | |
apply (simp_all) | |
apply (blast dest: dvd_mod_imp_dvd) | |
done | |
theorem gcd_greatest: "k dvd m ⟶ k dvd n ⟶ k dvd gcd m n" | |
apply (induct_tac m n rule: "gcd.induct") | |
apply (case_tac "n = 0") | |
apply (simp_all add: dvd_mod) | |
done | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment