Skip to content

Instantly share code, notes, and snippets.

@gabriel-fallen
Created March 16, 2016 14:15
Show Gist options
  • Save gabriel-fallen/5f8ea78dcec02056c3b2 to your computer and use it in GitHub Desktop.
Save gabriel-fallen/5f8ea78dcec02056c3b2 to your computer and use it in GitHub Desktop.
Euclid's algorithm proof in Isabelle
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