src/HOL/Vector_Spaces.thy
changeset 68412 07f8c09e3f79
parent 68397 cace81744c61
child 68620 707437105595
child 68626 330c0ec897a4
equal deleted inserted replaced
68411:d8363de26567 68412:07f8c09e3f79
   522   from this[of B C] this[of C B] B C eq \<open>infinite C\<close> \<open>infinite B\<close>
   522   from this[of B C] this[of C B] B C eq \<open>infinite C\<close> \<open>infinite B\<close>
   523   show ?thesis by (auto simp add: ordIso_iff_ordLeq card_of_ordIso)
   523   show ?thesis by (auto simp add: ordIso_iff_ordLeq card_of_ordIso)
   524 qed
   524 qed
   525 
   525 
   526 definition dim :: "'b set \<Rightarrow> nat"
   526 definition dim :: "'b set \<Rightarrow> nat"
   527   where "dim V = card (SOME b. independent b \<and> span b = span V)"
   527   where "dim V = (if \<exists>b. independent b \<and> span b = span V then
       
   528     card (SOME b. independent b \<and> span b = span V) else 0)"
   528 
   529 
   529 lemma dim_eq_card:
   530 lemma dim_eq_card:
   530   assumes BV: "span B = span V" and B: "independent B"
   531   assumes BV: "span B = span V" and B: "independent B"
   531   shows "dim V = card B"
   532   shows "dim V = card B"
   532 proof -
   533 proof -
   536   then have "\<exists>f. bij_betw f B (SOME B. p B)"
   537   then have "\<exists>f. bij_betw f B (SOME B. p B)"
   537     by (subst (asm) p_def, intro bij_if_span_eq_span_bases[OF B]) (simp_all add: BV)
   538     by (subst (asm) p_def, intro bij_if_span_eq_span_bases[OF B]) (simp_all add: BV)
   538   then have "card B = card (SOME B. p B)"
   539   then have "card B = card (SOME B. p B)"
   539     by (auto intro: bij_betw_same_card)
   540     by (auto intro: bij_betw_same_card)
   540   then show ?thesis
   541   then show ?thesis
   541     by (simp add: dim_def p_def)
   542     using BV B
       
   543     by (auto simp add: dim_def p_def)
   542 qed
   544 qed
   543 
   545 
   544 lemma basis_card_eq_dim: "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = dim V"
   546 lemma basis_card_eq_dim: "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = dim V"
   545   using dim_eq_card[of B V] span_mono[of B V] span_minimal[OF _ subspace_span, of V B] by auto
   547   using dim_eq_card[of B V] span_mono[of B V] span_minimal[OF _ subspace_span, of V B] by auto
   546 
   548 
   550 
   552 
   551 lemma dim_eq_card_independent: "independent B \<Longrightarrow> dim B = card B"
   553 lemma dim_eq_card_independent: "independent B \<Longrightarrow> dim B = card B"
   552   by (rule dim_eq_card[OF refl])
   554   by (rule dim_eq_card[OF refl])
   553 
   555 
   554 lemma dim_span[simp]: "dim (span S) = dim S"
   556 lemma dim_span[simp]: "dim (span S) = dim S"
   555   by (simp add: dim_def span_span)
   557   by (auto simp add: dim_def span_span)
   556 
   558 
   557 lemma dim_span_eq_card_independent: "independent B \<Longrightarrow> dim (span B) = card B"
   559 lemma dim_span_eq_card_independent: "independent B \<Longrightarrow> dim (span B) = card B"
   558   by (simp add: dim_eq_card)
   560   by (simp add: dim_eq_card)
   559 
   561 
   560 lemma dim_le_card: assumes "V \<subseteq> span W" "finite W" shows "dim V \<le> card W"
   562 lemma dim_le_card: assumes "V \<subseteq> span W" "finite W" shows "dim V \<le> card W"