[STATEMENT]
theorem (in linear_map) rank_nullity_main:
  assumes fd: "V.fin_dim"
  shows "(vectorspace.dim K (W.vs imT)) + (vectorspace.dim K (V.vs kerT)) = V.dim"
    "T ` (carrier V) = carrier W \<Longrightarrow> W.fin_dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim &&& (T ` carrier V = carrier W \<Longrightarrow> W.fin_dim)
[PROOF STEP]
proof -
  \<comment> \<open>First interpret kerT, imT as vectorspaces\<close>
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have subs_ker: "subspace K kerT V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace K kerT V
[PROOF STEP]
by (intro kerT_is_subspace)
[PROOF STATE]
proof (state)
this:
subspace K kerT V

goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from subs_ker
[PROOF STATE]
proof (chain)
picking this:
subspace K kerT V
[PROOF STEP]
have vs_ker: "vectorspace K (V.vs kerT)"
[PROOF STATE]
proof (prove)
using this:
subspace K kerT V

goal (1 subgoal):
 1. vectorspace K (V.vs kerT)
[PROOF STEP]
by (rule V.subspace_is_vs)
[PROOF STATE]
proof (state)
this:
vectorspace K (V.vs kerT)

goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from vs_ker
[PROOF STATE]
proof (chain)
picking this:
vectorspace K (V.vs kerT)
[PROOF STEP]
interpret ker: vectorspace K "(V.vs kerT)"
[PROOF STATE]
proof (prove)
using this:
vectorspace K (V.vs kerT)

goal (1 subgoal):
 1. vectorspace K (V.vs kerT)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have kerInC: "kerT\<subseteq>carrier V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kerT \<subseteq> carrier V
[PROOF STEP]
by (unfold ker_def, auto)
[PROOF STATE]
proof (state)
this:
kerT \<subseteq> carrier V

goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have subs_im: "subspace K imT W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace K imT W
[PROOF STEP]
by (intro imT_is_subspace)
[PROOF STATE]
proof (state)
this:
subspace K imT W

goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from subs_im
[PROOF STATE]
proof (chain)
picking this:
subspace K imT W
[PROOF STEP]
have vs_im: "vectorspace K (W.vs imT)"
[PROOF STATE]
proof (prove)
using this:
subspace K imT W

goal (1 subgoal):
 1. vectorspace K (W.vs imT)
[PROOF STEP]
by (rule W.subspace_is_vs)
[PROOF STATE]
proof (state)
this:
vectorspace K (W.vs imT)

goal (2 subgoals):
 1. vectorspace.dim K (W.vs imT) + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from vs_im
[PROOF STATE]
proof (chain)
picking this:
vectorspace K (W.vs imT)
[PROOF STEP]
interpret im: vectorspace K "(W.vs imT)"
[PROOF STATE]
proof (prove)
using this:
vectorspace K (W.vs imT)

goal (1 subgoal):
 1. vectorspace K (W.vs imT)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have imInC: "imT\<subseteq>carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imT \<subseteq> carrier W
[PROOF STEP]
by (unfold im_def, auto)
[PROOF STATE]
proof (state)
this:
imT \<subseteq> carrier W

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
(* obvious fact *)
[PROOF STATE]
proof (state)
this:
imT \<subseteq> carrier W

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have zero_same[simp]: "\<zero>\<^bsub>V.vs kerT\<^esub> = \<zero>\<^bsub>V\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero>\<^bsub>V.vs kerT\<^esub> = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
apply (unfold ker_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero>\<^bsub>V.vs {v \<in> carrier V. T v = \<zero>\<^bsub>W\<^esub>}\<^esub> = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
by auto
  \<comment> \<open>Show ker T has a finite basis. This is not obvious. Show that any linearly independent set
has size at most that of V. There exists a maximal linearly independent set, which is the basis.\<close>
[PROOF STATE]
proof (state)
this:
\<zero>\<^bsub>V.vs kerT\<^esub> = \<zero>\<^bsub>V\<^esub>

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have every_li_small: "\<And>A. (A \<subseteq> kerT)\<and> ker.lin_indpt A \<Longrightarrow>
    finite A \<and> card A \<le> V.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
assume eli_asm: "(A \<subseteq> kerT)\<and> ker.lin_indpt A"
[PROOF STATE]
proof (state)
this:
A \<subseteq> kerT \<and> ker.lin_indpt A

goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
(*annoying: I can't just use subst V.module.span_li_not_depend(2) in the show ?thesis
    statement because it doesn't appear in the conclusion.*)
[PROOF STATE]
proof (state)
this:
A \<subseteq> kerT \<and> ker.lin_indpt A

goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
note V.module.span_li_not_depend(2)[where ?N="kerT" and ?S="A"]
[PROOF STATE]
proof (state)
this:
\<lbrakk>A \<subseteq> kerT; LinearCombinations.submodule K kerT V\<rbrakk> \<Longrightarrow> ker.lin_dep A = V.module.lin_dep A

goal (1 subgoal):
 1. \<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim
[PROOF STEP]
from this subs_ker fd eli_asm kerInC
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>A \<subseteq> kerT; LinearCombinations.submodule K kerT V\<rbrakk> \<Longrightarrow> ker.lin_dep A = V.module.lin_dep A
subspace K kerT V
V.fin_dim
A \<subseteq> kerT \<and> ker.lin_indpt A
kerT \<subseteq> carrier V
[PROOF STEP]
show "?thesis A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<subseteq> kerT; LinearCombinations.submodule K kerT V\<rbrakk> \<Longrightarrow> ker.lin_dep A = V.module.lin_dep A
subspace K kerT V
V.fin_dim
A \<subseteq> kerT \<and> ker.lin_indpt A
kerT \<subseteq> carrier V

goal (1 subgoal):
 1. finite A \<and> card A \<le> V.dim
[PROOF STEP]
apply (intro conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<lbrakk>A \<subseteq> kerT; LinearCombinations.submodule K kerT V\<rbrakk> \<Longrightarrow> ker.lin_dep A = V.module.lin_dep A; subspace K kerT V; V.fin_dim; A \<subseteq> kerT \<and> ker.lin_indpt A; kerT \<subseteq> carrier V\<rbrakk> \<Longrightarrow> finite A
 2. \<lbrakk>\<lbrakk>A \<subseteq> kerT; LinearCombinations.submodule K kerT V\<rbrakk> \<Longrightarrow> ker.lin_dep A = V.module.lin_dep A; subspace K kerT V; V.fin_dim; A \<subseteq> kerT \<and> ker.lin_indpt A; kerT \<subseteq> carrier V\<rbrakk> \<Longrightarrow> card A \<le> V.dim
[PROOF STEP]
by (auto intro!: V.li_le_dim)
[PROOF STATE]
proof (state)
this:
finite A \<and> card A \<le> V.dim

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?A1 \<subseteq> kerT \<and> ker.lin_indpt ?A1 \<Longrightarrow> finite ?A1 \<and> card ?A1 \<le> V.dim

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from every_li_small
[PROOF STATE]
proof (chain)
picking this:
?A1 \<subseteq> kerT \<and> ker.lin_indpt ?A1 \<Longrightarrow> finite ?A1 \<and> card ?A1 \<le> V.dim
[PROOF STEP]
have exA:
    "\<exists>A. finite A \<and> maximal A (\<lambda>S. S\<subseteq>carrier (V.vs kerT) \<and> ker.lin_indpt S)"
[PROOF STATE]
proof (prove)
using this:
?A1 \<subseteq> kerT \<and> ker.lin_indpt ?A1 \<Longrightarrow> finite ?A1 \<and> card ?A1 \<le> V.dim

goal (1 subgoal):
 1. \<exists>A. finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)
[PROOF STEP]
apply (intro maximal_exists[where ?N="V.dim" and ?B="{}"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>\<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim; A \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt A\<rbrakk> \<Longrightarrow> finite A \<and> card A \<le> V.dim
 2. (\<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim) \<Longrightarrow> {} \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt {}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>A. A \<subseteq> kerT \<and> ker.lin_indpt A \<Longrightarrow> finite A \<and> card A \<le> V.dim; ker.lin_dep {}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (unfold ker.lin_dep_def, auto)
[PROOF STATE]
proof (state)
this:
\<exists>A. finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from exA
[PROOF STATE]
proof (chain)
picking this:
\<exists>A. finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)
[PROOF STEP]
obtain A where A:" finite A \<and> maximal A (\<lambda>S. S\<subseteq>carrier (V.vs kerT) \<and> ker.lin_indpt S)"
[PROOF STATE]
proof (prove)
using this:
\<exists>A. finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)

goal (1 subgoal):
 1. (\<And>A. finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
hence finA: "finite A" and Ainker: "A\<subseteq>carrier (V.vs kerT)" and AinC: "A\<subseteq>carrier V"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)

goal (1 subgoal):
 1. finite A &&& A \<subseteq> carrier (V.vs kerT) &&& A \<subseteq> carrier V
[PROOF STEP]
by (unfold maximal_def ker_def, auto)
  \<comment> \<open>We obtain the basis A of kerT. It is also linearly independent when considered in V rather
than kerT\<close>
[PROOF STATE]
proof (state)
this:
finite A
A \<subseteq> carrier (V.vs kerT)
A \<subseteq> carrier V

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)
[PROOF STEP]
have Abasis: "ker.basis A"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)

