src/HOL/Modules.thy
changeset 68073 fad29d2a17a5
parent 68072 493b818e8e10
child 68074 8d50467f7555
equal deleted inserted replaced
68072:493b818e8e10 68073:fad29d2a17a5
   162 next
   162 next
   163   show "\<exists>t r. (\<Sum>v\<in>S. u v *s v) = (\<Sum>a\<in>t. r a *s a) \<and> finite t \<and> t \<subseteq> S" for u
   163   show "\<exists>t r. (\<Sum>v\<in>S. u v *s v) = (\<Sum>a\<in>t. r a *s a) \<and> finite t \<and> t \<subseteq> S" for u
   164     by (intro exI[of _ u] exI[of _ S]) (auto intro: fS)
   164     by (intro exI[of _ u] exI[of _ S]) (auto intro: fS)
   165 qed
   165 qed
   166 
   166 
   167 lemma span_induct_alt[consumes 1]:
   167 lemma span_induct_alt [consumes 1, case_names base step, induct set: span]:
   168   assumes x: "x \<in> span S"
   168   assumes x: "x \<in> span S"
   169   assumes h0: "h 0" and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *s x + y)"
   169   assumes h0: "h 0" and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *s x + y)"
   170   shows "h x"
   170   shows "h x"
   171   using x unfolding span_explicit
   171   using x unfolding span_explicit
   172 proof safe
   172 proof safe
   208   fix t r assume *: "finite t" "t \<subseteq> S"
   208   fix t r assume *: "finite t" "t \<subseteq> S"
   209   show "\<exists>t' r'. c *s (\<Sum>a\<in>t. r a *s a) = (\<Sum>a\<in>t'. r' a *s a) \<and> finite t' \<and> t' \<subseteq> S"
   209   show "\<exists>t' r'. c *s (\<Sum>a\<in>t. r a *s a) = (\<Sum>a\<in>t'. r' a *s a) \<and> finite t' \<and> t' \<subseteq> S"
   210     by (intro exI[of _ t] exI[of _ "\<lambda>a. c * r a"]) (auto simp: * scale_sum_right)
   210     by (intro exI[of _ t] exI[of _ "\<lambda>a. c * r a"]) (auto simp: * scale_sum_right)
   211 qed
   211 qed
   212 
   212 
   213 lemma subspace_span: "subspace (span S)"
   213 lemma subspace_span [iff]: "subspace (span S)"
   214   by (auto simp: subspace_def span_zero span_add span_scale)
   214   by (auto simp: subspace_def span_zero span_add span_scale)
   215 
   215 
   216 lemma span_neg: "x \<in> span S \<Longrightarrow> - x \<in> span S"
   216 lemma span_neg: "x \<in> span S \<Longrightarrow> - x \<in> span S"
   217   by (metis subspace_neg subspace_span)
   217   by (metis subspace_neg subspace_span)
   218 
   218 
   243   from x hull_minimal[where S=subspace, OF SP' P, unfolded span_def[symmetric]]
   243   from x hull_minimal[where S=subspace, OF SP' P, unfolded span_def[symmetric]]
   244   show "x \<in> P"
   244   show "x \<in> P"
   245     by (metis subset_eq)
   245     by (metis subset_eq)
   246 qed
   246 qed
   247 
   247 
   248 lemma (in module) span_induct[consumes 1]:
   248 lemma (in module) span_induct[consumes 1, case_names base step, induct set: span]:
   249   assumes x: "x \<in> span S"
   249   assumes x: "x \<in> span S"
   250     and P: "subspace (Collect P)"
   250     and P: "subspace (Collect P)"
   251     and SP: "\<And>x. x \<in> S \<Longrightarrow> P x"
   251     and SP: "\<And>x. x \<in> S \<Longrightarrow> P x"
   252   shows "P x"
   252   shows "P x"
   253   using P SP span_subspace_induct x by fastforce
   253   using P SP span_subspace_induct x by fastforce
   254 
       
   255 lemma (in module) span_induct':
       
   256   "\<forall>x \<in> S. P x \<Longrightarrow> subspace {x. P x} \<Longrightarrow> \<forall>x \<in> span S. P x"
       
   257   unfolding span_def by (rule hull_induct) auto
       
   258 
   254 
   259 lemma span_empty[simp]: "span {} = {0}"
   255 lemma span_empty[simp]: "span {} = {0}"
   260   by (rule span_unique) (auto simp add: subspace_def)
   256   by (rule span_unique) (auto simp add: subspace_def)
   261 
   257 
   262 lemma span_subspace: "A \<subseteq> B \<Longrightarrow> B \<subseteq> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B"
   258 lemma span_subspace: "A \<subseteq> B \<Longrightarrow> B \<subseteq> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B"