lemma gcd_non_0 [simp]: "0 gcd m n = gcd n (m mod n)" apply (simp) done
declare gcd.simps [simp del]
(*gcd(m,n) divides m and n. The conjunctions don't seem provable separately*) lemma gcd_dvd_both: "(gcd m n dvd m) \ (gcd m n dvd n)" apply (induct_tac m n rule: gcd.induct) \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close> apply (case_tac "n=0") txt\<open>subgoals after the case tac
@{subgoals[display,indent=0,margin=65]} \<close> apply (simp_all) \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close> by (blast dest: dvd_mod_imp_dvd)
(*Maximality: for all m,n,k naturals,
if k divides m and k divides n then k divides gcd(m,n)*) lemma gcd_greatest [rule_format]: "k dvd m \ k dvd n \ k dvd gcd m n" apply (induct_tac m n rule: gcd.induct) apply (case_tac "n=0") txt\<open>subgoals after the case tac
@{subgoals[display,indent=0,margin=65]} \<close> apply (simp_all add: dvd_mod) done
(*just checking the claim that case_tac "n" works too*) lemma"k dvd m \ k dvd n \ k dvd gcd m n" apply (induct_tac m n rule: gcd.induct) apply (case_tac "n") apply (simp_all add: dvd_mod) done
theorem gcd_greatest_iff [iff]: "(k dvd gcd m n) = (k dvd m \ k dvd n)" by (blast intro!: gcd_greatest intro: dvd_trans)
(**** The material below was omitted from the book ****)
definition is_gcd :: "[nat,nat,nat] \ bool" where (*gcd as a relation*) "is_gcd p m n == p dvd m \ p dvd n \
(\<forall>d. d dvd m \<and> d dvd n \<longrightarrow> d dvd p)"
(*Function gcd yields the Greatest Common Divisor*) lemma is_gcd: "is_gcd (gcd m n) m n" apply (simp add: is_gcd_def gcd_greatest) done
(*uniqueness of GCDs*) lemma is_gcd_unique: "\ is_gcd m a b; is_gcd n a b \ \ m=n" apply (simp add: is_gcd_def) apply (blast intro: dvd_antisym) done
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.