lemma isomorphism_expand: "f ∘ g = id ∧ g ∘ f = id ⟷ (∀x. f (g x) = x) ∧ (∀x. g (f x) = x)" by (simp add: fun_eq_iff o_def id_def)
lemma left_right_inverse_eq: assumes fg: "f ∘ g = id" and gh: "g ∘ h = id" shows"f = h" proof - have"f = f ∘ (g ∘ h)" unfolding gh by simp alsohave"… = (f ∘ g) ∘ h" by (simp add: o_assoc) finallyshow"f = h" unfolding fg by simp qed
lemma ordLeq3_finite_infinite: assumes A: "finite A"and B: "infinite B"shows"ordLeq3 (card_of A) (card_of B)" proof - have‹ordLeq3 (card_of A) (card_of B) ∨ ordLeq3 (card_of B) (card_of A)› by (intro ordLeq_total card_of_Well_order) moreoverhave"¬ ordLeq3 (card_of B) (card_of A)" using B A card_of_ordLeq_finite[of B A] by auto ultimatelyshow ?thesis by auto qed
locale vector_space = fixes scale :: "'a::field ==> 'b::ab_group_add ==> 'b" (infixr‹*s›75) assumes vector_space_assms:― ‹re-stating the assumptions of ‹module› instead of extending ‹module›
allows us to rewrite in the sublocale.› "a *s (x + y) = a *s x + a *s y" "(a + b) *s x = a *s x + b *s x" "a *s (b *s x) = (a * b) *s x" "1 *s x = x"
lemmas― ‹from ‹module››
linear_id = module_hom_id and linear_ident = module_hom_ident and linear_scale_self = module_hom_scale_self and linear_scale_left = module_hom_scale_left and linear_uminus = module_hom_uminus
lemma linear_representation: assumes"independent B""span B = UNIV" shows"linear scale (*) (λv. representation B v b)" proof (unfold_locales, goal_cases) case (5 x y) show ?case using assms by (subst representation_add) auto next case (6 r x) show ?case using assms by (subst representation_scale) auto qed (simp_all add: algebra_simps)
lemma linear_imp_scale: fixes D::"'a ==> 'b" assumes"linear (*) scale D" obtains d where"D = (λx. scale x d)" proof - interpret linear "(*)" scale D by fact show ?thesis by (metis mult.commute mult.left_neutral scale that) qed
lemma scale_eq_0_iff [simp]: "scale a x = 0⟷ a = 0∨ x = 0" by (metis scale_left_commute right_inverse scale_one scale_scale scale_zero_left)
lemma scale_left_imp_eq: assumes nonzero: "a ≠0" and scale: "scale a x = scale a y" shows "x = y" proof - from scale have "scale a (x - y) = 0" by (simp add: scale_right_diff_distrib) with nonzero have "x - y = 0" by simp then show "x = y" by (simp only: right_minus_eq) qed
lemma scale_right_imp_eq: assumes nonzero: "x ≠0" and scale: "scale a x = scale b x" shows "a = b" proof - from scale have "scale (a - b) x = 0" by (simp add: scale_left_diff_distrib) with nonzero have "a - b = 0" by simp then show "a = b" by (simp only: right_minus_eq) qed
lemma scale_cancel_left [simp]: "scale a x = scale a y ⟷ x = y ∨ a = 0" by (auto intro: scale_left_imp_eq)
lemma scale_cancel_right [simp]: "scale a x = scale b x ⟷ a = b ∨ x = 0" by (auto intro: scale_right_imp_eq)
lemma injective_scale: "c ≠0==> inj (λx. scale c x)" by (simp add: inj_on_def)
lemma dependent_def: "dependent P ⟷ (∃a ∈ P. a ∈ span (P - {a}))" unfolding dependent_explicit proof safe fix a assume aP: "a ∈ P" and "a ∈ span (P - {a})" then obtain a S u where aP: "a ∈ P" and fS: "finite S" and SP: "S ⊆ P" "a ∉ S" and ua: "(∑v∈S. u v *s v) = a" unfolding span_explicit by blast let ?S = "insert a S" let ?u = "λy. if y = a then - 1 else u y" from fS SP have "(∑v∈?S. ?u v *s v) = 0" by (simp add: if_distrib[of "λr. r *s a" for a] sum.If_cases field_simps Diff_eq[symmetric] ua) moreover have "finite ?S" "?S ⊆ P" "a ∈ ?S" "?u a ≠0" using fS SP aP by auto ultimately show "∃t u. finite t ∧ t ⊆ P ∧ (∑v∈t. u v *s v) = 0∧ (∃v∈t. u v ≠0)" by fast next fix S u v assume fS: "finite S" and SP: "S ⊆ P" and vS: "v ∈ S" and uv: "u v ≠0" and u: "(∑v∈S. u v *s v) = 0" let ?a = v let ?S = "S - {v}" let ?u = "λi. (- u i) / u v" have th0: "?a ∈ P" "finite ?S" "?S ⊆ P" using fS SP vS by auto have "(∑v∈?S. ?u v *s v) = (∑v∈S. (- (inverse (u ?a))) *s (u v *s v)) - ?u v *s v" using fS vS uv by (simp add: sum_diff1 field_simps) also have "… = ?a" unfolding scale_sum_right[symmetric] u using uv by simp finally have "(∑v∈?S. ?u v *s v) = ?a" . with th0 show "∃a ∈ P. a ∈ span (P - {a})" unfolding span_explicit by (auto intro!: bexI[where x="?a"] exI[where x="?S"] exI[where x="?u"]) qed
lemma dependent_single[simp]: "dependent {x} ⟷ x = 0" unfolding dependent_def by auto
lemma in_span_insert: assumes a: "a ∈ span (insert b S)" and na: "a ∉ span S" shows "b ∈ span (insert a S)" proof - from span_breakdown[of b "insert b S" a, OF insertI1 a] obtain k where k: "a - k *s b ∈ span (S - {b})" by auto have "k ≠0" proof assume "k = 0" with k span_mono[of "S - {b}" S] have "a ∈ span S" by auto with na show False by blast qed then have eq: "b = (1/k) *s a - (1/k) *s (a - k *s b)" by (simp add: algebra_simps)
from k have "(1/k) *s (a - k *s b) ∈ span (S - {b})" by (rule span_scale) also have "... ⊆ span (insert a S)" by (rule span_mono) auto finally show ?thesis using k by (subst eq) (blast intro: span_diff span_scale span_base) qed
lemma dependent_insertD: assumes a: "a ∉ span S" and S: "dependent (insert a S)" shows "dependent S" proof - have "a ∉ S" using a by (auto dest: span_base) obtain b where b: "b = a ∨ b ∈ S" "b ∈ span (insert a S - {b})" using S unfolding dependent_def by blast have "b ≠ a" "b ∈ S" using b ‹a ∉ S› a by auto with b have *: "b ∈ span (insert a (S - {b}))" by (auto simp: insert_Diff_if) show "dependent S" proof cases assume "b ∈ span (S - {b})" with ‹b ∈ S› show ?thesis by (auto simp add: dependent_def) next assume "b ∉ span (S - {b})" with * have "a ∈ span (insert b (S - {b}))" by (rule in_span_insert) with a show ?thesis using ‹b ∈ S› by (auto simp: insert_absorb) qed qed
lemma independent_insertI: "a ∉ span S ==> independent S ==> independent (insert a S)" by (auto dest: dependent_insertD)
lemma independent_insert: "independent (insert a S) ⟷ (if a ∈ S then independent S else independent S ∧ a ∉ span S)" proof - have "a ∉ S ==> a ∈ span S ==> dependent (insert a S)" by (auto simp: dependent_def) then show ?thesis by (auto intro: dependent_mono simp: independent_insertI) qed
lemma maximal_independent_subset_extend: assumes "S ⊆ V" "independent S" obtains B where "S ⊆ B" "B ⊆ V" "independent B" "V ⊆ span B" proof - let ?C = "{B. S ⊆ B ∧ independent B ∧ B ⊆ V}" have "∃M∈?C. ∀X∈?C. M ⊆ X ⟶ X = M" proof (rule subset_Zorn) fix C :: "'b set set" assume "subset.chain ?C C" then have C: "∧c. c ∈ C ==> c ⊆ V" "∧c. c ∈ C ==> S ⊆ c" "∧c. c ∈ C ==> independent c" "∧c d. c ∈ C ==> d ∈ C ==> c ⊆ d ∨ d ⊆ c" unfolding subset.chain_def by blast+
show "∃U∈?C. ∀X∈C. X ⊆ U" proof cases assume "C = {}" with assms show ?thesis by (auto intro!: exI[of _ S]) next assume "C ≠ {}" with C(2) have "S ⊆∪C" by auto moreover have "independent (∪C)" by (intro independent_Union_directed C) moreover have "∪C ⊆ V" using C by auto ultimately show ?thesis by auto qed qed then obtain B where B: "independent B" "B ⊆ V" "S ⊆ B" and max: "∧S. independent S ==> S ⊆ V ==> B ⊆ S ==> S = B" by auto moreover { assume "¬ V ⊆ span B" then obtain v where "v ∈ V" "v ∉ span B" by auto with B have "independent (insert v B)" by (auto intro: dependent_insertD) from max[OF this] ‹v ∈ V›‹B ⊆ V› have "v ∈ B" by auto with ‹v ∉ span B› have False by (auto intro: span_base) } ultimately show ?thesis by (meson that) qed
lemma maximal_independent_subset: obtains B where "B ⊆ V" "independent B" "V ⊆ span B" by (metis maximal_independent_subset_extend[of "{}"] empty_subsetI independent_empty)
text ‹Extends a basis from B to a basis of the entire space.› definition extend_basis :: "'b set ==> 'b set" where "extend_basis B = (SOME B'. B ⊆ B' ∧ independent B' ∧ span B' = UNIV)"
lemma assumes B: "independent B" shows extend_basis_superset: "B ⊆ extend_basis B" and independent_extend_basis: "independent (extend_basis B)" and span_extend_basis[simp]: "span (extend_basis B) = UNIV" proof - define p where "p B' ≡ B ⊆ B' ∧ independent B' ∧ span B' = UNIV" for B' obtain B' where "p B'" using maximal_independent_subset_extend[OF subset_UNIV B] by (metis top.extremum_uniqueI p_def) then have "p (extend_basis B)" unfolding extend_basis_def p_def[symmetric] by (rule someI) then show "B ⊆ extend_basis B" "independent (extend_basis B)" "span (extend_basis B) = UNIV" by (auto simp: p_def) qed
lemma in_span_delete: assumes a: "a ∈ span S" and na: "a ∉ span (S - {b})" shows "b ∈ span (insert a (S - {b}))" by (metis Diff_empty Diff_insert0 a in_span_insert insert_Diff na)
lemma span_redundant: "x ∈ span S ==> span (insert x S) = span S" unfolding span_def by (rule hull_redundant)
lemma span_trans: "x ∈ span S ==> y ∈ span (insert x S) ==> y ∈ span S" by (simp only: span_redundant)
lemma span_delete_0 [simp]: "span(S - {0}) = span S" proof show "span (S - {0}) ⊆ span S" by (blast intro!: span_mono) next have "span S ⊆ span(insert 0 (S - {0}))" by (blast intro!: span_mono) also have "... ⊆ span(S - {0})" using span_insert_0 by blast finally show "span S ⊆ span (S - {0})" . qed
lemma span_image_scale: assumes "finite S" and nz: "∧x. x ∈ S ==> c x ≠0" shows "span ((λx. c x *s x) ` S) = span S" using assms proof (induction S arbitrary: c) case (empty c) show ?case by simp next case (insert x F c) show ?case proof (intro set_eqI iffI) fix y assume "y ∈ span ((λx. c x *s x) ` insert x F)" then show "y ∈ span (insert x F)" using insert by (force simp: span_breakdown_eq) next fix y assume "y ∈ span (insert x F)" then show "y ∈ span ((λx. c x *s x) ` insert x F)" using insert apply (clarsimp simp: span_breakdown_eq) apply (rule_tac x="k / c x" in exI) by simp qed qed
lemma exchange_lemma: assumes f: "finite T" and i: "independent S" and sp: "S ⊆ span T" shows "∃t'. card t' = card T ∧ finite t' ∧ S ⊆ t' ∧ t' ⊆ S ∪ T ∧ S ⊆ span t'" using f i sp proof (induct "card (T - S)" arbitrary: S T rule: less_induct) case less note ft = ‹finite T› and S = ‹independent S› and sp = ‹S ⊆ span T› let ?P = "λt'. card t' = card T ∧ finite t' ∧ S ⊆ t' ∧ t' ⊆ S ∪ T ∧ S ⊆ span t'" show ?case proof (cases "S ⊆ T ∨ T ⊆ S") case True then show ?thesis proof assume "S ⊆ T" then show ?thesis by (metis ft Un_commute sp sup_ge1) next assume "T ⊆ S" then show ?thesis by (metis Un_absorb sp spanning_subset_independent[OF _ S sp] ft) qed next case False then have st: "¬ S ⊆ T" "¬ T ⊆ S" by auto from st(2) obtain b where b: "b ∈ T" "b ∉ S" by blast from b have "T - {b} - S ⊂ T - S" by blast then have cardlt: "card (T - {b} - S) < card (T - S)" using ft by (auto intro: psubset_card_mono) from b ft have ct0: "card T ≠0" by auto show ?thesis proof (cases "S ⊆ span (T - {b})") case True from ft have ftb: "finite (T - {b})" by auto from less(1)[OF cardlt ftb S True] obtain U where U: "card U = card (T - {b})" "S ⊆ U" "U ⊆ S ∪ (T - {b})" "S ⊆ span U" and fu: "finite U" by blast let ?w = "insert b U" have th0: "S ⊆ insert b U" using U by blast have th1: "insert b U ⊆ S ∪ T" using U b by blast have bu: "b ∉ U" using b U by blast from U(1) ft b have "card U = (card T - 1)" by auto then have th2: "card (insert b U) = card T" using card_insert_disjoint[OF fu bu] ct0 by auto from U(4) have "S ⊆ span U" . also have "…⊆ span (insert b U)" by (rule span_mono) blast finally have th3: "S ⊆ span (insert b U)" . from th0 th1 th2 th3 fu have th: "?P ?w" by blast from th show ?thesis by blast next case False then obtain a where a: "a ∈ S" "a ∉ span (T - {b})" by blast have ab: "a ≠ b" using a b by blast have at: "a ∉ T" using a ab span_base[of a "T- {b}"] by auto have mlt: "card ((insert a (T - {b})) - S) < card (T - S)" using cardlt ft a b by auto have ft': "finite (insert a (T - {b}))" using ft by auto have sp': "S ⊆ span (insert a (T - {b}))" proof fix x assume xs: "x ∈ S" have T: "T ⊆ insert b (insert a (T - {b}))" using b by auto have bs: "b ∈ span (insert a (T - {b}))" by (rule in_span_delete) (use a sp in auto) from xs sp have "x ∈ span T" by blast with span_mono[OF T] have x: "x ∈ span (insert b (insert a (T - {b})))" .. from span_trans[OF bs x] show "x ∈ span (insert a (T - {b}))" . qed from less(1)[OF mlt ft' S sp'] obtain U where U: "card U = card (insert a (T - {b}))" "finite U" "S ⊆ U" "U ⊆ S ∪ insert a (T - {b})" "S ⊆ span U" by blast from U a b ft at ct0 have "?P U" by auto then show ?thesis by blast qed qed qed
lemma independent_span_bound: assumes f: "finite T" and i: "independent S" and sp: "S ⊆ span T" shows "finite S ∧ card S ≤ card T" by (metis exchange_lemma[OF f i sp] finite_subset card_mono)
lemma independent_explicit_finite_subsets: "independent A ⟷ (∀S ⊆ A. finite S ⟶ (∀u. (∑v∈S. u v *s v) = 0⟶ (∀v∈S. u v = 0)))" unfolding dependent_explicit [of A] by (simp add: disj_not2)
lemma independent_if_scalars_zero: assumes fin_A: "finite A" and sum: "∧f x. (∑x∈A. f x *s x) = 0==> x ∈ A ==> f x = 0" shows "independent A" proof (unfold independent_explicit_finite_subsets, clarify) fix S v and u :: "'b ==> 'a" assume S: "S ⊆ A" and v: "v ∈ S" let ?g = "λx. if x ∈ S then u x else 0" have "(∑v∈A. ?g v *s v) = (∑v∈S. u v *s v)" using S fin_A by (auto intro!: sum.mono_neutral_cong_right) also assume "(∑v∈S. u v *s v) = 0" finally have "?g v = 0" using v S sum by force thus "u v = 0" unfolding if_P[OF v] . qed
lemma bij_if_span_eq_span_bases: assumes B: "independent B" and C: "independent C" and eq: "span B = span C" shows "∃f. bij_betw f B C" proof cases assume "finite B ∨ finite C" then have "finite B ∧ finite C ∧ card C = card B" using independent_span_bound[of B C] independent_span_bound[of C B] assms span_superset[of B] span_superset[of C] by auto then show ?thesis by (auto intro!: finite_same_card_bij) next assume "¬ (finite B ∨ finite C)" then have "infinite B" "infinite C" by auto { fix B C assume B: "independent B" and C: "independent C" and "infinite B" "infinite C" and eq: "span B = span C" let ?R = "representation B" and ?R' = "representation C" let ?U = "λc. {v. ?R c v ≠0}" have in_span_C [simp, intro]: ‹b ∈ B ==> b ∈ span C› for b unfolding eq[symmetric] by (rule span_base) have in_span_B [simp, intro]: ‹c ∈ C ==> c ∈ span B› for c unfolding eq by (rule span_base) have ‹B ⊆ (∪c∈C. ?U c)› proof fix b assume ‹b ∈ B› have ‹b ∈ span C› using ‹b ∈ B› unfolding eq[symmetric] by (rule span_base) have ‹(∑v | ?R' b v ≠ 0. ∑w | ?R v w ≠ 0. (?R' b v * ?R v w) *s w) = (∑v | ?R' b v ≠ 0. ?R' b v *s (∑w | ?R v w ≠ 0. ?R v w *s w))› by (simp add: scale_sum_right) also have ‹… = (∑v | ?R' b v ≠ 0. ?R' b v *s v)› by (auto simp: sum_nonzero_representation_eq B eq span_base representation_ne_zero) also have ‹… = b› by (rule sum_nonzero_representation_eq[OF C ‹b ∈ span C›]) finally have "?R b b = ?R (∑v | ?R' b v ≠0. ∑w | ?R v w ≠0. (?R' b v * ?R v w) *s w) b" by simp also have "... = (∑i∈{v. ?R' b v ≠0}. ?R (∑w | ?R i w ≠0. (?R' b i * ?R i w) *s w) b)" by (subst representation_sum[OF B]) (auto intro: span_sum span_scale span_base representation_ne_zero) also have "... = (∑i∈{v. ?R' b v ≠0}. ∑j ∈ {w. ?R i w ≠0}. ?R ((?R' b i * ?R i j ) *s j ) b)" by (subst representation_sum[OF B]) (auto simp add: span_sum span_scale span_base representation_ne_zero) also have ‹… = (∑v | ?R' b v ≠ 0. ∑w | ?R v w ≠ 0. ?R' b v * ?R v w * ?R w b)› using B ‹b ∈ B› by (simp add: representation_scale[OF B] span_base representation_ne_zero) finally have "(∑v | ?R' b v ≠0. ∑w | ?R v w ≠0. ?R' b v * ?R v w * ?R w b) ≠0" using representation_basis[OF B ‹b ∈ B›] by auto then obtain v w where bv: "?R' b v ≠0" and vw: "?R v w ≠0" and "?R' b v * ?R v w * ?R w b ≠0" by (blast elim: sum.not_neutral_contains_not_neutral) with representation_basis[OF B, of w] vw[THEN representation_ne_zero] have ‹?R' b v ≠ 0›‹?R v b ≠ 0› by (auto split: if_splits) then show ‹b ∈ (∪c∈C. ?U c)› by (auto dest: representation_ne_zero) qed then have B_eq: ‹B = (∪c∈C. ?U c)› by (auto intro: span_base representation_ne_zero eq) have "ordLeq3 (card_of B) (card_of C)" proof (subst B_eq, rule card_of_UNION_ordLeq_infinite[OF ‹infinite C›]) show "ordLeq3 (card_of C) (card_of C)" by (intro ordLeq_refl card_of_Card_order) show "∀c∈C. ordLeq3 (card_of {v. ?R c v ≠0}) (card_of C)" by (intro ballI ordLeq3_finite_infinite ‹infinite C› finite_representation) qed } from this[of B C] this[of C B] B C eq ‹infinite C›‹infinite B› show ?thesis by (auto simp add: ordIso_iff_ordLeq card_of_ordIso) qed
definition dim :: "'b set ==> nat" where "dim V = (if∃b. independent b ∧ span b = span V then
card (SOME b. independent b ∧ span b = span V) else 0)"
lemma dim_eq_card: assumes BV: "span B = span V" and B: "independent B" shows "dim V = card B" proof - define p where "p b ≡ independent b ∧ span b = span V" for b have "p (SOME B. p B)" using assms by (intro someI[of p B]) (auto simp: p_def) then have "∃f. bij_betw f B (SOME B. p B)" by (subst (asm) p_def, intro bij_if_span_eq_span_bases[OF B]) (simp_all add: BV) then have "card B = card (SOME B. p B)" by (auto intro: bij_betw_same_card) then show ?thesis using BV B by (auto simp add: dim_def p_def) qed
lemma basis_card_eq_dim: "B ⊆ V ==> V ⊆ span B ==> independent B ==> card B = dim V" using dim_eq_card[of B V] span_mono[of B V] span_minimal[OF _ subspace_span, of V B] by auto
lemma basis_exists: obtains B where "B ⊆ V" "independent B" "V ⊆ span B" "card B = dim V" by (meson basis_card_eq_dim empty_subsetI independent_empty maximal_independent_subset_extend)
lemma dim_eq_card_independent: "independent B ==> dim B = card B" by (rule dim_eq_card[OF refl])
lemma dim_span[simp]: "dim (span S) = dim S" by (auto simp add: dim_def span_span)
lemma dim_span_eq_card_independent: "independent B ==> dim (span B) = card B" by (simp add: dim_eq_card)
lemma dim_le_card: assumes "V ⊆ span W" "finite W" shows "dim V ≤ card W" proof - obtain A where "independent A" "A ⊆ V" "V ⊆ span A" using maximal_independent_subset[of V] by force with assms independent_span_bound[of W A] basis_card_eq_dim[of A V] show ?thesis by auto qed
lemma span_eq_dim: "span S = span T ==> dim S = dim T" by (metis dim_span)
corollary dim_le_card': "finite s ==> dim s ≤ card s" by (metis basis_exists card_mono)
lemma span_card_ge_dim: "B ⊆ V ==> V ⊆ span B ==> finite B ==> dim V ≤ card B" by (simp add: dim_le_card)
lemma dim_unique: "B ⊆ V ==> V ⊆ span B ==> independent B ==> card B = n ==> dim V = n" by (metis basis_card_eq_dim)
lemma subspace_sums: "[subspace S; subspace T]==> subspace {x + y|x y. x ∈ S ∧ y ∈ T}" apply (simp add: subspace_def) apply (intro conjI impI allI; clarsimp simp: algebra_simps) using add.left_neutral apply blast apply (metis add.assoc) using scale_right_distrib by blast
end
lemma linear_iff: "linear s1 s2 f ⟷
(vector_space s1 ∧ vector_space s2 ∧ (∀x y. f (x + y) = f x + f y) ∧ (∀c x. f (s1 c x) = s2 c (f x)))" unfolding linear_def module_hom_iff vector_space_def module_def by auto
context begin qualified lemma linear_compose: "linear s1 s2 f ==> linear s2 s3 g ==> linear s1 s3 (g o f)" unfolding module_hom_iff_linear[symmetric] by (rule module_hom_compose) end
context fixes f assumes "linear s1 s2 f" begin interpretation linear s1 s2 f by fact lemmas― ‹from locale ‹module_hom›› linear_0 = zero and linear_add = add and linear_scale = scale and linear_neg = neg and linear_diff = diff and linear_sum = sum and linear_inj_on_iff_eq_0 = inj_on_iff_eq_0 and linear_inj_iff_eq_0 = inj_iff_eq_0 and linear_subspace_image = subspace_image and linear_subspace_vimage = subspace_vimage and linear_subspace_kernel = subspace_kernel and linear_span_image = span_image and linear_dependent_inj_imageD = dependent_inj_imageD and linear_eq_0_on_span = eq_0_on_span and linear_independent_injective_image = independent_injective_image and linear_inj_on_span_independent_image = inj_on_span_independent_image and linear_inj_on_span_iff_independent_image = inj_on_span_iff_independent_image and linear_subspace_linear_preimage = subspace_linear_preimage and linear_spans_image = spans_image and linear_spanning_surjective_image = spanning_surjective_image end
sublocale module_pair rewrites "module_hom = linear" by unfold_locales (fact module_hom_eq_linear)
lemmas― ‹from locale ‹module_pair›› linear_eq_on_span = module_hom_eq_on_span and linear_compose_scale_right = module_hom_scale and linear_compose_add = module_hom_add and linear_zero = module_hom_zero and linear_compose_sub = module_hom_sub and linear_compose_neg = module_hom_neg and linear_compose_scale = module_hom_compose_scale
lemma linear_indep_image_lemma: assumes lf: "linear s1 s2 f" and fB: "finite B" and ifB: "vs2.independent (f ` B)" and fi: "inj_on f B" and xsB: "x ∈ vs1.span B" and fx: "f x = 0" shows "x = 0" using fB ifB fi xsB fx proof (induction B arbitrary: x rule: finite_induct) case empty then show ?case by auto next case (insert a b x) have th0: "f ` b ⊆ f ` (insert a b)" by (simp add: subset_insertI) have ifb: "vs2.independent (f ` b)" using vs2.independent_mono insert.prems(1) th0 by blast have fib: "inj_on f b" using insert.prems(2) by blast from vs1.span_breakdown[of a "insert a b", simplified, OF insert.prems(3)] obtain k where k: "x - k *a a ∈ vs1.span (b - {a})" by blast have "f (x - k *a a) ∈ vs2.span (f ` b)" unfolding linear_span_image[OF lf] using "insert.hyps"(2) k by auto then have "f x - k *b f a ∈ vs2.span (f ` b)" by (simp add: linear_diff linear_scale lf) then have th: "-k *b f a ∈ vs2.span (f ` b)" using insert.prems(4) by simp have xsb: "x ∈ vs1.span b" proof (cases "k = 0") case True with k have "x ∈ vs1.span (b - {a})" by simp then show ?thesis using vs1.span_mono[of "b - {a}" b] by blast next case False from inj_on_image_set_diff[OF insert.prems(2), of "insert a b " "{a}", symmetric] have "f ` insert a b - f ` {a} = f ` (insert a b - {a})" by blast then have "f a ∉ vs2.span (f ` b)" using vs2.dependent_def insert.hyps(2) insert.prems(1) by fastforce moreover have "f a ∈ vs2.span (f ` b)" using False vs2.span_scale[OF th, of "- 1/ k"] by auto ultimately have False by blast then show ?thesis by blast qed show "x = 0" using ifb fib xsb insert.IH insert.prems(4) by blast qed
lemma linear_eq_on: assumes l: "linear s1 s2 f" "linear s1 s2 g" assumes x: "x ∈ vs1.span B" and eq: "∧b. b ∈ B ==> f b = g b" shows "f x = g x" proof - interpret d: linear s1 s2 "λx. f x - g x" using l by (intro linear_compose_sub) (auto simp: module_hom_iff_linear) have "f x - g x = 0" by (rule d.eq_0_on_span[OF _ x]) (auto simp: eq) then show ?thesis by auto qed
definition construct :: "'b set ==> ('b ==> 'c) ==> ('b ==> 'c)" where "construct B g v = (∑b | vs1.representation (vs1.extend_basis B) v b ≠0.
vs1.representation (vs1.extend_basis B) v b *b (if b ∈ B then g b else 0))"
lemma construct_cong: "(∧b. b ∈ B ==> f b = g b) ==> construct B f = construct B g" unfolding construct_def by (auto intro!: sum.cong)
lemma linear_construct: assumes B[simp]: "vs1.independent B" shows "linear s1 s2 (construct B f)" unfolding module_hom_iff_linear linear_iff proof safe have eB[simp]: "vs1.independent (vs1.extend_basis B)" using vs1.independent_extend_basis[OF B] . let ?R = "vs1.representation (vs1.extend_basis B)" fix c x y have "construct B f (x + y) =
(∑b∈{b. ?R x b ≠0} ∪ {b. ?R y b ≠0}. ?R (x + y) b *b (if b ∈ B then f b else 0))" by (auto intro!: sum.mono_neutral_cong_left simp: vs1.finite_representation vs1.representation_add construct_def) also have "… = construct B f x + construct B f y" by (auto simp: construct_def vs1.representation_add vs2.scale_left_distrib sum.distrib intro!: arg_cong2[where f="(+)"] sum.mono_neutral_cong_right vs1.finite_representation) finally show "construct B f (x + y) = construct B f x + construct B f y" .
show "construct B f (c *a x) = c *b construct B f x" by (auto simp del: vs2.scale_scale intro!: sum.mono_neutral_cong_left vs1.finite_representation simp add: construct_def vs2.scale_scale[symmetric] vs1.representation_scale vs2.scale_sum_right) qed intro_locales
lemma construct_basis: assumes B[simp]: "vs1.independent B" and b: "b ∈ B" shows "construct B f b = f b" proof - have *: "vs1.representation (vs1.extend_basis B) b = (λv. if v = b then1 else 0)" using vs1.extend_basis_superset[OF B] b by (intro vs1.representation_basis vs1.independent_extend_basis) auto then have "{v. vs1.representation (vs1.extend_basis B) b v ≠0} = {b}" by auto then show ?thesis unfolding construct_def by (simp add: * b) qed
lemma construct_outside: assumes B: "vs1.independent B" and v: "v ∈ vs1.span (vs1.extend_basis B - B)" shows "construct B f v = 0" unfolding construct_def proof (clarsimp intro!: sum.neutral simp del: vs2.scale_eq_0_iff) fix b assume "b ∈ B" then have "vs1.representation (vs1.extend_basis B - B) v b = 0" using vs1.representation_ne_zero[of "vs1.extend_basis B - B" v b] by auto moreover have "vs1.representation (vs1.extend_basis B) v = vs1.representation (vs1.extend_basis B - B) v" using vs1.representation_extend[OF vs1.independent_extend_basis[OF B] v] by auto ultimately show "vs1.representation (vs1.extend_basis B) v b *b f b = 0" by simp qed
lemma construct_add: assumes B[simp]: "vs1.independent B" shows "construct B (λx. f x + g x) v = construct B f v + construct B g v" proof (rule linear_eq_on) show "v ∈ vs1.span (vs1.extend_basis B)" by simp show "b ∈ vs1.extend_basis B ==> construct B (λx. f x + g x) b = construct B f b + construct B g b" for b using construct_outside[OF B vs1.span_base, of b] by (cases "b ∈ B") (auto simp: construct_basis) qed (intro linear_compose_add linear_construct B)+
lemma construct_scale: assumes B[simp]: "vs1.independent B" shows "construct B (λx. c *b f x) v = c *b construct B f v" proof (rule linear_eq_on) show "v ∈ vs1.span (vs1.extend_basis B)" by simp show "b ∈ vs1.extend_basis B ==> construct B (λx. c *b f x) b = c *b construct B f b" for b using construct_outside[OF B vs1.span_base, of b] by (cases "b ∈ B") (auto simp: construct_basis) qed (intro linear_construct module_hom_scale B)+
lemma construct_in_span: assumes B[simp]: "vs1.independent B" shows "construct B f v ∈ vs2.span (f ` B)" proof - interpret c: linear s1 s2 "construct B f" by (rule linear_construct) fact let ?R = "vs1.representation B" have "v ∈ vs1.span ((vs1.extend_basis B - B) ∪ B)" by (auto simp: Un_absorb2 vs1.extend_basis_superset) then obtain x y where "v = x + y" "x ∈ vs1.span (vs1.extend_basis B - B)" "y ∈ vs1.span B" unfolding vs1.span_Un by auto moreover have "construct B f (∑b | ?R y b ≠0. ?R y b *a b) ∈ vs2.span (f ` B)" by (auto simp add: c.sum c.scale construct_basis vs1.representation_ne_zero intro!: vs2.span_sum vs2.span_scale intro: vs2.span_base ) ultimately show "construct B f v ∈ vs2.span (f ` B)" by (auto simp add: c.add construct_outside vs1.sum_nonzero_representation_eq) qed
lemma linear_compose_sum: assumes lS: "∀a ∈ S. linear s1 s2 (f a)" shows "linear s1 s2 (λx. sum (λa. f a x) S)" proof (cases "finite S") case True then show ?thesis using lS by induct (simp_all add: linear_zero linear_compose_add) next case False then show ?thesis by (simp add: linear_zero) qed
lemma in_span_in_range_construct: "x ∈ range (construct B f)" if i: "vs1.independent B" and x: "x ∈ vs2.span (f ` B)" proof - interpret linear "(*a)" "(*b)" "construct B f" usingiby(rulelinear_construct) obtainbb::"('b\<Rightarrow>'c)\<Rightarrow>('b\<Rightarrow>'c)\<Rightarrow>'bset\<Rightarrow>'b"where "\<forall>x0x1x2.(\<exists>v4.v4\<in>x2\<and>x1v4\<noteq>x0v4)=(bbx0x1x2\<in>x2\<and>x1(bbx0x1x2)\<noteq>x0(bbx0x1x2))" bymoura thenhavef2:"\<forall>BBaffa.(B\<noteq>Ba\<or>bbfafBa\<in>Ba\<and>f(bbfafBa)\<noteq>fa(bbfafBa))\<or>f`B=fa`Ba" by(mesonimage_cong) have"vs1.spanB\<subseteq>vs1.span(vs1.extend_basisB)" by(simpadd:vs1.extend_basis_superset[OFi]vs1.span_mono) thenshow"x\<in>range(constructBf)" usingf2xby(metis(no_types)construct_basis[OFi,of_f] vs1.span_extend_basis[OFi]subsetDspan_imagespans_image) qed
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.