src/HOL/Number_Theory/Euclidean_Algorithm.thy
changeset 62353 7f927120b5a2
parent 62348 9a5f43dac883
child 62422 4aa35fd6c152
equal deleted inserted replaced
62352:35a9e1cbb5b3 62353:7f927120b5a2
  1062 
  1062 
  1063 lemma Lcm_empty [simp]:
  1063 lemma Lcm_empty [simp]:
  1064   "Lcm {} = 1"
  1064   "Lcm {} = 1"
  1065   by (simp add: Lcm_1_iff)
  1065   by (simp add: Lcm_1_iff)
  1066 
  1066 
  1067 lemma Lcm_eq_0 [simp]:
  1067 lemma Lcm_eq_0_I [simp]:
  1068   "0 \<in> A \<Longrightarrow> Lcm A = 0"
  1068   "0 \<in> A \<Longrightarrow> Lcm A = 0"
  1069   by (drule dvd_Lcm) simp
  1069   by (drule dvd_Lcm) simp
  1070 
  1070 
  1071 lemma Lcm0_iff':
  1071 lemma Lcm_0_iff':
  1072   "Lcm A = 0 \<longleftrightarrow> \<not>(\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l))"
  1072   "Lcm A = 0 \<longleftrightarrow> \<not>(\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l))"
  1073 proof
  1073 proof
  1074   assume "Lcm A = 0"
  1074   assume "Lcm A = 0"
  1075   show "\<not>(\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l))"
  1075   show "\<not>(\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l))"
  1076   proof
  1076   proof
  1090        by (simp only: Lcm_Lcm_eucl Lcm_eucl_def n_def l_def if_True Let_def)
  1090        by (simp only: Lcm_Lcm_eucl Lcm_eucl_def n_def l_def if_True Let_def)
  1091     finally show False using \<open>Lcm A = 0\<close> by contradiction
  1091     finally show False using \<open>Lcm A = 0\<close> by contradiction
  1092   qed
  1092   qed
  1093 qed (simp only: Lcm_Lcm_eucl Lcm_eucl_def if_False)
  1093 qed (simp only: Lcm_Lcm_eucl Lcm_eucl_def if_False)
  1094 
  1094 
  1095 lemma Lcm0_iff [simp]:
  1095 lemma Lcm_0_iff [simp]:
  1096   "finite A \<Longrightarrow> Lcm A = 0 \<longleftrightarrow> 0 \<in> A"
  1096   "finite A \<Longrightarrow> Lcm A = 0 \<longleftrightarrow> 0 \<in> A"
  1097 proof -
  1097 proof -
  1098   assume "finite A"
  1098   assume "finite A"
  1099   have "0 \<in> A \<Longrightarrow> Lcm A = 0"  by (intro dvd_0_left dvd_Lcm)
  1099   have "0 \<in> A \<Longrightarrow> Lcm A = 0"  by (intro dvd_0_left dvd_Lcm)
  1100   moreover {
  1100   moreover {
  1106       apply (rule no_zero_divisors)
  1106       apply (rule no_zero_divisors)
  1107       apply blast+
  1107       apply blast+
  1108       done
  1108       done
  1109     moreover from \<open>finite A\<close> have "\<forall>a\<in>A. a dvd \<Prod>A" by blast
  1109     moreover from \<open>finite A\<close> have "\<forall>a\<in>A. a dvd \<Prod>A" by blast
  1110     ultimately have "\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l)" by blast
  1110     ultimately have "\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l)" by blast
  1111     with Lcm0_iff' have "Lcm A \<noteq> 0" by simp
  1111     with Lcm_0_iff' have "Lcm A \<noteq> 0" by simp
  1112   }
  1112   }
  1113   ultimately show "Lcm A = 0 \<longleftrightarrow> 0 \<in> A" by blast
  1113   ultimately show "Lcm A = 0 \<longleftrightarrow> 0 \<in> A" by blast
  1114 qed
  1114 qed
  1115 
  1115 
  1116 lemma Lcm_no_multiple:
  1116 lemma Lcm_no_multiple:
  1208   shows "b = Gcd A"
  1208   shows "b = Gcd A"
  1209   by (rule associated_eqI) (auto simp: assms intro: Gcd_greatest)
  1209   by (rule associated_eqI) (auto simp: assms intro: Gcd_greatest)
  1210 
  1210 
  1211 lemma Lcm_Gcd:
  1211 lemma Lcm_Gcd:
  1212   "Lcm A = Gcd {m. \<forall>a\<in>A. a dvd m}"
  1212   "Lcm A = Gcd {m. \<forall>a\<in>A. a dvd m}"
  1213   by (rule LcmI[symmetric]) (auto intro: dvd_Gcd Gcd_greatest)
  1213   by (rule LcmI[symmetric]) (auto intro: Gcd_greatest Gcd_greatest)
  1214 
  1214 
  1215 lemma Gcd_1:
  1215 lemma Gcd_1:
  1216   "1 \<in> A \<Longrightarrow> Gcd A = 1"
  1216   "1 \<in> A \<Longrightarrow> Gcd A = 1"
  1217   by (auto intro!: Gcd_eq_1_I)
  1217   by (auto intro!: Gcd_eq_1_I)
  1218 
  1218