src/HOL/Algebra/Module.thy
changeset 68551 b680e74eb6f2
parent 61565 352c73a689da
child 68552 391e89e03eef
equal deleted inserted replaced
68550:516e81f75957 68551:b680e74eb6f2
    74       "!!x. x \<in> carrier M ==> (one R) \<odot>\<^bsub>M\<^esub> x = x"
    74       "!!x. x \<in> carrier M ==> (one R) \<odot>\<^bsub>M\<^esub> x = x"
    75     and smult_assoc2:
    75     and smult_assoc2:
    76       "!!a x y. [| a \<in> carrier R; x \<in> carrier M; y \<in> carrier M |] ==>
    76       "!!a x y. [| a \<in> carrier R; x \<in> carrier M; y \<in> carrier M |] ==>
    77       (a \<odot>\<^bsub>M\<^esub> x) \<otimes>\<^bsub>M\<^esub> y = a \<odot>\<^bsub>M\<^esub> (x \<otimes>\<^bsub>M\<^esub> y)"
    77       (a \<odot>\<^bsub>M\<^esub> x) \<otimes>\<^bsub>M\<^esub> y = a \<odot>\<^bsub>M\<^esub> (x \<otimes>\<^bsub>M\<^esub> y)"
    78   shows "algebra R M"
    78   shows "algebra R M"
    79 apply intro_locales
    79   apply intro_locales
    80 apply (rule cring.axioms ring.axioms abelian_group.axioms comm_monoid.axioms assms)+
    80              apply (rule cring.axioms ring.axioms abelian_group.axioms comm_monoid.axioms assms)+
    81 apply (rule module_axioms.intro)
    81       apply (rule module_axioms.intro)
    82  apply (simp add: smult_closed)
    82           apply (simp add: smult_closed)
    83  apply (simp add: smult_l_distr)
    83          apply (simp add: smult_l_distr)
    84  apply (simp add: smult_r_distr)
    84         apply (simp add: smult_r_distr)
    85  apply (simp add: smult_assoc1)
    85        apply (simp add: smult_assoc1)
    86  apply (simp add: smult_one)
    86       apply (simp add: smult_one)
    87 apply (rule cring.axioms ring.axioms abelian_group.axioms comm_monoid.axioms assms)+
    87      apply (rule cring.axioms ring.axioms abelian_group.axioms comm_monoid.axioms assms)+
    88 apply (rule algebra_axioms.intro)
    88   apply (rule algebra_axioms.intro)
    89  apply (simp add: smult_assoc2)
    89   apply (simp add: smult_assoc2)
    90 done
    90   done
    91 
    91 
    92 lemma (in algebra) R_cring:
    92 lemma (in algebra) R_cring: "cring R" ..
    93   "cring R"
       
    94   ..
       
    95 
    93 
    96 lemma (in algebra) M_cring:
    94 lemma (in algebra) M_cring: "cring M" ..
    97   "cring M"
       
    98   ..
       
    99 
    95 
   100 lemma (in algebra) module:
    96 lemma (in algebra) module: "module R M"
   101   "module R M"
    97   by (auto intro: moduleI R_cring is_abelian_group smult_l_distr smult_r_distr smult_assoc1)
   102   by (auto intro: moduleI R_cring is_abelian_group
       
   103     smult_l_distr smult_r_distr smult_assoc1)
       
   104 
    98 
   105 
    99 
   106 subsection \<open>Basic Properties of Algebras\<close>
   100 subsection \<open>Basic Properties of Modules\<close>
   107 
   101 
   108 lemma (in algebra) smult_l_null [simp]:
   102 lemma (in module) smult_l_null [simp]:
   109   "x \<in> carrier M ==> \<zero> \<odot>\<^bsub>M\<^esub> x = \<zero>\<^bsub>M\<^esub>"
   103  "x \<in> carrier M ==> \<zero> \<odot>\<^bsub>M\<^esub> x = \<zero>\<^bsub>M\<^esub>"
   110 proof -
   104 proof-
   111   assume M: "x \<in> carrier M"
   105   assume M : "x \<in> carrier M"
   112   note facts = M smult_closed [OF R.zero_closed]
   106   note facts = M smult_closed [OF R.zero_closed]
   113   from facts have "\<zero> \<odot>\<^bsub>M\<^esub> x = (\<zero> \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> \<zero> \<odot>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (\<zero> \<odot>\<^bsub>M\<^esub> x)" by algebra
   107   from facts have "\<zero> \<odot>\<^bsub>M\<^esub> x = (\<zero> \<oplus> \<zero>) \<odot>\<^bsub>M\<^esub> x "
   114   also from M have "... = (\<zero> \<oplus> \<zero>) \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (\<zero> \<odot>\<^bsub>M\<^esub> x)"
   108     using smult_l_distr by auto
   115     by (simp add: smult_l_distr del: R.l_zero R.r_zero)
   109   also have "... = \<zero> \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> \<zero> \<odot>\<^bsub>M\<^esub> x"
   116   also from facts have "... = \<zero>\<^bsub>M\<^esub>" apply algebra apply algebra done
   110     using smult_l_distr[of \<zero> \<zero> x] facts by auto
   117   finally show ?thesis .
   111   finally show "\<zero> \<odot>\<^bsub>M\<^esub> x = \<zero>\<^bsub>M\<^esub>" using facts
       
   112     by (metis M.add.r_cancel_one')
   118 qed
   113 qed
   119 
   114 
   120 lemma (in algebra) smult_r_null [simp]:
   115 lemma (in module) smult_r_null [simp]:
   121   "a \<in> carrier R ==> a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> = \<zero>\<^bsub>M\<^esub>"
   116   "a \<in> carrier R ==> a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> = \<zero>\<^bsub>M\<^esub>"
   122 proof -
   117 proof -
   123   assume R: "a \<in> carrier R"
   118   assume R: "a \<in> carrier R"
   124   note facts = R smult_closed
   119   note facts = R smult_closed
   125   from facts have "a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> = (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>)"
   120   from facts have "a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> = (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub> \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>)"
   126     by algebra
   121     by (simp add: M.add.inv_solve_right)
   127   also from R have "... = a \<odot>\<^bsub>M\<^esub> (\<zero>\<^bsub>M\<^esub> \<oplus>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>)"
   122   also from R have "... = a \<odot>\<^bsub>M\<^esub> (\<zero>\<^bsub>M\<^esub> \<oplus>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> \<zero>\<^bsub>M\<^esub>)"
   128     by (simp add: smult_r_distr del: M.l_zero M.r_zero)
   123     by (simp add: smult_r_distr del: M.l_zero M.r_zero)
   129   also from facts have "... = \<zero>\<^bsub>M\<^esub>" by algebra
   124   also from facts have "... = \<zero>\<^bsub>M\<^esub>"
       
   125     by (simp add: M.r_neg)
   130   finally show ?thesis .
   126   finally show ?thesis .
   131 qed
   127 qed
   132 
   128 
   133 lemma (in algebra) smult_l_minus:
   129 lemma (in module) smult_l_minus:
   134   "[| a \<in> carrier R; x \<in> carrier M |] ==> (\<ominus>a) \<odot>\<^bsub>M\<^esub> x = \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> x)"
   130 "\<lbrakk> a \<in> carrier R; x \<in> carrier M \<rbrakk> \<Longrightarrow> (\<ominus>a) \<odot>\<^bsub>M\<^esub> x = \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> x)"
   135 proof -
   131 proof-
   136   assume RM: "a \<in> carrier R" "x \<in> carrier M"
   132   assume RM: "a \<in> carrier R" "x \<in> carrier M"
   137   from RM have a_smult: "a \<odot>\<^bsub>M\<^esub> x \<in> carrier M" by simp
   133   from RM have a_smult: "a \<odot>\<^bsub>M\<^esub> x \<in> carrier M" by simp
   138   from RM have ma_smult: "\<ominus>a \<odot>\<^bsub>M\<^esub> x \<in> carrier M" by simp
   134   from RM have ma_smult: "\<ominus>a \<odot>\<^bsub>M\<^esub> x \<in> carrier M" by simp
   139   note facts = RM a_smult ma_smult
   135   note facts = RM a_smult ma_smult
   140   from facts have "(\<ominus>a) \<odot>\<^bsub>M\<^esub> x = (\<ominus>a \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   136   from facts have "(\<ominus>a) \<odot>\<^bsub>M\<^esub> x = (\<ominus>a \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   141     by algebra
   137     by (simp add: M.add.inv_solve_right)
   142   also from RM have "... = (\<ominus>a \<oplus> a) \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   138   also from RM have "... = (\<ominus>a \<oplus> a) \<odot>\<^bsub>M\<^esub> x \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   143     by (simp add: smult_l_distr)
   139     by (simp add: smult_l_distr)
   144   also from facts smult_l_null have "... = \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   140   also from facts smult_l_null have "... = \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   145     apply algebra apply algebra done
   141     by (simp add: R.l_neg)
   146   finally show ?thesis .
   142   finally show ?thesis .
   147 qed
   143 qed
   148 
   144 
   149 lemma (in algebra) smult_r_minus:
   145 lemma (in module) smult_r_minus:
   150   "[| a \<in> carrier R; x \<in> carrier M |] ==> a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x) = \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> x)"
   146   "[| a \<in> carrier R; x \<in> carrier M |] ==> a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x) = \<ominus>\<^bsub>M\<^esub> (a \<odot>\<^bsub>M\<^esub> x)"
   151 proof -
   147 proof -
   152   assume RM: "a \<in> carrier R" "x \<in> carrier M"
   148   assume RM: "a \<in> carrier R" "x \<in> carrier M"
   153   note facts = RM smult_closed
   149   note facts = RM smult_closed
   154   from facts have "a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x) = (a \<odot>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>x \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   150   from facts have "a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x) = (a \<odot>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>x \<oplus>\<^bsub>M\<^esub> a \<odot>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   155     by algebra
   151     by (simp add: M.add.inv_solve_right)
   156   also from RM have "... = a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x \<oplus>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   152   also from RM have "... = a \<odot>\<^bsub>M\<^esub> (\<ominus>\<^bsub>M\<^esub>x \<oplus>\<^bsub>M\<^esub> x) \<oplus>\<^bsub>M\<^esub> \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
   157     by (simp add: smult_r_distr)
   153     by (simp add: smult_r_distr)
   158   also from facts smult_r_null have "... = \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)" by algebra
   154   also from facts smult_l_null have "... = \<ominus>\<^bsub>M\<^esub>(a \<odot>\<^bsub>M\<^esub> x)"
       
   155     by (metis M.add.inv_closed M.add.inv_solve_right M.l_neg R.zero_closed r_null smult_assoc1)
   159   finally show ?thesis .
   156   finally show ?thesis .
   160 qed
   157 qed
   161 
   158 
       
   159 lemma (in module) finsum_smult_ldistr:
       
   160   "\<lbrakk> finite A; a \<in> carrier R; f: A \<rightarrow> carrier M \<rbrakk> \<Longrightarrow>
       
   161      a \<odot>\<^bsub>M\<^esub> (\<Oplus>\<^bsub>M\<^esub> i \<in> A. (f i)) = (\<Oplus>\<^bsub>M\<^esub> i \<in> A. ( a \<odot>\<^bsub>M\<^esub> (f i)))"
       
   162 proof (induct set: finite)
       
   163   case empty then show ?case
       
   164     by (metis M.finsum_empty M.zero_closed R.zero_closed r_null smult_assoc1 smult_l_null)
       
   165 next
       
   166   case (insert x F) then show ?case
       
   167     by (simp add: Pi_def smult_r_distr)
       
   168 qed
       
   169 
   162 end
   170 end