src/HOL/Decision_Procs/Algebra_Aux.thy
changeset 67341 df79ef3b3a41
parent 67123 3fe40ff1b921
child 67397 12b0c11e3d20
equal deleted inserted replaced
67340:150d40a25622 67341:df79ef3b3a41
   188 next
   188 next
   189   assume "x = y"
   189   assume "x = y"
   190   with assms show "x \<ominus> y = \<zero>" by (simp add: minus_eq r_neg)
   190   with assms show "x \<ominus> y = \<zero>" by (simp add: minus_eq r_neg)
   191 qed
   191 qed
   192 
   192 
   193 lemma power2_eq_square: "x \<in> carrier R \<Longrightarrow> x (^) (2::nat) = x \<otimes> x"
   193 lemma power2_eq_square: "x \<in> carrier R \<Longrightarrow> x [^] (2::nat) = x \<otimes> x"
   194   by (simp add: numeral_eq_Suc)
   194   by (simp add: numeral_eq_Suc)
   195 
   195 
   196 lemma eq_neg_iff_add_eq_0:
   196 lemma eq_neg_iff_add_eq_0:
   197   assumes "x \<in> carrier R" "y \<in> carrier R"
   197   assumes "x \<in> carrier R" "y \<in> carrier R"
   198   shows "x = \<ominus> y \<longleftrightarrow> x \<oplus> y = \<zero>"
   198   shows "x = \<ominus> y \<longleftrightarrow> x \<oplus> y = \<zero>"
   228 lemma mult2: "x \<in> carrier R \<Longrightarrow> x \<oplus> x = \<guillemotleft>2\<guillemotright> \<otimes> x"
   228 lemma mult2: "x \<in> carrier R \<Longrightarrow> x \<oplus> x = \<guillemotleft>2\<guillemotright> \<otimes> x"
   229   by (simp add: of_int_2 l_distr)
   229   by (simp add: of_int_2 l_distr)
   230 
   230 
   231 end
   231 end
   232 
   232 
   233 lemma (in cring) of_int_power [simp]: "\<guillemotleft>i ^ n\<guillemotright> = \<guillemotleft>i\<guillemotright> (^) n"
   233 lemma (in cring) of_int_power [simp]: "\<guillemotleft>i ^ n\<guillemotright> = \<guillemotleft>i\<guillemotright> [^] n"
   234   by (induct n) (simp_all add: m_ac)
   234   by (induct n) (simp_all add: m_ac)
   235 
   235 
   236 definition cring_class_ops :: "'a::comm_ring_1 ring"
   236 definition cring_class_ops :: "'a::comm_ring_1 ring"
   237   where "cring_class_ops \<equiv> \<lparr>carrier = UNIV, mult = op *, one = 1, zero = 0, add = op +\<rparr>"
   237   where "cring_class_ops \<equiv> \<lparr>carrier = UNIV, mult = op *, one = 1, zero = 0, add = op +\<rparr>"
   238 
   238 
   265   done
   265   done
   266 
   266 
   267 lemma minus_class: "x \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   267 lemma minus_class: "x \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   268   by (simp add: a_minus_def carrier_class plus_class uminus_class)
   268   by (simp add: a_minus_def carrier_class plus_class uminus_class)
   269 
   269 
   270 lemma power_class: "x (^)\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   270 lemma power_class: "x [^]\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   271   by (induct n) (simp_all add: one_class times_class
   271   by (induct n) (simp_all add: one_class times_class
   272     monoid.nat_pow_0 [OF comm_monoid.axioms(1) [OF cring.axioms(2) [OF cring_class]]]
   272     monoid.nat_pow_0 [OF comm_monoid.axioms(1) [OF cring.axioms(2) [OF cring_class]]]
   273     monoid.nat_pow_Suc [OF comm_monoid.axioms(1) [OF cring.axioms(2) [OF cring_class]]])
   273     monoid.nat_pow_Suc [OF comm_monoid.axioms(1) [OF cring.axioms(2) [OF cring_class]]])
   274 
   274 
   275 lemma of_nat_class: "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   275 lemma of_nat_class: "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   286     and "(\<one>\<^bsub>cring_class_ops\<^esub>::'a) = 1"
   286     and "(\<one>\<^bsub>cring_class_ops\<^esub>::'a) = 1"
   287     and "(x::'a) \<oplus>\<^bsub>cring_class_ops\<^esub> y = x + y"
   287     and "(x::'a) \<oplus>\<^bsub>cring_class_ops\<^esub> y = x + y"
   288     and "(x::'a) \<otimes>\<^bsub>cring_class_ops\<^esub> y = x * y"
   288     and "(x::'a) \<otimes>\<^bsub>cring_class_ops\<^esub> y = x * y"
   289     and "\<ominus>\<^bsub>cring_class_ops\<^esub> (x::'a) = - x"
   289     and "\<ominus>\<^bsub>cring_class_ops\<^esub> (x::'a) = - x"
   290     and "(x::'a) \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   290     and "(x::'a) \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   291     and "(x::'a) (^)\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   291     and "(x::'a) [^]\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   292     and "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   292     and "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   293     and "((\<guillemotleft>i\<guillemotright>\<^bsub>cring_class_ops\<^esub>)::'a) = of_int i"
   293     and "((\<guillemotleft>i\<guillemotright>\<^bsub>cring_class_ops\<^esub>)::'a) = of_int i"
   294     and "(Int.of_int (numeral m)::'a) = numeral m"
   294     and "(Int.of_int (numeral m)::'a) = numeral m"
   295   by (simp_all add: cring_class class_simps)
   295   by (simp_all add: cring_class class_simps)
   296 
   296 
   297 lemma (in domain) nat_pow_eq_0_iff [simp]:
   297 lemma (in domain) nat_pow_eq_0_iff [simp]:
   298   "a \<in> carrier R \<Longrightarrow> (a (^) (n::nat) = \<zero>) = (a = \<zero> \<and> n \<noteq> 0)"
   298   "a \<in> carrier R \<Longrightarrow> (a [^] (n::nat) = \<zero>) = (a = \<zero> \<and> n \<noteq> 0)"
   299   by (induct n) (auto simp add: integral_iff)
   299   by (induct n) (auto simp add: integral_iff)
   300 
   300 
   301 lemma (in domain) square_eq_iff:
   301 lemma (in domain) square_eq_iff:
   302   assumes "x \<in> carrier R" "y \<in> carrier R"
   302   assumes "x \<in> carrier R" "y \<in> carrier R"
   303   shows "(x \<otimes> x = y \<otimes> y) = (x = y \<or> x = \<ominus> y)"
   303   shows "(x \<otimes> x = y \<otimes> y) = (x = y \<or> x = \<ominus> y)"
   444     a \<otimes> (b \<oslash> c) = a \<otimes> b \<oslash> c"
   444     a \<otimes> (b \<oslash> c) = a \<otimes> b \<oslash> c"
   445   by (simp add: m_div_def m_ac)
   445   by (simp add: m_div_def m_ac)
   446 
   446 
   447 lemma nonzero_power_divide:
   447 lemma nonzero_power_divide:
   448   "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> b \<noteq> \<zero> \<Longrightarrow>
   448   "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> b \<noteq> \<zero> \<Longrightarrow>
   449     (a \<oslash> b) (^) (n::nat) = a (^) n \<oslash> b (^) n"
   449     (a \<oslash> b) [^] (n::nat) = a [^] n \<oslash> b [^] n"
   450   by (induct n) (simp_all add: nonzero_divide_divide_eq_left)
   450   by (induct n) (simp_all add: nonzero_divide_divide_eq_left)
   451 
   451 
   452 lemma r_diff_distr:
   452 lemma r_diff_distr:
   453   "x \<in> carrier R \<Longrightarrow> y \<in> carrier R \<Longrightarrow> z \<in> carrier R \<Longrightarrow>
   453   "x \<in> carrier R \<Longrightarrow> y \<in> carrier R \<Longrightarrow> z \<in> carrier R \<Longrightarrow>
   454     z \<otimes> (x \<ominus> y) = z \<otimes> x \<ominus> z \<otimes> y"
   454     z \<otimes> (x \<ominus> y) = z \<otimes> x \<ominus> z \<otimes> y"
   502     and "(\<one>\<^bsub>cring_class_ops\<^esub>::'a) = 1"
   502     and "(\<one>\<^bsub>cring_class_ops\<^esub>::'a) = 1"
   503     and "(x::'a) \<oplus>\<^bsub>cring_class_ops\<^esub> y = x + y"
   503     and "(x::'a) \<oplus>\<^bsub>cring_class_ops\<^esub> y = x + y"
   504     and "(x::'a) \<otimes>\<^bsub>cring_class_ops\<^esub> y = x * y"
   504     and "(x::'a) \<otimes>\<^bsub>cring_class_ops\<^esub> y = x * y"
   505     and "\<ominus>\<^bsub>cring_class_ops\<^esub> (x::'a) = - x"
   505     and "\<ominus>\<^bsub>cring_class_ops\<^esub> (x::'a) = - x"
   506     and "(x::'a) \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   506     and "(x::'a) \<ominus>\<^bsub>cring_class_ops\<^esub> y = x - y"
   507     and "(x::'a) (^)\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   507     and "(x::'a) [^]\<^bsub>cring_class_ops\<^esub> n = x ^ n"
   508     and "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   508     and "\<guillemotleft>n\<guillemotright>\<^sub>\<nat>\<^bsub>cring_class_ops\<^esub> = of_nat n"
   509     and "((\<guillemotleft>i\<guillemotright>\<^bsub>cring_class_ops\<^esub>)::'a) = of_int i"
   509     and "((\<guillemotleft>i\<guillemotright>\<^bsub>cring_class_ops\<^esub>)::'a) = of_int i"
   510     and "(x::'a) \<oslash>\<^bsub>cring_class_ops\<^esub> y = x / y"
   510     and "(x::'a) \<oslash>\<^bsub>cring_class_ops\<^esub> y = x / y"
   511     and "(Int.of_int (numeral m)::'a) = numeral m"
   511     and "(Int.of_int (numeral m)::'a) = numeral m"
   512   by (simp_all add: field_class class_simps div_class)
   512   by (simp_all add: field_class class_simps div_class)