270 and independent_extend_basis: "independent (extend_basis B)" |
270 and independent_extend_basis: "independent (extend_basis B)" |
271 and span_extend_basis[simp]: "span (extend_basis B) = UNIV" |
271 and span_extend_basis[simp]: "span (extend_basis B) = UNIV" |
272 proof - |
272 proof - |
273 define p where "p B' \<equiv> B \<subseteq> B' \<and> independent B' \<and> span B' = UNIV" for B' |
273 define p where "p B' \<equiv> B \<subseteq> B' \<and> independent B' \<and> span B' = UNIV" for B' |
274 obtain B' where "p B'" |
274 obtain B' where "p B'" |
275 using maximal_independent_subset_extend[OF subset_UNIV B] by (auto simp: p_def) |
275 using maximal_independent_subset_extend[OF subset_UNIV B] |
|
276 by (metis top.extremum_uniqueI p_def) |
276 then have "p (extend_basis B)" |
277 then have "p (extend_basis B)" |
277 unfolding extend_basis_def p_def[symmetric] by (rule someI) |
278 unfolding extend_basis_def p_def[symmetric] by (rule someI) |
278 then show "B \<subseteq> extend_basis B" "independent (extend_basis B)" "span (extend_basis B) = UNIV" |
279 then show "B \<subseteq> extend_basis B" "independent (extend_basis B)" "span (extend_basis B) = UNIV" |
279 by (auto simp: p_def) |
280 by (auto simp: p_def) |
280 qed |
281 qed |
401 then obtain a where a: "a \<in> S" "a \<notin> span (T - {b})" |
402 then obtain a where a: "a \<in> S" "a \<notin> span (T - {b})" |
402 by blast |
403 by blast |
403 have ab: "a \<noteq> b" |
404 have ab: "a \<noteq> b" |
404 using a b by blast |
405 using a b by blast |
405 have at: "a \<notin> T" |
406 have at: "a \<notin> T" |
406 using a ab span_superset[of a "T- {b}"] by auto |
407 using a ab span_base[of a "T- {b}"] by auto |
407 have mlt: "card ((insert a (T - {b})) - S) < card (T - S)" |
408 have mlt: "card ((insert a (T - {b})) - S) < card (T - S)" |
408 using cardlt ft a b by auto |
409 using cardlt ft a b by auto |
409 have ft': "finite (insert a (T - {b}))" |
410 have ft': "finite (insert a (T - {b}))" |
410 using ft by auto |
411 using ft by auto |
411 have sp': "S \<subseteq> span (insert a (T - {b}))" |
412 have sp': "S \<subseteq> span (insert a (T - {b}))" |
552 |
553 |
553 lemma dim_span[simp]: "dim (span S) = dim S" |
554 lemma dim_span[simp]: "dim (span S) = dim S" |
554 by (simp add: dim_def span_span) |
555 by (simp add: dim_def span_span) |
555 |
556 |
556 lemma dim_span_eq_card_independent: "independent B \<Longrightarrow> dim (span B) = card B" |
557 lemma dim_span_eq_card_independent: "independent B \<Longrightarrow> dim (span B) = card B" |
557 by (simp add: dim_span dim_eq_card) |
558 by (simp add: dim_eq_card) |
558 |
559 |
559 lemma dim_le_card: assumes "V \<subseteq> span W" "finite W" shows "dim V \<le> card W" |
560 lemma dim_le_card: assumes "V \<subseteq> span W" "finite W" shows "dim V \<le> card W" |
560 proof - |
561 proof - |
561 obtain A where "independent A" "A \<subseteq> V" "V \<subseteq> span A" |
562 obtain A where "independent A" "A \<subseteq> V" "V \<subseteq> span A" |
562 using maximal_independent_subset[of V] by auto |
563 using maximal_independent_subset[of V] by force |
563 with assms independent_span_bound[of W A] basis_card_eq_dim[of A V] |
564 with assms independent_span_bound[of W A] basis_card_eq_dim[of A V] |
564 show ?thesis by auto |
565 show ?thesis by auto |
565 qed |
566 qed |
566 |
567 |
567 lemma span_eq_dim: "span S = span T \<Longrightarrow> dim S = dim T" |
568 lemma span_eq_dim: "span S = span T \<Longrightarrow> dim S = dim T" |
654 proof (induction B arbitrary: x rule: finite_induct) |
655 proof (induction B arbitrary: x rule: finite_induct) |
655 case empty |
656 case empty |
656 then show ?case by auto |
657 then show ?case by auto |
657 next |
658 next |
658 case (insert a b x) |
659 case (insert a b x) |
659 have fb: "finite b" using "2.prems" by simp |
|
660 have th0: "f ` b \<subseteq> f ` (insert a b)" |
660 have th0: "f ` b \<subseteq> f ` (insert a b)" |
661 by (simp add: subset_insertI) |
661 by (simp add: subset_insertI) |
662 have ifb: "vs2.independent (f ` b)" |
662 have ifb: "vs2.independent (f ` b)" |
663 using independent_mono insert.prems(1) th0 by blast |
663 using vs2.independent_mono insert.prems(1) th0 by blast |
664 have fib: "inj_on f b" |
664 have fib: "inj_on f b" |
665 using insert.prems(2) by blast |
665 using insert.prems(2) by blast |
666 from vs1.span_breakdown[of a "insert a b", simplified, OF insert.prems(3)] |
666 from vs1.span_breakdown[of a "insert a b", simplified, OF insert.prems(3)] |
667 obtain k where k: "x - k *a a \<in> vs1.span (b - {a})" |
667 obtain k where k: "x - k *a a \<in> vs1.span (b - {a})" |
668 by blast |
668 by blast |
681 by blast |
681 by blast |
682 next |
682 next |
683 case False |
683 case False |
684 from inj_on_image_set_diff[OF insert.prems(2), of "insert a b " "{a}", symmetric] |
684 from inj_on_image_set_diff[OF insert.prems(2), of "insert a b " "{a}", symmetric] |
685 have "f ` insert a b - f ` {a} = f ` (insert a b - {a})" by blast |
685 have "f ` insert a b - f ` {a} = f ` (insert a b - {a})" by blast |
686 then have "f a \<notin> span (f ` b)" |
686 then have "f a \<notin> vs2.span (f ` b)" |
687 using dependent_def insert.hyps(2) insert.prems(1) by fastforce |
687 using vs2.dependent_def insert.hyps(2) insert.prems(1) by fastforce |
688 moreover have "f a \<in> span (f ` b)" |
688 moreover have "f a \<in> vs2.span (f ` b)" |
689 using False span_mul[OF th, of "- 1/ k"] by auto |
689 using False vs2.span_scale[OF th, of "- 1/ k"] by auto |
690 ultimately have False |
690 ultimately have False |
691 by blast |
691 by blast |
692 then show ?thesis by blast |
692 then show ?thesis by blast |
693 qed |
693 qed |
694 show "x = 0" |
694 show "x = 0" |
849 assumes V: "vs1.subspace V" and f: "inj_on f V" |
849 assumes V: "vs1.subspace V" and f: "inj_on f V" |
850 shows "\<exists>g\<in>UNIV \<rightarrow> V. linear s2 s1 g \<and> (\<forall>v\<in>V. g (f v) = v)" |
850 shows "\<exists>g\<in>UNIV \<rightarrow> V. linear s2 s1 g \<and> (\<forall>v\<in>V. g (f v) = v)" |
851 proof - |
851 proof - |
852 interpret linear s1 s2 f by fact |
852 interpret linear s1 s2 f by fact |
853 obtain B where V_eq: "V = vs1.span B" and B: "vs1.independent B" |
853 obtain B where V_eq: "V = vs1.span B" and B: "vs1.independent B" |
854 using vs1.maximal_independent_subset[of V] vs1.span_minimal[OF _ \<open>vs1.subspace V\<close>] by auto |
854 using vs1.maximal_independent_subset[of V] vs1.span_minimal[OF _ \<open>vs1.subspace V\<close>] |
|
855 by (metis antisym_conv) |
855 have f: "inj_on f (vs1.span B)" |
856 have f: "inj_on f (vs1.span B)" |
856 using f unfolding V_eq . |
857 using f unfolding V_eq . |
857 show ?thesis |
858 show ?thesis |
858 proof (intro bexI ballI conjI) |
859 proof (intro bexI ballI conjI) |
859 interpret p: vector_space_pair s2 s1 by unfold_locales |
860 interpret p: vector_space_pair s2 s1 by unfold_locales |
890 assumes lf: "linear s1 s2 f" |
891 assumes lf: "linear s1 s2 f" |
891 assumes "vs1.subspace V" |
892 assumes "vs1.subspace V" |
892 shows "\<exists>g\<in>UNIV \<rightarrow> V. linear s2 s1 g \<and> (\<forall>v\<in>f ` V. f (g v) = v)" |
893 shows "\<exists>g\<in>UNIV \<rightarrow> V. linear s2 s1 g \<and> (\<forall>v\<in>f ` V. f (g v) = v)" |
893 proof - |
894 proof - |
894 obtain B where V_eq: "V = vs1.span B" and B: "vs1.independent B" |
895 obtain B where V_eq: "V = vs1.span B" and B: "vs1.independent B" |
895 using vs1.maximal_independent_subset[of V] vs1.span_minimal[OF _ \<open>vs1.subspace V\<close>] by auto |
896 using vs1.maximal_independent_subset[of V] vs1.span_minimal[OF _ \<open>vs1.subspace V\<close>] |
|
897 by (metis antisym_conv) |
896 obtain C where C: "vs2.independent C" and fB_C: "f ` B \<subseteq> vs2.span C" "C \<subseteq> f ` B" |
898 obtain C where C: "vs2.independent C" and fB_C: "f ` B \<subseteq> vs2.span C" "C \<subseteq> f ` B" |
897 using vs2.maximal_independent_subset[of "f ` B"] by auto |
899 using vs2.maximal_independent_subset[of "f ` B"] by metis |
898 then have "\<forall>v\<in>C. \<exists>b\<in>B. v = f b" by auto |
900 then have "\<forall>v\<in>C. \<exists>b\<in>B. v = f b" by auto |
899 then obtain g where g: "\<And>v. v \<in> C \<Longrightarrow> g v \<in> B" "\<And>v. v \<in> C \<Longrightarrow> f (g v) = v" by metis |
901 then obtain g where g: "\<And>v. v \<in> C \<Longrightarrow> g v \<in> B" "\<And>v. v \<in> C \<Longrightarrow> f (g v) = v" by metis |
900 show ?thesis |
902 show ?thesis |
901 proof (intro bexI ballI conjI) |
903 proof (intro bexI ballI conjI) |
902 interpret p: vector_space_pair s2 s1 by unfold_locales |
904 interpret p: vector_space_pair s2 s1 by unfold_locales |
915 apply fact |
917 apply fact |
916 subgoal by fact |
918 subgoal by fact |
917 done |
919 done |
918 show "linear ( *b) ( *b) id" by (rule vs2.linear_id) |
920 show "linear ( *b) ( *b) id" by (rule vs2.linear_id) |
919 have "vs2.span (f ` B) = vs2.span C" |
921 have "vs2.span (f ` B) = vs2.span C" |
920 using fB_C vs2.span_mono[of C "f ` B"] vs2.span_minimal[of "f`B" "vs2.span C"] by (auto simp: vs2.subspace_span) |
922 using fB_C vs2.span_mono[of C "f ` B"] vs2.span_minimal[of "f`B" "vs2.span C"] |
|
923 by auto |
921 then show "v \<in> vs2.span C" |
924 then show "v \<in> vs2.span C" |
922 using v linear_span_image[OF lf, of B] by (simp add: V_eq) |
925 using v linear_span_image[OF lf, of B] by (simp add: V_eq) |
923 show "(f \<circ> p.construct C g) b = id b" if b: "b \<in> C" for b |
926 show "(f \<circ> p.construct C g) b = id b" if b: "b \<in> C" for b |
924 by (auto simp: p.construct_basis g C b) |
927 by (auto simp: p.construct_basis g C b) |
925 qed |
928 qed |
933 shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs1.span S. g (f x) = x)" |
936 shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs1.span S. g (f x) = x)" |
934 using linear_exists_left_inverse_on[OF lf vs1.subspace_span fi] |
937 using linear_exists_left_inverse_on[OF lf vs1.subspace_span fi] |
935 by (auto simp: linear_iff_module_hom) |
938 by (auto simp: linear_iff_module_hom) |
936 |
939 |
937 lemma linear_injective_left_inverse: "linear s1 s2 f \<Longrightarrow> inj f \<Longrightarrow> \<exists>g. linear s2 s1 g \<and> g \<circ> f = id" |
940 lemma linear_injective_left_inverse: "linear s1 s2 f \<Longrightarrow> inj f \<Longrightarrow> \<exists>g. linear s2 s1 g \<and> g \<circ> f = id" |
938 using linear_inj_on_left_inverse[of f UNIV] by (auto simp: fun_eq_iff) |
941 using linear_inj_on_left_inverse[of f UNIV] |
|
942 by force |
939 |
943 |
940 lemma linear_surj_right_inverse: |
944 lemma linear_surj_right_inverse: |
941 assumes lf: "linear s1 s2 f" |
945 assumes lf: "linear s1 s2 f" |
942 assumes sf: "vs2.span T \<subseteq> f`vs1.span S" |
946 assumes sf: "vs2.span T \<subseteq> f`vs1.span S" |
943 shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)" |
947 shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)" |
944 using linear_exists_right_inverse_on[OF lf vs1.subspace_span, of S] sf |
948 using linear_exists_right_inverse_on[OF lf vs1.subspace_span, of S] sf |
945 by (auto simp: linear_iff_module_hom) |
949 by (auto simp: linear_iff_module_hom) |
946 |
950 |
947 lemma linear_surjective_right_inverse: "linear s1 s2 f \<Longrightarrow> surj f \<Longrightarrow> \<exists>g. linear s2 s1 g \<and> f \<circ> g = id" |
951 lemma linear_surjective_right_inverse: "linear s1 s2 f \<Longrightarrow> surj f \<Longrightarrow> \<exists>g. linear s2 s1 g \<and> f \<circ> g = id" |
948 using linear_surj_right_inverse[of f UNIV UNIV] |
952 using linear_surj_right_inverse[of f UNIV UNIV] |
949 by (auto simp: vs1.span_UNIV vs2.span_UNIV fun_eq_iff) |
953 by (auto simp: fun_eq_iff) |
950 |
954 |
951 end |
955 end |
952 |
956 |
953 lemma surjective_iff_injective_gen: |
957 lemma surjective_iff_injective_gen: |
954 assumes fS: "finite S" |
958 assumes fS: "finite S" |
1023 have 1: "insert x B \<subseteq> span (insert x S)" |
1027 have 1: "insert x B \<subseteq> span (insert x S)" |
1024 by (meson B(1) insertI1 insert_subset order_trans span_base span_mono subset_insertI) |
1028 by (meson B(1) insertI1 insert_subset order_trans span_base span_mono subset_insertI) |
1025 have 2: "span (insert x S) \<subseteq> span (insert x B)" |
1029 have 2: "span (insert x S) \<subseteq> span (insert x B)" |
1026 by (metis \<open>B \<subseteq> span S\<close> \<open>span S \<subseteq> span B\<close> span_breakdown_eq span_subspace subsetI subspace_span) |
1030 by (metis \<open>B \<subseteq> span S\<close> \<open>span S \<subseteq> span B\<close> span_breakdown_eq span_subspace subsetI subspace_span) |
1027 have 3: "independent (insert x B)" |
1031 have 3: "independent (insert x B)" |
1028 by (metis B independent_insert span_subspace subspace_span False) |
1032 by (metis B(1-3) independent_insert span_subspace subspace_span False) |
1029 have "dim (span (insert x S)) = Suc (dim S)" |
1033 have "dim (span (insert x S)) = Suc (dim S)" |
1030 apply (rule dim_unique [OF 1 2 3]) |
1034 apply (rule dim_unique [OF 1 2 3]) |
1031 by (metis B False card_insert_disjoint dim_span finiteI_independent span_base span_eq span_span) |
1035 by (metis B False card_insert_disjoint dim_span finiteI_independent span_base span_eq span_span) |
1032 then show ?thesis |
1036 then show ?thesis |
1033 by (metis False Suc_eq_plus1 dim_span) |
1037 by (metis False Suc_eq_plus1 dim_span) |
1053 then show ?case |
1057 then show ?case |
1054 proof (cases "span S \<subseteq> span T") |
1058 proof (cases "span S \<subseteq> span T") |
1055 case True |
1059 case True |
1056 have "dim S = dim T" |
1060 have "dim S = dim T" |
1057 apply (rule span_eq_dim [OF subset_antisym [OF True]]) |
1061 apply (rule span_eq_dim [OF subset_antisym [OF True]]) |
1058 by (simp add: \<open>T \<subseteq> span S\<close> span_minimal subspace_span) |
1062 by (simp add: \<open>T \<subseteq> span S\<close> span_minimal) |
1059 then show ?thesis |
1063 then show ?thesis |
1060 using Suc.prems \<open>dim T = n\<close> by linarith |
1064 using Suc.prems \<open>dim T = n\<close> by linarith |
1061 next |
1065 next |
1062 case False |
1066 case False |
1063 then obtain y where y: "y \<in> S" "y \<notin> T" |
1067 then obtain y where y: "y \<in> S" "y \<notin> T" |
1064 by (meson span_mono subsetI) |
1068 by (meson span_mono subsetI) |
1065 then have "span (insert y T) \<subseteq> span S" |
1069 then have "span (insert y T) \<subseteq> span S" |
1066 by (metis (no_types) \<open>T \<subseteq> span S\<close> subsetD insert_subset span_superset span_mono span_span) |
1070 by (metis (no_types) \<open>T \<subseteq> span S\<close> subsetD insert_subset span_superset span_mono span_span) |
1067 with \<open>dim T = n\<close> \<open>subspace T\<close> y show ?thesis |
1071 with \<open>dim T = n\<close> \<open>subspace T\<close> y show ?thesis |
1068 apply (rule_tac x="span(insert y T)" in exI) |
1072 apply (rule_tac x="span(insert y T)" in exI) |
1069 apply (auto simp: dim_insert dim_span subspace_span) |
1073 apply (auto simp: dim_insert) |
1070 using span_eq_iff by blast |
1074 using span_eq_iff by blast |
1071 qed |
1075 qed |
1072 qed |
1076 qed |
1073 with that show ?thesis by blast |
1077 with that show ?thesis by blast |
1074 qed |
1078 qed |
1075 |
1079 |
1076 lemma basis_subspace_exists: |
1080 lemma basis_subspace_exists: |
1077 assumes "subspace S" |
1081 assumes "subspace S" |
1078 obtains B where "finite B" "B \<subseteq> S" "independent B" "span B = S" "card B = dim S" |
1082 obtains B where "finite B" "B \<subseteq> S" "independent B" "span B = S" "card B = dim S" |
1079 by (metis assms span_subspace basis_exists independent_imp_finite) |
1083 by (metis assms span_subspace basis_exists finiteI_independent) |
1080 |
1084 |
1081 lemma dim_mono: assumes "V \<subseteq> span W" shows "dim V \<le> dim W" |
1085 lemma dim_mono: assumes "V \<subseteq> span W" shows "dim V \<le> dim W" |
1082 proof - |
1086 proof - |
1083 obtain B where "independent B" "B \<subseteq> W" "W \<subseteq> span B" |
1087 obtain B where "independent B" "B \<subseteq> W" "W \<subseteq> span B" |
1084 using maximal_independent_subset[of W] by auto |
1088 using maximal_independent_subset[of W] by force |
1085 with dim_le_card[of V B] assms independent_span_bound[of Basis B] basis_card_eq_dim[of B W] |
1089 with dim_le_card[of V B] assms independent_span_bound[of Basis B] basis_card_eq_dim[of B W] |
1086 span_mono[of B W] span_minimal[OF _ subspace_span, of W B] |
1090 span_mono[of B W] span_minimal[OF _ subspace_span, of W B] |
1087 show ?thesis |
1091 show ?thesis |
1088 by (auto simp: finite_Basis span_Basis) |
1092 by (auto simp: finite_Basis span_Basis) |
1089 qed |
1093 qed |
1091 lemma dim_subset: "S \<subseteq> T \<Longrightarrow> dim S \<le> dim T" |
1095 lemma dim_subset: "S \<subseteq> T \<Longrightarrow> dim S \<le> dim T" |
1092 using dim_mono[of S T] by (auto intro: span_base) |
1096 using dim_mono[of S T] by (auto intro: span_base) |
1093 |
1097 |
1094 lemma dim_eq_0 [simp]: |
1098 lemma dim_eq_0 [simp]: |
1095 "dim S = 0 \<longleftrightarrow> S \<subseteq> {0}" |
1099 "dim S = 0 \<longleftrightarrow> S \<subseteq> {0}" |
1096 using basis_exists finiteI_independent |
1100 by (metis basis_exists card_eq_0_iff dim_span finiteI_independent span_empty subset_empty subset_singletonD) |
1097 apply safe |
|
1098 subgoal by fastforce |
|
1099 by (metis dim_singleton dim_subset le_0_eq) |
|
1100 |
1101 |
1101 lemma dim_UNIV[simp]: "dim UNIV = card Basis" |
1102 lemma dim_UNIV[simp]: "dim UNIV = card Basis" |
1102 using dim_eq_card[of Basis UNIV] by (simp add: independent_Basis span_Basis span_UNIV) |
1103 using dim_eq_card[of Basis UNIV] by (simp add: independent_Basis span_Basis) |
1103 |
1104 |
1104 lemma independent_card_le_dim: assumes "B \<subseteq> V" and "independent B" shows "card B \<le> dim V" |
1105 lemma independent_card_le_dim: assumes "B \<subseteq> V" and "independent B" shows "card B \<le> dim V" |
1105 by (subst dim_eq_card[symmetric, OF refl \<open>independent B\<close>]) (rule dim_subset[OF \<open>B \<subseteq> V\<close>]) |
1106 by (subst dim_eq_card[symmetric, OF refl \<open>independent B\<close>]) (rule dim_subset[OF \<open>B \<subseteq> V\<close>]) |
1106 |
1107 |
1107 lemma dim_subset_UNIV: "dim S \<le> dimension" |
1108 lemma dim_subset_UNIV: "dim S \<le> dimension" |
1189 using assms \<open>span B = S\<close> by auto |
1190 using assms \<open>span B = S\<close> by auto |
1190 qed |
1191 qed |
1191 |
1192 |
1192 corollary dim_eq_span: |
1193 corollary dim_eq_span: |
1193 shows "\<lbrakk>S \<subseteq> T; dim T \<le> dim S\<rbrakk> \<Longrightarrow> span S = span T" |
1194 shows "\<lbrakk>S \<subseteq> T; dim T \<le> dim S\<rbrakk> \<Longrightarrow> span S = span T" |
1194 by (simp add: dim_span span_mono subspace_dim_equal subspace_span) |
1195 by (simp add: span_mono subspace_dim_equal) |
1195 |
1196 |
1196 lemma dim_psubset: |
1197 lemma dim_psubset: |
1197 "span S \<subset> span T \<Longrightarrow> dim S < dim T" |
1198 "span S \<subset> span T \<Longrightarrow> dim S < dim T" |
1198 by (metis (no_types, hide_lams) dim_span less_le not_le subspace_dim_equal subspace_span) |
1199 by (metis (no_types, hide_lams) dim_span less_le not_le subspace_dim_equal subspace_span) |
1199 |
1200 |
1378 shows "inj f" |
1379 shows "inj f" |
1379 proof - |
1380 proof - |
1380 interpret linear s1 s2 f by fact |
1381 interpret linear s1 s2 f by fact |
1381 have *: "card (f ` B1) \<le> vs2.dim UNIV" |
1382 have *: "card (f ` B1) \<le> vs2.dim UNIV" |
1382 using vs1.finite_Basis vs1.dim_eq_card[of B1 UNIV] sf |
1383 using vs1.finite_Basis vs1.dim_eq_card[of B1 UNIV] sf |
1383 by (auto simp: vs1.span_Basis vs1.span_UNIV vs1.independent_Basis eq |
1384 by (auto simp: vs1.span_Basis vs1.independent_Basis eq |
1384 simp del: vs2.dim_UNIV |
1385 simp del: vs2.dim_UNIV |
1385 intro!: card_image_le) |
1386 intro!: card_image_le) |
1386 have indep_fB: "vs2.independent (f ` B1)" |
1387 have indep_fB: "vs2.independent (f ` B1)" |
1387 using vs1.finite_Basis vs1.dim_eq_card[of B1 UNIV] sf * |
1388 using vs1.finite_Basis vs1.dim_eq_card[of B1 UNIV] sf * |
1388 by (intro vs2.card_le_dim_spanning[of "f ` B1" UNIV]) (auto simp: span_image vs1.span_Basis ) |
1389 by (intro vs2.card_le_dim_spanning[of "f ` B1" UNIV]) (auto simp: span_image vs1.span_Basis ) |
1573 fix x |
1574 fix x |
1574 assume x: "x \<in> span B" and fx: "f x = 0" |
1575 assume x: "x \<in> span B" and fx: "f x = 0" |
1575 from B(2) have fB: "finite B" |
1576 from B(2) have fB: "finite B" |
1576 using finiteI_independent by auto |
1577 using finiteI_independent by auto |
1577 have Uspan: "UNIV \<subseteq> span (f ` B)" |
1578 have Uspan: "UNIV \<subseteq> span (f ` B)" |
1578 by (simp add: B(3) lf sf spanning_surjective_image) |
1579 by (simp add: B(3) lf linear_spanning_surjective_image sf) |
1579 have fBi: "independent (f ` B)" |
1580 have fBi: "independent (f ` B)" |
1580 proof (rule card_le_dim_spanning) |
1581 proof (rule card_le_dim_spanning) |
1581 show "card (f ` B) \<le> dim ?U" |
1582 show "card (f ` B) \<le> dim ?U" |
1582 using card_image_le d fB by fastforce |
1583 using card_image_le d fB by fastforce |
1583 qed (use fB Uspan in auto) |
1584 qed (use fB Uspan in auto) |
1591 by (simp add: eq_card_imp_inj_on fB th1) |
1592 by (simp add: eq_card_imp_inj_on fB th1) |
1592 from linear_indep_image_lemma[OF lf fB fBi fiB x] fx |
1593 from linear_indep_image_lemma[OF lf fB fBi fiB x] fx |
1593 have "x = 0" by blast |
1594 have "x = 0" by blast |
1594 } |
1595 } |
1595 then show ?thesis |
1596 then show ?thesis |
1596 unfolding linear_injective_0[OF lf] using B(3) by blast |
1597 unfolding linear_inj_iff_eq_0[OF lf] using B(3) by blast |
1597 qed |
1598 qed |
1598 |
1599 |
1599 lemma linear_inverse_left: |
1600 lemma linear_inverse_left: |
1600 assumes lf: "linear scale scale f" |
1601 assumes lf: "linear scale scale f" |
1601 and lf': "linear scale scale f'" |
1602 and lf': "linear scale scale f'" |
1627 from linear_injective_isomorphism[OF lf fi] |
1628 from linear_injective_isomorphism[OF lf fi] |
1628 obtain h :: "'b \<Rightarrow> 'b" where "linear scale scale h" and h: "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x" |
1629 obtain h :: "'b \<Rightarrow> 'b" where "linear scale scale h" and h: "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x" |
1629 by blast |
1630 by blast |
1630 have "h = g" |
1631 have "h = g" |
1631 by (metis gf h isomorphism_expand left_right_inverse_eq) |
1632 by (metis gf h isomorphism_expand left_right_inverse_eq) |
1632 with \<open>linear h\<close> show ?thesis by blast |
1633 with \<open>linear scale scale h\<close> show ?thesis by blast |
1633 qed |
1634 qed |
1634 |
1635 |
1635 lemma inj_linear_imp_inv_linear: |
1636 lemma inj_linear_imp_inv_linear: |
1636 assumes "linear scale scale f" "inj f" shows "linear scale scale (inv f)" |
1637 assumes "linear scale scale f" "inj f" shows "linear scale scale (inv f)" |
1637 using assms inj_iff left_inverse_linear by blast |
1638 using assms inj_iff left_inverse_linear by blast |
1666 and d: "vs1.dim S = vs2.dim T" |
1667 and d: "vs1.dim S = vs2.dim T" |
1667 shows "\<exists>f. linear s1 s2 f \<and> f ` S = T \<and> inj_on f S" |
1668 shows "\<exists>f. linear s1 s2 f \<and> f ` S = T \<and> inj_on f S" |
1668 proof - |
1669 proof - |
1669 from vs1.basis_exists[of S] vs1.finiteI_independent |
1670 from vs1.basis_exists[of S] vs1.finiteI_independent |
1670 obtain B where B: "B \<subseteq> S" "vs1.independent B" "S \<subseteq> vs1.span B" "card B = vs1.dim S" and fB: "finite B" |
1671 obtain B where B: "B \<subseteq> S" "vs1.independent B" "S \<subseteq> vs1.span B" "card B = vs1.dim S" and fB: "finite B" |
1671 by blast |
1672 by metis |
1672 from vs2.basis_exists[of T] vs2.finiteI_independent |
1673 from vs2.basis_exists[of T] vs2.finiteI_independent |
1673 obtain C where C: "C \<subseteq> T" "vs2.independent C" "T \<subseteq> vs2.span C" "card C = vs2.dim T" and fC: "finite C" |
1674 obtain C where C: "C \<subseteq> T" "vs2.independent C" "T \<subseteq> vs2.span C" "card C = vs2.dim T" and fC: "finite C" |
1674 by blast |
1675 by metis |
1675 from B(4) C(4) card_le_inj[of B C] d |
1676 from B(4) C(4) card_le_inj[of B C] d |
1676 obtain f where f: "f ` B \<subseteq> C" "inj_on f B" using \<open>finite B\<close> \<open>finite C\<close> |
1677 obtain f where f: "f ` B \<subseteq> C" "inj_on f B" using \<open>finite B\<close> \<open>finite C\<close> |
1677 by auto |
1678 by auto |
1678 from linear_independent_extend[OF B(2)] |
1679 from linear_independent_extend[OF B(2)] |
1679 obtain g where g: "linear s1 s2 g" "\<forall>x\<in> B. g x = f x" |
1680 obtain g where g: "linear s1 s2 g" "\<forall>x\<in> B. g x = f x" |