src/HOL/Analysis/Cartesian_Euclidean_Space.thy
changeset 68069 36209dfb981e
parent 68062 ee88c0fccbae
child 68073 fad29d2a17a5
equal deleted inserted replaced
68065:d2daeef3ce47 68069:36209dfb981e
  1098     then have ?rhs unfolding rhseq by blast }
  1098     then have ?rhs unfolding rhseq by blast }
  1099   moreover
  1099   moreover
  1100   { assume h:?rhs
  1100   { assume h:?rhs
  1101     let ?P = "\<lambda>(y::real ^'n). \<exists>(x::real^'m). sum (\<lambda>i. (x$i) *s column i A) ?U = y"
  1101     let ?P = "\<lambda>(y::real ^'n). \<exists>(x::real^'m). sum (\<lambda>i. (x$i) *s column i A) ?U = y"
  1102     { fix y
  1102     { fix y
  1103       have "?P y"
  1103       have "y \<in> span (columns A)"
  1104       proof (rule span_induct_alt[of ?P "columns A", folded scalar_mult_eq_scaleR])
  1104         using h by auto
  1105         show "\<exists>x::real ^ 'm. sum (\<lambda>i. (x$i) *s column i A) ?U = 0"
  1105       then have "?P y"
  1106           by (rule exI[where x=0], simp)
  1106       proof (induction rule: span_induct_alt)
       
  1107         case base
       
  1108         then show ?case
       
  1109           by (metis (full_types) matrix_mult_sum matrix_vector_mult_0_right)
  1107       next
  1110       next
  1108         fix c y1 y2
  1111         case (step c y1 y2)
  1109         assume y1: "y1 \<in> columns A" and y2: "?P y2"
  1112         then obtain i where i: "i \<in> ?U" "y1 = column i A"
  1110         from y1 obtain i where i: "i \<in> ?U" "y1 = column i A"
       
  1111           unfolding columns_def by blast
  1113           unfolding columns_def by blast
  1112         from y2 obtain x:: "real ^'m" where
  1114         obtain x:: "real ^'m" where x: "sum (\<lambda>i. (x$i) *s column i A) ?U = y2"
  1113           x: "sum (\<lambda>i. (x$i) *s column i A) ?U = y2" by blast
  1115           using step by blast
  1114         let ?x = "(\<chi> j. if j = i then c + (x$i) else (x$j))::real^'m"
  1116         let ?x = "(\<chi> j. if j = i then c + (x$i) else (x$j))::real^'m"
  1115         show "?P (c*s y1 + y2)"
  1117         show ?case
  1116         proof (rule exI[where x= "?x"], vector, auto simp add: i x[symmetric] if_distrib distrib_left cond_application_beta cong del: if_weak_cong)
  1118         proof (rule exI[where x= "?x"], vector, auto simp add: i x[symmetric] if_distrib distrib_left cond_application_beta cong del: if_weak_cong)
  1117           fix j
  1119           fix j
  1118           have th: "\<forall>xa \<in> ?U. (if xa = i then (c + (x$i)) * ((column xa A)$j)
  1120           have th: "\<forall>xa \<in> ?U. (if xa = i then (c + (x$i)) * ((column xa A)$j)
  1119               else (x$xa) * ((column xa A$j))) = (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))"
  1121               else (x$xa) * ((column xa A$j))) = (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))"
  1120             using i(1) by (simp add: field_simps)
  1122             using i(1) by (simp add: field_simps)
  1127             unfolding sum.delta[OF fU]
  1129             unfolding sum.delta[OF fU]
  1128             using i(1) by simp
  1130             using i(1) by simp
  1129           finally show "sum (\<lambda>xa. if xa = i then (c + (x$i)) * ((column xa A)$j)
  1131           finally show "sum (\<lambda>xa. if xa = i then (c + (x$i)) * ((column xa A)$j)
  1130             else (x$xa) * ((column xa A$j))) ?U = c * ((column i A)$j) + sum (\<lambda>xa. ((x$xa) * ((column xa A)$j))) ?U" .
  1132             else (x$xa) * ((column xa A$j))) ?U = c * ((column i A)$j) + sum (\<lambda>xa. ((x$xa) * ((column xa A)$j))) ?U" .
  1131         qed
  1133         qed
  1132       next
       
  1133         show "y \<in> span (columns A)"
       
  1134           unfolding h by blast
       
  1135       qed
  1134       qed
  1136     }
  1135     }
  1137     then have ?lhs unfolding lhseq ..
  1136     then have ?lhs unfolding lhseq ..
  1138   }
  1137   }
  1139   ultimately show ?thesis by blast
  1138   ultimately show ?thesis by blast
  1754 proof -
  1753 proof -
  1755   have "dim (span (rows A)) \<le> dim (span (columns A))"
  1754   have "dim (span (rows A)) \<le> dim (span (columns A))"
  1756   proof -
  1755   proof -
  1757     obtain B where "independent B" "span(rows A) \<subseteq> span B"
  1756     obtain B where "independent B" "span(rows A) \<subseteq> span B"
  1758               and B: "B \<subseteq> span(rows A)""card B = dim (span(rows A))"
  1757               and B: "B \<subseteq> span(rows A)""card B = dim (span(rows A))"
  1759       using basis_exists [of "span(rows A)"] by blast
  1758       using basis_exists [of "span(rows A)"] by metis
  1760     with span_subspace have eq: "span B = span(rows A)"
  1759     with span_subspace have eq: "span B = span(rows A)"
  1761       by auto
  1760       by auto
  1762     then have inj: "inj_on (( *v) A) (span B)"
  1761     then have inj: "inj_on (( *v) A) (span B)"
  1763       using inj_on_def matrix_vector_mul_injective_on_rowspace by blast
  1762       using inj_on_def matrix_vector_mul_injective_on_rowspace by blast
  1764     then have ind: "independent (( *v) A ` B)"
  1763     then have ind: "independent (( *v) A ` B)"