3540 lemma exchange_lemma: |
3540 lemma exchange_lemma: |
3541 assumes f:"finite (t:: ('a::field^'n) set)" and i: "independent s" |
3541 assumes f:"finite (t:: ('a::field^'n) set)" and i: "independent s" |
3542 and sp:"s \<subseteq> span t" |
3542 and sp:"s \<subseteq> span t" |
3543 shows "\<exists>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
3543 shows "\<exists>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
3544 using f i sp |
3544 using f i sp |
3545 proof(induct c\<equiv>"card(t - s)" arbitrary: s t rule: nat_less_induct) |
3545 proof(induct "card (t - s)" arbitrary: s t rule: less_induct) |
3546 fix n:: nat and s t :: "('a ^'n) set" |
3546 case less |
3547 assume H: " \<forall>m<n. \<forall>(x:: ('a ^'n) set) xa. |
3547 note ft = `finite t` and s = `independent s` and sp = `s \<subseteq> span t` |
3548 finite xa \<longrightarrow> |
|
3549 independent x \<longrightarrow> |
|
3550 x \<subseteq> span xa \<longrightarrow> |
|
3551 m = card (xa - x) \<longrightarrow> |
|
3552 (\<exists>t'. (card t' = card xa) \<and> finite t' \<and> |
|
3553 x \<subseteq> t' \<and> t' \<subseteq> x \<union> xa \<and> x \<subseteq> span t')" |
|
3554 and ft: "finite t" and s: "independent s" and sp: "s \<subseteq> span t" |
|
3555 and n: "n = card (t - s)" |
|
3556 let ?P = "\<lambda>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
3548 let ?P = "\<lambda>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'" |
3557 let ?ths = "\<exists>t'. ?P t'" |
3549 let ?ths = "\<exists>t'. ?P t'" |
3558 {assume st: "s \<subseteq> t" |
3550 {assume st: "s \<subseteq> t" |
3559 from st ft span_mono[OF st] have ?ths apply - apply (rule exI[where x=t]) |
3551 from st ft span_mono[OF st] have ?ths apply - apply (rule exI[where x=t]) |
3560 by (auto intro: span_superset)} |
3552 by (auto intro: span_superset)} |
3566 by (auto intro: span_superset)} |
3558 by (auto intro: span_superset)} |
3567 moreover |
3559 moreover |
3568 {assume st: "\<not> s \<subseteq> t" "\<not> t \<subseteq> s" |
3560 {assume st: "\<not> s \<subseteq> t" "\<not> t \<subseteq> s" |
3569 from st(2) obtain b where b: "b \<in> t" "b \<notin> s" by blast |
3561 from st(2) obtain b where b: "b \<in> t" "b \<notin> s" by blast |
3570 from b have "t - {b} - s \<subset> t - s" by blast |
3562 from b have "t - {b} - s \<subset> t - s" by blast |
3571 then have cardlt: "card (t - {b} - s) < n" using n ft |
3563 then have cardlt: "card (t - {b} - s) < card (t - s)" using ft |
3572 by (auto intro: psubset_card_mono) |
3564 by (auto intro: psubset_card_mono) |
3573 from b ft have ct0: "card t \<noteq> 0" by auto |
3565 from b ft have ct0: "card t \<noteq> 0" by auto |
3574 {assume stb: "s \<subseteq> span(t -{b})" |
3566 {assume stb: "s \<subseteq> span(t -{b})" |
3575 from ft have ftb: "finite (t -{b})" by auto |
3567 from ft have ftb: "finite (t -{b})" by auto |
3576 from H[rule_format, OF cardlt ftb s stb] |
3568 from less(1)[OF cardlt ftb s stb] |
3577 obtain u where u: "card u = card (t-{b})" "s \<subseteq> u" "u \<subseteq> s \<union> (t - {b})" "s \<subseteq> span u" and fu: "finite u" by blast |
3569 obtain u where u: "card u = card (t-{b})" "s \<subseteq> u" "u \<subseteq> s \<union> (t - {b})" "s \<subseteq> span u" and fu: "finite u" by blast |
3578 let ?w = "insert b u" |
3570 let ?w = "insert b u" |
3579 have th0: "s \<subseteq> insert b u" using u by blast |
3571 have th0: "s \<subseteq> insert b u" using u by blast |
3580 from u(3) b have "u \<subseteq> s \<union> t" by blast |
3572 from u(3) b have "u \<subseteq> s \<union> t" by blast |
3581 then have th1: "insert b u \<subseteq> s \<union> t" using u b by blast |
3573 then have th1: "insert b u \<subseteq> s \<union> t" using u b by blast |
3592 moreover |
3584 moreover |
3593 {assume stb: "\<not> s \<subseteq> span(t -{b})" |
3585 {assume stb: "\<not> s \<subseteq> span(t -{b})" |
3594 from stb obtain a where a: "a \<in> s" "a \<notin> span (t - {b})" by blast |
3586 from stb obtain a where a: "a \<in> s" "a \<notin> span (t - {b})" by blast |
3595 have ab: "a \<noteq> b" using a b by blast |
3587 have ab: "a \<noteq> b" using a b by blast |
3596 have at: "a \<notin> t" using a ab span_superset[of a "t- {b}"] by auto |
3588 have at: "a \<notin> t" using a ab span_superset[of a "t- {b}"] by auto |
3597 have mlt: "card ((insert a (t - {b})) - s) < n" |
3589 have mlt: "card ((insert a (t - {b})) - s) < card (t - s)" |
3598 using cardlt ft n a b by auto |
3590 using cardlt ft a b by auto |
3599 have ft': "finite (insert a (t - {b}))" using ft by auto |
3591 have ft': "finite (insert a (t - {b}))" using ft by auto |
3600 {fix x assume xs: "x \<in> s" |
3592 {fix x assume xs: "x \<in> s" |
3601 have t: "t \<subseteq> (insert b (insert a (t -{b})))" using b by auto |
3593 have t: "t \<subseteq> (insert b (insert a (t -{b})))" using b by auto |
3602 from b(1) have "b \<in> span t" by (simp add: span_superset) |
3594 from b(1) have "b \<in> span t" by (simp add: span_superset) |
3603 have bs: "b \<in> span (insert a (t - {b}))" |
3595 have bs: "b \<in> span (insert a (t - {b}))" |
3606 with span_mono[OF t] |
3598 with span_mono[OF t] |
3607 have x: "x \<in> span (insert b (insert a (t - {b})))" .. |
3599 have x: "x \<in> span (insert b (insert a (t - {b})))" .. |
3608 from span_trans[OF bs x] have "x \<in> span (insert a (t - {b}))" .} |
3600 from span_trans[OF bs x] have "x \<in> span (insert a (t - {b}))" .} |
3609 then have sp': "s \<subseteq> span (insert a (t - {b}))" by blast |
3601 then have sp': "s \<subseteq> span (insert a (t - {b}))" by blast |
3610 |
3602 |
3611 from H[rule_format, OF mlt ft' s sp' refl] obtain u where |
3603 from less(1)[OF mlt ft' s sp'] obtain u where |
3612 u: "card u = card (insert a (t -{b}))" "finite u" "s \<subseteq> u" "u \<subseteq> s \<union> insert a (t -{b})" |
3604 u: "card u = card (insert a (t -{b}))" "finite u" "s \<subseteq> u" "u \<subseteq> s \<union> insert a (t -{b})" |
3613 "s \<subseteq> span u" by blast |
3605 "s \<subseteq> span u" by blast |
3614 from u a b ft at ct0 have "?P u" by auto |
3606 from u a b ft at ct0 have "?P u" by auto |
3615 then have ?ths by blast } |
3607 then have ?ths by blast } |
3616 ultimately have ?ths by blast |
3608 ultimately have ?ths by blast |
3655 |
3647 |
3656 lemma maximal_independent_subset_extend: |
3648 lemma maximal_independent_subset_extend: |
3657 assumes sv: "(S::(real^'n) set) \<subseteq> V" and iS: "independent S" |
3649 assumes sv: "(S::(real^'n) set) \<subseteq> V" and iS: "independent S" |
3658 shows "\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
3650 shows "\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
3659 using sv iS |
3651 using sv iS |
3660 proof(induct d\<equiv> "CARD('n) - card S" arbitrary: S rule: nat_less_induct) |
3652 proof(induct "CARD('n) - card S" arbitrary: S rule: less_induct) |
3661 fix n and S:: "(real^'n) set" |
3653 case less |
3662 assume H: "\<forall>m<n. \<forall>S \<subseteq> V. independent S \<longrightarrow> m = CARD('n) - card S \<longrightarrow> |
3654 note sv = `S \<subseteq> V` and i = `independent S` |
3663 (\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B)" |
|
3664 and sv: "S \<subseteq> V" and i: "independent S" and n: "n = CARD('n) - card S" |
|
3665 let ?P = "\<lambda>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
3655 let ?P = "\<lambda>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B" |
3666 let ?ths = "\<exists>x. ?P x" |
3656 let ?ths = "\<exists>x. ?P x" |
3667 let ?d = "CARD('n)" |
3657 let ?d = "CARD('n)" |
3668 {assume "V \<subseteq> span S" |
3658 {assume "V \<subseteq> span S" |
3669 then have ?ths using sv i by blast } |
3659 then have ?ths using sv i by blast } |
3672 from VS obtain a where a: "a \<in> V" "a \<notin> span S" by blast |
3662 from VS obtain a where a: "a \<in> V" "a \<notin> span S" by blast |
3673 from a have aS: "a \<notin> S" by (auto simp add: span_superset) |
3663 from a have aS: "a \<notin> S" by (auto simp add: span_superset) |
3674 have th0: "insert a S \<subseteq> V" using a sv by blast |
3664 have th0: "insert a S \<subseteq> V" using a sv by blast |
3675 from independent_insert[of a S] i a |
3665 from independent_insert[of a S] i a |
3676 have th1: "independent (insert a S)" by auto |
3666 have th1: "independent (insert a S)" by auto |
3677 have mlt: "?d - card (insert a S) < n" |
3667 have mlt: "?d - card (insert a S) < ?d - card S" |
3678 using aS a n independent_bound[OF th1] |
3668 using aS a independent_bound[OF th1] |
3679 by auto |
3669 by auto |
3680 |
3670 |
3681 from H[rule_format, OF mlt th0 th1 refl] |
3671 from less(1)[OF mlt th0 th1] |
3682 obtain B where B: "insert a S \<subseteq> B" "B \<subseteq> V" "independent B" " V \<subseteq> span B" |
3672 obtain B where B: "insert a S \<subseteq> B" "B \<subseteq> V" "independent B" " V \<subseteq> span B" |
3683 by blast |
3673 by blast |
3684 from B have "?P B" by auto |
3674 from B have "?P B" by auto |
3685 then have ?ths by blast} |
3675 then have ?ths by blast} |
3686 ultimately show ?ths by blast |
3676 ultimately show ?ths by blast |