goal (1 subgoal):
 1. ker.basis A
[PROOF STEP]
by (intro ker.max_li_is_basis, auto)
[PROOF STATE]
proof (state)
this:
ker.basis A

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from subs_ker Abasis
[PROOF STATE]
proof (chain)
picking this:
subspace K kerT V
ker.basis A
[PROOF STEP]
have spanA: "V.module.span A = kerT"
[PROOF STATE]
proof (prove)
using this:
subspace K kerT V
ker.basis A

goal (1 subgoal):
 1. V.module.span A = kerT
[PROOF STEP]
apply (unfold ker.basis_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subspace K kerT V; ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT)\<rbrakk> \<Longrightarrow> V.module.span A = kerT
[PROOF STEP]
by (subst sym[OF V.module.span_li_not_depend(1)[where ?N="kerT"]], auto)
[PROOF STATE]
proof (state)
this:
V.module.span A = kerT

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from Abasis
[PROOF STATE]
proof (chain)
picking this:
ker.basis A
[PROOF STEP]
have Akerli: "ker.lin_indpt A"
[PROOF STATE]
proof (prove)
using this:
ker.basis A

goal (1 subgoal):
 1. ker.lin_indpt A
[PROOF STEP]
apply (unfold ker.basis_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT) \<Longrightarrow> ker.lin_indpt A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ker.lin_indpt A

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from subs_ker Ainker Akerli
[PROOF STATE]
proof (chain)
picking this:
subspace K kerT V
A \<subseteq> carrier (V.vs kerT)
ker.lin_indpt A
[PROOF STEP]
have Ali: "V.module.lin_indpt A"
[PROOF STATE]
proof (prove)
using this:
subspace K kerT V
A \<subseteq> carrier (V.vs kerT)
ker.lin_indpt A

goal (1 subgoal):
 1. V.module.lin_indpt A
[PROOF STEP]
by (auto simp add: V.module.span_li_not_depend(2))
[PROOF STATE]
proof (state)
this:
V.module.lin_indpt A

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt\<open>Use the replacement theorem to find C such that $A\cup C$ is a basis of V.\<close>
[PROOF STATE]
proof (state)
this:
V.module.lin_indpt A

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from fd
[PROOF STATE]
proof (chain)
picking this:
V.fin_dim
[PROOF STEP]
obtain B where B: "finite B\<and> V.basis B"
[PROOF STATE]
proof (prove)
using this:
V.fin_dim

goal (1 subgoal):
 1. (\<And>B. finite B \<and> V.basis B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis V.finite_basis_exists)
[PROOF STATE]
proof (state)
this:
finite B \<and> V.basis B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from B
[PROOF STATE]
proof (chain)
picking this:
finite B \<and> V.basis B
[PROOF STEP]
have Bfin: "finite B" and Bbasis:"V.basis B"
[PROOF STATE]
proof (prove)
using this:
finite B \<and> V.basis B

goal (1 subgoal):
 1. finite B &&& V.basis B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite B
V.basis B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from B
[PROOF STATE]
proof (chain)
picking this:
finite B \<and> V.basis B
[PROOF STEP]
have Bcard: "V.dim = card B"
[PROOF STATE]
proof (prove)
using this:
finite B \<and> V.basis B

goal (1 subgoal):
 1. V.dim = card B
[PROOF STEP]
by (intro V.dim_basis, auto)
[PROOF STATE]
proof (state)
this:
V.dim = card B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from Bbasis
[PROOF STATE]
proof (chain)
picking this:
V.basis B
[PROOF STEP]
have 62: "V.module.span B = carrier V"
[PROOF STATE]
proof (prove)
using this:
V.basis B

goal (1 subgoal):
 1. V.module.gen_set B
[PROOF STEP]
by (unfold V.basis_def, auto)
[PROOF STATE]
proof (state)
this:
V.module.gen_set B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from A Abasis Ali B vs_ker
[PROOF STATE]
proof (chain)
picking this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)
ker.basis A
V.module.lin_indpt A
finite B \<and> V.basis B
vectorspace K (V.vs kerT)
[PROOF STEP]
have "\<exists>C. finite C \<and> C\<subseteq>carrier V \<and> C\<subseteq> V.module.span B \<and> C\<inter>A={}
      \<and> int (card C) \<le> (int (card B)) - (int (card A)) \<and> (V.module.span (A \<union> C) = V.module.span B)"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S)
ker.basis A
V.module.lin_indpt A
finite B \<and> V.basis B
vectorspace K (V.vs kerT)

goal (1 subgoal):
 1. \<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
apply (intro V.replacement)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.basis A; V.module.lin_indpt A; finite B \<and> V.basis B; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> finite A
 2. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.basis A; V.module.lin_indpt A; finite B \<and> V.basis B; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> finite B
 3. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.basis A; V.module.lin_indpt A; finite B \<and> V.basis B; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> B \<subseteq> carrier V
 4. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.basis A; V.module.lin_indpt A; finite B \<and> V.basis B; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> V.module.lin_indpt A
 5. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.basis A; V.module.lin_indpt A; finite B \<and> V.basis B; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> A \<subseteq> V.module.span B
[PROOF STEP]
apply (unfold vectorspace.basis_def V.basis_def)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT); V.module.lin_indpt A; finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> finite A
 2. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT); V.module.lin_indpt A; finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> finite B
 3. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT); V.module.lin_indpt A; finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> B \<subseteq> carrier V
 4. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT); V.module.lin_indpt A; finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> V.module.lin_indpt A
 5. \<lbrakk>finite A \<and> maximal A (\<lambda>S. S \<subseteq> carrier (V.vs kerT) \<and> ker.lin_indpt S); ker.lin_indpt A \<and> ker.gen_set A \<and> A \<subseteq> carrier (V.vs kerT); V.module.lin_indpt A; finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; vectorspace K (V.vs kerT)\<rbrakk> \<Longrightarrow> A \<subseteq> V.module.span B
