From 0a08da97a27c94237464f7ebed69cd7c6144c92c Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 09:55:18 +0200 Subject: [PATCH 1/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 43 +- IsarMathLib/Module_ZF_1.thy | 1561 +++++++++++++++++++++++++++++++++++ 2 files changed, 1603 insertions(+), 1 deletion(-) create mode 100644 IsarMathLib/Module_ZF_1.thy diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index 584d770..1e3bb8f 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -213,6 +213,18 @@ text\A more common definition of a module assumes that $R$ is a ring, $V$ In this section we show that the definition of a module as a ring action on an abelian group $V$ implies these properties. \ + +text\ $\Theta$ is fixed by scalar multiplication.\ + +lemma (in module0) zero_fixed: assumes "r\R" + shows "r \\<^sub>S \ = \" +proof- + have "Homomor(H`r,\,A\<^sub>M,\,A\<^sub>M)" + using assms H_val_type(1) unfolding End_def by simp_all + with image_neutral mAbGr have "(H`r)`TheNeutralElement(\,A\<^sub>M) = TheNeutralElement(\,A\<^sub>M)" by auto + then show ?thesis by auto +qed + text\The scalar multiplication is distributive with respect to the module addition.\ lemma (in module0) module_ax1: assumes "r\R" "x\\" "y\\" @@ -265,7 +277,36 @@ proof - with assms show "\\\<^sub>Sx = x" by simp qed -end +text\Multiplying by zero is zero.\ +lemma(in module0) mult_zero: + assumes "g\\" + shows "\ \\<^sub>S g=\" +proof- + from vec_act_homo.homomor_dest_zero have "H ` \ = TheNeutralElement(End(\, A\<^sub>M), EndAdd(\, A\<^sub>M))" . + from trans[OF this add_mult_neut_elems(2)] have "H`\ = ConstantFunction(\,\)" . + then have "(H`\)`g = ConstantFunction(\,\)`g" by auto + then show "\ \\<^sub>S g=\" using func1_3_L2 assms by auto +qed + +text \Taking inverses in a module is just multiplying by $-1$\ + +lemma(in module0) inv_module: + assumes "g\\" + shows "(\\) \\<^sub>S g = \ g" +proof- + have A:"\\R" using Ring_ZF_1_L2(2) by auto + then have B:"(\\) \ R" using Ring_ZF_1_L3(1) by auto + have "g+\<^sub>V ((\\) \\<^sub>S g)=(\ \\<^sub>S g)+\<^sub>V ((\\) \\<^sub>S g)" + using module_ax4 assms by auto + also have "\=(\ \\) \\<^sub>S g" using module_ax2 unfolding ringsub_def using A B assms by auto + also have "\=\ \\<^sub>S g" using Ring_ZF_1_L3(7) A by auto + also have "\=\" using mult_zero assms by auto + ultimately have "g+\<^sub>V ((\\) \\<^sub>S g)=\" by auto moreover + from B have "H`(\\)\\\\" using H_val_type(2) by auto + then have "(\\) \\<^sub>S g\\" unfolding End_def using apply_type assms by auto + ultimately show ?thesis using mod_ab_gr.group0_2_L9(2) assms by auto +qed +end \ No newline at end of file diff --git a/IsarMathLib/Module_ZF_1.thy b/IsarMathLib/Module_ZF_1.thy new file mode 100644 index 0000000..79d8829 --- /dev/null +++ b/IsarMathLib/Module_ZF_1.thy @@ -0,0 +1,1561 @@ +(* + This file is a part of IsarMathLib - + a library of formalized mathematics written for Isabelle/Isar. + + Copyright (C) 2024 Daniel de la Concepcion Saez + + This program is free software; Redistribution and use in source and binary forms, + with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*) + +subsection \ Linear Combinations on Modules\ + +theory Module_ZF_1 imports Module_ZF CommutativeSemigroup_ZF + +begin + +text\Since modules are abelian groups, we can make use of its commutativity to create new elements +by adding acted on elements finitely. Consider two ordered collections of ring elements and of +group elements (indexed by a finite set); then we can add their actions to obtain a new group +element. This is a linear combination.\ + +definition(in module0) + LinearComb ("\[_;{_,_}]" 88) + where "fR:C\R \ fG:C\\ \ D\FinPow(C) \ LinearComb(D,fR,fG) \ if D\0 then CommSetFold(A\<^sub>M,{\m,(fR`m)\\<^sub>S (fG`m)\. m\domain(fR)},D) + else \" + +text\The function that for each index element gives us the acted element of the +abelian group is a function from the index to the group.\ + +lemma(in module0) coordinate_function: + assumes "AA:C\R" "B:C\\" + shows "{\m,(AA`m)\\<^sub>S (B`m)\. m\C}:C\\" +proof- + { + fix m assume "m\C" + then have p:"AA`m\R""B`m\\" using assms(1,2) apply_type by auto + from p(1) have "H`(AA`m):\\\" using H_val_type(2) by auto + then have "(AA`m)\\<^sub>S(B`m)\\" using p(2) apply_type by auto + } + then have "{\m,(AA`m)\\<^sub>S (B`m)\. m\C}\C\\" by auto moreover + { + fix x y assume "\x,y\\{\m,(AA`m)\\<^sub>S (B`m)\. m\C}" + then have xx:"x\C" "y=(AA`x)\\<^sub>S (B`x)" by auto + { + fix y' assume "\x,y'\\{\m,(AA`m)\\<^sub>S (B`m)\. m\C}" + then have "y'=(AA`x)\\<^sub>S (B`x)" by auto + with xx(2) have "y=y'" by auto + } + then have "\y'. \x,y'\\{\m,(AA`m)\\<^sub>S (B`m)\. m\C} \ y=y'" by auto + } + then have "\x y. \x,y\\{\m,(AA`m)\\<^sub>S (B`m)\. m\C} \ (\y'. \x,y'\\{\m,(AA`m)\\<^sub>S (B`m)\. m\C} \ y=y')" + by auto + moreover have "domain({\m,(AA`m)\\<^sub>S (B`m)\. m\C})\C" unfolding domain_def by auto ultimately + show "{\m,(AA`m)\\<^sub>S (B`m)\. m\C}:C\\" unfolding Pi_def function_def by auto +qed + +text\A linear combination results in a group element where +the functions and the sets are well defined.\ + +theorem(in module0) linComb_is_in_module: + assumes "AA:C\R" "B:C\\" "D\FinPow(C)" + shows "(\[D;{AA,B}])\\" +proof- + { + assume noE:"D\0" + have ffun:"{\m,(AA`m)\\<^sub>S (B`m)\. m\C}:C\\" using coordinate_function assms by auto + note commsemigr.sum_over_set_add_point(1)[OF + commsemigr.intro[OF _ _ ffun] assms(3) noE] + mod_ab_gr.abelian_group_axioms abelian_group_def + group0_def IsAgroup_def IsAmonoid_def abelian_group_axioms_def moreover + from assms(1) have "domain(AA)=C" unfolding Pi_def by auto + ultimately have ?thesis unfolding LinearComb_def[OF assms(1-3)] using noE by auto + } + then show ?thesis unfolding LinearComb_def[OF assms(1-3)] + using mod_ab_gr.group0_2_L2 by auto +qed + +text\A linear combination of one element functions is just the action +of one element onto another.\ + +lemma(in module0) linComb_one_element: + assumes "x\X" "AA:X\R" "B:X\\" + shows "\[{x};{AA,B}]=(AA`x)\\<^sub>S(B`x)" +proof- + have dom:"domain(AA)=X" using assms(2) func1_1_L1 by auto + have fin:"{x}\FinPow(X)" unfolding FinPow_def using assms(1) by auto + have A:"\[{x};{AA,B}]=CommSetFold(A\<^sub>M,{\t,(AA`t)\\<^sub>S (B`t)\. t\X},{x})" + unfolding LinearComb_def[OF assms(2,3) fin] dom by auto + have assoc:"A\<^sub>M{is associative on}\" using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def group0_def IsAgroup_def IsAmonoid_def by auto + have comm:"commsemigr(\, A\<^sub>M, X, {\t,(AA`t)\\<^sub>S (B`t)\. t\X})" + unfolding commsemigr_def + using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def abelian_group_axioms_def + group0_def IsAgroup_def IsAmonoid_def using coordinate_function[OF assms(2,3)] by auto + have sing:"1\{x}" "|{x}|=1" using singleton_eqpoll_1 eqpoll_sym by auto + then obtain b where b:"b\bij(|{x}|,{x})" "b\bij(1,{x})" unfolding eqpoll_def by auto then + have "\[{x};{AA,B}]=Fold1(A\<^sub>M,{\t,(AA`t)\\<^sub>S (B`t)\. t\X} O b)" + using commsemigr.sum_over_set_bij[OF comm fin, of b] trans[OF A] by blast + also have "\=({\t,(AA`t)\\<^sub>S (B`t)\. t\X} O b)`0" using semigr0.prod_of_1elem unfolding semigr0_def using + comp_fun[OF _ coordinate_function[OF assms(2,3)], of b 1] b(2) assms(1) func1_1_L1B[of b 1 "{x}" X] assoc unfolding bij_def inj_def by blast + also have "\=({\t,(AA`t)\\<^sub>S (B`t)\. t\X})`(b`0)" using comp_fun_apply b unfolding bij_def inj_def by auto + also have "\= {\t,(AA`t)\\<^sub>S (B`t)\. t\X}`x" using apply_type[of b 1 "\t. {x}" 0] b unfolding bij_def inj_def + by auto + ultimately show ?thesis using apply_equality[OF _ coordinate_function[OF assms(2,3)]] assms(1) by auto +qed + +text \Since a linear combination is a group element, it makes sense to apply the action onto it. +With this result we simplify it to a linear combination.\ + +lemma(in module0) linComb_action: + assumes "AA:X\R" "B:X\\" "r\R" "D\FinPow(X)" + shows "r\\<^sub>S(\[D;{AA,B}])=\[D;{{\k,r\(AA`k)\. k\X},B}]" + and "{\m,r \(AA`m)\. m\X}:X\R" +proof- + show f:"{\m,r \(AA`m)\. m\X}:X\R" unfolding Pi_def function_def domain_def + using apply_type[OF assms(1)] assms(3) Ring_ZF_1_L4(3) by auto + { + fix AAt Bt assume as:"AAt:X \ R" "Bt:X \ \" + have "\[0;{AAt,Bt}]=\" using LinearComb_def[OF as] unfolding FinPow_def by auto + then have "r \\<^sub>S (\[0;{AAt,Bt}])=\" using assms(3) zero_fixed by auto moreover + have mr:"{\m,r\(AAt`m)\. m\X}:X\R" unfolding Pi_def function_def domain_def + using apply_type[OF as(1)] assms(3) Ring_ZF_1_L4(3) by auto + then have "\[0;{{\x, r \ (AAt ` x)\ . x \ X},Bt}]=\" using LinearComb_def[OF mr as(2)] + unfolding FinPow_def by auto + ultimately have "r \\<^sub>S (\[0;{AAt,Bt}]) = \[0;{{\x, r \(AAt ` x)\ . x \ X},Bt}]" by auto + } + then have case0:"(\AAt\X \ R. + \Bt\X \ \. r \\<^sub>S (\[0;{AAt,Bt}]) = \[0;{{\x, r \ (AAt ` x)\ . x \ X},Bt}])" by auto + { + fix Tk assume A:"Tk\FinPow(X)" "Tk\0" + then obtain t where tt:"t\Tk" by auto + { + assume "(\AAk\X\R. \Bk\X\\. (r\\<^sub>S(\[Tk-{t};{AAk,Bk}])=\[Tk-{t};{{\k,r\(AAk`k)\. k\X},Bk}]))" + with tt obtain t where t:"t\Tk" "(\AAk\X\R. \Bk\X\\. (r\\<^sub>S(\[Tk-{t};{AAk,Bk}])=\[Tk-{t};{{\k,r\(AAk`k)\. k\X},Bk}]))" by auto + let ?Tk="Tk-{t}" + have CC:"Tk=?Tk\{t}" using t by auto + have DD:"?Tk\FinPow(X)" using A(1) unfolding FinPow_def using subset_Finite[of ?Tk Tk] + by auto + have tX:"t\X" using t(1) A(1) unfolding FinPow_def by auto + then have EE:"X-(?Tk)=(X-Tk)\{t}" using t(1) by auto + { + assume as:"Tk-{t}\0" + with t have BB:"t\Tk" "Tk-{t}\0" "\AAk\X\R. \Bk\X\\. (r\\<^sub>S(\[Tk-{t};{AAk,Bk}])=\[Tk-{t};{{\k,r\(AAk`k)\. k\X},Bk}])" by auto + from BB(3) have A3:"\AAk\X\R. \Bk\X\\. (r\\<^sub>S(\[?Tk;{AAk,Bk}])=\[?Tk;{{\k,r\(AAk`k)\. k\X},Bk}])" by auto + { + fix AAt Bt assume B:"AAt:X\R" "Bt:X\\" + then have af:"{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X}:X\\" using coordinate_function by auto + have comm:"commsemigr(\, A\<^sub>M, X, {\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X})" + unfolding commsemigr_def + using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def abelian_group_axioms_def + group0_def IsAgroup_def IsAmonoid_def using af by auto + then have "CommSetFold(A\<^sub>M,{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X},Tk)=CommSetFold(A\<^sub>M,{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X},?Tk) + +\<^sub>V({\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X}`t)" using commsemigr.sum_over_set_add_point(2)[of \ A\<^sub>M X "{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X}" "Tk-{t}"] DD BB(2) + A(1-2) EE CC by auto + also have "\=CommSetFold(A\<^sub>M,{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X},?Tk) + +\<^sub>V((AAt`t)\\<^sub>S(Bt`t))" using apply_equality[OF _ af, of t "(AAt`t)\\<^sub>S(Bt`t)"] tX by auto + ultimately have "CommSetFold(A\<^sub>M,{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X},Tk)=CommSetFold(A\<^sub>M,{\k,(AAt`k)\\<^sub>S(Bt`k)\. k\X},?Tk) + +\<^sub>V((AAt`t)\\<^sub>S(Bt`t))" by auto moreover + have "domain(AAt)=X" using B(1) Pi_def by auto ultimately + have "(\[Tk;{AAt,Bt}])=(\[?Tk;{AAt,Bt}])+\<^sub>V((AAt`t)\\<^sub>S(Bt`t))" unfolding LinearComb_def[OF B(1,2) A(1)] + LinearComb_def[OF B(1,2) DD] using as A(2) by auto + then have eq:"r\\<^sub>S(\[Tk;{AAt,Bt}])=r\\<^sub>S((\[?Tk;{AAt,Bt}])+\<^sub>V((AAt`t)\\<^sub>S(Bt`t)))" by auto + moreover have "\g\\. \h\\. (H`r)`(g+\<^sub>Vh)=((H`r)`g)+\<^sub>V((H`r)`h)" + using module_ax1 assms(3) by auto + moreover have AR:"AAt`t\R" using B(1) tX apply_type by auto + then have "H`(AAt`t):\\\" using H_val_type(2) by auto + from apply_type[OF this] have "(AAt`t)\\<^sub>S(Bt`t)\\" using apply_type[OF B(2)] tX by auto moreover + have mr:"{\m,r\(AAt`m)\. m\X}:X\R" unfolding Pi_def function_def domain_def + using apply_type[OF B(1)] assms(3) Ring_ZF_1_L4(3) by auto + then have fff:"{\m,({\m,r\(AAt`m)\. m\X}`m)\\<^sub>S(Bt`m)\. m\X}:X\\" using coordinate_function[OF mr B(2)] apply_equality[OF _ mr] by auto + with tX have pff:"\t,({\m,r\(AAt`m)\. m\X}`t)\\<^sub>S(Bt`t)\\{\m,({\m,r\(AAt`m)\. m\X}`m)\\<^sub>S(Bt`m)\. m\X}" + by auto + have dom:"domain({\m,(r\(AAt`m))\. m\X})=X" by auto + have comm2:"commsemigr(\, A\<^sub>M, X, {\m, ({\x,r \(AAt`x)\. x\X}`m)\\<^sub>S(Bt`m)\. m\X})" + unfolding commsemigr_def + using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def abelian_group_axioms_def + group0_def IsAgroup_def IsAmonoid_def using fff by auto + have "\[?Tk;{AAt,Bt}]\\" using linComb_is_in_module[OF B(1,2) DD]. + ultimately have "r \\<^sub>S ((\[?Tk;{AAt,Bt}]) +\<^sub>V ((AAt ` t) \\<^sub>S (Bt ` t)))=(r\\<^sub>S(\[?Tk;{AAt,Bt}]))+\<^sub>V(r\\<^sub>S((AAt`t)\\<^sub>S(Bt`t)))" + by auto + also have "\=(r\\<^sub>S(\[?Tk;{AAt,Bt}]))+\<^sub>V((r\(AAt`t))\\<^sub>S(Bt`t))" using module_ax3 + assms(3) AR apply_type[OF B(2)] tX by auto + also have "\=(\[?Tk;{{\x,r\(AAt`x)\. x\X},Bt}])+\<^sub>V((r\(AAt`t))\\<^sub>S(Bt`t))" + using A3 B(1,2) by auto + also have "\=(\[?Tk;{{\x,r\(AAt`x)\. x\X},Bt}])+\<^sub>V(({\m, r \ (AAt ` m)\ . m \ X} `t)\\<^sub>S(Bt`t))" + using apply_equality[OF _ mr] tX by auto + also have "\=(\[?Tk;{{\x,r\(AAt`x)\. x\X},Bt}])+\<^sub>V({\m, ({\x,(r \(AAt`x))\. x\X}`m)\\<^sub>S(Bt`m)\. m\X}`t)" + using apply_equality[OF pff fff] by auto + also have "\=CommSetFold(A\<^sub>M,{\m, ({\x,r \(AAt`x)\. x\X}`m)\\<^sub>S(Bt`m)\. m\X},?Tk)+\<^sub>V({\m, ({\x,(r \(AAt`x))\. x\X}`m)\\<^sub>S(Bt`m)\. m\X}`t)" + unfolding LinearComb_def[OF mr B(2) DD] using dom as by auto + also have "\=CommSetFold(A\<^sub>M,{\m, ({\x,r \(AAt`x)\. x\X}`m)\\<^sub>S(Bt`m)\. m\X},Tk)" using + commsemigr.sum_over_set_add_point(2)[OF comm2, of "Tk-{t}"] fff DD tX CC BB(2) by auto + ultimately have "r \\<^sub>S ((\[?Tk;{AAt,Bt}]) +\<^sub>V ((AAt ` t) \\<^sub>S (Bt ` t))) =CommSetFold(A\<^sub>M,{\m, ({\x,r \(AAt`x)\. x\X}`m)\\<^sub>S(Bt`m)\. m\X},Tk)" + by auto + with eq have "r \\<^sub>S (\[Tk;{AAt,Bt}]) =CommSetFold(A\<^sub>M,{\m, ({\x,r \(AAt`x)\. x\X}`m)\\<^sub>S(Bt`m)\. m\X},Tk)" by auto + also have "\=\[Tk;{{\x,r\(AAt`x)\. x\X},Bt}]" using A(2) unfolding LinearComb_def[OF mr B(2) A(1)] dom by auto + ultimately have "r \\<^sub>S (\[Tk;{AAt,Bt}]) =\[Tk;{{\x,r\(AAt`x)\. x\X},Bt}]" by auto + } + then have "\AA\X\R. \B\X\\. r \\<^sub>S (\[Tk;{AA,B}]) =\[Tk;{{\x,r\(AA`x)\. x\X},B}]" using BB by auto + } + moreover + { + assume "Tk-{t}=0" + then have sing:"Tk={t}" using A(2) by auto + { + fix AAt Bt assume B:"AAt:X\R" "Bt:X\\" + have mr:"{\m,r\(AAt`m)\. m\X}:X\R" unfolding Pi_def function_def domain_def + using apply_type[OF B(1)] assms(3) Ring_ZF_1_L4(3) by auto + from sing have "\[Tk;{AAt,Bt}]=(AAt`t)\\<^sub>S(Bt`t)" using linComb_one_element[OF tX B] + by auto + then have "r \\<^sub>S (\[Tk;{AAt,Bt}])=r \\<^sub>S ((AAt`t)\\<^sub>S(Bt`t))" by auto + also have "\=(r \ (AAt`t))\\<^sub>S(Bt`t)" using module_ax3 assms(3) apply_type[OF B(1) tX] + apply_type[OF B(2) tX] by auto + also have "\=({\m,(r \ (AAt`m))\. m\X}`t)\\<^sub>S(Bt`t)" using apply_equality[OF _ mr] tX by auto + also have "\=\[Tk;{{\m,(r \ (AAt`m))\. m\X},Bt}]" using sing linComb_one_element[OF tX mr B(2)] + by auto + ultimately have "r \\<^sub>S (\[Tk;{AAt,Bt}])=\[Tk;{{\m,(r \ (AAt`m))\. m\X},Bt}]" by auto + } + } + ultimately have " \AA\X \ R. \B\X \ \. r \\<^sub>S (\[Tk;{AA,B}]) = \[Tk;{{\x, r \ (AA ` x)\ . x \ X},B}]" + by auto + } + with tt have "\t\Tk. (\AAt\X \ R. \Bt\X \ \. + r \\<^sub>S (\[Tk - {t};{AAt,Bt}]) = + \[Tk - {t};{{\x, r \ (AAt ` x)\ . x \ X},Bt}]) \ + (\AAt\X \ R. \Bt\X \ \. + r \\<^sub>S (\[Tk;{AAt,Bt}]) = \[Tk;{{\x, r \ (AAt ` x)\ . x \ X},Bt}])" by auto + } + then have caseStep:"\A\FinPow(X). A\0 \ (\t\A. (\AAt\X \ R. + \Bt\X \ \. + r \\<^sub>S (\[A - {t};{AAt,Bt}]) = + \[A - {t};{{\x, r \ (AAt ` x)\ . x \ X},Bt}]) \ + (\AAt\X \ R. + \Bt\X \ \. + r \\<^sub>S (\[A;{AAt,Bt}]) = \[A;{{\x, r \ (AAt ` x)\ . x \ X},Bt}]))" by auto + have "\AAt\X\R. \Bt\X\\. r \\<^sub>S(\[D;{AAt,Bt}]) =\[D;{{\x,r\(AAt`x)\. x\X},Bt}]" using + FinPow_ind_rem_one[where P="\D. (\AAt\X\R. \Bt\X\\. r \\<^sub>S(\[D;{AAt,Bt}]) =\[D;{{\x,r\(AAt`x)\. x\X},Bt}])", + OF case0 caseStep] assms(4) by auto + with assms(1,2) show "r \\<^sub>S(\[D;{AA,B}]) =\[D;{{\x,r\(AA`x)\. x\X},B}]" by auto +qed + +text\A linear combination can always be defined on a cardinal.\ + +lemma(in module0) linComb_reorder_terms1: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "g\bij(|D|,D)" + shows "(\[D;{AA,B}])=\[|D|;{AA O g,B O g}]" +proof- + from assms(3,4) have funf:"g:|D|\X" unfolding bij_def inj_def FinPow_def using func1_1_L1B by auto + have ABfun:"AA O g:|D|\R" "B O g:|D|\\" using comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)] by auto + then have domAg:"domain(AA O g)=|D|" unfolding Pi_def by auto + from assms(1) have domA:"domain(AA)=X" unfolding Pi_def by auto + have comm:"commsemigr(\, A\<^sub>M, domain(AA), {\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)})" + unfolding commsemigr_def using mod_ab_gr.abelian_group_axioms unfolding IsAgroup_def + IsAmonoid_def abelian_group_def group0_def abelian_group_axioms_def + using coordinate_function[OF assms(1,2)] domA by auto + { + assume A:"D=0" + then have D:"\[D;{AA,B}]=\" using LinearComb_def assms(1-3) by auto moreover + from A assms(4) have "|D|=0" unfolding bij_def inj_def Pi_def by auto + moreover then have "|D|\FinPow(|D|)" unfolding FinPow_def by auto moreover + note ABfun + ultimately have ?thesis using LinearComb_def[of "AA O g" "|D|" "B O g", of "|D|"] by auto + } + moreover + { + assume A:"D\0" + then have eqD:"\[D;{AA,B}]=CommSetFold(A\<^sub>M,{\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)},D)" using LinearComb_def[OF assms(1-3)] by auto + have eqD1:"CommSetFold(A\<^sub>M,{\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)},D)=Fold1(A\<^sub>M,{\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)} O g)" + using commsemigr.sum_over_set_bij[OF comm] assms(3) A + domA assms(4) by blast + { + fix n assume n:"n\|D|" + then have T:"({\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)} O g)`n={\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)}`( g`n)" + using comp_fun_apply funf unfolding bij_def inj_def by auto + have "g`n\D" using assms(4) unfolding bij_def inj_def using apply_type n by auto + then have "g`n\domain(AA)" using domA assms(3) unfolding FinPow_def by auto + then have "{\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)}`( g`n)=(AA`(g`n))\\<^sub>S (B`( g`n))" using apply_equality[OF _ coordinate_function[OF assms(1,2)]] + domA by auto + also have "\=((AA O g)`n)\\<^sub>S ((B O g)`n)" using comp_fun_apply funf n by auto + also have "\={\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|}`n" using apply_equality[OF _ coordinate_function[OF comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)]]] + n by auto + ultimately have "({\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)} O g)`n={\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|}`n" using T by auto + } + then have "\x\|D|. ({\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)} O g)`x={\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|}`x" by auto + then have eq:"{\m,(AA`m)\\<^sub>S (B`m)\. m\domain(AA)} O g={\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|}" using func_eq[OF comp_fun[OF funf coordinate_function[OF assms(1) assms(2)]] + coordinate_function[OF comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)]]] domA by auto + have R1:"\[D;{AA,B}]=Fold1(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|})" + using trans[OF eqD eqD1] subst[OF eq, of "\t. \[D;{AA,B}] = Fold1(A\<^sub>M,t)"] by blast + from A have Dno:"|D|\0" using assms(4) unfolding bij_def surj_def by auto + have "||D||=|D|" using cardinal_cong assms(4) unfolding eqpoll_def by auto + then have idf:"id(|D|)\bij(||D||,|D|)" using id_bij by auto + have comm:"commsemigr(\, A\<^sub>M, |D|, {\m, ((AA O g) ` m) \\<^sub>S ((B O g) ` m)\ . m \ |D|})" + unfolding commsemigr_def using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def group0_def IsAgroup_def IsAmonoid_def + abelian_group_axioms_def using coordinate_function[OF comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)]] + by auto + have sub:"{\m, ((AA O g) ` m) \\<^sub>S ((B O g) ` m)\ . m \ |D|} \ |D|\\" using + coordinate_function[OF comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)]] + unfolding Pi_def by auto + have finE:"Finite(|D|)" using assms(4,3) eqpoll_imp_Finite_iff unfolding eqpoll_def FinPow_def by auto + then have EFP:"|D|\FinPow(|D|)" unfolding FinPow_def by auto + then have eqE:"\[|D|;{AA O g,B O g}]=CommSetFold(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\domain(AA O g)},|D|)" using LinearComb_def[OF comp_fun[OF funf assms(1)] + comp_fun[OF funf assms(2)]] Dno by auto + also have "\=CommSetFold(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|},|D|)" using domAg by auto + also have "\=Fold1(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|})" using commsemigr.sum_over_set_bij[OF comm + EFP Dno idf] + subst[OF right_comp_id[of "{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|}" "|D|" \, OF sub], + of "\t. CommSetFold(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|},|D|) = Fold1(A\<^sub>M,t)"] + by blast + ultimately have "\[|D|;{AA O g,B O g}]=Fold1(A\<^sub>M,{\m,((AA O g)`m)\\<^sub>S ((B O g)`m)\. m\|D|})" + by (simp only:trans) + with R1 have ?thesis by (simp only:trans sym) + } + ultimately show ?thesis by blast +qed + +text\Actually a linear combination can be defined over any +bijective set with the original set.\ + +lemma(in module0) linComb_reorder_terms2: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "g\bij(E,D)" + shows "(\[D;{AA,B}])=\[E;{AA O g,B O g}]" +proof- + from assms(3,4) have funf:"g:E\X" unfolding bij_def inj_def FinPow_def using func1_1_L1B by auto + have ABfun:"AA O g:E\R" "B O g:E\\" using comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)] by auto + then have domAg:"domain(AA O g)=E" unfolding Pi_def by auto + from assms(1) have domA:"domain(AA)=X" unfolding Pi_def by auto + from assms(3-4) have finE:"Finite(E)" unfolding FinPow_def using eqpoll_imp_Finite_iff unfolding eqpoll_def by auto + then have "|E|\E" using well_ord_cardinal_eqpoll Finite_imp_well_ord by blast + then obtain h where h:"h\bij(|E|,E)" unfolding eqpoll_def by auto + then have "(g O h)\bij(|E|,D)" using comp_bij assms(4) by auto moreover + have ED:"|E|=|D|" using cardinal_cong assms(4) unfolding eqpoll_def by auto + ultimately have "(g O h)\bij(|D|,D)" by auto + then have "(\[D;{AA,B}])=(\[|D|;{AA O (g O h),B O (g O h)}])" using linComb_reorder_terms1 assms(1-3) by auto moreover + from h have "(\[E;{AA O g,B O g}])=(\[|E|;{(AA O g) O h,(B O g) O h}])" using linComb_reorder_terms1 comp_fun[OF funf assms(1)] comp_fun[OF funf assms(2)] + finE unfolding FinPow_def by auto + moreover note ED ultimately + show ?thesis using comp_assoc by auto +qed + +text\Restricting the defining functions to the domain set does nothing to +the linear combination\ + +corollary(in module0) linComb_restrict_coord: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" + shows "(\[D;{AA,B}])=\[D;{restrict(AA,D),restrict(B,D)}]" + using linComb_reorder_terms2[OF assms id_bij] right_comp_id_any by auto + +text\A linear combination can by defined with a natural number +and functions with that number as domain.\ + +corollary(in module0) linComb_nat: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" + shows "\n\nat. \A1\n\R. \B1\n\\. \[D;{AA,B}]=\[n;{A1,B1}] \ A1``n=AA``D \ B1``n=B``D" +proof + from assms(3) have fin:"Finite(D)" unfolding FinPow_def by auto + then obtain n where n:"n\nat" "D\n" unfolding Finite_def by auto moreover + from fin have "|D|\D" using well_ord_cardinal_eqpoll Finite_imp_well_ord by blast + ultimately have "|D|\n" "n\nat" using eqpoll_trans[of "|D|"] by auto + then have "n\nat" "||D||=|n|" using cardinal_cong by auto + then have D:"|D|=n" "n\nat" using Card_cardinal_eq[OF Card_cardinal] Card_cardinal_eq[OF nat_into_Card] by auto + then show "|D|\nat" by auto + from n(2) D(1) obtain g where g:"g\bij(|D|,D)" using eqpoll_sym unfolding eqpoll_def by auto + show "\A1\|D|\R. \B1\|D|\\. \[D;{AA,B}]=\[|D|;{A1,B1}] \ A1``|D|=AA``D \ B1``|D|=B``D" + proof + from g have gX:"g:|D|\X" unfolding bij_def inj_def using assms(3) unfolding FinPow_def using func1_1_L1B by auto + then show "(AA O g):|D|\R" using comp_fun assms(1) by auto + show "\B1\|D|\\. \[D;{AA,B}]=\[|D|;{AA O g,B1}] \ (AA O g)``|D|=AA``D \ B1``|D|=B``D" + proof + show "(B O g):|D|\\" using comp_fun assms(2) gX by auto + have "\[D;{AA,B}]=\[|D|;{AA O g,B O g}]" using g linComb_reorder_terms1 assms func1_1_L1B by auto + moreover have "(AA O g)``|D|=AA``(g``|D|)" using image_comp by auto + then have "(AA O g)``|D|=AA``D" using g unfolding bij_def using surj_range_image_domain by auto + moreover have "(B O g)``|D|=B``(g``|D|)" using image_comp by auto + then have "(B O g)``|D|=B``D" using g unfolding bij_def using surj_range_image_domain by auto + ultimately show "\[D;{AA,B}]=\[|D|;{AA O g,B O g}] \ (AA O g)``|D|=AA``D \ (B O g)``|D|=B``D" by auto + qed + qed +qed + +subsubsection\Adding linear combinations\ + +text \Adding a linear combination defined over $\emptyset$ leaves it as is\ + +lemma(in module0) linComb_sum_base_induct1: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "AA1:Y\R" "B1:Y\\" + shows "(\[D;{AA,B}])+\<^sub>V(\[0;{AA1,B1}])=\[D;{AA,B}]" +proof- + from assms(1-3) have "\[D;{AA,B}]\\" using linComb_is_in_module by auto + then have eq:"(\[D;{AA,B}])+\<^sub>V\=\[D;{AA,B}]" using zero_neutral(1) + by auto moreover + have ff:"0\FinPow(Y)" unfolding FinPow_def by auto + from eq show ?thesis using LinearComb_def[OF assms(4-5) ff] by auto +qed + +text\Applying a product of $1\times$ to the defining set computes the same linear combination; since they are bijective sets\ + +lemma(in module0) linComb_sum_base_induct2: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" + shows "(\[D;{AA,B}])=\[{0}\D;{{\\0,x\,AA`x\. x\X},{\\0,x\,B`x\. x\X}}]" and + "(\[D;{AA,B}])=\[{0}\D;{restrict({\\0,x\,AA`x\. x\X},{0}\D),restrict({\\0,x\,B`x\. x\X},{0}\D)}]" +proof- + let ?g="{\\0,d\,d\. d\D}" + from assms(3) have sub:"D\X" unfolding FinPow_def by auto + have gfun:"?g:{0}\D\D" unfolding Pi_def function_def by blast + then have gfunX:"?g:{0}\D\X" using sub func1_1_L1B by auto + from gfun have "?g\surj({0}\D,D)" unfolding surj_def using apply_equality[OF _ gfun] by blast moreover + { + fix w y assume "?g`w=?g`y" "w\{0}\D" "y\{0}\D" + then obtain dw dy where "w=\0,dw\" "y=\0,dy\" "?g`w=?g`y" "dw\D" "dy\D" by auto + then have "dw=dy" "w=\0,dw\" "y=\0,dy\" using apply_equality[OF _ gfun, of w dw] apply_equality[OF _ gfun, of y dy] by auto + then have "w=y" by auto + } + then have "?g\inj({0}\D,D)" unfolding inj_def using gfun by auto ultimately + have gbij:"?g\bij({0}\D,D)" unfolding bij_def by auto + with assms have A1:"(\[D;{AA,B}])=\[{0}\D;{AA O ?g,B O ?g}]" using linComb_reorder_terms2 by auto + from gbij have "Finite({0}\D)" using assms(3) eqpoll_imp_Finite_iff unfolding FinPow_def eqpoll_def by auto + then have fin:"{0}\D\FinPow({0}\X)" unfolding FinPow_def using sub by auto + have A0:"{\\0,x\,AA`x\. x\X}:{0}\X\R" unfolding Pi_def function_def using apply_type[OF assms(1)] by auto + have B0:"{\\0,x\,B`x\. x\X}:{0}\X\\" unfolding Pi_def function_def using apply_type[OF assms(2)] by auto + { + fix r assume "r\{0}\D" + then obtain rd where rd:"r=\0,rd\" "rd\D" by auto + then have "(AA O ?g)`r=AA`rd" using comp_fun_apply gfun apply_equality by auto + also have "\={\\0,x\,AA`x\. x\X}`\0,rd\" using apply_equality[OF _ A0] sub rd(2) by auto + also have "\=restrict({\\0,x\,AA`x\. x\X},{0}\D)`\0,rd\" using restrict rd(2) by auto + ultimately have "(AA O ?g)`r=restrict({\\0,x\,AA`x\. x\X},{0}\D)`r" using rd(1) by auto + } + then have "\r\{0}\D. (AA O ?g)`r=restrict({\\0,x\,AA`x\. x\X},{0}\D)`r" by auto moreover + have "AA O ?g:{0}\D\R" using gfunX assms(1) comp_fun by auto moreover + have "{0}\D\{0}\X" using sub by auto + then have "restrict({\\0,x\,AA`x\. x\X},{0}\D):{0}\D\R" using A0 restrict_fun by auto ultimately + have f1:"(AA O ?g)=restrict({\\0,x\,AA`x\. x\X},{0}\D)" using func_eq[of "AA O ?g" "{0}\D" R "restrict({\\0, x\, AA ` x\ . x \ X}, {0} \ D)"] + by auto + { + fix r assume "r\{0}\D" + then obtain rd where rd:"r=\0,rd\" "rd\D" by auto + then have "(B O ?g)`r=B`rd" using comp_fun_apply gfun apply_equality by auto + also have "\={\\0,x\,B`x\. x\X}`\0,rd\" using apply_equality[OF _ B0] sub rd(2) by auto + also have "\=restrict({\\0,x\,B`x\. x\X},{0}\D)`\0,rd\" using restrict rd(2) by auto + ultimately have "(B O ?g)`r=restrict({\\0,x\,B`x\. x\X},{0}\D)`r" using rd(1) by auto + } + then have "\r\{0}\D. (B O ?g)`r=restrict({\\0,x\,B`x\. x\X},{0}\D)`r" by auto moreover + have "B O ?g:{0}\D\\" using gfunX assms(2) comp_fun by auto moreover + have "{0}\D\{0}\X" using sub by auto + then have "restrict({\\0,x\,B`x\. x\X},{0}\D):{0}\D\\" using B0 restrict_fun by auto ultimately + have "(B O ?g)=restrict({\\0,x\,B`x\. x\X},{0}\D)" using func_eq[of "B O ?g" "{0}\D" \ "restrict({\\0, x\, B ` x\ . x \ X}, {0} \ D)"] + by auto + with A1 f1 show "(\[D;{AA,B}])=\[{0}\D;{restrict({\\0,x\,AA`x\. x\X},{0}\D),restrict({\\0,x\,B`x\. x\X},{0}\D)}]" by auto + also have "\=\[{0}\D;{{\\0,x\,AA`x\. x\X},{\\0,x\,B`x\. x\X}}]" using linComb_restrict_coord[OF A0 B0 fin] by auto + ultimately show "(\[D;{AA,B}])=\[{0}\D;{{\\0,x\,AA`x\. x\X},{\\0,x\,B`x\. x\X}}]" by auto +qed + +text\Then, we can model adding a liner combination on the empty set +as a linear combination of the disjoint union of sets\ + +lemma(in module0) linComb_sum_base_induct: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "AA1:Y\R" "B1:Y\\" + shows "(\[D;{AA,B}])+\<^sub>V(\[0;{AA1,B1}])=\[D+0;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" +proof- + from assms(3) have sub:"D\X" unfolding FinPow_def by auto + then have sub2:"{0}\D\{0}\X" by auto + then have sub3:"{0}\D\Pow(X+Y)" unfolding sum_def by auto + let ?g="{\\0,x\,x\. x\D}" + have gfun:"?g:{0}\D\D" unfolding Pi_def function_def by blast + then have "?g\surj({0}\D,D)" unfolding surj_def using apply_equality by auto moreover + { + fix w y assume "?g`w=?g`y" "w\{0}\D" "y\{0}\D" + then obtain dw dy where "w=\0,dw\" "y=\0,dy\" "?g`w=?g`y" "dw\D" "dy\D" by auto + then have "dw=dy" "w=\0,dw\" "y=\0,dy\" using apply_equality[OF _ gfun, of w dw] apply_equality[OF _ gfun, of y dy] by auto + then have "w=y" by auto + } + then have "?g\inj({0}\D,D)" unfolding inj_def using gfun by auto ultimately + have gbij:"?g\bij({0}\D,D)" unfolding bij_def by auto + then have "Finite({0}\D)" using assms(3) eqpoll_imp_Finite_iff unfolding FinPow_def eqpoll_def by auto + with sub3 have finpow0D:"{0}\D\FinPow(X+Y)" unfolding FinPow_def by auto + have A0:"{\\0,x\,AA`x\. x\X}:{0}\X\R" unfolding Pi_def function_def using apply_type[OF assms(1)] by auto + have A1:"{\\1,x\,AA1`x\. x\Y}:{1}\Y\R" unfolding Pi_def function_def using apply_type[OF assms(4)] by auto + have domA0:"domain({\\0,x\,AA`x\. x\X})={0}\X" by auto + have domA1:"domain({\\1,x\,AA1`x\. x\Y})={1}\Y" by auto + have A:"{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y}:X+Y\R" using fun_disjoint_Un[OF A0 A1] unfolding sum_def by auto + have B0:"{\\0,x\,B`x\. x\X}:{0}\X\\" unfolding Pi_def function_def using apply_type[OF assms(2)] by auto + have B1:"{\\1,x\,B1`x\. x\Y}:{1}\Y\\" unfolding Pi_def function_def using apply_type[OF assms(5)] by auto + then have domB0:"domain({\\0,x\,B`x\. x\X})={0}\X" unfolding Pi_def by auto + then have domB1:"domain({\\1,x\,B1`x\. x\Y})={1}\Y" unfolding Pi_def by auto + have B:"{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}:X+Y\\" using fun_disjoint_Un[OF B0 B1] unfolding sum_def by auto + have "(\[D;{AA,B}])+\<^sub>V(\[0;{AA1,B1}])=\[D;{AA,B}]" using linComb_sum_base_induct1 assms by auto + also have "\=\[{0}\D;{restrict({\\0,x\,AA`x\. x\X},{0}\D),restrict({\\0,x\,B`x\. x\X},{0}\D)}]" using linComb_sum_base_induct2(2) assms(1-3) by auto + ultimately have eq1:"(\[D;{AA,B}])+\<^sub>V(\[0;{AA1,B1}])=\[{0}\D;{restrict({\\0,x\,AA`x\. x\X},{0}\D),restrict({\\0,x\,B`x\. x\X},{0}\D)}]" by auto + { + fix s assume "s\{0}\D" + then obtain ds where ds:"ds\D" "s=\0,ds\" by auto + then have "restrict({\\0,x\,AA`x\. x\X},{0}\D)`s={\\0,x\,AA`x\. x\X}`s" using restrict by auto + also have "\=({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s" using fun_disjoint_apply1 domA1 ds(2) by auto + also have "\=restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D)`s" using restrict ds by auto + ultimately have "restrict({\\0,x\,AA`x\. x\X},{0}\D)`s=restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D)`s" by auto + } + then have tot:"\s\{0}\D. restrict({\\0,x\,AA`x\. x\X},{0}\D)`s=restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D)`s" by auto moreover + have f1:"restrict({\\0,x\,AA`x\. x\X},{0}\D):{0}\D\R" using restrict_fun A0 sub2 by auto moreover + have f2:"restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D):{0}\D\R" using restrict_fun[OF fun_disjoint_Un[OF A0 A1]] sub2 by auto + ultimately have fA:"restrict({\\0,x\,AA`x\. x\X},{0}\D)=restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D)" using func_eq[OF f1 f2] by auto + { + fix s assume "s\{0}\D" + then obtain ds where ds:"ds\D" "s=\0,ds\" by auto + then have "restrict({\\0,x\,B`x\. x\X},{0}\D)`s={\\0,x\,B`x\. x\X}`s" using restrict by auto + also have "\=({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s" using fun_disjoint_apply1 domB1 ds(2) by auto + also have "\=restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D)`s" using restrict ds by auto + ultimately have "restrict({\\0,x\,B`x\. x\X},{0}\D)`s=restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D)`s" by auto + } + then have tot:"\s\{0}\D. restrict({\\0,x\,B`x\. x\X},{0}\D)`s=restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D)`s" by auto moreover + have f1:"restrict({\\0,x\,B`x\. x\X},{0}\D):{0}\D\\" using restrict_fun B0 sub2 by auto moreover + have f2:"restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D):{0}\D\\" using restrict_fun[OF fun_disjoint_Un[OF B0 B1]] sub2 by auto + ultimately have fB:"restrict({\\0,x\,B`x\. x\X},{0}\D)=restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D)" using func_eq[OF f1 f2] by auto + with fA eq1 have "(\[D;{AA,B}])+\<^sub>V(\[0;{AA1,B1}])=\[{0}\D;{restrict({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{0}\D),restrict({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y},{0}\D)}]" + by auto + also have "\=\[{0}\D;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" using linComb_restrict_coord[OF A B finpow0D] + by auto + also have "\=\[D+0;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" unfolding sum_def by auto + ultimately show ?thesis by auto +qed + +text\An element of the set for the linear combination +can be removed and add it using group addition.\ + +lemma(in module0) sum_one_element: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "t\D" + shows "(\[D;{AA,B}])=(\[D-{t};{AA,B}])+\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" +proof- + from assms(1,2) have af:"{\k,(AA`k)\\<^sub>S(B`k)\. k\X}:X\\" using coordinate_function by auto + from assms(3) have sub:"D\X" unfolding FinPow_def by auto + then have tX:"t\X" using assms(4) by auto + have dom:"domain(AA)=X" using assms(1) Pi_def by auto + { + assume A:"D-{t}=0" + with assms(4) have "D={t}" by auto + then have "(\[D;{AA,B}])=\[{t};{AA,B}]" by auto + also have "\=(AA`t)\\<^sub>S(B`t)" using linComb_one_element sub assms(1,2,4) by auto + also have "\={\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t" using af assms(4) sub apply_equality by auto + also have "\=\ +\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" using zero_neutral(2) + apply_type[OF af] assms(4) sub by auto + also have "\=(\[D-{t};{AA,B}])+\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" using A LinearComb_def[OF assms(1,2), of "D-{t}"] + unfolding FinPow_def by auto + ultimately have ?thesis by auto + } + moreover + { + assume A:"D-{t}\0" + then have D:"D\0" by auto + have comm:"commsemigr(\, A\<^sub>M, X, {\k,(AA`k)\\<^sub>S(B`k)\. k\X})" + unfolding commsemigr_def using mod_ab_gr.abelian_group_axioms + unfolding abelian_group_def abelian_group_axioms_def group0_def + IsAgroup_def IsAmonoid_def using af by auto + have fin:"D-{t}\FinPow(X)" using assms(3) unfolding FinPow_def using subset_Finite[of "D-{t}" D] by auto + have "(D-{t})\{t}=D" "X-(D-{t})=(X-D)\{t}" using assms(4) sub by auto + then have "CommSetFold(A\<^sub>M,{\k,(AA`k)\\<^sub>S(B`k)\. k\X},D)=CommSetFold(A\<^sub>M,{\k,(AA`k)\\<^sub>S(B`k)\. k\X},D-{t}) + +\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" using commsemigr.sum_over_set_add_point(2)[OF comm + fin A] by auto + also have "\=(\[D-{t};{AA,B}])+\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" using LinearComb_def[OF assms(1,2) fin] A + dom by auto + ultimately have "CommSetFold(A\<^sub>M,{\k,(AA`k)\\<^sub>S(B`k)\. k\X},D)=(\[D-{t};{AA,B}])+\<^sub>V({\k,(AA`k)\\<^sub>S(B`k)\. k\X}`t)" by auto moreover + then have ?thesis unfolding LinearComb_def[OF assms(1-3)] using D dom by auto + } + ultimately show ?thesis by blast +qed + +text \A small technical lemma to proof by induction on finite sets that the addition of linear combinations +is a linear combination\ + +lemma(in module0) linComb_sum_ind_step: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" "E\FinPow(Y)" "AA1:Y\R" "B1:Y\\" "t\E" "D\0" + "(\[D;{AA,B}])+\<^sub>V(\[E-{t};{AA1,B1}])=\[D+(E-{t});{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" + shows "(\[D;{AA,B}])+\<^sub>V(\[E;{AA1,B1}])=\[D+E;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" +proof- + have a1f:"{\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}:Y\\" using coordinate_function assms(5,6) by auto + with assms(4,7) have p1:"({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t)\\" unfolding FinPow_def using apply_type by auto + have p2:"\[D;{AA,B}]\\" using linComb_is_in_module assms(1-3) by auto + have "E-{t}\FinPow(Y)" using assms(4,7) unfolding FinPow_def using subset_Finite[of "E-{t}" E] by auto + then have p3:"\[E-{t};{AA1,B1}]\\" using linComb_is_in_module assms(5,6) by auto + have "\[E;{AA1,B1}]=(\[E-{t};{AA1,B1}])+\<^sub>V({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t)" using sum_one_element[OF assms(5,6,4,7)]. + then have "(\[D;{AA,B}])+\<^sub>V(\[E;{AA1,B1}])=(\[D;{AA,B}])+\<^sub>V((\[E-{t};{AA1,B1}])+\<^sub>V({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t))" by auto + also have "\=((\[D;{AA,B}])+\<^sub>V(\[E-{t};{AA1,B1}]))+\<^sub>V({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t)" + using p1 p2 p3 mod_ab_gr.group_oper_assoc by auto + also have "\=(\[D+(E-{t});{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}])+\<^sub>V({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t)" + using assms(9) by auto + ultimately have "(\[D;{AA,B}])+\<^sub>V(\[E;{AA1,B1}])=(\[D+(E-{t});{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}])+\<^sub>V({\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t)" by auto + moreover have "{\k,(AA1`k)\\<^sub>S(B1`k)\. k\Y}`t=(AA1`t)\\<^sub>S(B1`t)" using apply_equality[OF _ a1f] assms(7,4) unfolding FinPow_def by auto moreover + { + have dA:"domain({\\0,x\,AA`x\. x\X})={\0,x\. x\X}" unfolding domain_def by auto + have dA1:"domain({\\1,x\,AA1`x\. x\Y})={\1,x\. x\Y}" unfolding domain_def by auto + have "\1,t\\domain({\\0,x\,AA`x\. x\X})" by auto + then have "({\\1,x\,AA1`x\. x\Y}\{\\0,x\,AA`x\. x\X})`\1,t\={\\1,x\,AA1`x\. x\Y}`\1,t\" using fun_disjoint_apply1[of "\1,t\" "{\\0,x\,AA`x\. x\X}"] by auto + moreover have "{\\1,x\,AA1`x\. x\Y}\{\\0,x\,AA`x\. x\X}={\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y}" by auto + ultimately have "({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,t\={\\1,x\,AA1`x\. x\Y}`\1,t\" by auto moreover + have "{\\1,x\,AA1`x\. x\Y}:{1}\Y\R" unfolding Pi_def function_def using apply_type[OF assms(5)] by auto + then have "{\\1,x\,AA1`x\. x\Y}`\1,t\=(AA1`t)" using apply_equality assms(7,4) unfolding FinPow_def by auto + ultimately have e1:"({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,t\=(AA1`t)" by auto + have dB:"domain({\\0,x\,B`x\. x\X})={\0,x\. x\X}" unfolding domain_def by auto + have dB1:"domain({\\1,x\,B1`x\. x\Y})={\1,x\. x\Y}" unfolding domain_def by auto + have "\1,t\\domain({\\0,x\,B`x\. x\X})" by auto + then have "({\\1,x\,B1`x\. x\Y}\{\\0,x\,B`x\. x\X})`\1,t\={\\1,x\,B1`x\. x\Y}`\1,t\" using fun_disjoint_apply1[of "\1,t\" "{\\0,x\,B`x\. x\X}"] by auto + moreover have "{\\1,x\,B1`x\. x\Y}\{\\0,x\,B`x\. x\X}={\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}" by auto + ultimately have "({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,t\={\\1,x\,B1`x\. x\Y}`\1,t\" by auto moreover + have "{\\1,x\,B1`x\. x\Y}:{1}\Y\\" unfolding Pi_def function_def using apply_type[OF assms(6)] by auto + then have "{\\1,x\,B1`x\. x\Y}`\1,t\=(B1`t)" using apply_equality assms(7,4) unfolding FinPow_def by auto + ultimately have e2:"({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,t\=(B1`t)" by auto + with e1 have "(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,t\)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,t\)=(AA1`t)\\<^sub>S(B1`t)" by auto + moreover have tXY:"\1,t\\X+Y" unfolding sum_def using assms(7,4) unfolding FinPow_def by auto + { + fix s w assume as:"\s,w\\{\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" + then have s:"s\X+Y" and w:"w=(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)" by auto + then have ss:"s\{0}\X \ {1}\Y" unfolding sum_def by auto + { + assume "s\{0}\X" + then obtain r where r:"r\X" "s=\0,r\" by auto + with s have a:"\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\0,r\)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\0,r\)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto + have "({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\0,r\={\\0,x\,AA`x\. x\X}`\0,r\" using fun_disjoint_apply1[of "\0,r\" + "{\\1,x\,AA1`x\. x\Y}"] by auto + also have "\=AA`r" using r(1) apply_equality[of "\0,r\" "AA`r" "{\\0,x\,AA`x\. x\X}" "{0}\X" "\p. R"] unfolding Pi_def function_def + using apply_type[OF assms(1)] by auto + ultimately have AAr:"({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\0,r\=AA`r" by auto + with a have a1:"\s,(AA`r)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\0,r\)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto + have "({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\0,r\={\\0,x\,B`x\. x\X}`\0,r\" using fun_disjoint_apply1[of "\0,r\" + "{\\1,x\,B1`x\. x\Y}"] by auto + also have "\=B`r" using r(1) apply_equality[of "\0,r\" "B`r" "{\\0,x\,B`x\. x\X}" "{0}\X" "\p. \"] unfolding Pi_def function_def + using apply_type[OF assms(2)] by auto + ultimately have Br:"({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\0,r\=B`r" by auto + with a1 have "\s,(AA`r)\\<^sub>S(B`r)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto moreover + have "(AA`r)\\<^sub>S(B`r)\\" using apply_type[OF coordinate_function[OF assms(1,2)] r(1)] apply_equality[OF _ coordinate_function[OF assms(1,2)]] r(1) by auto + ultimately have "\s,(AA`r)\\<^sub>S(B`r)\\(X+Y)\\" using s by auto moreover + from w r(2) AAr Br have "w=(AA`r)\\<^sub>S(B`r)" by auto + ultimately have "\s,w\\(X+Y)\\" by auto + } + moreover + { + assume "s\{0}\X" + with ss have "s\{1}\Y" by auto + then obtain r where r:"r\Y" "s=\1,r\" by auto + with s have a:"\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,r\)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,r\)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto + have "({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,r\={\\1,x\,AA1`x\. x\Y}`\1,r\" using fun_disjoint_apply2[of "\1,r\" + "{\\0,x\,AA`x\. x\X}"] by auto + also have "\=AA1`r" using r(1) apply_equality[of "\1,r\" "AA1`r" "{\\1,x\,AA1`x\. x\Y}" "{1}\Y" "\p. R"] unfolding Pi_def function_def + using apply_type[OF assms(5)] by auto + ultimately have AAr:"({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,r\=AA1`r" by auto + with a have a1:"\s,(AA1`r)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,r\)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto + have "({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,r\={\\1,x\,B1`x\. x\Y}`\1,r\" using fun_disjoint_apply2[of "\1,r\" + "{\\0,x\,B`x\. x\X}"] by auto + also have "\=B1`r" using r(1) apply_equality[of "\1,r\" "B1`r" "{\\1,x\,B1`x\. x\Y}" "{1}\Y" "\p. \"] unfolding Pi_def function_def + using apply_type[OF assms(6)] by auto + ultimately have Br:"({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,r\=B1`r" by auto + with a1 have "\s,(AA1`r)\\<^sub>S(B1`r)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto moreover + have "(AA1`r)\\<^sub>S(B1`r)\\" using apply_type[OF coordinate_function[OF assms(5,6)] r(1)] apply_equality[OF _ coordinate_function[OF assms(5,6)]] r(1) by auto + ultimately have "\s,(AA1`r)\\<^sub>S(B1`r)\\(X+Y)\\" using s by auto moreover + from w r(2) AAr Br have "w=(AA1`r)\\<^sub>S(B1`r)" by auto + ultimately have "\s,w\\(X+Y)\\" by auto + } + ultimately have "\s,w\\(X+Y)\\" by auto + } + then have "{\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}\(X+Y)\\" by auto + then have fun:"{\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}:X+Y\\" + unfolding Pi_def function_def by auto + from tXY have pp:"\\1,t\,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,t\)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,t\)\\ + {\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}" by auto + have "{\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}`\1,t\= + (({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`\1,t\)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`\1,t\)" using apply_equality[OF pp fun] by auto + ultimately have "{\s,(({\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y})`s)\\<^sub>S(({\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y})`s)\. s\X+Y}`\1,t\=(AA1`t)\\<^sub>S(B1`t)" + by auto + } + ultimately have "(\[D;{AA,B}]) +\<^sub>V (\[E;{AA1,B1}]) = + (\[D+(E-{t});{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]) +\<^sub>V + (({\s, ((({\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y}) ` s) \\<^sub>S (({\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}) ` s))\ . + s \ X + Y}) ` \1, t\)" by auto moreover + have "D+(E-{t})=(D+E)-{\1,t\}" unfolding sum_def by auto ultimately + have A1:"(\[D;{AA,B}]) +\<^sub>V (\[E;{AA1,B1}]) = + (\[(D+E)-{\1,t\};{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]) +\<^sub>V + (({\s, ((({\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y}) ` s) \\<^sub>S (({\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}) ` s))\ . + s \ X + Y}) ` \1, t\)" by auto + have f1:"{\\0, x\, AA ` x\ . x \ X}:{0}\X\R" using apply_type[OF assms(1)] unfolding Pi_def function_def by auto + have f2:"{\\1, x\, AA1 ` x\ . x \ Y}:{1}\Y\R" using apply_type[OF assms(5)] unfolding Pi_def function_def by auto + have "({0}\X)\({1}\Y)=0" by auto + then have ffA:"({\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y}):X+Y\R" unfolding sum_def using fun_disjoint_Un[OF f1 f2] by auto + have f1:"{\\0, x\, B ` x\ . x \ X}:{0}\X\\" using apply_type[OF assms(2)] unfolding Pi_def function_def by auto + have f2:"{\\1, x\, B1 ` x\ . x \ Y}:{1}\Y\\" using apply_type[OF assms(6)] unfolding Pi_def function_def by auto + have "({0}\X)\({1}\Y)=0" by auto + then have ffB:"({\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}):X+Y\\" unfolding sum_def using fun_disjoint_Un[OF f1 f2] by auto + have "D+E\X+Y" using assms(3,4) unfolding FinPow_def sum_def by auto moreover + obtain nd ne where "nd\nat" "D\nd" "ne\nat" "E\ne" using assms(3,4) unfolding FinPow_def Finite_def by auto + then have "D+E\nd+ne" "nd\nat" "ne\nat" using sum_eqpoll_cong by auto + then have "D+E\nd #+ ne" using nat_sum_eqpoll_sum eqpoll_trans by auto + then have "\n\nat. D+E\n" using add_type by auto + then have "Finite(D+E)" unfolding Finite_def by auto + ultimately have fin:"D+E\FinPow(X+Y)" unfolding FinPow_def by auto + from assms(7) have "\1,t\\D+E" unfolding sum_def by auto + with A1 show ?thesis using sum_one_element[OF ffA ffB fin] by auto +qed + +text\The addition of two linear combinations is a linear combination\ + +theorem(in module0) linComb_sum: + assumes "AA:X\R" "AA1:Y\R" "B:X\\" "B1:Y\\" "D\0" "D\FinPow(X)" "E\FinPow(Y)" + shows "(\[D;{AA,B}])+\<^sub>V(\[E;{AA1,B1}])=\[D+E;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]" +proof- + { + fix \ \ \1 \1 assume fun:"\:X\R" "\:X\\" "\1:Y\R" "\1:Y\\" + have "((\[D;{\,\}]) +\<^sub>V(\[0;{\1,\1}])=\[D+0;{{\\0,x\,\`x\. x\X}\{\\1,x\,\1`x\. x\Y},{\\0,x\,\`x\. x\X}\{\\1,x\,\1`x\. x\Y}}])" using linComb_sum_base_induct[OF fun(1,2) assms(6) fun(3,4)] + by auto + } + then have base:"\AA\X \ R. + \B\X \ \. + \AA1\Y \ R. + \B1\Y \ \. + (\[D;{AA,B}]) +\<^sub>V (\[0;{AA1,B1}]) = + \[D + 0;{{\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y},{\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}}]" by auto + { + fix \ assume R:"\\FinPow(Y)" "\\0" + then obtain r where r:"r\\" by auto + { + fix \ \ \1 \1 assume fun:"\:X\R" "\:X\\" "\1:Y\R" "\1:Y\\" and + step:"\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. (\[D;{AA,B}]) +\<^sub>V (\[\ - {r};{AA1,B1}])=(\[D+(\ - {r});{{\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y},{\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}}])" + then have "(\[D;{\,\}]) +\<^sub>V (\[\;{\1,\1}])=(\[D+\;{{\\0, x\, \ ` x\ . x \ X} \ {\\1, x\, \1 ` x\ . x \ Y},{\\0, x\, \ ` x\ . x \ X} \ {\\1, x\, \1 ` x\ . x \ Y}}])" using linComb_sum_ind_step[OF fun(1,2) assms(6) R(1) fun(3,4) r assms(5)] + by auto + } + then have "(\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. (\[D;{AA,B}]) +\<^sub>V (\[\ - {r};{AA1,B1}])=(\[D+(\ - {r});{{\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y},{\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}}])) \ + (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. ((\[D;{AA,B}]) +\<^sub>V(\[\;{AA1,B1}])=\[D+\;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]))" by auto + then have "\r\\. (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. (\[D;{AA,B}]) +\<^sub>V (\[\ - {r};{AA1,B1}])=(\[D+(\ - {r});{{\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y},{\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}}])) \ + (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. ((\[D;{AA,B}]) +\<^sub>V(\[\;{AA1,B1}])=\[D+\;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]))" using r by auto + } + then have indstep:"\\\FinPow(Y). \\0 \ (\r\\. (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. (\[D;{AA,B}]) +\<^sub>V (\[\ - {r};{AA1,B1}])=(\[D+(\ - {r});{{\\0, x\, AA ` x\ . x \ X} \ {\\1, x\, AA1 ` x\ . x \ Y},{\\0, x\, B ` x\ . x \ X} \ {\\1, x\, B1 ` x\ . x \ Y}}])) \ + (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. ((\[D;{AA,B}]) +\<^sub>V(\[\;{AA1,B1}])=\[D+\;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}])))" by auto + have "\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. ((\[D;{AA,B}]) +\<^sub>V(\[E;{AA1,B1}])=\[D+E;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}])" + using FinPow_ind_rem_one[where P="\E. (\AA\X\R. \B\X\\. \AA1\Y\R. \B1\Y\\. ((\[D;{AA,B}]) +\<^sub>V(\[E;{AA1,B1}])=\[D+E;{{\\0,x\,AA`x\. x\X}\{\\1,x\,AA1`x\. x\Y},{\\0,x\,B`x\. x\X}\{\\1,x\,B1`x\. x\Y}}]))", + OF base indstep assms(7)]. + with assms(1-4) show ?thesis by auto +qed + +subsubsection\Linear dependency\ + +text \Now, we have the conditions to define what linear independence means:\ + +definition(in module0) + LinInde ("_{is linearly independent}" 89) + where "\\\ \ \{is linearly independent} \ (\X\nat. \AA\X\R. \B\inj(X,\). ((\[X;{AA,B}] = \ ) ) \ (\m\X. AA`m=\))" + +text\If a set has the zero element, then it is not linearly independent.\ + +theorem(in module0) zero_set_dependent: + assumes "\\T" "T\\" "R\{\}" + shows "\(T{is linearly independent})" +proof + assume "T{is linearly independent}" + then have reg:"\n\nat. \AA\n\R. \B\inj(n,T).(\[n;{AA,B}] =\ ) \ (\m\n. AA`m=\)" + unfolding LinInde_def[OF assms(2)] by auto + from assms(3) obtain r where r:"r\R" "r\\" using Ring_ZF_1_L2(1) by auto + let ?A="{\0,r\}" + let ?B="{\0,\\}" + have A:"?A:succ(0)\R" using `r\R` unfolding Pi_def function_def domain_def by auto + have B:"?B:succ(0)\T" using assms(1) unfolding Pi_def function_def domain_def by auto + with assms(2) have B2:"?B:succ(0)\\" unfolding Pi_def by auto + have C:"succ(0)\nat" by auto + have fff:"{\m, (?A ` m) \\<^sub>S (?B ` m)\ . m \ 1}:1\\" using coordinate_function[OF A B2] by auto + have "?B\inj(succ(0),T)" unfolding inj_def using apply_equality B by auto + with A C reg have "\[succ(0);{?A,?B}] =\ \ (\m\succ(0). ?A`m=\)" by blast + then have "\[succ(0);{?A,?B}] =\ \ (?A`0=\)" by blast + then have "\[succ(0);{?A,?B}] =\ \ (r=\)" using apply_equality[OF _ A,of 0 r] by auto + with r(2) have "\[succ(0);{?A,?B}] \\" by auto + moreover have "\[succ(0);{?A,?B}]=(?A`0) \\<^sub>S (?B ` 0)" using linComb_one_element[OF _ A B2] unfolding succ_def by auto + also have "\=r\\<^sub>S\" using apply_equality A B by auto + also have "\=\" using zero_fixed r(1) by auto + ultimately show False by auto +qed + +subsection\Submodule\ + +text\A submodule is a subgroup that is invariant by the action\ + +definition(in module0) + IsAsubmodule + where "IsAsubmodule(\) \ (\r\R. \h\\. r\\<^sub>S h\\) \ IsAsubgroup(\,A\<^sub>M)" + +lemma(in module0) sumodule_is_subgroup: + assumes "IsAsubmodule(\)" + shows "IsAsubgroup(\,A\<^sub>M)" + using assms unfolding IsAsubmodule_def by auto + +lemma(in module0) sumodule_is_subaction: + assumes "IsAsubmodule(\)" "r\R" "h\\" + shows "r\\<^sub>S h\\" + using assms unfolding IsAsubmodule_def by auto + +text\For groups, we need to prove that the inverse function +is closed in a set to prove that set to be a subgroup. In module, that is not necessary.\ + +lemma(in module0) inverse_in_set: + assumes "\r\R. \h\\. r\\<^sub>S h\\" "\\\" + shows "\h\\. (\h)\\" +proof + fix h assume "h\\" moreover + then have "h\\" using assms(2) by auto + then have "(\\)\\<^sub>S h=(\h)" using inv_module by auto moreover + have "(\\)\R" using Ring_ZF_1_L2(2) Ring_ZF_1_L3(1) by auto ultimately + show "(\h)\\" using assms(1) by force +qed + +corollary(in module0) submoduleI: + assumes "\\\" "\\0" "\{is closed under}A\<^sub>M" "\r\R. \h\\. r\\<^sub>S h\\" + shows "IsAsubmodule(\)" unfolding IsAsubmodule_def + using inverse_in_set[OF assms(4,1)] assms mod_ab_gr.group0_3_T3 + by auto + +text\Every module has at least two submodules: the whole module and the trivial module.\ + +corollary(in module0) trivial_submodules: + shows "IsAsubmodule(\)" and "IsAsubmodule({\})" + unfolding IsAsubmodule_def +proof(safe) + have "A\<^sub>M:\\\\\" using mod_ab_gr.group_oper_fun by auto + then have "A\<^sub>M\((\\\)\\)" unfolding Pi_def by auto + then have "restrict(A\<^sub>M,\\\)=A\<^sub>M" unfolding restrict_def by blast + then show "IsAsubgroup(\,A\<^sub>M)" using mAbGr unfolding IsAsubgroup_def by auto +next + fix r h assume A:"r\R" "h\\" + from A(1) have "H`r:\\\" using H_val_type(2) by auto + with A(2) show "r\\<^sub>Sh\\" using apply_type[of "H`r" \ "\t. \"] by auto +next + fix r assume "r\R" + with zero_fixed show "r \\<^sub>S \ = \" by auto +next + have "{\}\0" by auto moreover + have "{\}\\" using mod_ab_gr.group0_2_L2 by auto moreover + { + fix x y assume "x\{\}" "y\{\}" + then have "A\<^sub>M`\x,y\=\" using mod_ab_gr.group0_2_L2 by auto + } + then have "{\}{is closed under}A\<^sub>M" unfolding IsOpClosed_def by auto moreover + { + fix x assume "x\{\}" + then have "GroupInv(\, A\<^sub>M) `(x)= \" using mod_ab_gr.group_inv_of_one by auto + } + then have "\x\{\}. GroupInv(\, A\<^sub>M) `(x)\{\}" by auto ultimately + show "IsAsubgroup({\},A\<^sub>M)" using mod_ab_gr.group0_3_T3 by auto +qed + +text\The restriction of the action is an action.\ + +lemma(in module0) action_submodule: + assumes "IsAsubmodule(\)" + shows "{\r,restrict(H`r,\)\. r\R}:R\End(\,restrict(A\<^sub>M,\\\))" +proof- + have sub:"\\\" using mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms]] by auto + { + fix t assume "t\{\r,restrict(H`r,\)\. r\R}" + then obtain r where t:"r\R" "t=\r,restrict(H`r,\)\" by auto + then have E:"H`r\End(\,A\<^sub>M)" using H_val_type(1) by auto + from t(1) have "H`r:\\\" using H_val_type(2) by auto + then have "restrict(H`r,\):\\\" using restrict_fun sub by auto moreover + have "\h\\. restrict(H`r,\)`h\\" using restrict sumodule_is_subaction[OF assms `r\R`] by auto + ultimately have HH:"restrict(H`r,\):\\\" using func1_1_L1A by auto + { + fix g1 g2 assume H:"g1\\""g2\\" + with sub have G:"g1\\""g2\\" by auto + from H have AA:"A\<^sub>M`\g1,g2\=restrict(A\<^sub>M,\\\)`\g1,g2\" using restrict by auto + then have "(H`r)`(A\<^sub>M`\g1,g2\)=(H`r)`(restrict(A\<^sub>M,\\\)`\g1,g2\)" by auto + then have "A\<^sub>M`\(H`r)`g1,(H`r)`g2\=(H`r)`(restrict(A\<^sub>M,\\\)`\g1,g2\)" using E G + unfolding End_def Homomor_def IsMorphism_def by auto + with H have "restrict(A\<^sub>M,\\\)`\(H`r)`g1,(H`r)`g2\=(H`r)`(restrict(A\<^sub>M,\\\)`\g1,g2\)" using sumodule_is_subaction[OF assms `r\R`] + by auto moreover + from H have "A\<^sub>M`\g1,g2\\\" using sumodule_is_subgroup[OF assms] mod_ab_gr.group0_3_L6 by auto + then have "restrict(H`r,\)`(A\<^sub>M`\g1,g2\)=(H`r)`(A\<^sub>M`\g1,g2\)" by auto + with AA have "restrict(H`r,\)`(restrict(A\<^sub>M,\\\)`\g1,g2\)=(H`r)`(restrict(A\<^sub>M,\\\)`\g1,g2\)" by auto moreover + from H have "(H`r)`g1=restrict(H`r,\)`g1""(H`r)`g2=restrict(H`r,\)`g2" by auto ultimately + have "restrict(H`r,\)`(restrict(A\<^sub>M,\\\)`\g1,g2\) = restrict(A\<^sub>M,\\\)`\restrict(H`r,\)`g1,restrict(H`r,\)`g2\" by auto + } + then have "\g1\\. \g2\\. restrict(H`r,\)`(restrict(A\<^sub>M,\\\)`\g1,g2\) = restrict(A\<^sub>M,\\\)`\restrict(H`r,\)`g1,restrict(H`r,\)`g2\" by auto + then have "Homomor(restrict(H`r,\),\,restrict(A\<^sub>M,\\\),\,restrict(A\<^sub>M,\\\))" using HH + unfolding Homomor_def IsMorphism_def by auto + with HH have "restrict(H`r,\)\End(\,restrict(A\<^sub>M,\\\))" unfolding End_def by auto + then have "t\R\End(\,restrict(A\<^sub>M,\\\))" using t by auto + } + then have "{\r,restrict(H`r,\)\. r\R}\R\End(\,restrict(A\<^sub>M,\\\))" by auto moreover + { + fix x y assume "\x,y\\{\r,restrict(H`r,\)\. r\R}" + then have y:"x\R""y=restrict(H`x,\)" by auto + { + fix y' assume "\x,y'\\{\r,restrict(H`r,\)\. r\R}" + then have "y'=restrict(H`x,\)" by auto + with y(2) have "y=y'" by auto + } + then have "\y'. \x,y'\\{\r,restrict(H`r,\)\. r\R} \ y=y'" by auto + } + then have "\x y. \x,y\\{\r,restrict(H`r,\)\. r\R} \ (\y'. \x,y'\\{\r,restrict(H`r,\)\. r\R} \ y=y')" by auto + moreover + have "domain({\r,restrict(H`r,\)\. r\R})\R" unfolding domain_def by auto + ultimately show fun:"{\r,restrict(H`r,\)\. r\R}:R\End(\,restrict(A\<^sub>M,\\\))" unfolding Pi_def function_def by auto +qed + +text\A submodule is a module with the restricted action.\ + +corollary(in module0) submodule: + assumes "IsAsubmodule(\)" + shows "IsLeftModule(R,A,M,\,restrict(A\<^sub>M,\\\),{\r,restrict(H`r,\)\. r\R})" + unfolding IsLeftModule_def IsAction_def ringHomomor_def IsMorphism_def +proof(safe) + show "IsAring(R, A, M)" using ringAssum by auto + show g:"IsAgroup(\, restrict(A\<^sub>M,\\\))" using sumodule_is_subgroup assms unfolding IsAsubgroup_def + by auto + have sub:"\\\" using mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms]] by auto + then show "restrict(A\<^sub>M,\\\) {is commutative on} \" using mAbGr + using func_ZF_4_L1[OF mod_ab_gr.group_oper_fun] by auto + show fun:"{\r,restrict(H`r,\)\. r\R}:R\End(\,restrict(A\<^sub>M, \ \ \))" using action_submodule assms by auto + then have Q:"{\r,restrict(H`r,\)\. r\R}`\=restrict(H`\,\)" using apply_equality Ring_ZF_1_L2(2) + by auto + then have "\h\\. ({\r,restrict(H`r,\)\. r\R}`\)`h=restrict(H`\,\)`h" by auto + then have "\h\\. ({\r,restrict(H`r,\)\. r\R}`\)`h=(H`\)`h" using restrict by auto + then have "\h\\. ({\r,restrict(H`r,\)\. r\R}`\)`h=h" using module_ax4 + sub by auto + then have "\h\\. ({\r,restrict(H`r,\)\. r\R}`\)`h=id(\)`h" by auto moreover + have "id(\):\\\" using id_inj unfolding inj_def by auto moreover + from Q have "{\r,restrict(H`r,\)\. r\R}`\:\\\" using restrict_fun[OF H_val_type(2)[OF Ring_ZF_1_L2(2)] sub] + by auto + ultimately have "{\r,restrict(H`r,\)\. r\R}`\=id(\)" using fun_extension[of "{\r,restrict(H`r,\)\. r\R}`\" \ "\_. \" "id(\)"] by auto + also have "\=TheNeutralElement(End(\, restrict(A\<^sub>M, \ \ \)), restrict(Composition(\), End(\, restrict(A\<^sub>M, \ \ \)) \ End(\, restrict(A\<^sub>M, \ \ \))))" + using group0.end_comp_monoid(2) sumodule_is_subgroup[OF assms] unfolding group0_def IsAsubgroup_def + by auto + ultimately show "{\r,restrict(H`r,\)\. r\R}`TheNeutralElement(R, M)=TheNeutralElement(End(\, restrict(A\<^sub>M, \ \ \)), EndMult(\, restrict(A\<^sub>M, \ \ \)))" + unfolding EndMult_def by auto + fix r s assume AS:"r\R""s\R" + then have END:"restrict(H ` r, \)\End(\,restrict(A\<^sub>M, \ \ \))""restrict(H ` s, \)\End(\,restrict(A\<^sub>M, \ \ \))" using apply_type[OF fun] + apply_equality[OF _ fun] by auto + then have funf:"restrict(H ` r, \):\\\""restrict(H ` s, \):\\\" unfolding End_def by auto + from AS have rs:"r\s\R""r\s\R" using Ring_ZF_1_L4(1,3) by auto + then have EE:"{\r, restrict(H ` r, \)\ . r \ R} ` (r\s)=restrict(H ` (r\s), \)" using apply_equality fun by auto + have m:"monoid0(\,restrict(A\<^sub>M, \ \ \))" unfolding monoid0_def + using g unfolding IsAgroup_def by auto + have f1:"{\r, restrict(H ` r, \)\ . r \ R} ` (r\s):\\\" using apply_type[OF fun rs(1)] unfolding End_def by auto + have f:"(restrict(A\<^sub>M, \ \ \) {lifted to function space over} \) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\:\\\" using monoid0.Group_ZF_2_1_L0[OF m _ funf] + AS apply_equality[OF _ fun] by auto + from END have "\{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\ \ End(\, restrict(A\<^sub>M, \ \ \)) \ End(\, restrict(A\<^sub>M, \ \ \))" + using apply_equality[OF _ fun] AS by auto + from apply_type[OF restrict_fun[OF monoid0.Group_ZF_2_1_L0A[OF m, of "restrict(A\<^sub>M,\\\) {lifted to function space over}\" \], of "End(\,restrict(A\<^sub>M, \ \ \))\End(\,restrict(A\<^sub>M, \ \ \))"] this] + have f2:"(EndAdd(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\):\\\" + unfolding EndAdd_def End_def by blast + { + fix g assume gh:"g\\" + have A:"((restrict(A\<^sub>M, \ \ \) {lifted to function space over} \) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g=((restrict(A\<^sub>M, \ \ \) {lifted to function space over} \) ` + \restrict(H ` r, \), restrict(H ` s, \)\)`g" using apply_equality[OF _ fun] AS by auto + from END have "\{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\ \ End(\, restrict(A\<^sub>M, \ \ \)) \ End(\, restrict(A\<^sub>M, \ \ \))" + using apply_equality[OF _ fun] AS by auto + with A have "(EndAdd(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g=((restrict(A\<^sub>M, \ \ \) {lifted to function space over} \) ` + \restrict(H ` r, \), restrict(H ` s, \)\)`g" unfolding EndAdd_def + using restrict[of "(restrict(A\<^sub>M, \ \ \) {lifted to function space over} \)" "End(\,restrict(A\<^sub>M, \ \ \))\End(\,restrict(A\<^sub>M, \ \ \))" "\restrict(H ` r, \), restrict(H ` s, \)\"] + by auto + also have "\=restrict(A\<^sub>M,\ \ \)`\restrict(H ` r, \)`g, restrict(H ` s, \)`g\" using group0.Group_ZF_2_1_L3[OF _ _ funf gh] g + unfolding group0_def by auto + also have "\=A\<^sub>M`\restrict(H ` r, \)`g, restrict(H ` s, \)`g\" using apply_type[OF funf(1) gh] apply_type[OF funf(2) gh] + by auto + also have "\=A\<^sub>M`\(H ` r)`g, (H ` s)`g\" using gh by auto + also have "\=(H`(r\s))`g" using module_ax2 AS gh sub by auto + also have "\=restrict(H`(r\s),\)`g" using gh by auto + also have "\=({\r, restrict(H ` r, \)\ . r \ R} ` (r\s))`g" using EE by auto + ultimately have "(EndAdd(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g=({\r, restrict(H ` r, \)\ . r \ R} ` (r\s))`g" by auto + } + then have "\g\\. (EndAdd(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g=({\r, restrict(H ` r, \)\ . r \ R} ` (r\s))`g" by auto + then show "{\r, restrict(H ` r, \)\ . r \ R} ` (A ` \r, s\) = + EndAdd(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\" using fun_extension[OF f1 f2] by auto + have f1:"({\r, restrict(H ` r, \)\ . r \ R} `(r\s)):\\\" using apply_type[OF fun rs(2)] unfolding End_def by auto + have ff1:"{\r, restrict(H ` r, \)\ . r \ R} ` r:\\\""{\r, restrict(H ` r, \)\ . r \ R} ` s:\\\" using apply_type[OF fun] AS unfolding End_def by auto + then have "({\r, restrict(H ` r, \)\ . r \ R} ` r)O({\r, restrict(H ` r, \)\ . r \ R} ` s):\\\" using comp_fun by auto + then have f:"(Composition(\) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\):\\\" using func_ZF_5_L2 + [OF ff1] using EndMult_def by auto + from END have "\{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\ \ End(\, restrict(A\<^sub>M, \ \ \)) \ End(\, restrict(A\<^sub>M, \ \ \))" + using apply_equality[OF _ fun] AS by auto + from apply_type[OF restrict_fun[OF func_ZF_5_L1[of \], of "End(\,restrict(A\<^sub>M, \ \ \))\End(\,restrict(A\<^sub>M, \ \ \))"] this] + have f2:"(EndMult(\, restrict(A\<^sub>M, \ \ \)) ` + \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\):\\\" + unfolding EndMult_def End_def by blast + { + fix g assume gh:"g\\" + have A:"(Composition(\) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g= + (Composition(\) ` \restrict(H ` r, \), restrict(H ` s,\)\)`g" using apply_equality[OF _ fun] AS by auto + from END have "\{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\ \ End(\, restrict(A\<^sub>M, \ \ \)) \ End(\, restrict(A\<^sub>M, \ \ \))" + using apply_equality[OF _ fun] AS by auto + with A have "(EndMult(\, restrict(A\<^sub>M, \ \ \)) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g= + (Composition(\) ` \restrict(H ` r, \), restrict(H ` s,\)\)`g" + using restrict unfolding EndMult_def by auto + also have "\=(restrict(H ` r, \)O restrict(H ` s,\))`g" using func_ZF_5_L2[OF funf] by auto + also have "\=restrict(H ` r, \)`( restrict(H` s,\)`g)" using comp_fun_apply[OF funf(2) gh] by auto + also have "\=(H ` r)`((H ` s)`g)" using gh apply_type[OF funf(2) gh] by auto + also have "\=(H`(r\s))`g" using module_ax3 gh sub AS by auto + also have "\=restrict(H ` (r\s), \)`g" using gh by auto + also have "\=({\r, restrict(H ` r, \)\ . r \ R} `(r\s))`g" using apply_equality[OF _ fun] rs(2) by auto + ultimately have "({\r, restrict(H ` r, \)\ . r \ R} `(r\s))`g =(EndMult(\, restrict(A\<^sub>M, \ \ \)) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g" + by auto + } + then have "\g\\. ({\r, restrict(H ` r, \)\ . r \ R} `(r\s))`g =(EndMult(\, restrict(A\<^sub>M, \ \ \)) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\)`g" by auto + then show "{\r, restrict(H ` r, \)\ . r \ R} ` (M ` \r, s\) = + EndMult(\, restrict(A\<^sub>M, \ \ \)) ` \{\r, restrict(H ` r, \)\ . r \ R} ` r, {\r, restrict(H ` r, \)\ . r \ R} ` s\" using fun_extension[OF f1 f2] by auto +qed + +text\If we consider linear combinations of elements in a submodule, then +the linear combination is also in the submodule.\ + +lemma(in module0) linear_comb_submod: + assumes "IsAsubmodule(\)" "D\FinPow(X)" "AA:X\R" "B:X\\" + shows "\[D;{AA,B}]\\" +proof- + have fun:"A\<^sub>M:\\\\\" using mod_ab_gr.group_oper_fun. + from assms(4) have BB:"B:X\\" using mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms(1)]] func1_1_L1B by auto + { + fix A1 B1 assume fun:"A1:X\R" "B1:X\\" + from fun(2) have fun2:"B1:X\\" using mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms(1)]] func1_1_L1B by auto + have "0\FinPow(X)" unfolding FinPow_def by auto + then have "\[0;{A1,B1}]=\" using LinearComb_def[OF fun(1) fun2] by auto + then have "\[0;{A1,B1}]\\" using assms(1) mod_ab_gr.group0_3_L5 unfolding IsAsubmodule_def by auto + } + then have base:"\A1\X\R. \B1\X\\. \[0;{A1,B1}]\\" by auto + { + fix RR assume a:"RR\0" "RR\FinPow(X)" + then obtain d where d:"d\RR" by auto + { + fix A1 B1 assume fun:"A1:X\R" "B1:X\\" and step:"\A1\X\R. \B1\X\\. \[RR-{d};{A1,B1}]\\" + have F:"{\m, ({\r, restrict(H ` r, \)\ . r \ R} ` (A1 ` m)) ` (B1 ` m)\ . m \ X} : X \ \" using module0.coordinate_function[OF _ fun] + submodule[OF assms(1)] unfolding module0_def IsLeftModule_def ring0_def module0_axioms_def by auto + { + fix m assume mx:"m\X" + then have bh:"B1`m\\" using fun(2) apply_type by auto + from mx have ar:"A1`m\R" using fun(1) apply_type by auto + then have A:"{\r, restrict(H ` r, \)\ . r \ R}`(A1`m)=restrict(H ` (A1`m), \)" using apply_equality action_submodule[OF assms(1)] + by auto + have B:"(restrict(H ` (A1`m), \)) ` (B1 ` m)=(H ` (A1`m))`(B1 ` m)" using bh restrict by auto + with A have "({\r, restrict(H ` r, \)\ . r \ R} ` (A1 ` m)) ` (B1 ` m)=(H ` (A1`m))`(B1 ` m)" by auto + } + then have eq1:"{\m, ({\r, restrict(H ` r, \)\ . r \ R} ` (A1 ` m)) ` (B1 ` m)\ . m \ X} ={\m, (H ` (A1`m))`(B1 ` m)\ . m \ X} " by auto + then have pd:"{\m, (H ` (A1`m))`(B1 ` m)\ . m \ X}`d\\" using d apply_type[OF F] a(2) unfolding FinPow_def by auto + from fun(2) have fun2:"B1:X\\" using mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms(1)]] func1_1_L1B by auto + have "\[RR;{A1,B1}]=(\[RR-{d};{A1,B1}])+\<^sub>V({\k, (A1 ` k) \\<^sub>S (B1 ` k)\ . k \ X} ` d)" using sum_one_element[OF fun(1) fun2 a(2) d]. + also have "\\\" using pd step fun mod_ab_gr.group0_3_L6[OF sumodule_is_subgroup[OF assms(1)]] by auto + ultimately have "\[RR;{A1,B1}]\\" by auto + } + then have "(\AA1\X\R. \BB1\X\\. \[RR-{d};{AA1,BB1}]\\)\(\AA1\X\R. \BB1\X\\. \[RR;{AA1,BB1}]\\)" by auto + with d have "\d\RR. ((\AA1\X\R. \BB1\X\\. \[RR-{d};{AA1,BB1}]\\)\(\AA1\X\R. \BB1\X\\. \[RR;{AA1,BB1}]\\))" by auto + } + then have step:"\RR\FinPow(X). RR\0 \ (\d\RR. ((\AA1\X\R. \BB1\X\\. \[RR-{d};{AA1,BB1}]\\)\(\AA1\X\R. \BB1\X\\. \[RR;{AA1,BB1}]\\)))" by auto + show ?thesis using FinPow_ind_rem_one[OF base step] assms(2-4) by auto +qed + +subsubsection\Spans\ + +text\Since we know linear combinations, we can define the span of a subset +of a module as the linear combinations of elements in that subset. We have already +proven that the sum can be done only over finite numbers considering a bijection +between a finite number and the original finite set, and that the function can be +restricted to that finite number.\ + +text\The terms of a linear combination can be reordered so +that they are indexed by the elements of the module.\ + +lemma(in module0) index_module: + assumes "AAA:X\R" "BB:X\\" "D\FinPow(X)" + shows "\AA\\\R. \[D;{AAA,BB}]=\[BB``D;{AA,id(\)}] \ (\x\\-BB``D. AA`x=\)" +proof- + let ?F="{\d,CommSetFold(A,AAA,D\(BB-``({BB`d})))\. d\D}" + let ?f1="{\d,D\(BB-``({BB`d}))\. d\D}" + have "?f1:D\{D\(BB-``({BB`d})). d\D}" unfolding Pi_def function_def by auto + then have "RepFun(D,\t. ?f1`t)={D\(BB-``({BB`d})). d\D}" using apply_equality by auto + with assms(3) have "Finite({D\(BB-``({BB`d})). d\D})" using Finite_RepFun unfolding FinPow_def by auto + then obtain n where "{D\(BB-``({BB`d})). d\D}\n" and n:"n\nat" unfolding Finite_def by auto + then have n2:"{D\(BB-``({BB`d})). d\D}\n" using eqpoll_imp_lepoll by auto + { + fix T assume "T\{D\(BB-``({BB`d})). d\D}" + then obtain d where d:"d\D" "T=D\(BB-``({BB`d}))" by auto + { + assume "d\T" + with d have "d\(BB-``({BB`d}))" by auto + then have "\d,BB`d\\BB" using vimage_iff by auto + with d(1) assms(2,3) have "False" unfolding FinPow_def Pi_def using function_apply_Pair[of BB d] by auto + } + then have "T\0" by auto + } + then have n3:"\t\{D\(BB-``({BB`d})). d\D}. id({D\(BB-``({BB`d})). d\D}) ` t \ 0" using id_def by auto + from n have "\M N. M \ n \ (\t\M. N ` t \ 0) \ (\f. f \ Pi(M,\t. N ` t) \ (\t\M. f ` t \ N ` t))" using finite_choice[of n] unfolding AxiomCardinalChoiceGen_def + by auto + with n2 have "\N. (\t\{D\(BB-``({BB`d})). d\D}. N ` t \ 0) \ (\f. f \ Pi({D\(BB-``({BB`d})). d\D},\t. N ` t) \ (\t\{D\(BB-``({BB`d})). d\D}. f ` t \ N ` t))" + by blast + with n3 have "\f. f \ Pi({D\(BB-``({BB`d})). d\D},\t. id({D\(BB-``({BB`d})). d\D}) ` t) \ (\t\{D\(BB-``({BB`d})). d\D}. f ` t \ id({D\(BB-``({BB`d})). d\D}) ` t)" + by auto + then obtain ff where ff:"ff\Pi({D\(BB-``({BB`d})). d\D},\t. id({D\(BB-``({BB`d})). d\D}) ` t)" "(\t\{D\(BB-``({BB`d})). d\D}. ff ` t \ id({D\(BB-``({BB`d})). d\D}) ` t)" by force + { + fix t assume as:"t\{D\(BB-``({BB`d})). d\D}" + with ff(2) have "ff`t\id({D\(BB-``({BB`d})). d\D}) ` t" by blast + with as have "ff`t\t" using id_def by auto + } + then have ff2:"\t\{D\(BB-``({BB`d})). d\D}. ff ` t \t" by auto + have "\x\{D\(BB-``({BB`d})). d\D}. id({D\(BB-``({BB`d})). d\D})`x=x" using id_def by auto + with ff(1) have ff1:"ff\Pi({D\(BB-``({BB`d})). d\D},\t. t)" unfolding Pi_def Sigma_def by auto + have case0:"\AA\\\R. \[0;{AAA,BB}]=\[BB``0;{AA,id(\)}] \ (\x\\-BB``0. AA`x=\)" + proof + have "\[0;{AAA,BB}]=\" using LinearComb_def[OF assms(1,2)] unfolding FinPow_def by auto moreover + let ?A="ConstantFunction(\,\)" + have "\[0;{?A,id(\)}]=\" using LinearComb_def[OF func1_3_L1[OF Ring_ZF_1_L2(1)], of "id(\)" \ 0] + unfolding id_def FinPow_def by auto moreover + have "BB``0=0" by auto ultimately + show "\[0;{AAA,BB}]=\[BB``0;{?A,id(\)}] \ (\x\\-BB``0. ?A`x=\)" using func1_3_L2 by auto + then show "?A:\\R" using func1_3_L1[OF Ring_ZF_1_L2(1), of \] by auto + qed + { + fix E assume E:"E\FinPow(X)" "E\0" + { + fix d assume d:"d\E" + { + assume hyp:"\AA\\\R. \[E-{d};{AAA,BB}]=\[BB``(E-{d});{AA,id(\)}] \ (\x\\-BB``(E-{d}). AA`x=\)" + from hyp obtain AA where AA:"AA\\\R" "\[E-{d};{AAA,BB}]=\[BB``(E-{d});{AA,id(\)}]" "\x\\-BB``(E-{d}). AA`x=\" by auto + have "\[E;{AAA,BB}] = (\[E-{d};{AAA,BB}])+\<^sub>V({\e,(AAA`e)\\<^sub>S(BB`e)\. e\X}`d)" using sum_one_element[OF assms(1,2) E(1) d]. + with AA(2) also have "\=(\[BB``(E-{d});{AA,id(\)}])+\<^sub>V((AAA`d)\\<^sub>S(BB`d))" using d E(1) unfolding FinPow_def using apply_equality[OF _ + coordinate_function[OF assms(1,2)]] by auto + ultimately have eq:"\[E;{AAA,BB}] =(\[BB``(E-{d});{AA,id(\)}])+\<^sub>V((AAA`d)\\<^sub>S(BB`d))" by auto + have btype:"BB`d\\" using apply_type assms(2) d E(1) unfolding FinPow_def by auto + have "(E-{d})\FinPow(X)" using E(1) unfolding FinPow_def using subset_Finite[of "E-{d}" E] by auto moreover + then have "{BB`x. x\E-{d}}=BB``(E-{d})" using func_imagedef[OF assms(2), of "E-{d}"] unfolding FinPow_def + by auto + ultimately have fin:"Finite(BB``(E-{d}))" using Finite_RepFun[of "E-{d}" "\t. BB`t"] unfolding FinPow_def by auto + then have "Finite(BB``(E-{d})\{BB`d})" using Finite_cons[of "BB``(E-{d})" "BB`d"] by auto + with btype have finpow:"BB``(E-{d})\{BB`d}\FinPow(\)" using func1_1_L6(2)[OF assms(2)] unfolding FinPow_def by auto + { + assume as:"BB`d\BB``(E-{d})" + then have T_def:"BB``(E-{d})=(BB``(E-{d})\{BB`d})-{BB`d}" by auto + from as have sub:"BB``(E-{d})\\-{BB`d}" using func1_1_L6(2)[OF assms(2)] by auto + let ?A="restrict(AA,\-{BB`d})\ConstantFunction({BB`d},AAA`d)" + have res:"restrict(AA,\-{BB`d}):\-{BB`d}\R" using restrict_fun[OF AA(1)] by auto + moreover have "AAA`d\R" using apply_type assms(1) d E(1) unfolding FinPow_def by auto + then have con:"ConstantFunction({BB`d},AAA`d):{BB`d}\R" using func1_3_L1 by auto + moreover have "(G-{BB`d})\{BB`d}=0" by auto moreover + have "R\R=R" by auto moreover + have "(\-{BB`d})\{BB`d}=\" using apply_type[OF assms(2)] d E(1) unfolding FinPow_def by auto ultimately + have A_fun:"?A:\\R" using fun_disjoint_Un[of "restrict(AA,\-{BB`d})" "\-{BB`d}" R "ConstantFunction({BB`d},AAA`d)" "{BB`d}" R] by auto + have "?A`(BB`d)=ConstantFunction({BB`d},AAA`d)`(BB`d)" using as fun_disjoint_apply2 by auto moreover note btype + ultimately have A_app:"?A`(BB`d)=AAA`d" using as func1_3_L2 by auto + { + fix z assume "z\restrict(?A,BB``(E-{d}))" + then have z:"z\?A" "\x\BB `` (E - {d}). \y. z = \x, y\" using restrict_iff by auto + then have "\x\BB `` (E - {d}). \y. z = \x, y\" "z\ConstantFunction({BB`d},AAA`d) \ z\restrict(AA,\-{BB`d})" by auto + then have "\x\BB `` (E - {d}). \y. z = \x, y\" "z\{BB`d}\{AAA`d} \ z\restrict(AA,\-{BB`d})" using ConstantFunction_def by auto + then have "fst(z)\BB `` (E - {d})" "z=\BB`d,AAA`d\ \ z\restrict(AA,\-{BB`d})" by auto + with as have "z\restrict(AA,\-{BB`d})" by auto + with z(2) have "z\AA" "\x\BB `` (E - {d}). \y. z = \x, y\" using restrict_iff by auto + then have "z\restrict(AA,BB``(E-{d}))" using restrict_iff by auto + } + then have "restrict(?A,BB``(E-{d}))\restrict(AA,BB``(E-{d}))" by auto moreover + { + fix z assume z:"z\restrict(AA,BB``(E-{d}))" "z\restrict(?A,BB``(E-{d}))" + then have disj:"z\?A \ (\x\BB``(E-{d}). \y. z \ \x, y\)" using restrict_iff[of z ?A "BB``(E-{d})"] by auto moreover + with z(1) have z:"z\AA" "\x\BB``(E-{d}). \y. z=\x, y\" using restrict_iff[of _ AA "BB``(E-{d})"] by auto moreover + from z(2) sub have "\x\\-{BB`d}. \y. z=\x, y\" by auto + with z(1) have "z\restrict(AA,\-{BB`d})" using restrict_iff by auto + then have "z\?A" by auto + with disj have "\x\BB``(E-{d}). \y. z \ \x, y\" by auto + with z(2) have "False" by auto + } + then have "restrict(AA,BB``(E-{d}))\restrict(?A,BB``(E-{d}))" by auto ultimately + have resA:"restrict(AA,BB``(E-{d}))=restrict(?A,BB``(E-{d}))" by auto + have "\[BB``(E-{d});{AA,id(\)}]=\[BB``(E-{d});{restrict(AA,BB``(E-{d})),restrict(id(\), BB``(E-{d}))}]" using linComb_restrict_coord[OF AA(1) id_type, of "BB``(E-{d})"] + fin func1_1_L6(2)[OF assms(2)] unfolding FinPow_def by auto + also have "\=\[BB``(E-{d});{restrict(?A,BB``(E-{d})),restrict(id(\), BB``(E-{d}))}]" using resA by auto + also have "\=\[BB``(E-{d});{?A,id(\)}]" using linComb_restrict_coord[OF A_fun id_type, of "BB``(E-{d})"] fin func1_1_L6(2)[OF assms(2)] unfolding FinPow_def by auto + ultimately have "\[BB``(E-{d});{AA,id(\)}]=\[(BB``(E-{d})\{BB`d})-{BB`d};{?A,id(\)}]" using T_def by auto + then have "(\[BB``(E-{d});{AA,id(\)}])+\<^sub>V((AAA`d)\\<^sub>S(BB`d))=(\[(BB``(E-{d})\{BB`d})-{BB`d};{?A,id(\)}])+\<^sub>V((?A`(BB`d))\\<^sub>S(BB`d))" using A_app by auto + also have "\=(\[(BB``(E-{d})\{BB`d})-{BB`d};{?A,id(\)}])+\<^sub>V((?A`(BB`d))\\<^sub>S(id(\)`(BB`d)))" using id_conv[OF btype] by auto + also have "\=(\[(BB``(E-{d})\{BB`d})-{BB`d};{?A,id(\)}])+\<^sub>V({\g,(?A`g)\\<^sub>S(id(\)`g)\. g\\}`(BB`d))" using apply_equality[OF _ coordinate_function[OF A_fun id_type] + ,of "BB`d" "(?A`(BB`d))\\<^sub>S(id(\)`(BB`d))"] btype by auto + also have "\=(\[(BB``(E-{d})\{BB`d});{?A,id(\)}])" using sum_one_element[OF A_fun id_type finpow, of "BB`d"] by auto + ultimately have "(\[BB``(E-{d});{AA,id(\)}])+\<^sub>V((AAA`d)\\<^sub>S(BB`d))=\[(BB``(E-{d})\{BB`d});{?A,id(\)}]" by auto + with eq have eq:"\[E;{AAA,BB}] =\[(BB``(E-{d})\{BB`d});{?A,id(\)}]" by auto + have "BB``(E-{d})\{BB`d}={BB`x. x\E-{d}}\{BB`d}" using func_imagedef[OF assms(2), of "E-{d}"] + E(1) unfolding FinPow_def by force + also have "\={BB`x. x\E}" using d by auto ultimately + have set:"BB``(E-{d})\{BB`d}=BB``E" using func_imagedef[OF assms(2), of "E"] E(1) unfolding FinPow_def by auto + { + fix x assume x:"x\\-BB``E" + then have x1:"x\BB`d" using d func_imagedef[OF assms(2), of E] E(1) unfolding FinPow_def by auto + then have "?A`x=restrict(AA,\-{BB`d})`x" using fun_disjoint_apply1[of x "ConstantFunction({BB`d},AAA`d)"] unfolding + ConstantFunction_def by blast + with x x1 have "?A`x=AA`x" using restrict by auto moreover + from x set have "x\\-BB``(E-{d})" by auto ultimately + have "?A`x=\" using AA(3) by auto + } + with set eq A_fun have "\AA\\\R. \[E;{AAA,BB}]=\[BB``E;{AA,id(\)}] \ (\x\\-(BB``E). AA`x=\)" by auto + } + moreover + { + assume as:"BB`d\BB``(E-{d})" + then have "BB``(E-{d})\{BB`d}=BB``(E-{d})" by auto + then have finpow:"BB``(E-{d})\FinPow(\)" using finpow by auto + have sub:"E-{d}\X" using E(1) unfolding FinPow_def by force + with as have "BB`d\{BB`f. f\E-{d}}" using func_imagedef[OF assms(2), of "E-{d}"] by auto + then have "{BB`f. f\E-{d}}={BB`f. f\E}" by auto + then have im_eq:"BB``(E-{d})=BB``E" using func_imagedef[OF assms(2),of "E-{d}"] func_imagedef[OF assms(2),of E] sub E(1) unfolding FinPow_def + by auto + from as have "\[BB``(E-{d});{AA,id(\)}]=(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V({\g,(AA`g)\\<^sub>S(id(\)`g)\. g\\}`(BB`d))" using sum_one_element[OF AA(1) id_type] + finpow by auto + also have "\=(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V((AA`(BB`d))\\<^sub>S(id(\)`(BB`d)))" using apply_equality[OF _ coordinate_function[OF AA(1) id_type]] + btype by auto + also have "\=(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V((AA`(BB`d))\\<^sub>S(BB`d))" using id_conv btype by auto + ultimately have "\[BB``(E-{d});{AA,id(\)}]=(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V((AA`(BB`d))\\<^sub>S(BB`d))" by auto + then have "\[E;{AAA,BB}] =((\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V((AA`(BB`d))\\<^sub>S(BB`d)))+\<^sub>V((AAA ` d)\\<^sub>S (BB ` d))" using eq by auto + moreover have "\[BB``(E-{d})-{BB`d};{AA,id(\)}]\\" using linComb_is_in_module[OF AA(1) id_type, of "BB``(E-{d})-{BB`d}"] finpow subset_Finite[of "BB``(E-{d})-{BB`d}" "BB``(E-{d})"] unfolding FinPow_def + by auto moreover + have "(AA`(BB`d))\\<^sub>S(BB`d)\\" using apply_type[OF AA(1) btype] apply_type[OF H_val_type(2)] + btype by auto moreover + have "(AAA`d)\\<^sub>S(BB`d)\\" using apply_type apply_type[OF assms(1), of d] apply_type[OF H_val_type(2)] + btype d E(1) unfolding FinPow_def by auto ultimately + have "\[E;{AAA,BB}] =(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V(((AA`(BB`d))\\<^sub>S(BB`d))+\<^sub>V((AAA ` d) \\<^sub>S (BB ` d)))" + using mod_ab_gr.group_oper_assoc by auto moreover + have "((AA`(BB`d))\\<^sub>S(BB`d))+\<^sub>V((AAA ` d) \\<^sub>S (BB ` d))=((AA`(BB`d))\(AAA ` d))\\<^sub>S(BB`d)" using btype apply_type[OF assms(1), of d] + apply_type[OF AA(1) btype] d E(1) module_ax2 unfolding FinPow_def by auto + ultimately have eq:"\[E;{AAA,BB}] =(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V(((AA`(BB`d))\(AAA ` d))\\<^sub>S(BB`d))" by auto + let ?A="restrict(AA,\-{BB`d})\ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d))" + have "(\-{BB`d})\({BB`d})=0" by auto moreover + have "(\-{BB`d})\({BB`d})=\" using finpow as unfolding FinPow_def by auto moreover + have "restrict(AA,\-{BB`d}):(\-{BB`d})\R" using restrict_fun[OF AA(1), of "\-{BB`d}"] finpow unfolding FinPow_def by auto moreover + have "AAA`d\R" "AA`(BB`d)\R" using apply_type assms(1) AA(1) btype d E(1) unfolding FinPow_def by auto + then have "(AA`(BB`d))\(AAA ` d)\R" using Ring_ZF_1_L4(1) by auto + then have "ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d)):{BB`d}\R" using func1_3_L1 by auto + ultimately have A_fun:"?A:\\R" using fun_disjoint_Un[of "restrict(AA,\-{BB`d})" "\-{BB`d}" R "ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d))" "{BB`d}" R] by auto + have "?A`(BB`d)=ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d))`(BB`d)" using as fun_disjoint_apply2 by auto moreover note btype + ultimately have A_app:"?A`(BB`d)=(AA`(BB`d))\(AAA ` d)" using as func1_3_L2 by auto + { + fix z assume "z\restrict(?A,BB``(E-{d})-{BB`d})" + then have z:"\x\BB``(E-{d})-{BB`d}. \y. z=\x,y\" "z\?A" using restrict_iff by auto + then have "\x\BB `` (E - {d})-{BB`d}. \y. z = \x, y\" "z\ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d)) \ z\restrict(AA,\-{BB`d})" by auto + then have "\x\BB `` (E - {d})-{BB`d}. \y. z = \x, y\" "z\{BB`d}\{(AA`(BB`d))\(AAA ` d)} \ z\restrict(AA,\-{BB`d})" using ConstantFunction_def by auto + then have "fst(z)\BB `` (E - {d})-{BB`d}" "z=\BB`d,AAA`d\ \ z\restrict(AA,\-{BB`d})" by auto + then have "z\restrict(AA,\-{BB`d})" by auto + with z(1) have "z\AA" "\x\BB `` (E - {d})-{BB`d}. \y. z = \x, y\" using restrict_iff by auto + then have "z\restrict(AA,BB``(E-{d})-{BB`d})" using restrict_iff by auto + } + then have "restrict(?A,BB``(E-{d})-{BB`d})\restrict(AA,BB``(E-{d})-{BB`d})" by auto moreover + { + fix z assume z:"z\restrict(AA,BB``(E-{d})-{BB`d})" "z\restrict(?A,BB``(E-{d})-{BB`d})" + then have disj:"z\?A \ (\x\BB``(E-{d})-{BB`d}. \y. z \ \x, y\)" using restrict_iff[of z ?A "BB``(E-{d})-{BB`d}"] by auto moreover + with z(1) have z:"z\AA" "\x\BB``(E-{d})-{BB`d}. \y. z=\x, y\" using restrict_iff[of _ AA "BB``(E-{d})-{BB`d}"] by auto moreover + from z(2) func1_1_L6(2)[OF assms(2)] have "\x\\-{BB`d}. \y. z=\x, y\" by auto + with z(1) have "z\restrict(AA,\-{BB`d})" using restrict_iff by auto + then have "z\?A" by auto + with disj have "\x\BB``(E-{d})-{BB`d}. \y. z \ \x, y\" by auto + with z(2) have "False" by auto + } + then have "restrict(AA,BB``(E-{d})-{BB`d})\restrict(?A,BB``(E-{d})-{BB`d})" by auto ultimately + have resA:"restrict(AA,BB``(E-{d})-{BB`d})=restrict(?A,BB``(E-{d})-{BB`d})" by auto + have "Finite(BB``(E-{d})-{BB`d})" using finpow unfolding FinPow_def using subset_Finite[of "BB``(E-{d}) -{BB`d}"] by auto + with finpow have finpow2:"BB``(E-{d})-{BB`d}\FinPow(\)" unfolding FinPow_def by auto + have "\[BB``(E-{d})-{BB`d};{AA,id(\)}]=\[BB``(E-{d})-{BB`d};{restrict(AA,BB``(E-{d})-{BB`d}),restrict(id(\), BB``(E-{d})-{BB`d})}]" using linComb_restrict_coord[OF AA(1) id_type finpow2] + by auto + also have "\=\[BB``(E-{d})-{BB`d};{restrict(?A,BB``(E-{d})-{BB`d}),restrict(id(\), BB``(E-{d})-{BB`d})}]" using resA by auto + also have "\=\[BB``(E-{d})-{BB`d};{?A,id(\)}]" using linComb_restrict_coord[OF A_fun id_type finpow2] by auto + ultimately have "\[BB``(E-{d})-{BB`d};{AA,id(\)}]=\[BB``(E-{d})-{BB`d};{?A,id(\)}]" by auto + then have "(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V(((AA`(BB`d))\(AAA ` d))\\<^sub>S(BB`d))=(\[BB``(E-{d})-{BB`d};{?A,id(\)}])+\<^sub>V((?A`(BB`d))\\<^sub>S(BB`d))" using A_app by auto + also have "\=(\[BB``(E-{d})-{BB`d};{?A,id(\)}])+\<^sub>V((?A`(BB`d))\\<^sub>S(id(\)`(BB`d)))" using id_conv[OF btype] by auto + also have "\=(\[BB``(E-{d})-{BB`d};{?A,id(\)}])+\<^sub>V({\g,(?A`g)\\<^sub>S(id(\)`g)\. g\\}`(BB`d))" using apply_equality[OF _ coordinate_function[OF A_fun id_type] + ,of "BB`d" "(?A`(BB`d))\\<^sub>S(id(\)`(BB`d))"] btype by auto + also have "\=(\[BB``(E-{d});{?A,id(\)}])" using sum_one_element[OF A_fun id_type finpow as] by auto + ultimately have "(\[BB``(E-{d})-{BB`d};{AA,id(\)}])+\<^sub>V(((AA`(BB`d))\(AAA ` d))\\<^sub>S(BB`d))=(\[BB``(E-{d});{?A,id(\)}])" by auto + with eq have sol:"\[E;{AAA,BB}] =\[BB``(E-{d});{?A,id(\)}]" by auto + { + fix x assume x:"x\\-BB``E" + with as have x1:"x\\-{BB`d}" by auto + then have "?A`x=restrict(AA,\-{BB`d})`x" using fun_disjoint_apply1[of x "ConstantFunction({BB`d},(AA`(BB`d))\(AAA ` d))"] + unfolding ConstantFunction_def by blast + with x1 have "?A`x=AA`x" using restrict by auto + with x im_eq have "?A`x=\" using AA(3) by auto + } + with sol A_fun im_eq have "\AA\\\R. \[E;{AAA,BB}]=\[BB``(E);{AA,id(\)}] \ (\x\\-BB``E. AA`x=\)" by auto + } + ultimately have "\AA\\\R. \[E;{AAA,BB}]=\[BB``E;{AA,id(\)}] \ (\x\\-BB``E. AA`x=\)" by auto + } + then have "( \AA\\\R. (\[E-{d};{AAA,BB}])=(\[BB``(E-{d});{AA,id(\)}]) \ (\x\\-BB``(E-{d}). AA`x=\)) \ (\AA\\\R. (\[E;{AAA,BB}])=(\[BB``E;{AA,id(\)}]) \ (\x\\-BB``E. AA`x=\))" by auto + } + then have "\d\E. (( \AA\\\R. \[E-{d};{AAA,BB}]=\[BB``(E-{d});{AA,id(\)}] \ (\x\\-BB``(E-{d}). AA`x=\)) \ (\AA\\\R. \[E;{AAA,BB}]=\[BB``(E);{AA,id(\)}] \ (\x\\-BB``E. AA`x=\)))" + using E(2) by auto + } + then have "\E\FinPow(X). E\0 \ (\d\E. ((\AA\\\R. \[E-{d};{AAA,BB}]=\[BB``(E-{d});{AA,id(\)}]\ (\x\\-BB``(E-{d}). AA`x=\)) \ (\AA\\\R. \[E;{AAA,BB}]=\[BB``(E);{AA,id(\)}]\ (\x\\-BB``E. AA`x=\))))" + by auto + then show ?thesis using FinPow_ind_rem_one[where ?P="\E. \AA\\\R. \[E;{AAA,BB}]=\[BB``E;{AA,id(\)}]\ (\x\\-BB``E. AA`x=\)", OF case0 _ assms(3)] by auto +qed + +text\A span over a set is the collection over all linear combinations on those elements.\ + +definition(in module0) + Span("{span of}_") + where "T\\ \ {span of}T \ if T=0 then {\} else {\[F;{AA,id(T)}]. \F,AA\\{\FF,B\\FinPow(T)\(T\R). \m\T-FF. B`m=\}}" + +text\The span of a subset is then a submodule and contains the original set.\ + +theorem(in module0) linear_ind_set_comb_submodule: + assumes "T\\" + shows "IsAsubmodule({span of}T)" + and "T\{span of}T" +proof- + have "id(T):T\T" unfolding id_def by auto + then have idG:"id(T):T\\" using assms func1_1_L1B by auto + { + assume A:"T=0" + from A assms have eq:"({span of}T)={\}" using Span_def by auto + have "\r\R. r\\<^sub>S\=\" using zero_fixed by auto + with eq have "\r\R. \g\({span of}T). r\\<^sub>Sg\({span of}T)" by auto moreover + from eq have "IsAsubgroup(({span of}T),A\<^sub>M)" using mod_ab_gr.trivial_normal_subgroup + unfolding IsAnormalSubgroup_def by auto + ultimately have "IsAsubmodule({span of}T)" unfolding IsAsubmodule_def by auto + with A have "IsAsubmodule({span of}T)" "T\{span of}T" by auto + } + moreover + { + assume A:"T\0" + { + fix t assume asT:"t\T" + then have "Finite({t})" by auto + with asT have FP:"{t}\FinPow(T)" unfolding FinPow_def by auto moreover + from asT have Af:"{\t,\\}\{\r,\\. r\T-{t}}:T\R" unfolding Pi_def function_def using + Ring_ZF_1_L2(1,2) by auto moreover + { + fix m assume "m\T-{t}" + with Af have "({\t,\\}\{\r,\\. r\T-{t}})`m=\" using apply_equality by auto + } + ultimately have "\[{t};{{\t,\\}\{\r,\\. r\T-{t}},id(T)}]\{span of}T" unfolding Span_def[OF assms(1)] using A + by auto + then have "(({\t,\\}\{\r,\\. r\T-{t}})`t) \\<^sub>S (id(T)`t) \{span of}T" using linComb_one_element[OF asT + Af idG] by auto + then have "(({\t,\\}\{\r,\\. r\T-{t}})`t) \\<^sub>S t \{span of}T" using asT by auto + then have "(\) \\<^sub>S t \{span of}T" using apply_equality Af by auto moreover + have "(\) \\<^sub>S t=t" using module_ax4 assms asT by auto ultimately + have "t\{span of}T" by auto + } + then have "T\{span of}T" by auto moreover + with A have "({span of}T)\0" by auto moreover + { + fix l assume "l\{span of}T" + with A obtain S AA where l:"l=\[S;{AA,id(T)}]" "S\FinPow(T)" "AA:T\R" "\m\T-S. AA`m=\" unfolding Span_def[OF assms(1)] + by auto + from l(1) have "l\\" using linComb_is_in_module[OF l(3) _ l(2), of "id(T)"] idG unfolding FinPow_def by auto + } + then have sub:"({span of}T)\\" by force moreover + { + fix T1 T2 assume as:"T1\{span of}T" + "T2\{span of}T" + with A obtain TT1 AA1 TT2 AA2 where T:"TT1\FinPow(T)" "TT2\FinPow(T)" "AA1:T\R" + "AA2:T\R" "T1=\[TT1;{AA1,id(T)}]" "T2=\[TT2;{AA2,id(T)}]" "\m\T-TT1. AA1`m=\" "\m\T-TT2. AA2`m=\" unfolding Span_def[OF assms(1)] by auto + { + assume A:"TT1=0" + then have "T1=\[0;{AA1,id(T)}]" using T(5) by auto + also have "\=\" using LinearComb_def[OF T(3) idG T(1)] A by auto + ultimately have "T1+\<^sub>VT2=\+\<^sub>VT2" by auto + also have "\\{span of}T" using sub as(2) mod_ab_gr.group0_2_L2 by auto + ultimately have "T1+\<^sub>VT2\{span of}T" by auto + } + moreover + { + assume AA:"TT1\0" + have "T1+\<^sub>VT2=\[TT1+TT2;{{\\0,x\,AA1`x\. x\T}\{\\1,x\,AA2`x\. x\T},{\\0,x\,id(T)`x\. x\T}\{\\1,x\,id(T)`x\. x\T}}]" using linComb_sum[OF T(3,4) idG idG + AA T(1,2)] T(5,6) by auto + also have "\=\[TT1+TT2;{{\\0,x\,AA1`x\. x\T}\{\\1,x\,AA2`x\. x\T},{\\0,x\,x\. x\T}\{\\1,x\,x\. x\T}}]" by auto + ultimately have eq:"T1+\<^sub>VT2=\[TT1+TT2;{{\\0,x\,AA1`x\. x\T}\{\\1,x\,AA2`x\. x\T},{\\0,x\,x\. x\T}\{\\1,x\,x\. x\T}}]" by auto + from T(1,2) obtain n1 n2 where fin:"TT1\n1" "n1\nat" "TT2\n2" "n2\nat" unfolding FinPow_def Finite_def by auto + then have "n1+n2\n1#+n2" using nat_sum_eqpoll_sum by auto moreover + with fin(1,3) have "TT1+TT2\n1#+n2" using sum_eqpoll_cong[] eqpoll_trans[of "TT1+TT2" "n1+n2" "n1#+n2"] by auto + then have "Finite(TT1+TT2)" unfolding Finite_def using add_type by auto + then have fin:"TT1+TT2\FinPow(T+T)" using T(1,2) unfolding FinPow_def by auto moreover + have f1:"{\\0, x\, AA1 ` x\ . x \ T}:{0}\T\R" using apply_type[OF T(3)] unfolding Pi_def function_def by auto + have f2:"{\\1, x\, AA2 ` x\ . x \ T}:{1}\T\R" using apply_type[OF T(4)] unfolding Pi_def function_def by auto + have "({0}\T)\({1}\T)=0" by auto + then have ffA:"({\\0, x\, AA1 ` x\ . x \ T} \ {\\1, x\, AA2 ` x\ . x \ T}):T+T\R" unfolding sum_def using fun_disjoint_Un[OF f1 f2] by auto moreover + have f1:"{\\0, x\, x\ . x \ T}:{0}\T\\" using assms unfolding Pi_def function_def by blast + have f2:"{\\1, x\, x\ . x \ T}:{1}\T\\" using assms unfolding Pi_def function_def by blast + have f1T:"{\\0, x\, x\ . x \ T}:{0}\T\T" using assms unfolding Pi_def function_def by blast + have f2T:"{\\1, x\, x\ . x \ T}:{1}\T\T" using assms unfolding Pi_def function_def by blast + have "({0}\T)\({1}\T)=0" by auto + then have ffB:"({\\0, x\, x\ . x \ T} \ {\\1, x\, x\ . x \T}):T+T\\" and ffBT:"({\\0, x\, x\ . x \ T} \ {\\1, x\, x\ . x \T}):T+T\T" unfolding sum_def using fun_disjoint_Un[OF f1 f2] + using fun_disjoint_Un[OF f1T f2T] by auto + obtain AA where AA:"\[TT1+TT2;{{\\0,x\,AA1`x\. x\T}\{\\1,x\,AA2`x\. x\T},{\\0,x\,x\. x\T}\{\\1,x\,x\. x\T}}]= + \[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{AA,id(\)}]" "AA:\\R" "\x\\-({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2). AA`x=\" + using index_module[OF ffA ffB fin] by auto + from ffBT have sub:"({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)\T" using func1_1_L6(2) by auto + then have finpow:"({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)\FinPow(T)" using fin Finite_RepFun[of "TT1+TT2" "\t. ({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})`t"] + func_imagedef[OF ffBT, of "TT1+TT2"] unfolding FinPow_def by auto + { + fix R T assume "R\Pow(T)" + then have "id(R)\R*T" using func1_1_L1B[OF id_type] by auto + then have "id(R)=restrict(id(T),R)" using right_comp_id_any[of "id(T)"] using left_comp_id[of "id(R)" R T] by force + } + then have reg:"\T. \R\Pow(T). id(R)=restrict(id(T),R)" by blast + then have "\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]= + \[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(restrict(AA,T),({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)),id(({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))}]" + using linComb_restrict_coord[OF restrict_fun[OF AA(2) assms] func1_1_L1B[OF id_type assms] finpow] sub by auto moreover + from sub have " T \ ({\\0, x\, x\ . x \ T} \ {\\1, x\, x\ . x \ T}) `` (TT1 + TT2)=({\\0, x\, x\ . x \ T} \ {\\1, x\, x\ . x \ T}) `` (TT1 + TT2)" by auto + then have "restrict(restrict(AA,T),({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))=restrict(AA,({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))" + using restrict_restrict[of AA T "({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)"] by auto + ultimately have "\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]= + \[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)),id(({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))}]" by auto + moreover have "({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)\\" using sub assms by auto + with reg have "id(({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))=restrict(id(\),({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))" by auto + ultimately have "\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]= + \[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)),restrict(id(\),({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2))}]" + by auto + also have "\=\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{AA,id(\)}]" using linComb_restrict_coord[OF AA(2) id_type, of "({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)"] + finpow unfolding FinPow_def using assms by force + ultimately have eq1:"\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]= + \[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{AA,id(\)}]" by auto + have "restrict(AA,T):T\R" using restrict_fun[OF AA(2) assms]. moreover + note finpow moreover + { + fix x assume x:"x\T-({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)" + with assms have "x\\-({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)" by auto + with AA(3) have "AA`x=\" by auto + with x have "restrict(AA,T)`x=\" using restrict by auto + } + then have "\x\T-({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2). restrict(AA,T)`x=\" by auto ultimately + have "\({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2),restrict(AA,T)\\{\F,E\\FinPow(T)\(T\R). \x\T-F. E`x=\}" by auto + then have "\F\FinPow(T). \E\T\R. (\x\T-F. E`x=\) \ (\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]=\[F;{E,id(T)}])" + using exI[of "\F. F\FinPow(T) \ (\E\T\R. (\x\T-F. E`x=\) \ (\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]=\[F;{E,id(T)}]))" "({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)"] + exI[of "\E. E\T\R \ ((\x\T-(({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2)). E`x=\) \ (\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]=\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{E,id(T)}]))" + "restrict(AA,T)"] by auto + then have "\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{restrict(AA,T),id(T)}]\{\[FF;{AA,id(T)}]. + \FF,AA\ \ {\F,E\\FinPow(T)\(T\R). \x\T-F. E`x=\}}" by auto + with eq1 have "\[({\\0,x\,x\. x\T}\{\\1,x\,x\. x\T})``(TT1+TT2);{AA,id(\)}]\{span of}T" using A unfolding Span_def[OF assms] + by auto + with AA(1) eq have "T1+\<^sub>VT2\{span of}T" by auto + } + ultimately have "T1+\<^sub>VT2\{span of}T" by auto + } + then have "\x\{span of}T. \y\{span of}T. x+\<^sub>Vy\{span of}T" by blast + then have "({span of}T){is closed under}A\<^sub>M" unfolding IsOpClosed_def by auto moreover + { + fix r TT assume "r\R" "TT\{span of}T" + with A obtain n AA where T:"r\R" "TT=\[n;{AA,id(T)}]" "n\FinPow(T)" "AA:T\R" "\x\T-n. AA`x=\" + unfolding Span_def[OF assms(1)] by auto + have "r\\<^sub>S(TT)=\[n;{{\t,r\(AA`t)\.t\T},id(T)}]" using linComb_action(1)[OF T(4) _ T(1) T(3), of "id(T)"] T(2) + func1_1_L1B[OF id_type assms] by auto moreover + have fun:"{\t,r\(AA`t)\.t\T}:T\R" using linComb_action(2)[OF T(4) _ T(1,3)] func1_1_L1B[OF id_type assms] by auto + moreover + { + fix z assume z:"z\T-n" + then have "{\t,r\(AA`t)\.t\T}`z=r\(AA`z)" using apply_equality[of z "r\(AA`z)" + "{\t,r\(AA`t)\.t\T}" T "\t. R"] using fun by auto + also have "\=r\\" using T(5) z by auto + also have "\=\" using Ring_ZF_1_L6(2)[OF T(1)] by auto + ultimately have "{\t,r\(AA`t)\.t\T}`z=\" by auto + } + then have "\z\T-n. {\t,r\(AA`t)\.t\T}`z=\" by auto ultimately + have "r\\<^sub>S(TT)\{span of}T" unfolding Span_def[OF assms(1)] using A T(3) by auto + } + then have "\r\R. \TT\{span of}T. r\\<^sub>S(TT)\{span of}T" by blast + ultimately have "IsAsubmodule({span of}T)" "T\({span of}T)" using submoduleI by auto + } + ultimately show "IsAsubmodule({span of}T)" "T\({span of}T)" by auto +qed + + +text\Given a linear combination, it is in the span of the image of the second function.\ + +lemma (in module0) linear_comb_span: + assumes "AA:X\R" "B:X\\" "D\FinPow(X)" + shows "\[D;{AA,B}]\({span of}(B``D))" +proof- + { + assume A:"B``D=0" + { + assume "D\0" + then obtain d where "d\D" by auto + then have "B`d\B``D" using image_fun[OF assms(2)] assms(3) unfolding FinPow_def by auto + with A have "False" by auto + } + then have "D=0" by auto + then have "\[D;{AA,B}]=\" using LinearComb_def[OF assms] by auto moreover + with A have ?thesis using Span_def by auto + } + moreover + { + assume A:"B``D\0" + have sub:"B``D\\" using assms(2) func1_1_L6(2) by auto + from assms obtain AB where AA:"\[D;{AA,B}]=\[B``D;{AB,id(\)}]" "AB:\\R" "\x\\-B``D. AB`x=\" + using index_module by blast + have fin:"Finite(B``D)" using func_imagedef[OF assms(2)] assms(3) unfolding FinPow_def + using Finite_RepFun[of D "\t. B`t"] by auto + with sub have finpow:"B``D\FinPow(\)" unfolding FinPow_def by auto + with AA(1) have "\[D;{AA,B}]=\[B``D;{restrict(AB,B``D),restrict(id(\),B``D)}]" + using linComb_restrict_coord AA(2) id_type by auto + moreover have "restrict(id(\),B``D)=id(\) O id(B``D)" using right_comp_id_any by auto + then have "restrict(id(\),B``D)=id(B``D)" using left_comp_id[of "id(B``D)"] sub by auto + ultimately have "\[D;{AA,B}]=\[B``D;{restrict(AB,B``D),id(B``D)}]" by auto moreover + have "restrict(AB,B``D):B``D\R" using AA(2) restrict_fun sub by auto moreover + have "\x\B``D-B``D. restrict(AB,B``D)`x=\\<^sub>R" by auto ultimately + have "\[D;{AA,B}]\{span of}(B``D)" using fin A unfolding Span_def[OF sub] FinPow_def by auto + } + ultimately show ?thesis by blast +qed + +text\It turns out that the span is the smallest submodule that contains the +original set.\ + +theorem(in module0) minimal_submodule: + assumes "T\\" "IsAsubmodule(\)" + shows "({span of}T)\\" +proof- + have as:"T\\" using assms(1) mod_ab_gr.group0_3_L2[OF sumodule_is_subgroup[OF assms(2)]] by auto + { + assume A:"T=0" + { + fix x assume "x\{span of}T" + with A have "x=\" using Span_def[OF as] by auto + then have "x\\" using assms(2) unfolding IsAsubmodule_def + using mod_ab_gr.group0_3_L5 by auto + } + then have "({span of}T)\\" by auto + } + moreover + { + assume A:"T\0" + { + fix x assume "x\{span of}T" + with A obtain n AA where "x=\[n;{AA,id(T)}]" "n\FinPow(T)" "AA:T\R" + unfolding Span_def[OF as] by auto + then have x:"x=\[n;{AA,id(T)}]" "n\FinPow(T)" "AA:T\R" "id(T):T\\" + using assms(1) func1_1_L1B id_type[of T] by auto + then have "x\\" using linear_comb_submod assms(2) by auto + } + then have "({span of}T)\\" by auto + } + ultimately show "({span of}T)\\" by auto +qed + +end \ No newline at end of file From 6714a642e81958bafc135dcad89e17e0c5630d3a Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 09:59:20 +0200 Subject: [PATCH 2/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index 1e3bb8f..22e61f4 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -279,7 +279,7 @@ qed text\Multiplying by zero is zero.\ -lemma(in module0) mult_zero: +lemma (in module0) mult_zero: assumes "g\\" shows "\ \\<^sub>S g=\" proof- @@ -291,7 +291,7 @@ qed text \Taking inverses in a module is just multiplying by $-1$\ -lemma(in module0) inv_module: +lemma (in module0) inv_module: assumes "g\\" shows "(\\) \\<^sub>S g = \ g" proof- From a618601e46153e8c71efd3d29b8fc5d5195ec002 Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 10:46:36 +0200 Subject: [PATCH 3/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index 22e61f4..a824938 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -283,8 +283,7 @@ lemma (in module0) mult_zero: assumes "g\\" shows "\ \\<^sub>S g=\" proof- - from vec_act_homo.homomor_dest_zero have "H ` \ = TheNeutralElement(End(\, A\<^sub>M), EndAdd(\, A\<^sub>M))" . - from trans[OF this add_mult_neut_elems(2)] have "H`\ = ConstantFunction(\,\)" . + from trans[OF vec_act_homo.homomor_dest_zero add_mult_neut_elems(2)] have "H`\ = ConstantFunction(\,\)" by auto then have "(H`\)`g = ConstantFunction(\,\)`g" by auto then show "\ \\<^sub>S g=\" using func1_3_L2 assms by auto qed From a06db9f54698bd319ec374128a9cad4cfb6cdfb0 Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 11:10:00 +0200 Subject: [PATCH 4/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index a824938..17b0bc1 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -283,7 +283,7 @@ lemma (in module0) mult_zero: assumes "g\\" shows "\ \\<^sub>S g=\" proof- - from trans[OF vec_act_homo.homomor_dest_zero add_mult_neut_elems(2)] have "H`\ = ConstantFunction(\,\)" by auto + from vec_act_homo.homomor_dest_zero add_mult_neut_elems(2) have "H`\ = ConstantFunction(\,\)" by (rule trans) then have "(H`\)`g = ConstantFunction(\,\)`g" by auto then show "\ \\<^sub>S g=\" using func1_3_L2 assms by auto qed From bf39cd3fe7ea9a678f333a5f2a6e53adf9f611e9 Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 11:12:36 +0200 Subject: [PATCH 5/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index 17b0bc1..4b4ad8a 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -288,7 +288,7 @@ proof- then show "\ \\<^sub>S g=\" using func1_3_L2 assms by auto qed -text \Taking inverses in a module is just multiplying by $-1$\ +text\Taking inverses in a module is just multiplying by $-1$\ lemma (in module0) inv_module: assumes "g\\" From d34e23352c8437454dec0d0c8383d7686fb40cdd Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 11:41:19 +0200 Subject: [PATCH 6/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index 4b4ad8a..f45dfd9 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -298,7 +298,7 @@ proof- then have B:"(\\) \ R" using Ring_ZF_1_L3(1) by auto have "g+\<^sub>V ((\\) \\<^sub>S g)=(\ \\<^sub>S g)+\<^sub>V ((\\) \\<^sub>S g)" using module_ax4 assms by auto - also have "\=(\ \\) \\<^sub>S g" using module_ax2 unfolding ringsub_def using A B assms by auto + also with A B assms have "\=(\ \\) \\<^sub>S g" using module_ax2 unfolding ringsub_def by auto also have "\=\ \\<^sub>S g" using Ring_ZF_1_L3(7) A by auto also have "\=\" using mult_zero assms by auto ultimately have "g+\<^sub>V ((\\) \\<^sub>S g)=\" by auto moreover From 008a238bc0d9ba942267831aaa2472b440a09f1a Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 12:01:53 +0200 Subject: [PATCH 7/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index f45dfd9..a8081f7 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -298,7 +298,7 @@ proof- then have B:"(\\) \ R" using Ring_ZF_1_L3(1) by auto have "g+\<^sub>V ((\\) \\<^sub>S g)=(\ \\<^sub>S g)+\<^sub>V ((\\) \\<^sub>S g)" using module_ax4 assms by auto - also with A B assms have "\=(\ \\) \\<^sub>S g" using module_ax2 unfolding ringsub_def by auto + also have "\=(\ \\) \\<^sub>S g" using module_ax2 A B assms unfolding ringsub_def by auto also have "\=\ \\<^sub>S g" using Ring_ZF_1_L3(7) A by auto also have "\=\" using mult_zero assms by auto ultimately have "g+\<^sub>V ((\\) \\<^sub>S g)=\" by auto moreover From 331bd046b7e2d2f964d9ae818fe8f398a109d58d Mon Sep 17 00:00:00 2001 From: dnl232 Date: Wed, 1 May 2024 13:05:51 +0200 Subject: [PATCH 8/8] Module_ZF_1.thy - Submodules - Linear combinations --- IsarMathLib/Module_ZF.thy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IsarMathLib/Module_ZF.thy b/IsarMathLib/Module_ZF.thy index a8081f7..fe44a33 100755 --- a/IsarMathLib/Module_ZF.thy +++ b/IsarMathLib/Module_ZF.thy @@ -301,7 +301,7 @@ proof- also have "\=(\ \\) \\<^sub>S g" using module_ax2 A B assms unfolding ringsub_def by auto also have "\=\ \\<^sub>S g" using Ring_ZF_1_L3(7) A by auto also have "\=\" using mult_zero assms by auto - ultimately have "g+\<^sub>V ((\\) \\<^sub>S g)=\" by auto moreover + finally have "g+\<^sub>V ((\\) \\<^sub>S g)=\" by auto moreover from B have "H`(\\)\\\\" using H_val_type(2) by auto then have "(\\) \\<^sub>S g\\" unfolding End_def using apply_type assms by auto ultimately show ?thesis using mod_ab_gr.group0_2_L9(2) assms by auto