[PROOF STEP]
by (unfold ker_def, auto)
[PROOF STATE]
proof (state)
this:
\<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt \<open>From replacement we got $|C|\leq |B|-|A|$. Equality must actually hold, because no generating set
can be smaller than $B$. Now $A\cup C$ is a maximal generating set, hence a basis; its cardinality
equals the dimension.\<close>
[PROOF STATE]
proof (state)
this:
\<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt \<open>We claim that $T(C)$ is basis for $\text{im}(T)$.\<close>
[PROOF STATE]
proof (state)
this:
\<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
obtain C where C: "finite C \<and> C\<subseteq>carrier V \<and> C\<subseteq> V.module.span B \<and> C\<inter>A={}
    \<and> int (card C) \<le> (int (card B)) - (int (card A)) \<and> (V.module.span (A \<union> C) = V.module.span B)"
[PROOF STATE]
proof (prove)
using this:
\<exists>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. (\<And>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
hence Cfin: "finite C" and CinC: "C\<subseteq>carrier V" and CinspanB: " C\<subseteq>V.module.span B" and CAdis: "C\<inter>A={}"
    and Ccard: "int (card C) \<le> (int (card B)) - (int (card A))"
    and ACspanB: "(V.module.span (A \<union> C) = V.module.span B)"
[PROOF STATE]
proof (prove)
using this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. (finite C &&& C \<subseteq> carrier V &&& C \<subseteq> V.module.span B) &&& C \<inter> A = {} &&& int (card C) \<le> int (card B) - int (card A) &&& V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite C
C \<subseteq> carrier V
C \<subseteq> V.module.span B
C \<inter> A = {}
int (card C) \<le> int (card B) - int (card A)
V.module.span (A \<union> C) = V.module.span B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from C
[PROOF STATE]
proof (chain)
picking this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
have cardLe: "card A + card C \<le> card B"
[PROOF STATE]
proof (prove)
using this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. card A + card C \<le> card B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card A + card C \<le> card B

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from B C
[PROOF STATE]
proof (chain)
picking this:
finite B \<and> V.basis B
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
have ACgen: "V.module.gen_set (A\<union>C)"
[PROOF STATE]
proof (prove)
using this:
finite B \<and> V.basis B
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. V.module.gen_set (A \<union> C)
[PROOF STEP]
apply (unfold V.basis_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B \<and> V.module.lin_indpt B \<and> V.module.gen_set B \<and> B \<subseteq> carrier V; finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B\<rbrakk> \<Longrightarrow> V.module.gen_set (A \<union> C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V.module.gen_set (A \<union> C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from finA C ACgen AinC B
[PROOF STATE]
proof (chain)
picking this:
finite A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
V.module.gen_set (A \<union> C)
A \<subseteq> carrier V
finite B \<and> V.basis B
[PROOF STEP]
have cardGe: "card (A\<union>C) \<ge> card B"
[PROOF STATE]
proof (prove)
using this:
finite A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
V.module.gen_set (A \<union> C)
A \<subseteq> carrier V
finite B \<and> V.basis B

goal (1 subgoal):
 1. card B \<le> card (A \<union> C)
[PROOF STEP]
by (intro V.li_smaller_than_gen, unfold V.basis_def, auto)
[PROOF STATE]
proof (state)
this:
card B \<le> card (A \<union> C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from finA C
[PROOF STATE]
proof (chain)
picking this:
finite A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
have cardUn: "card (A\<union>C)\<le>  card A + card C"
[PROOF STATE]
proof (prove)
using this:
finite A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. card (A \<union> C) \<le> card A + card C
[PROOF STEP]
by (metis Int_commute card_Un_disjoint le_refl)
[PROOF STATE]
proof (state)
this:
card (A \<union> C) \<le> card A + card C

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from cardLe cardUn cardGe Bcard
[PROOF STATE]
proof (chain)
picking this:
card A + card C \<le> card B
card (A \<union> C) \<le> card A + card C
card B \<le> card (A \<union> C)
V.dim = card B
[PROOF STEP]
have cardEq:
    "card (A\<union>C) = card A + card C"
    "card (A\<union>C) = card B"
    "card (A\<union>C) = V.dim"
[PROOF STATE]
proof (prove)
using this:
card A + card C \<le> card B
card (A \<union> C) \<le> card A + card C
card B \<le> card (A \<union> C)
V.dim = card B

goal (1 subgoal):
 1. card (A \<union> C) = card A + card C &&& card (A \<union> C) = card B &&& card (A \<union> C) = V.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from Abasis C cardEq
[PROOF STATE]
proof (chain)
picking this:
ker.basis A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
[PROOF STEP]
have disj: "A\<inter>C={}"
[PROOF STATE]
proof (prove)
using this:
ker.basis A
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim

goal (1 subgoal):
 1. A \<inter> C = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<inter> C = {}

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from finA AinC C cardEq 62
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
V.module.gen_set B
[PROOF STEP]
have ACfin: "finite (A\<union>C)" and ACbasis: "V.basis (A\<union>C)"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
V.module.gen_set B

goal (1 subgoal):
 1. finite (A \<union> C) &&& V.basis (A \<union> C)
[PROOF STEP]
by (auto intro!: V.dim_gen_is_basis)
[PROOF STATE]
proof (state)
this:
finite (A \<union> C)
V.basis (A \<union> C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have lm: "linear_map K V W T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_map K V W T
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
linear_map K V W T

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt \<open>Let $C'$ be the image of $C$ under $T$. We will show $C'$ is a basis for $\text{im}(T)$.\<close>
[PROOF STATE]
proof (state)
this:
linear_map K V W T

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
let ?C' = "T`C"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from Cfin
[PROOF STATE]
proof (chain)
picking this:
finite C
[PROOF STEP]
have C'fin: "finite ?C'"
[PROOF STATE]
proof (prove)
using this:
finite C

goal (1 subgoal):
 1. finite (T ` C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (T ` C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from AinC C
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
[PROOF STEP]
have cim: "?C'\<subseteq>imT"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B

goal (1 subgoal):
 1. T ` C \<subseteq> imT
[PROOF STEP]
by (unfold im_def, auto)
[PROOF STATE]
proof (state)
this:
T ` C \<subseteq> imT

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt \<open>"There is a subtle detail: we first have to show $T$ is injective on $C$.\<close>
[PROOF STATE]
proof (state)
this:
T ` C \<subseteq> imT

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
txt \<open>We establish that no nontrivial linear combination of $C$ can have image 0 under $T$,
because that would mean it is a linear combination of $A$, giving that $A\cup C$ is linearly dependent,
contradiction. We use this result in 2 ways: (1) if $T$ is not injective on $C$, then we obtain $v$, $w\in C$
such that $v-w$ is in the kernel, contradiction, (2) if $T(C)$ is linearly dependent,
taking the inverse image of that linear combination gives a linear combination of $C$ in the kernel,
contradiction. Hence $T$ is injective on $C$ and $T(C)$ is linearly independent.\<close>
[PROOF STATE]
proof (state)
this:
T ` C \<subseteq> imT

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have lc_in_ker: "\<And>d D v. \<lbrakk>D\<subseteq>C; d\<in>D\<rightarrow>carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>;
    v\<in>D; d v \<noteq>\<zero>\<^bsub>K\<^esub>\<rbrakk>\<Longrightarrow>False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix d D v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume D: "D\<subseteq>C" and d: "d\<in>D\<rightarrow>carrier K" and T0: "T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>"
      and v: "v\<in>D" and dvnz: "d v \<noteq>\<zero>\<^bsub>K\<^esub>"
[PROOF STATE]
proof (state)
this:
D \<subseteq> C
d \<in> D \<rightarrow> carrier K
T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>
v \<in> D
d v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from D Cfin
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> C
finite C
[PROOF STEP]
have Dfin: "finite D"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> C
finite C

goal (1 subgoal):
 1. finite D
[PROOF STEP]
by (auto intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite D

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from D CinC
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> C
C \<subseteq> carrier V
[PROOF STEP]
have DinC: "D\<subseteq>carrier V"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> C
C \<subseteq> carrier V

goal (1 subgoal):
 1. D \<subseteq> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D \<subseteq> carrier V

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from T0 d Dfin DinC
[PROOF STATE]
proof (chain)
picking this:
T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>
d \<in> D \<rightarrow> carrier K
finite D
D \<subseteq> carrier V
[PROOF STEP]
have lc_d: "V.module.lincomb d D\<in>kerT"
[PROOF STATE]
proof (prove)
using this:
T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>
d \<in> D \<rightarrow> carrier K
finite D
D \<subseteq> carrier V

goal (1 subgoal):
 1. V.module.lincomb d D \<in> kerT
[PROOF STEP]
by (unfold ker_def, auto)
[PROOF STATE]
proof (state)
this:
V.module.lincomb d D \<in> kerT

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from lc_d spanA AinC
[PROOF STATE]
proof (chain)
picking this:
V.module.lincomb d D \<in> kerT
V.module.span A = kerT
A \<subseteq> carrier V
[PROOF STEP]
have  "\<exists>a' A'. A'\<subseteq>A \<and> a'\<in>A'\<rightarrow>carrier K \<and>
       V.module.lincomb a' A'= V.module.lincomb d D"
[PROOF STATE]
proof (prove)
using this:
V.module.lincomb d D \<in> kerT
V.module.span A = kerT
A \<subseteq> carrier V

goal (1 subgoal):
 1. \<exists>a' A'. A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb a' A' = V.module.lincomb d D
[PROOF STEP]
by (intro V.module.in_span, auto)
[PROOF STATE]
proof (state)
this:
\<exists>a' A'. A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb a' A' = V.module.lincomb d D

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a' A'. A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb a' A' = V.module.lincomb d D
[PROOF STEP]
obtain a' A' where a': "A'\<subseteq>A \<and> a'\<in>A'\<rightarrow>carrier K \<and>
      V.module.lincomb d D = V.module.lincomb a' A'"
[PROOF STATE]
proof (prove)
using this:
\<exists>a' A'. A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb a' A' = V.module.lincomb d D

goal (1 subgoal):
 1. (\<And>A' a'. A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence  A'sub: "A'\<subseteq>A" and a'fun: "a'\<in>A'\<rightarrow>carrier K"
      and a'_lc:"V.module.lincomb d D = V.module.lincomb a' A'"
[PROOF STATE]
proof (prove)
using this:
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'

goal (1 subgoal):
 1. A' \<subseteq> A &&& a' \<in> A' \<rightarrow> carrier K &&& V.module.lincomb d D = V.module.lincomb a' A'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<subseteq> A
a' \<in> A' \<rightarrow> carrier K
V.module.lincomb d D = V.module.lincomb a' A'

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from a' finA Dfin
[PROOF STATE]
proof (chain)
picking this:
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'
finite A
finite D
[PROOF STEP]
have A'fin: "finite (A')"
[PROOF STATE]
proof (prove)
using this:
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'
finite A
finite D

goal (1 subgoal):
 1. finite A'
[PROOF STEP]
by (auto intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite A'

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from AinC A'sub
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
A' \<subseteq> A
[PROOF STEP]
have A'inC: "A'\<subseteq>carrier V"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V
A' \<subseteq> A

goal (1 subgoal):
 1. A' \<subseteq> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<subseteq> carrier V

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
let ?e = "(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<otimes>\<^bsub>K\<^esub> d v)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from a'fun d
[PROOF STATE]
proof (chain)
picking this:
a' \<in> A' \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
[PROOF STEP]
have e_fun: "?e \<in> A' \<union> D \<rightarrow> carrier K"
[PROOF STATE]
proof (prove)
using this:
a' \<in> A' \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K

goal (1 subgoal):
 1. (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
[PROOF STEP]
apply (unfold Pi_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a' \<in> {f. \<forall>x. x \<in> A' \<longrightarrow> f x \<in> carrier K}; d \<in> {f. \<forall>x. x \<in> D \<longrightarrow> f x \<in> carrier K}\<rbrakk> \<Longrightarrow> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> {f. \<forall>x. x \<in> A' \<union> D \<longrightarrow> f x \<in> carrier K}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from
      A'fin Dfin (*finiteness*)
      A'inC DinC (*in carrier*)
      a'fun d e_fun (*coefficients valid*)
      disj D A'sub
[PROOF STATE]
proof (chain)
picking this:
finite A'
finite D
A' \<subseteq> carrier V
D \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
A \<inter> C = {}
D \<subseteq> C
A' \<subseteq> A
[PROOF STEP]
(*A and C disjoint*)
[PROOF STATE]
proof (chain)
picking this:
finite A'
finite D
A' \<subseteq> carrier V
D \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
A \<inter> C = {}
D \<subseteq> C
A' \<subseteq> A
[PROOF STEP]
have lccomp1:
      "V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<odot>\<^bsub>V\<^esub> V.module.lincomb d D =
        V.module.lincomb (\<lambda>v. if v\<in>A' then a' v else \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<otimes>\<^bsub>K\<^esub> d v) (A'\<union>D)"
[PROOF STATE]
proof (prove)
using this:
finite A'
finite D
A' \<subseteq> carrier V
D \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
A \<inter> C = {}
D \<subseteq> C
A' \<subseteq> A

goal (1 subgoal):
 1. V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
[PROOF STEP]
apply (subst sym[OF V.module.lincomb_smult])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> D \<subseteq> carrier V
 2. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> d \<in> D \<rightarrow> carrier K
 3. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<in> carrier K
 4. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> V.module.lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d w) D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> V.module.lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d w) D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
[PROOF STEP]
apply (subst V.module.lincomb_union2)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> finite (A' \<union> D)
 2. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> A' \<union> D \<subseteq> carrier V
 3. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> A' \<inter> D = {}
 4. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> a' \<in> A' \<rightarrow> carrier K
 5. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> (\<lambda>w. \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d w) \<in> D \<rightarrow> carrier K
 6. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; a' \<in> A' \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<rightarrow> carrier K \<and> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> D \<rightarrow> carrier K; A \<inter> C = {}; D \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from
      A'fin (*finiteness*)
      A'inC (*in carrier*)
      a'fun
[PROOF STATE]
proof (chain)
picking this:
finite A'
A' \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K
[PROOF STEP]
(*coefficients valid*)
[PROOF STATE]
proof (chain)
picking this:
finite A'
A' \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K
[PROOF STEP]
have lccomp2:
      "V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<odot>\<^bsub>V\<^esub> V.module.lincomb d D =
      \<zero>\<^bsub>V\<^esub>"
[PROOF STATE]
proof (prove)
using this:
finite A'
A' \<subseteq> carrier V
a' \<in> A' \<rightarrow> carrier K

goal (1 subgoal):
 1. V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
by (simp add: a'_lc
        V.module.smult_minus_1  V.module.M.r_neg)
[PROOF STATE]
proof (state)
this:
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from lccomp1 lccomp2
[PROOF STATE]
proof (chain)
picking this:
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
have lc0: "V.module.lincomb (\<lambda>v. if v\<in>A' then a' v else \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<otimes>\<^bsub>K\<^esub> d v) (A'\<union>D)
      =\<zero>\<^bsub>V\<^esub>"
[PROOF STATE]
proof (prove)
using this:
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D)
V.module.lincomb a' A' \<oplus>\<^bsub>V\<^esub> \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<odot>\<^bsub>V\<^esub> V.module.lincomb d D = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from disj a' v D
[PROOF STATE]
proof (chain)
picking this:
A \<inter> C = {}
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'
v \<in> D
D \<subseteq> C
[PROOF STEP]
have v_nin: "v\<notin>A'"
[PROOF STATE]
proof (prove)
using this:
A \<inter> C = {}
A' \<subseteq> A \<and> a' \<in> A' \<rightarrow> carrier K \<and> V.module.lincomb d D = V.module.lincomb a' A'
v \<in> D
D \<subseteq> C

goal (1 subgoal):
 1. v \<notin> A'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<notin> A'

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from A'fin Dfin (*finiteness*)
      A'inC DinC (*in carrier*)
      e_fun d (*coefficients valid*)
      A'sub D disj (*A' D are disjoint subsets*)
      v dvnz (*d v is nonzero coefficient*)
      lc0
[PROOF STATE]
proof (chain)
picking this:
finite A'
finite D
A' \<subseteq> carrier V
D \<subseteq> carrier V
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
A' \<subseteq> A
D \<subseteq> C
A \<inter> C = {}
v \<in> D
d v \<noteq> \<zero>\<^bsub>K\<^esub>
V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
have AC_ld: "V.module.lin_dep (A\<union>C)"
[PROOF STATE]
proof (prove)
using this:
finite A'
finite D
A' \<subseteq> carrier V
D \<subseteq> carrier V
(\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
d \<in> D \<rightarrow> carrier K
A' \<subseteq> A
D \<subseteq> C
A \<inter> C = {}
v \<in> D
d v \<noteq> \<zero>\<^bsub>K\<^esub>
V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. V.module.lin_dep (A \<union> C)
[PROOF STEP]
apply (intro V.module.lin_dep_crit[where ?A="A'\<union>D" and
        ?S="A\<union>C" and ?a="\<lambda>v. if v\<in>A' then a' v else \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>\<otimes>\<^bsub>K\<^esub> d v" and ?v="v"])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> finite (A' \<union> D)
 2. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> A' \<union> D \<subseteq> A \<union> C
 3. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K
 4. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> v \<in> A' \<union> D
 5. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> (if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<noteq> \<zero>\<^bsub>K\<^esub>
 6. \<lbrakk>finite A'; finite D; A' \<subseteq> carrier V; D \<subseteq> carrier V; (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) \<in> A' \<union> D \<rightarrow> carrier K; d \<in> D \<rightarrow> carrier K; A' \<subseteq> A; D \<subseteq> C; A \<inter> C = {}; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>; V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> V.module.lincomb (\<lambda>v. if v \<in> A' then a' v else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> \<otimes>\<^bsub>K\<^esub> d v) (A' \<union> D) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
by (auto dest: integral)
[PROOF STATE]
proof (state)
this:
V.module.lin_dep (A \<union> C)

goal (1 subgoal):
 1. \<And>d D v. \<lbrakk>D \<subseteq> C; d \<in> D \<rightarrow> carrier K; T (V.module.lincomb d D) = \<zero>\<^bsub>W\<^esub>; v \<in> D; d v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from AC_ld ACbasis
[PROOF STATE]
proof (chain)
picking this:
V.module.lin_dep (A \<union> C)
V.basis (A \<union> C)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
V.module.lin_dep (A \<union> C)
V.basis (A \<union> C)

goal (1 subgoal):
 1. False
[PROOF STEP]
by (unfold V.basis_def, auto)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?D1 \<subseteq> C; ?d1 \<in> ?D1 \<rightarrow> carrier K; T (V.module.lincomb ?d1 ?D1) = \<zero>\<^bsub>W\<^esub>; ?v1 \<in> ?D1; ?d1 ?v1 \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> False

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have C'_card: "inj_on T C" "card C = card ?C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on T C &&& card C = card (T ` C)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on T C
 2. card C = card (T ` C)
[PROOF STEP]
show "inj_on T C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on T C
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> inj_on T C \<Longrightarrow> False
[PROOF STEP]
assume "\<not>inj_on T C"
[PROOF STATE]
proof (state)
this:
\<not> inj_on T C

goal (1 subgoal):
 1. \<not> inj_on T C \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> inj_on T C
[PROOF STEP]
obtain v w where "v\<in>C" "w\<in>C" "v\<noteq>w" "T v = T w"
[PROOF STATE]
proof (prove)
using this:
\<not> inj_on T C

goal (1 subgoal):
 1. (\<And>v w. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (unfold inj_on_def, auto)
[PROOF STATE]
proof (state)
this:
v \<in> C
w \<in> C
v \<noteq> w
T v = T w

goal (1 subgoal):
 1. \<not> inj_on T C \<Longrightarrow> False
[PROOF STEP]
from this CinC
[PROOF STATE]
proof (chain)
picking this:
v \<in> C
w \<in> C
v \<noteq> w
T v = T w
C \<subseteq> carrier V
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
v \<in> C
w \<in> C
v \<noteq> w
T v = T w
C \<subseteq> carrier V

goal (1 subgoal):
 1. False
[PROOF STEP]
apply (intro lc_in_ker[where ?D1="{v,w}" and ?d1="\<lambda>x. if x=v then \<one>\<^bsub>K\<^esub> else \<ominus>\<^bsub>K\<^esub>\<one>\<^bsub>K\<^esub>"
          and ?v1="v"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> {v, w} \<subseteq> C
 2. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> (\<lambda>x. if x = v then \<one>\<^bsub>K\<^esub> else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub>) \<in> {v, w} \<rightarrow> carrier K
 3. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> T (V.module.lincomb (\<lambda>x. if x = v then \<one>\<^bsub>K\<^esub> else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub>) {v, w}) = \<zero>\<^bsub>W\<^esub>
 4. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> v \<in> {v, w}
 5. \<lbrakk>v \<in> C; w \<in> C; v \<noteq> w; T v = T w; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> (if v = v then \<one>\<^bsub>K\<^esub> else \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub>) \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by (auto simp add: V.module.lincomb_def hom_sum ring_subset_carrier
              W.module.smult_minus_1 r_neg T_im)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on T C

goal (1 subgoal):
 1. card C = card (T ` C)
[PROOF STEP]
from this Cfin
[PROOF STATE]
proof (chain)
picking this:
inj_on T C
finite C
[PROOF STEP]
show "card C = card ?C'"
[PROOF STATE]
proof (prove)
using this:
inj_on T C
finite C

goal (1 subgoal):
 1. card C = card (T ` C)
[PROOF STEP]
by (metis card_image)
[PROOF STATE]
proof (state)
this:
card C = card (T ` C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on T C
card C = card (T ` C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
let ?f="the_inv_into C T"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have f: "\<And>x. x\<in>C \<Longrightarrow> ?f (T x) = x" "\<And>y. y\<in>?C' \<Longrightarrow> T (?f y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x) &&& (\<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y)
[PROOF STEP]
apply (insert C'_card(1))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<in> C; inj_on T C\<rbrakk> \<Longrightarrow> the_inv_into C T (T x) = x
 2. \<And>y. \<lbrakk>y \<in> T ` C; inj_on T C\<rbrakk> \<Longrightarrow> T (the_inv_into C T y) = y
[PROOF STEP]
apply (metis the_inv_into_f_f)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>y \<in> T ` C; inj_on T C\<rbrakk> \<Longrightarrow> T (the_inv_into C T y) = y
[PROOF STEP]
by (metis f_the_inv_into_f)
[PROOF STATE]
proof (state)
this:
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
(*We show C' is a basis for the image. First we show it is linearly independent.*)
[PROOF STATE]
proof (state)
this:
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have C'_li: "im.lin_indpt ?C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. im.lin_indpt (T ` C)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
assume Cld: "\<not>im.lin_indpt ?C'"
[PROOF STATE]
proof (state)
this:
\<not> im.lin_indpt (T ` C)

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
from Cld cim subs_im
[PROOF STATE]
proof (chain)
picking this:
\<not> im.lin_indpt (T ` C)
T ` C \<subseteq> imT
subspace K imT W
[PROOF STEP]
have CldW: "W.module.lin_dep ?C'"
[PROOF STATE]
proof (prove)
using this:
\<not> im.lin_indpt (T ` C)
T ` C \<subseteq> imT
subspace K imT W

goal (1 subgoal):
 1. W.module.lin_dep (T ` C)
[PROOF STEP]
apply (subst sym[OF W.module.span_li_not_depend(2)[where ?S="T`C" and ?N="imT"]])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<not> im.lin_indpt (T ` C); T ` C \<subseteq> imT; subspace K imT W\<rbrakk> \<Longrightarrow> T ` C \<subseteq> imT
 2. \<lbrakk>\<not> im.lin_indpt (T ` C); T ` C \<subseteq> imT; subspace K imT W\<rbrakk> \<Longrightarrow> LinearCombinations.submodule K imT W
 3. \<lbrakk>\<not> im.lin_indpt (T ` C); T ` C \<subseteq> imT; subspace K imT W\<rbrakk> \<Longrightarrow> im.lin_dep (T ` C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W.module.lin_dep (T ` C)

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
from C CldW
[PROOF STATE]
proof (chain)
picking this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
W.module.lin_dep (T ` C)
[PROOF STEP]
have "\<exists>c' v'. (c'\<in> (?C'\<rightarrow>carrier K)) \<and> (W.module.lincomb c' ?C' = \<zero>\<^bsub>W\<^esub>)
      \<and> (v'\<in>?C') \<and> (c' v'\<noteq> \<zero>\<^bsub>K\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
W.module.lin_dep (T ` C)

goal (1 subgoal):
 1. \<exists>c' v'. c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by (intro W.module.finite_lin_dep, auto)
[PROOF STATE]
proof (state)
this:
\<exists>c' v'. c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>c' v'. c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
obtain c' v' where c': "(c'\<in> (?C'\<rightarrow>carrier K)) \<and> (W.module.lincomb c' ?C' = \<zero>\<^bsub>W\<^esub>)
      \<and> (v'\<in>?C') \<and> (c' v'\<noteq> \<zero>\<^bsub>K\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
\<exists>c' v'. c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. (\<And>c' v'. c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
hence c'fun: "(c'\<in> (?C'\<rightarrow>carrier K))" and c'lc: "(W.module.lincomb c' ?C' = \<zero>\<^bsub>W\<^esub>)" and
      v':"(v'\<in>?C')" and cvnz: "(c' v'\<noteq> \<zero>\<^bsub>K\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
c' \<in> T ` C \<rightarrow> carrier K \<and> W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub> \<and> v' \<in> T ` C \<and> c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. (c' \<in> T ` C \<rightarrow> carrier K &&& W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>) &&& v' \<in> T ` C &&& c' v' \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c' \<in> T ` C \<rightarrow> carrier K
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>
v' \<in> T ` C
c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
(*can't get c' directly with metis/auto with W.module.finite_lin_dep*)
[PROOF STATE]
proof (state)
this:
c' \<in> T ` C \<rightarrow> carrier K
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>
v' \<in> T ` C
c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
txt \<open>We take the inverse image of $C'$ under $T$ to get a linear combination of $C$ that is
in the kernel and hence a linear combination of $A$. This contradicts $A\cup C$ being linearly
independent.\<close>
[PROOF STATE]
proof (state)
this:
c' \<in> T ` C \<rightarrow> carrier K
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>
v' \<in> T ` C
c' v' \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
let ?c="\<lambda>v. c' (T v)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
from c'fun
[PROOF STATE]
proof (chain)
picking this:
c' \<in> T ` C \<rightarrow> carrier K
[PROOF STEP]
have c_fun: "?c\<in> C\<rightarrow>carrier K"
[PROOF STATE]
proof (prove)
using this:
c' \<in> T ` C \<rightarrow> carrier K

goal (1 subgoal):
 1. (\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
from Cfin (*C finite*)
      c_fun c'fun (*coefficients valid*)
      C'_card (*bijective*)
      CinC (*C in carrier*)
      f (*inverse to T*)
      c'lc
[PROOF STATE]
proof (chain)
picking this:
finite C
(\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K
c' \<in> T ` C \<rightarrow> carrier K
inj_on T C
card C = card (T ` C)
C \<subseteq> carrier V
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
(*lc c' = 0*)
[PROOF STATE]
proof (chain)
picking this:
finite C
(\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K
c' \<in> T ` C \<rightarrow> carrier K
inj_on T C
card C = card (T ` C)
C \<subseteq> carrier V
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
have "T (V.module.lincomb ?c C) = \<zero>\<^bsub>W\<^esub>"
[PROOF STATE]
proof (prove)
using this:
finite C
(\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K
c' \<in> T ` C \<rightarrow> carrier K
inj_on T C
card C = card (T ` C)
C \<subseteq> carrier V
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
W.module.lincomb c' (T ` C) = \<zero>\<^bsub>W\<^esub>

goal (1 subgoal):
 1. T (V.module.lincomb (\<lambda>v. c' (T v)) C) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
apply (unfold V.module.lincomb_def W.module.lincomb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite C; (\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> T (\<Oplus>\<^bsub>V\<^esub>v\<in>C. c' (T v) \<odot>\<^bsub>V\<^esub> v) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
apply (subst hom_sum, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite C; (\<lambda>v. c' (T v)) \<in> C \<rightarrow> carrier K; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>a\<in>C. T (c' (T a) \<odot>\<^bsub>V\<^esub> a)) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
apply (simp cong: finsum_cong add: ring_subset_carrier coeff_in_ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite C; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>i\<in>C. c' (T i) \<odot>\<^bsub>W\<^esub> T i) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
apply (subst finsum_reindex[where ?f="\<lambda>w. c' w \<odot>\<^bsub>W\<^esub> w" and ?h="T" and ?A="C", THEN sym])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>finite C; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> (\<lambda>w. c' w \<odot>\<^bsub>W\<^esub> w) \<in> T ` C \<rightarrow> carrier W
 2. \<lbrakk>finite C; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> inj_on T C
 3. \<lbrakk>finite C; c' \<in> T ` C \<rightarrow> carrier K; inj_on T C; card C = card (T ` C); C \<subseteq> carrier V; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. c' v \<odot>\<^bsub>W\<^esub> v) = \<zero>\<^bsub>W\<^esub>\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>w\<in>T ` C. c' w \<odot>\<^bsub>W\<^esub> w) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T (V.module.lincomb (\<lambda>v. c' (T v)) C) = \<zero>\<^bsub>W\<^esub>

goal (1 subgoal):
 1. \<not> im.lin_indpt (T ` C) \<Longrightarrow> False
[PROOF STEP]
with f c'fun cvnz v'
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
c' \<in> T ` C \<rightarrow> carrier K
c' v' \<noteq> \<zero>\<^bsub>K\<^esub>
v' \<in> T ` C
T (V.module.lincomb (\<lambda>v. c' (T v)) C) = \<zero>\<^bsub>W\<^esub>
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
c' \<in> T ` C \<rightarrow> carrier K
c' v' \<noteq> \<zero>\<^bsub>K\<^esub>
v' \<in> T ` C
T (V.module.lincomb (\<lambda>v. c' (T v)) C) = \<zero>\<^bsub>W\<^esub>

goal (1 subgoal):
 1. False
[PROOF STEP]
by (intro lc_in_ker[where ?D1="C" and ?d1="?c" and ?v1="?f v'"], auto)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
im.lin_indpt (T ` C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have C'_gen: "im.gen_set ?C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. im.gen_set (T ` C)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. im.gen_set (T ` C)
[PROOF STEP]
have C'_span: "span ?C' = imT"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W.module.span (T ` C) = imT
[PROOF STEP]
proof (rule equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. W.module.span (T ` C) \<subseteq> imT
 2. imT \<subseteq> W.module.span (T ` C)
[PROOF STEP]
from cim subs_im
[PROOF STATE]
proof (chain)
picking this:
T ` C \<subseteq> imT
subspace K imT W
[PROOF STEP]
show "W.module.span ?C' \<subseteq> imT"
[PROOF STATE]
proof (prove)
using this:
T ` C \<subseteq> imT
subspace K imT W

goal (1 subgoal):
 1. W.module.span (T ` C) \<subseteq> imT
[PROOF STEP]
by (intro span_is_subset, unfold subspace_def, auto)
[PROOF STATE]
proof (state)
this:
W.module.span (T ` C) \<subseteq> imT

goal (1 subgoal):
 1. imT \<subseteq> W.module.span (T ` C)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. imT \<subseteq> W.module.span (T ` C)
[PROOF STEP]
show "imT\<subseteq>W.module.span ?C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imT \<subseteq> W.module.span (T ` C)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
assume w: "w\<in>imT"
[PROOF STATE]
proof (state)
this:
w \<in> imT

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
from this finA Cfin AinC CinC
[PROOF STATE]
proof (chain)
picking this:
w \<in> imT
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V
[PROOF STEP]
obtain v where v_inC: "v\<in>carrier V" and w_eq_T_v: "w= T v"
[PROOF STATE]
proof (prove)
using this:
w \<in> imT
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> carrier V; w = T v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (unfold im_def image_def, auto)
[PROOF STATE]
proof (state)
this:
v \<in> carrier V
w = T v

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
from finA Cfin AinC CinC v_inC ACgen
[PROOF STATE]
proof (chain)
picking this:
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V
v \<in> carrier V
V.module.gen_set (A \<union> C)
[PROOF STEP]
have "\<exists>a.  a \<in> A\<union>C \<rightarrow> carrier K\<and> V.module.lincomb a (A\<union>C) = v"
[PROOF STATE]
proof (prove)
using this:
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V
v \<in> carrier V
V.module.gen_set (A \<union> C)

goal (1 subgoal):
 1. \<exists>a. a \<in> A \<union> C \<rightarrow> carrier K \<and> V.module.lincomb a (A \<union> C) = v
[PROOF STEP]
by (intro V.module.finite_in_span, auto)
[PROOF STATE]
proof (state)
this:
\<exists>a. a \<in> A \<union> C \<rightarrow> carrier K \<and> V.module.lincomb a (A \<union> C) = v

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. a \<in> A \<union> C \<rightarrow> carrier K \<and> V.module.lincomb a (A \<union> C) = v
[PROOF STEP]
obtain a where
          a_fun: "a \<in> A\<union>C \<rightarrow> carrier K" and
          lc_a_v: "v= V.module.lincomb a (A\<union>C)"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. a \<in> A \<union> C \<rightarrow> carrier K \<and> V.module.lincomb a (A \<union> C) = v

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A \<union> C \<rightarrow> carrier K; v = V.module.lincomb a (A \<union> C)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A \<union> C \<rightarrow> carrier K
v = V.module.lincomb a (A \<union> C)

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
let ?a'="\<lambda>v. a (?f v)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
from finA Cfin AinC CinC a_fun disj Ainker f C'_card
[PROOF STATE]
proof (chain)
picking this:
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V
a \<in> A \<union> C \<rightarrow> carrier K
A \<inter> C = {}
A \<subseteq> carrier (V.vs kerT)
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
inj_on T C
card C = card (T ` C)
[PROOF STEP]
have Tv: "T v = W.module.lincomb ?a' ?C'"
[PROOF STATE]
proof (prove)
using this:
finite A
finite C
A \<subseteq> carrier V
C \<subseteq> carrier V
a \<in> A \<union> C \<rightarrow> carrier K
A \<inter> C = {}
A \<subseteq> carrier (V.vs kerT)
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
inj_on T C
card C = card (T ` C)

goal (1 subgoal):
 1. T v = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)
[PROOF STEP]
apply (subst lc_a_v)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; a \<in> A \<union> C \<rightarrow> carrier K; A \<inter> C = {}; A \<subseteq> carrier (V.vs kerT); \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C)\<rbrakk> \<Longrightarrow> T (V.module.lincomb a (A \<union> C)) = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)
[PROOF STEP]
apply (subst V.module.lincomb_union, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; a \<in> A \<rightarrow> carrier K \<and> a \<in> C \<rightarrow> carrier K; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C)\<rbrakk> \<Longrightarrow> T (V.module.lincomb a A) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb a C) = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)
[PROOF STEP]
(*Break up the union A\<union>C*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; a \<in> A \<rightarrow> carrier K \<and> a \<in> C \<rightarrow> carrier K; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C)\<rbrakk> \<Longrightarrow> T (V.module.lincomb a A) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb a C) = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)
[PROOF STEP]
apply (unfold lincomb_def V.module.lincomb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; a \<in> A \<rightarrow> carrier K \<and> a \<in> C \<rightarrow> carrier K; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C)\<rbrakk> \<Longrightarrow> T (\<Oplus>\<^bsub>V\<^esub>v\<in>A. a v \<odot>\<^bsub>V\<^esub> v) \<oplus>\<^bsub>W\<^esub> T (\<Oplus>\<^bsub>V\<^esub>v\<in>C. a v \<odot>\<^bsub>V\<^esub> v) = (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. a (the_inv_into C T v) \<odot>\<^bsub>W\<^esub> v)
[PROOF STEP]
apply (subst hom_sum, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C); a \<in> A \<rightarrow> carrier K; a \<in> C \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>aa\<in>A. T (a aa \<odot>\<^bsub>V\<^esub> aa)) \<oplus>\<^bsub>W\<^esub> T (\<Oplus>\<^bsub>V\<^esub>v\<in>C. a v \<odot>\<^bsub>V\<^esub> v) = (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. a (the_inv_into C T v) \<odot>\<^bsub>W\<^esub> v)
[PROOF STEP]
(*Take T inside the sum over A*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C); a \<in> A \<rightarrow> carrier K; a \<in> C \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>aa\<in>A. T (a aa \<odot>\<^bsub>V\<^esub> aa)) \<oplus>\<^bsub>W\<^esub> T (\<Oplus>\<^bsub>V\<^esub>v\<in>C. a v \<odot>\<^bsub>V\<^esub> v) = (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. a (the_inv_into C T v) \<odot>\<^bsub>W\<^esub> v)
[PROOF STEP]
apply (simp add: subsetD coeff_in_ring
            hom_sum (*Take T inside the sum over C*)
            T_ker (*all terms become 0 because the vectors are in the kernel.*)
            )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C); a \<in> A \<rightarrow> carrier K; a \<in> C \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>v\<in>C. T (a v \<odot>\<^bsub>V\<^esub> v)) = (\<Oplus>\<^bsub>W\<^esub>v\<in>T ` C. a (the_inv_into C T v) \<odot>\<^bsub>W\<^esub> v)
[PROOF STEP]
apply (subst finsum_reindex[where ?h="T" and ?f="\<lambda>v. ?a' v\<odot>\<^bsub>W\<^esub> v"], auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C); a \<in> A \<rightarrow> carrier K; a \<in> C \<rightarrow> carrier K; xa \<in> C\<rbrakk> \<Longrightarrow> a xa \<odot>\<^bsub>W\<^esub> T xa \<in> carrier W
 2. \<lbrakk>finite A; finite C; A \<subseteq> carrier V; C \<subseteq> carrier V; A \<inter> C = {}; A \<subseteq> kerT; \<And>x. x \<in> C \<Longrightarrow> the_inv_into C T (T x) = x; \<And>y. y \<in> T ` C \<Longrightarrow> T (the_inv_into C T y) = y; inj_on T C; card C = card (T ` C); a \<in> A \<rightarrow> carrier K; a \<in> C \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>W\<^esub>v\<in>C. T (a v \<odot>\<^bsub>V\<^esub> v)) = (\<Oplus>\<^bsub>W\<^esub>x\<in>C. a (the_inv_into C T (T x)) \<odot>\<^bsub>W\<^esub> T x)
[PROOF STEP]
by (auto cong: finsum_cong simp add: coeff_in_ring ring_subset_carrier)
[PROOF STATE]
proof (state)
this:
T v = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
from a_fun f
[PROOF STATE]
proof (chain)
picking this:
a \<in> A \<union> C \<rightarrow> carrier K
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1
[PROOF STEP]
have a'_fun: "?a'\<in>?C' \<rightarrow> carrier K"
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<union> C \<rightarrow> carrier K
?x1 \<in> C \<Longrightarrow> the_inv_into C T (T ?x1) = ?x1
?y1 \<in> T ` C \<Longrightarrow> T (the_inv_into C T ?y1) = ?y1

goal (1 subgoal):
 1. (\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K

goal (1 subgoal):
 1. \<And>x. x \<in> imT \<Longrightarrow> x \<in> W.module.span (T ` C)
[PROOF STEP]
from C'fin CinC this w_eq_T_v a'_fun Tv
[PROOF STATE]
proof (chain)
picking this:
finite (T ` C)
C \<subseteq> carrier V
(\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K
w = T v
(\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K
T v = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)
[PROOF STEP]
show "w \<in> LinearCombinations.module.span K W (T ` C)"
[PROOF STATE]
proof (prove)
using this:
finite (T ` C)
C \<subseteq> carrier V
(\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K
w = T v
(\<lambda>v. a (the_inv_into C T v)) \<in> T ` C \<rightarrow> carrier K
T v = W.module.lincomb (\<lambda>v. a (the_inv_into C T v)) (T ` C)

goal (1 subgoal):
 1. w \<in> W.module.span (T ` C)
[PROOF STEP]
by (subst finite_span, auto)
[PROOF STATE]
proof (state)
this:
w \<in> W.module.span (T ` C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
imT \<subseteq> W.module.span (T ` C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
W.module.span (T ` C) = imT

goal (1 subgoal):
 1. im.gen_set (T ` C)
[PROOF STEP]
from this subs_im CinC
[PROOF STATE]
proof (chain)
picking this:
W.module.span (T ` C) = imT
subspace K imT W
C \<subseteq> carrier V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
W.module.span (T ` C) = imT
subspace K imT W
C \<subseteq> carrier V

goal (1 subgoal):
 1. im.gen_set (T ` C)
[PROOF STEP]
apply (subst span_li_not_depend(1))
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>W.module.span (T ` C) = imT; subspace K imT W; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> T ` C \<subseteq> imT
 2. \<lbrakk>W.module.span (T ` C) = imT; subspace K imT W; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> LinearCombinations.submodule K imT W
 3. \<lbrakk>W.module.span (T ` C) = imT; subspace K imT W; C \<subseteq> carrier V\<rbrakk> \<Longrightarrow> W.module.span (T ` C) = carrier (W.vs imT)
[PROOF STEP]
by (unfold im_def subspace_def, auto)
[PROOF STATE]
proof (state)
this:
im.gen_set (T ` C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
im.gen_set (T ` C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from C'_li C'_gen C cim
[PROOF STATE]
proof (chain)
picking this:
im.lin_indpt (T ` C)
im.gen_set (T ` C)
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
T ` C \<subseteq> imT
[PROOF STEP]
have C'_basis: "im.basis  (T`C)"
[PROOF STATE]
proof (prove)
using this:
im.lin_indpt (T ` C)
im.gen_set (T ` C)
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> V.module.span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> V.module.span (A \<union> C) = V.module.span B
T ` C \<subseteq> imT

goal (1 subgoal):
 1. im.basis (T ` C)
[PROOF STEP]
by (unfold im.basis_def, auto)
[PROOF STATE]
proof (state)
this:
im.basis (T ` C)

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
have C_card_im: "card C = (vectorspace.dim K (W.vs imT))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card C = im.dim
[PROOF STEP]
using C'_basis C'_card(2) C'fin im.dim_basis
[PROOF STATE]
proof (prove)
using this:
im.basis (T ` C)
card C = card (T ` C)
finite (T ` C)
\<lbrakk>finite ?A; im.basis ?A\<rbrakk> \<Longrightarrow> im.dim = card ?A

goal (1 subgoal):
 1. card C = im.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card C = im.dim

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from finA Abasis
[PROOF STATE]
proof (chain)
picking this:
finite A
ker.basis A
[PROOF STEP]
have  "ker.dim = card A"
[PROOF STATE]
proof (prove)
using this:
finite A
ker.basis A

goal (1 subgoal):
 1. ker.dim = card A
[PROOF STEP]
by (rule ker.dim_basis)
[PROOF STATE]
proof (state)
this:
ker.dim = card A

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
note * = this C_card_im cardEq
[PROOF STATE]
proof (state)
this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim

goal (2 subgoals):
 1. im.dim + ker.dim = V.dim
 2. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
show "(vectorspace.dim K (W.vs imT)) + (vectorspace.dim K (V.vs kerT)) = V.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. im.dim + ker.dim = V.dim
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim

goal (1 subgoal):
 1. im.dim + ker.dim = V.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
im.dim + ker.dim = V.dim

goal (1 subgoal):
 1. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
assume "T` (carrier V) = carrier W"
[PROOF STATE]
proof (state)
this:
T ` carrier V = carrier W

goal (1 subgoal):
 1. T ` carrier V = carrier W \<Longrightarrow> W.fin_dim
[PROOF STEP]
from * surj_imp_imT_carrier[OF this]
[PROOF STATE]
proof (chain)
picking this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
imT = carrier W
[PROOF STEP]
show "W.fin_dim"
[PROOF STATE]
proof (prove)
using this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
imT = carrier W

goal (1 subgoal):
 1. W.fin_dim
[PROOF STEP]
using C'_basis C'fin
[PROOF STATE]
proof (prove)
using this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
imT = carrier W
im.basis (T ` C)
finite (T ` C)

goal (1 subgoal):
 1. W.fin_dim
[PROOF STEP]
unfolding W.fin_dim_def im.basis_def
[PROOF STATE]
proof (prove)
using this:
ker.dim = card A
card C = im.dim
card (A \<union> C) = card A + card C
card (A \<union> C) = card B
card (A \<union> C) = V.dim
imT = carrier W
im.lin_indpt (T ` C) \<and> im.gen_set (T ` C) \<and> T ` C \<subseteq> carrier (W.vs imT)
finite (T ` C)

goal (1 subgoal):
 1. \<exists>A. finite A \<and> A \<subseteq> carrier W \<and> W.module.gen_set A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W.fin_dim

goal:
No subgoals!
[PROOF STEP]
qed