(* File:Matroid.thy Author:JonasKeinholz
*) section‹Matroids› theory Matroid imports Indep_System begin
lemma card_subset_ex: assumes"finite A""n ≤ card A" shows"∃B ⊆ A. card B = n" using assms proof (induction A arbitrary: n rule: finite_induct) case (insert x A) show ?case proof (cases n) case0 thenshow ?thesis using card.empty by blast next case (Suc k) thenhave"∃B ⊆ A. card B = k"using insert by auto thenobtain B where"B ⊆ A""card B = k"by auto moreoverfrom this have"finite B"using insert.hyps finite_subset by auto ultimatelyhave"card (insert x B) = n" using Suc insert.hyps card_insert_disjoint by fastforce thenshow ?thesis using‹B ⊆ A›by blast qed qed auto
locale matroid = indep_system + assumes augment_aux: "indep X ==> indep Y ==> card X = Suc (card Y) ==>∃x ∈ X - Y. indep (insert x Y)" begin
lemma augment: assumes"indep X""indep Y""card Y < card X" shows"∃x ∈ X - Y. indep (insert x Y)" proof - obtain X' where"X' ⊆ X""card X' = Suc (card Y)" using assms card_subset_ex[of X "Suc (card Y)"] indep_finite by auto thenobtain x where"x ∈ X' - Y""indep (insert x Y)" using assms augment_aux[of X' Y] indep_subset by auto thenshow ?thesis using‹X' ⊆ X›by auto qed
lemma augment_psubset: assumes"indep X""indep Y""Y ⊂ X" shows"∃x ∈ X - Y. indep (insert x Y)" using assms augment psubset_card_mono indep_finite by blast
subsection‹Minors›
text‹
A subset of the ground set induces a matroid. ›
lemma matroid_subset [simp, intro]: assumes"E⊆ carrier" shows"matroid E (indep_in E)" unfolding matroid_def matroid_axioms_def proof (safe, goal_cases indep_system augment) case indep_system thenshow ?caseusing indep_system_subset[OF assms] . next case (augment X Y) thenshow ?caseusing augment_aux[of X Y] unfolding indep_in_def by auto qed
context fixesE assumes"E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using‹E⊆ carrier›by auto
lemma basis_card: assumes"basis B1" assumes"basis B2" shows"card B1 = card B2" proof (rule ccontr, goal_cases False) case False thenhave"card B1 < card B2∨ card B2 < card B1"by auto moreover { fix B1 B2 assume"basis B1""basis B2""card B1 < card B2" thenobtain x where"x ∈ B2 - B1""indep (insert x B1)" using augment basisD by blast thenhave"x ∈ carrier - B1" using‹basis B1› basisD indep_subset_carrier by blast thenhave"¬ indep (insert x B1)"using‹basis B1› basisD by auto thenhave"False"using‹indep (insert x B1)›by auto
} ultimatelyshow ?caseusing assms by auto qed
lemma basis_indep_card: assumes"indep X" assumes"basis B" shows"card X ≤ card B" proof - obtain B' where"basis B'""X ⊆ B'"using assms indep_imp_subset_basis by auto thenshow ?thesis using assms basis_finite basis_card[of B B'] by (auto intro: card_mono) qed
lemma basis_augment: assumes"basis B1""basis B2""x ∈ B1 - B2" shows"∃y ∈ B2 - B1. basis (insert y (B1 - {x}))" proof - let ?B1 = "B1 - {x}" have"card ?B1 < card B2" using assms basis_card[of B1 B2] card_Diff1_less[OF basis_finite, of B1] by auto moreoverhave"indep ?B1"using assms basis_indep[of B1] indep_subset[of B1 ?B1] by auto ultimatelyobtain y where y: "y ∈ B2 - ?B1""indep (insert y ?B1)" using assms augment[of B2 ?B1] basis_indep by auto let ?B1' = "insert y ?B1" have"basis ?B1'"using‹indep ?B1'› proof (rule basisI, goal_cases "insert") case (insert x) have"card (insert x ?B1') > card B1" proof - have"card (insert x ?B1') = Suc (card ?B1')" using insert card.insert_remove[OF indep_finite, of ?B1'] y by auto alsohave"… = Suc (Suc (card ?B1))" using card.insert_remove[OF indep_finite, of ?B1] ‹indep ?B1› y by auto alsohave"… = Suc (card B1)" using assms basis_finite[of B1] card.remove[of B1] by auto finallyshow ?thesis by auto qed thenhave"¬indep (insert x (insert y ?B1))" using assms basis_indep_card[of "insert x (insert y ?B1)" B1] by auto moreoverhave"insert x (insert y ?B1) ⊆ carrier" using assms insert y basis_finite indep_subset_carrier by auto ultimatelyshow ?caseby auto qed thenshow ?thesis using assms y by auto qed
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using‹E⊆ carrier›by auto
lemma basis_in_augment: assumes"basis_in E B1""basis_in E B2""x ∈ B1 - B2" shows"∃y ∈ B2 - B1. basis_in E (insert y (B1 - {x}))" using assms E.basis_augment unfolding basis_in_def by auto
have assms': "circuit_in carrier C1""circuit_in carrier C2" using assms circuit_imp_circuit_in by auto
have"?C ⊆ carrier"using assms circuit_subset_carrier by auto show ?thesis proof (cases "indep ?C") case False thenshow ?thesis using dep_iff_supset_circuit ‹?C ⊆ carrier›by auto next case True thenhave"indep_in ?carrier ?C"using‹?C ⊆ carrier›by (auto intro: indep_inI)
have *: "?carrier ⊆ carrier"using assms circuit_subset_carrier by auto obtain y where y: "y ∈ C2""y ∉ C1"using assms circuit_subset_eq by blast thenhave"indep_in ?carrier (C2 - {y})" using assms' circuit_in_min_dep_in[OF * circuit_in_supI[OF *, of C2]] by auto thenobtain B where B: "basis_in ?carrier B""C2 - {y} ⊆ B" using * assms indep_in_imp_subset_basis_in[of ?carrier "C2 - {y}"] by auto
have"y ∉ B" proof (rule ccontr, goal_cases False) case False thenhave"C2⊆ B"using B by auto moreoverhave"circuit_in ?carrier C2"using * assms' circuit_in_supI by auto ultimatelyhave"¬ indep_in ?carrier B" using B basis_in_subset_carrier[OF *] supset_circuit_in_imp_dep_in[OF *] by auto thenshow False using assms B basis_in_indep_in[OF *] by auto qed
have"C1 - B ≠ {}" proof (rule ccontr, goal_cases False) case False thenhave"C1 - (C1∩ B) = {}"by auto thenhave"C1 = C1∩ B"using assms circuit_subset_eq by auto moreoverhave"indep (C1∩ B)" using assms B basis_in_indep_in[OF *] indep_in_subset[OF *, of B "C1∩ B"] indep_in_indep by auto ultimatelyshow ?caseusing assms circuitD by auto qed thenobtain z where z: "z ∈ C1""z ∉ B"by auto
have"y ≠ z"using y z by auto have"x ∈ C1""x ∈ C2"using assms by auto
have"finite ?carrier"using assms carrier_finite finite_subset by auto have"card B ≤ card (?carrier - {y, z})" proof (rule card_mono) show"finite (C1∪ C2 - {y, z})"using‹finite ?carrier›by auto next show"B ⊆ C1∪ C2 - {y, z}" using B basis_in_subset_carrier[OF *, of B] ‹y ∉ B›‹z ∉ B›by auto qed alsohave"… = card ?carrier - 2" using‹finite ?carrier›‹y ∈ C2›‹z ∈ C1›‹y ≠ z› card_Diff_subset_Int by auto alsohave"… < card ?carrier - 1" proof - have"card ?carrier = card C1 + card C2 - card (C1∩ C2)" using assms ‹finite ?carrier› card_Un_Int[of C1 C2] by auto alsohave"… = card C1 + (card C2 - card (C1∩ C2))" using assms ‹finite ?carrier› card_mono[of C2] by auto alsohave"… = card C1 + card (C2 - C1)" proof - have"card (C2 - C1) = card C2 - card (C2∩ C1)" using assms ‹finite ?carrier› card_Diff_subset_Int[of C2 C1] by auto alsohave"… = card C2 - card (C1∩ C2)"by (simp add: inf_commute) finallyshow ?thesis by auto qed finallyhave"card (C1∪ C2) = card C1 + card (C2 - C1)" . moreoverhave"card C1 > 0"using assms circuit_nonempty ‹finite ?carrier›by auto moreoverhave"card (C2 - C1) > 0"using assms ‹finite ?carrier›‹y ∈ C2›‹y ∉ C1›byauto ultimatelyshow ?thesis by auto qed alsohave"… = card ?C" using‹finite ?carrier› card_Diff_singleton ‹x ∈ C1›‹x ∈ C2›by auto finallyhave"card B < card ?C" . thenhave False using basis_in_indep_in_card[OF *, of ?C B] B ‹indep_in ?carrier ?C›by auto thenshow ?thesis by auto qed qed
lemma min_dep_imp_supset_circuit: assumes"indep X" assumes"circuit C" assumes"C ⊆ insert x X" shows"x ∈ C" proof (rule ccontr) assume"x ∉ C" thenhave"C ⊆ X"using assms by auto thenhave"indep C"using assms indep_subset by auto thenshow False using assms circuitD by auto qed
lemma min_dep_imp_ex1_supset_circuit: assumes"x ∈ carrier" assumes"indep X" assumes"¬ indep (insert x X)" shows"∃!C. circuit C ∧ C ⊆ insert x X" proof - obtain C where C: "circuit C""C ⊆ insert x X" using assms indep_subset_carrier dep_iff_supset_circuit by auto
show ?thesis proof (rule ex1I, goal_cases ex unique) show"circuit C ∧ C ⊆ insert x X"using C by auto next
{ fix C' assume C': "circuit C'""C' ⊆ insert x X" have"C' = C" proof (rule ccontr) assume"C' ≠ C" moreoverhave"x ∈ C' ∩ C"using C C' assms min_dep_imp_supset_circuit by auto ultimatelyhave"¬ indep (C' ∪ C - {x})" using circuit_elim[OF C(1) C'(1), of x] supset_circuit_imp_dep[of _ "C' ∪ C - {x}"] by auto moreoverhave"C' ∪ C - {x} ⊆ X"using C C' by auto ultimatelyshow False using assms indep_subset by auto qed
} thenshow"∧C'. circuit C' ∧ C' ⊆ insert x X ==> C' = C" by auto qed qed
lemma basis_ex1_supset_circuit: assumes"basis B" assumes"x ∈ carrier - B" shows"∃!C. circuit C ∧ C ⊆ insert x B" using assms min_dep_imp_ex1_supset_circuit basisD by auto
definition fund_circuit :: "'a ==> 'a set ==> 'a set"where "fund_circuit x B ≡ (THE C. circuit C ∧ C ⊆ insert x B)"
lemma circuit_iff_fund_circuit: "circuit C ⟷ (∃x B. x ∈ carrier - B ∧ basis B ∧ C = fund_circuit x B)" proof (safe, goal_cases LTR RTL) case LTR thenobtain x where"x ∈ C"using circuit_nonempty by auto thenhave"indep (C - {x})"using LTR unfolding circuit_def by auto thenobtain B where B: "basis B""C - {x} ⊆ B"using indep_imp_subset_basis by auto thenhave"x ∈ carrier"using LTR circuit_subset_carrier ‹x ∈ C›by auto moreoverhave"x ∉ B" proof (rule ccontr, goal_cases False) case False thenhave"C ⊆ B"using‹C - {x} ⊆ B›by auto thenhave"¬ indep B"using LTR B basis_subset_carrier supset_circuit_imp_dep by auto thenshow ?caseusing B basis_indep by auto qed ultimatelyshow ?case unfolding fund_circuit_def using LTR B theI_unique[OF basis_ex1_supset_circuit[of B x], of C] by auto next case (RTL x B) thenhave"∃!C. circuit C ∧ C ⊆ insert x B" using min_dep_imp_ex1_supset_circuit basisD[of B] by auto thenshow ?case unfolding fund_circuit_def using theI[of "λC. circuit C ∧ C ⊆ insert x B"] by fastforce qed
lemma fund_circuitI: assumes"basis B" assumes"x ∈ carrier - B" assumes"circuit C" assumes"C ⊆ insert x B" shows"fund_circuit x B = C" unfolding fund_circuit_def using assms theI_unique[OF basis_ex1_supset_circuit, of B x C] by auto
definition fund_circuit_in where"fund_circuit_in E x B ≡ matroid.fund_circuit E (indep_in E) x B"
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using‹E⊆ carrier›by auto
lemma fund_circuit_inI_aux: "E.fund_circuit x B = fund_circuit_in E x B" unfolding fund_circuit_in_def by auto
lemma circuit_in_elim: assumes"circuit_in E C1""circuit_in E C2""C1≠ C2""x ∈ C1∩ C2" shows"∃C3⊆ (C1∪ C2) - {x}. circuit_in E C3" using assms E.circuit_elim unfolding circuit_in_def by auto
lemma min_dep_in_imp_ex1_supset_circuit_in: assumes"x ∈E" assumes"indep_in E X" assumes"¬ indep_in E (insert x X)" shows"∃!C. circuit_in E C ∧ C ⊆ insert x X" using assms E.min_dep_imp_ex1_supset_circuit unfolding circuit_in_def by auto
lemma basis_in_ex1_supset_circuit_in: assumes"basis_in E B" assumes"x ∈E - B" shows"∃!C. circuit_in E C ∧ C ⊆ insert x B" using assms E.basis_ex1_supset_circuit unfolding circuit_in_def basis_in_def by auto
lemma fund_circuit_inI: assumes"basis_in E B" assumes"x ∈E - B" assumes"circuit_in E C" assumes"C ⊆ insert x B" shows"fund_circuit_in E x B = C" using assms E.fund_circuitI unfolding basis_in_def circuit_in_def fund_circuit_in_def by auto
end
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using‹E⊆ carrier›by auto
lemma fund_circuit_in_sub_cong: assumes"E' ⊆E" assumes"x ∈E' - B" assumes"basis_in E' B" shows"E.fund_circuit_in E' x B = fund_circuit_in E' x B" proof - obtain C where C: "circuit_in E' C""C ⊆ insert x B" using * assms basis_in_ex1_supset_circuit_in[of E' B x] by auto thenhave"fund_circuit_in E' x B = C" using * assms fund_circuit_inI by auto alsohave"… = E.fund_circuit_in E' x B" using * assms C E.fund_circuit_inI basis_in_sub_cong[of E] circuit_in_sub_cong[of E] by auto finallyshow ?thesis by auto qed
interpretationE: matroid E"indep_in E" using * by auto
lemma lower_rank_of_eq_upper_rank_of: "lower_rank_of E = upper_rank_of E" proof - obtain B where"basis_in E B"using basis_in_ex[OF *] by auto thenhave"{card B | B. basis_in E B} = {card B}" by safe (auto dest: basis_in_card[OF *]) thenshow ?thesis unfolding lower_rank_of_def upper_rank_of_def by auto qed
lemma rank_of_eq_card_basis_in: assumes"basis_in E B" shows"rank_of E = card B" proof - have"{card B | B. basis_in E B} = {card B}"using assms by safe (auto dest: basis_in_card[OF *]) thenshow ?thesis unfolding rank_of_def by auto qed
lemma rank_of_indep_in_le: assumes"indep_in E X" shows"card X ≤ rank_of E" proof -
{ fix B assume"basis_in E B" moreoverobtain B' where"basis_in E B'""X ⊆ B'" using assms indep_in_imp_subset_basis_in[OF *] by auto ultimatelyhave"card X ≤ card B" using card_mono[OF basis_in_finite[OF *]] basis_in_card[OF *, of B B'] by auto
} moreoverhave"finite {card B | B. basis_in E B}" using collect_basis_in_finite[OF *] by auto ultimatelyshow ?thesis unfolding rank_of_def using basis_in_ex[OF *] by auto qed
end
lemma rank_of_mono: assumes"X ⊆ Y" assumes"Y ⊆ carrier" shows"rank_of X ≤ rank_of Y" proof - obtain BXwhere BX: "basis_in X BX"using assms basis_in_ex[of X] by auto moreoverobtain BYwhere BY: "basis_in Y BY"using assms basis_in_ex[of Y] by auto moreoverhave"card BX≤ card BY" using assms basis_in_indep_in_card[OF _ _ BY] basis_in_indep_in[OF _ BX] indep_in_subI_subset by auto ultimatelyshow ?thesis using assms rank_of_eq_card_basis_in by auto qed
lemma rank_of_insert_le: assumes"X ⊆ carrier" assumes"x ∈ carrier" shows"rank_of (insert x X) ≤ Suc (rank_of X)" proof - obtain B where B: "basis_in X B"using assms basis_in_ex[of X] by auto have"basis_in (insert x X) B ∨ basis_in (insert x X) (insert x B)" proof - obtain B' where B': "B' ⊆ insert x X - X""basis_in (insert x X) (B ∪ B')" using assms B basis_in_subI[of "insert x X" X B] by auto thenhave"B' = {} ∨ B' = {x}"by auto thenshow ?thesis proof assume"B' = {}" thenhave"basis_in (insert x X) B"using B' by auto thenshow ?thesis by auto next assume"B' = {x}" thenhave"basis_in (insert x X) (insert x B)"using B' by auto thenshow ?thesis by auto qed qed thenshow ?thesis proof assume"basis_in (insert x X) B" thenshow ?thesis using assms B rank_of_eq_card_basis_in by auto next assume"basis_in (insert x X) (insert x B)" thenhave"rank_of (insert x X) = card (insert x B)" using assms rank_of_eq_card_basis_in by auto alsohave"… = Suc (card (B - {x}))" using assms card.insert_remove[of B x] using B basis_in_finite by auto alsohave"…≤ Suc (card B)" using assms B basis_in_finite card_Diff1_le[of B] by auto alsohave"… = Suc (rank_of X)" using assms B rank_of_eq_card_basis_in by auto finallyshow ?thesis . qed qed
lemma rank_of_Un_Int_le: assumes"X ⊆ carrier" assumes"Y ⊆ carrier" shows"rank_of (X ∪ Y) + rank_of (X ∩ Y) ≤ rank_of X + rank_of Y" proof - obtain B_Int where B_Int: "basis_in (X ∩ Y) B_Int"using assms basis_in_ex[of "X ∩ Y"] byauto thenhave"indep_in (X ∪ Y) B_Int" using assms indep_in_subI_subset[OF _ basis_in_indep_in[of "X ∩ Y" B_Int], of "X ∪ Y"] byauto thenobtain B_Un where B_Un: "basis_in (X ∪ Y) B_Un""B_Int ⊆ B_Un" using assms indep_in_imp_subset_basis_in[of "X ∪ Y" B_Int] by auto
have"card (B_Un ∩ (X ∪ Y)) + card (B_Un ∩ (X ∩ Y)) = card ((B_Un ∩ X) ∪ (B_Un ∩Y)) + card ((B_Un ∩ X) ∩ (B_Un ∩ Y))" by (simp add: inf_assoc inf_left_commute inf_sup_distrib1) alsohave"… = card (B_Un ∩ X) + card (B_Un ∩ Y)" proof - have"finite (B_Un ∩ X)""finite (B_Un ∩ Y)" using assms finite_subset[OF _ carrier_finite] by auto thenshow ?thesis using card_Un_Int[of "B_Un ∩ X""B_Un ∩ Y"] by auto qed alsohave"…≤ rank_of X + rank_of Y" proof - have"card (B_Un ∩ X) ≤ rank_of X" proof - have"indep_in X (B_Un ∩ X)"using assms basis_in_indep_in[OF _ B_Un(1)] indep_in_subI by auto thenshow ?thesis using assms rank_of_indep_in_le by auto qed moreoverhave"card (B_Un ∩ Y) ≤ rank_of Y" proof - have"indep_in Y (B_Un ∩ Y)"using assms basis_in_indep_in[OF _ B_Un(1)] indep_in_subI by auto thenshow ?thesis using assms rank_of_indep_in_le by auto qed ultimatelyshow ?thesis by auto qed finallyhave"rank_of X + rank_of Y ≥ card (B_Un ∩ (X ∪ Y)) + card (B_Un ∩ (X ∩ Y))" . moreoverhave"B_Un ∩ (X ∪ Y) = B_Un"using assms basis_in_subset_carrier[OF _ B_Un(1)] by auto moreoverhave"B_Un ∩ (X ∩ Y) = B_Int" proof - have"card (B_Un ∩ (X ∩ Y)) ≤ card B_Int" proof - have"indep_in (X ∩ Y) (B_Un ∩ (X ∩ Y))" using assms basis_in_indep_in[OF _ B_Un(1)] indep_in_subI by auto thenshow ?thesis using assms basis_in_indep_in_card[of "X ∩ Y" _ B_Int] B_Int by auto qed moreoverhave"finite (B_Un ∩ (X ∩ Y))" using assms carrier_finite finite_subset[of "B_Un ∩ (X ∩ Y)"] by auto moreoverhave"B_Int ⊆ B_Un ∩ (X ∩ Y)" using assms B_Un B_Int basis_in_subset_carrier[of "X ∩ Y" B_Int] by auto ultimatelyshow ?thesis using card_seteq by blast qed ultimatelyhave"rank_of X + rank_of Y ≥ card B_Un + card B_Int"by auto moreoverhave"card B_Un = rank_of (X ∪ Y)" using assms rank_of_eq_card_basis_in[OF _ B_Un(1)] by auto moreoverhave"card B_Int = rank_of (X ∩ Y)" using assms rank_of_eq_card_basis_in[OF _ B_Int] by fastforce ultimatelyshow"rank_of X + rank_of Y ≥ rank_of (X ∪ Y) + rank_of (X ∩ Y)"by auto qed
lemma rank_of_Un_absorbI: assumes"X ⊆ carrier""Y ⊆ carrier" assumes"∧y. y ∈ Y - X ==> rank_of (insert y X) = rank_of X" shows"rank_of (X ∪ Y) = rank_of X" proof - have"finite (Y - X)"using finite_subset[OF ‹Y ⊆ carrier›] carrier_finite by auto thenshow ?thesis using assms proof (induction"Y - X" arbitrary: Y rule: finite_induct ) case empty thenhave"X ∪ Y = X"by auto thenshow ?caseby auto next case (insert y F) have"rank_of (X ∪ Y) + rank_of X ≤ rank_of X + rank_of X" proof - have"rank_of (X ∪ Y) + rank_of X = rank_of ((X ∪ (Y - {y})) ∪ (insert y X)) + rank_of ((X ∪ (Y - {y})) ∩ (insert y X))" proof - have"X ∪ Y = (X ∪ (Y - {y})) ∪ (insert y X)""X = (X ∪ (Y - {y})) ∩ (insert y X)"using insert by auto thenshow ?thesis by auto qed alsohave"…≤ rank_of (X ∪ (Y - {y})) + rank_of (insert y X)" proof (rule rank_of_Un_Int_le) show"X ∪ (Y - {y}) ⊆ carrier"using insert by auto next show"insert y X ⊆ carrier"using insert by auto qed alsohave"… = rank_of (X ∪ (Y - {y})) + rank_of X" proof - have"y ∈ Y - X"using insert by auto thenshow ?thesis using insert by auto qed alsohave"… = rank_of X + rank_of X" proof - have"F = (Y - {y}) - X""Y - {y} ⊆ carrier"using insert by auto thenshow ?thesis using insert insert(3)[of "Y - {y}"] by auto qed finallyshow ?thesis . qed moreoverhave"rank_of (X ∪ Y) + rank_of X ≥ rank_of X + rank_of X" using insert rank_of_mono by auto ultimatelyshow ?caseby auto qed qed
lemma indep_iff_rank_of: assumes"X ⊆ carrier" shows"indep X ⟷ rank_of X = card X" proof (standard, goal_cases LTR RTL) case LTR thenhave"indep_in X X"by (auto intro: indep_inI) thenhave"basis_in X X"by (auto intro: basis_inI[OF assms]) thenshow ?caseusing rank_of_eq_card_basis_in[OF assms] by auto next case RTL obtain B where B: "basis_in X B"using basis_in_ex[OF assms] by auto thenhave"card B = card X"using RTL rank_of_eq_card_basis_in[OF assms] by auto thenhave"B = X" using basis_in_subset_carrier[OF assms B] card_seteq[OF finite_subset[OF assms carrier_finite]] by auto thenshow ?caseusing basis_in_indep_in[OF assms B] indep_in_indep by auto qed
lemma basis_iff_rank_of: assumes"X ⊆ carrier" shows"basis X ⟷ rank_of X = card X ∧ rank_of X = rank_of carrier" proof (standard, goal_cases LTR RTL) case LTR thenhave"rank_of X = card X"using assms indep_iff_rank_of basis_indep by auto moreoverhave"… = rank_of carrier" using LTR rank_of_eq_card_basis_in[of carrier X] basis_iff_basis_in by auto ultimatelyshow ?caseby auto next case RTL show ?case proof (rule basisI) show"indep X"using assms RTL indep_iff_rank_of by blast next fix x assume x: "x ∈ carrier - X" show"¬ indep (insert x X)" proof (rule ccontr, goal_cases False) case False thenhave"card (insert x X) ≤ rank_of carrier" using assms x indep_inI rank_of_indep_in_le by auto alsohave"… = card X"using RTL by auto finallyshow ?caseusing finite_subset[OF assms carrier_finite] x by auto qed qed qed
lemma circuit_iff_rank_of: assumes"X ⊆ carrier" shows"circuit X ⟷ X ≠ {} ∧ (∀x ∈ X. rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = rank_of X)" proof (standard, goal_cases LTR RTL) case LTR thenhave"X ≠ {}"using circuit_nonempty by auto moreoverhave indep_remove: "∧x. x ∈ X ==> rank_of (X - {x}) = card (X - {x})" proof - fix x assume"x ∈ X" thenhave"indep (X - {x})"using circuit_min_dep[OF LTR] by auto moreoverhave"X - {x} ⊆ carrier"using assms by auto ultimatelyshow"rank_of (X - {x}) = card (X - {x})"using indep_iff_rank_of by auto qed moreoverhave"∧x. x ∈ X ==> rank_of (X - {x}) = rank_of X" proof - fix x assume *: "x ∈ X" have"rank_of X ≤ card X"using assms rank_of_le by auto moreoverhave"rank_of X ≠ card X"using assms LTR circuitD indep_iff_rank_of[of X] by auto ultimatelyhave"rank_of X < card X"by auto thenhave"rank_of X ≤ card (X - {x})"using * finite_subset[OF assms] carrier_finite byauto alsohave"… = rank_of (X - {x})"using indep_remove ‹x ∈ X›by auto finallyshow"rank_of (X - {x}) = rank_of X"using assms rank_of_mono[of "X - {x}" X] byauto qed ultimatelyshow ?caseby auto next case RTL thenhave"X ≠ {}" and indep_remove: "∧x. x ∈ X ==> rank_of (X - {x}) = card (X - {x})" and dep: "∧x. x ∈ X ==> rank_of (X - {x}) = rank_of X" by auto show ?caseusing assms proof (rule circuitI) obtain x where x: "x ∈ X"using‹X ≠ {}›by auto thenhave"rank_of X = card (X - {x})"using dep indep_remove by auto alsohave"… < card X"using card_Diff1_less[OF finite_subset[OF assms carrier_finite] x] . finallyshow"¬ indep X"using indep_iff_rank_of[OF assms] by auto next fix x assume"x ∈ X" thenshow"indep (X - {x})"using assms indep_remove[of x] indep_iff_rank_of[of "X - {x}"] by auto qed qed
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using * by auto
lemma indep_in_iff_rank_of: assumes"X ⊆E" shows"indep_in E X ⟷ rank_of X = card X" using assms E.indep_iff_rank_of rank_of_sub_cong[OF * assms] by auto
lemma basis_in_iff_rank_of: assumes"X ⊆E" shows"basis_in E X ⟷ rank_of X = card X ∧ rank_of X = rank_of E" usingE.basis_iff_rank_of[OF assms] rank_of_sub_cong[OF *] assms unfolding basis_in_def by auto
lemma circuit_in_iff_rank_of: assumes"X ⊆E" shows"circuit_in E X ⟷ X ≠ {} ∧ (∀x ∈ X. rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = rank_of X)" proof - have"circuit_in E X ⟷E.circuit X"unfolding circuit_in_def .. alsohave"…⟷ X ≠ {} ∧ (∀x ∈ X. E.rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = E.rank_of X)" usingE.circuit_iff_rank_of[OF assms] . alsohave"…⟷ X ≠ {} ∧ (∀x ∈ X. rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = rank_of X)" proof -
{ fix x have"E.rank_of (X - {x}) = rank_of (X - {x})""E.rank_of X = rank_of X" using assms rank_of_sub_cong[OF *, of "X - {x}"] rank_of_sub_cong[OF *, of X] by auto thenhave"E.rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = E.rank_of X ⟷ rank_of (X - {x}) = card (X - {x}) ∧ card (X - {x}) = rank_of X" by auto
} thenshow ?thesis by (auto simp: simp del: card_Diff_insert) qed finallyshow ?thesis . qed
end
subsection‹Closure›
definition cl :: "'a set ==> 'a set"where "cl X ≡ {x ∈ carrier. rank_of (insert x X) = rank_of X}"
lemma clI: assumes"x ∈ carrier" assumes"rank_of (insert x X) = rank_of X" shows"x ∈ cl X" unfolding cl_def using assms by auto
lemma cl_altdef: assumes"X ⊆ carrier" shows"cl X = ∪{Y ∈ Pow carrier. X ⊆ Y ∧ rank_of Y = rank_of X}" proof -
{ fix x assume *: "x ∈ cl X" have"x ∈∪{Y ∈ Pow carrier. X ⊆ Y ∧ rank_of Y = rank_of X}" proof show"insert x X ∈ {Y ∈ Pow carrier. X ⊆ Y ∧ rank_of Y = rank_of X}" using assms * unfolding cl_def by auto qed auto
} moreover { fix x assume *: "x ∈∪{Y ∈ Pow carrier. X ⊆ Y ∧ rank_of Y = rank_of X}" thenobtain Y where Y: "x ∈ Y""Y ⊆ carrier""X ⊆ Y""rank_of Y = rank_of X"by auto have"rank_of (insert x X) = rank_of X" proof - have"rank_of (insert x X) ≤ rank_of X" proof - have"insert x X ⊆ Y"using Y by auto thenshow ?thesis using rank_of_mono[of "insert x X" Y] Y by auto qed moreoverhave"rank_of X ≤ rank_of (insert x X)"using Y by (auto intro: rank_of_mono) ultimatelyshow ?thesis by auto qed thenhave"x ∈ cl X"using * unfolding cl_def by auto
} ultimatelyshow ?thesis by blast qed
lemma cl_rank_of: "x ∈ cl X ==> rank_of (insert x X) = rank_of X" unfolding cl_def by auto
lemma cl_subset_carrier: "cl X ⊆ carrier" unfolding cl_def by auto
lemmas clD = cl_rank_of cl_subset_carrier
lemma cl_subset: assumes"X ⊆ carrier" shows"X ⊆ cl X" using assms using insert_absorb[of _ X] by (auto intro!: clI)
lemma cl_mono: assumes"X ⊆ Y" assumes"Y ⊆ carrier" shows"cl X ⊆ cl Y" proof fix x assume"x ∈ cl X" thenhave"x ∈ carrier"using cl_subset_carrier by auto
have"insert x X ⊆ carrier" using assms ‹x ∈ cl X› cl_subset_carrier[of X] by auto theninterpret X_insert: matroid "insert x X""indep_in (insert x X)"by auto
have"insert x Y ⊆ carrier" using assms ‹x ∈ cl X› cl_subset_carrier[of X] by auto theninterpret Y_insert: matroid "insert x Y""indep_in (insert x Y)"by auto
show"x ∈ cl Y"using‹x ∈ carrier› proof (rule clI, cases "x ∈ X") case True thenshow"rank_of (insert x Y) = rank_of Y"using assms insert_absorb[of x Y] by auto next case False obtain BXwhere BX: "basis_in X BX"using assms basis_in_ex[of X] by auto
have"basis_in (insert x X) BX" proof - have"rank_of BX = card BX∧ rank_of BX = rank_of (insert x X)" proof - have"rank_of BX = card BX∧ rank_of BX = rank_of X" using assms BX
basis_in_subset_carrier[whereE = X and X = BX]
basis_in_iff_rank_of[whereE = X and X = BX] by blast thenshow ?thesis using cl_rank_of[OF ‹x ∈ cl X›] by auto qed thenshow ?thesis using assms basis_in_subset_carrier[OF _ BX] ‹x ∈ carrier› basis_in_iff_rank_of[of "insert x X" BX] by auto qed
have"indep_in (insert x Y) BX" using assms basis_in_indep_in[OF _ BX] indep_in_subI_subset[of X "insert x Y"] by auto thenobtain BYwhere BY: "basis_in (insert x Y) BY""BX⊆ BY" using assms ‹x ∈ carrier› indep_in_iff_subset_basis_in[of "insert x Y" BX] by auto
have"basis_in Y BY" proof - have"x ∉ BY" proof (rule ccontr, goal_cases False) case False thenhave"insert x BX⊆ BY"using‹BX⊆ BY›by auto thenhave"indep_in (insert x Y) (insert x BX)" using assms ‹x ∈ carrier›
BY basis_in_indep_in[whereE = "insert x Y"and X = BY]
indep_in_subset[whereE = "insert x Y"and X = BYand Y = "insert x BX"] by auto thenhave"indep_in (insert x X) (insert x BX)" using assms BX
basis_in_subset_carrier[whereE = X and X = BX]
indep_in_supI[whereE = "insert x Y"andE' = "insert x X"and X = "insert x BX"] by auto moreoverhave"x ∈ insert x X - BX" using assms ‹x ∉ X› BX basis_in_subset_carrier[whereE = X and X = BX] by auto ultimatelyshow ?case using assms ‹x ∈ carrier›‹basis_in (insert x X) BX›
basis_in_max_indep_in[whereE = "insert x X"and X = BXand x = x] by auto qed thenshow ?thesis using assms ‹x ∈ carrier› BY basis_in_subset_carrier[of "insert x Y" BY]
basis_in_supI[whereE = "insert x Y"andE' = Y and B = BY] by auto qed
show"rank_of (insert x Y) = rank_of Y" proof - have"rank_of (insert x Y) = card BY" using assms ‹x ∈ carrier›‹basis_in (insert x Y) BY› basis_in_subset_carrier using basis_in_iff_rank_of[whereE = "insert x Y"and X = BY] by auto alsohave"… = rank_of Y" using assms ‹x ∈ carrier›‹basis_in Y BY› basis_in_subset_carrier using basis_in_iff_rank_of[whereE = Y and X = BY] by auto finallyshow ?thesis . qed qed qed
lemma cl_insert_absorb: assumes"X ⊆ carrier" assumes"x ∈ cl X" shows"cl (insert x X) = cl X" proof show"cl (insert x X) ⊆ cl X" proof (standard, goal_cases elem) case (elem y) thenhave *: "x ∈ carrier""y ∈ carrier"using assms cl_subset_carrier by auto
have"rank_of (insert y X) = rank_of (insert y (insert x X))" proof - have"rank_of (insert y X) ≤ rank_of (insert y (insert x X))" using assms * by (auto intro: rank_of_mono) moreoverhave"rank_of (insert y (insert x X)) = rank_of (insert y X)" proof - have"insert y (insert x X) = insert x (insert y X)"by auto thenhave"rank_of (insert y (insert x X)) = rank_of (insert x (insert y X))"by auto alsohave"… = rank_of (insert y X)" proof - have"cl X ⊆ cl (insert y X)"by (rule cl_mono) (auto simp add: assms ‹y ∈ carrier›) thenhave"x ∈ cl (insert y X)"using assms by auto thenshow ?thesis unfolding cl_def by auto qed finallyshow ?thesis . qed ultimatelyshow ?thesis by auto qed alsohave"… = rank_of (insert x X)"using elem using cl_rank_of by auto alsohave"… = rank_of X"using assms cl_rank_of by auto finallyshow"y ∈ cl X"using * by (auto intro: clI) qed next have"insert x X ⊆ carrier"using assms cl_subset_carrier by auto moreoverhave"X ⊆ insert x X"using assms by auto ultimatelyshow"cl X ⊆ cl (insert x X)"using assms cl_subset_carrier cl_mono by auto qed
lemma cl_cl_absorb: assumes"X ⊆ carrier" shows"cl (cl X) = cl X" proof show"cl (cl X) ⊆ cl X" proof (standard, goal_cases elem) case (elem x) thenhave"x ∈ carrier"using cl_subset_carrier by auto thenshow ?case proof (rule clI) have"rank_of (insert x X) ≥ rank_of X" using assms ‹x ∈ carrier› rank_of_mono[of X "insert x X"] by auto moreoverhave"rank_of (insert x X) ≤ rank_of X" proof - have"rank_of (insert x X) ≤ rank_of (insert x (cl X))" using assms ‹x ∈ carrier› cl_subset_carrier cl_subset[of X]
rank_of_mono[of "insert x X""insert x (cl X)"] by auto alsohave"… = rank_of (cl X)"using elem cl_rank_of by auto alsohave"… = rank_of (X ∪ (cl X - X))" using Diff_partition[OF cl_subset[OF assms]] by auto alsohave"… = rank_of X"using‹X ⊆ carrier› proof (rule rank_of_Un_absorbI) show"cl X - X ⊆ carrier"using assms cl_subset_carrier by auto next fix y assume"y ∈ cl X - X - X" thenshow"rank_of (insert y X) = rank_of X"unfolding cl_def by auto qed finallyshow ?thesis . qed ultimatelyshow"rank_of (insert x X) = rank_of X"by auto qed qed next show"cl X ⊆ cl (cl X)"using cl_subset[OF cl_subset_carrier] by auto qed
lemma cl_augment: assumes"X ⊆ carrier" assumes"x ∈ carrier" assumes"y ∈ cl (insert x X) - cl X" shows"x ∈ cl (insert y X)" using‹x ∈ carrier› proof (rule clI) have"rank_of (insert y X) ≤ rank_of (insert x (insert y X))" using assms cl_subset_carrier by (auto intro: rank_of_mono) moreoverhave"rank_of (insert x (insert y X)) ≤ rank_of (insert y X)" proof - have"rank_of (insert x (insert y X)) = rank_of (insert y (insert x X))" proof - have"insert x (insert y X) = insert y (insert x X)"by auto thenshow ?thesis by auto qed alsohave"rank_of (insert y (insert x X)) = rank_of (insert x X)" using assms cl_def by auto alsohave"…≤ Suc (rank_of X)" using assms cl_subset_carrier by (auto intro: rank_of_insert_le) alsohave"… = rank_of (insert y X)" proof - have"rank_of (insert y X) ≤ Suc (rank_of X)" using assms cl_subset_carrier by (auto intro: rank_of_insert_le) moreoverhave"rank_of (insert y X) ≠ rank_of X" using assms cl_def by auto moreoverhave"rank_of X ≤ rank_of (insert y X)" using assms cl_subset_carrier by (auto intro: rank_of_mono) ultimatelyshow ?thesis by auto qed finallyshow ?thesis . qed ultimatelyshow"rank_of (insert x (insert y X)) = rank_of (insert y X)"by auto qed
lemma clI_insert: assumes"x ∈ carrier" assumes"indep X" assumes"¬ indep (insert x X)" shows"x ∈ cl X" using‹x ∈ carrier› proof (rule clI) have *: "X ⊆ carrier"using assms indep_subset_carrier by auto thenhave **: "insert x X ⊆ carrier"using assms by auto
have"indep_in (insert x X) X"using assms by (auto intro: indep_inI) thenobtain B where B: "basis_in (insert x X) B""X ⊆ B" using assms indep_in_iff_subset_basis_in[OF **] by auto have"x ∉ B" proof (rule ccontr, goal_cases False) case False thenhave"indep_in (insert x X) (insert x X)" using B indep_in_subset[OF ** basis_in_indep_in[OF **]] by auto thenshow ?caseusing assms indep_in_indep by auto qed
have"basis_in X B"using * proof (rule basis_inI, goal_cases indep max_indep) case indep show ?case proof (rule indep_in_supI[whereE = "insert x X"]) show"B ⊆ X"using B basis_in_subset_carrier[OF **] ‹x ∉ B›by auto next show"indep_in (insert x X) B"using basis_in_indep_in[OF ** B(1)] . qed auto next case (max_indep y) thenhave"¬ indep_in (insert x X) (insert y B)" using B basis_in_max_indep_in[OF **] by auto thenshow ?caseby (auto intro: indep_in_subI_subset) qed thenshow"rank_of (insert x X) = rank_of X" using B rank_of_eq_card_basis_in[OF *] rank_of_eq_card_basis_in[OF **] by auto qed
lemma indep_in_carrier [simp]: "indep_in carrier = indep" using indep_subset_carrier by (auto simp: indep_in_def fun_eq_iff)
context fixes I defines"I ≡ (λX. X ⊆ carrier ∧ (∀x∈X. x ∉ cl (X - {x})))" begin
lemma I_mono: "I Y"if"Y ⊆ X""I X"for X Y :: "'a set" proof - have"∀x∈Y. x ∉ cl (Y - {x})" proof (intro ballI) fix x assume x: "x ∈ Y" with that have"cl (Y - {x}) ⊆ cl (X - {x})" by (intro cl_mono) (auto simp: I_def) with that and x show"x ∉ cl (Y - {x})"by (auto simp: I_def) qed with that show ?thesis by (auto simp: I_def) qed
lemma clI': assumes"I X""x ∈ carrier""¬I (insert x X)" shows"x ∈ cl X" proof - from assms have x: "x ∉ X"by (auto simp: insert_absorb) from assms obtain y where y: "y ∈ insert x X""y ∈ cl (insert x X - {y})" by (force simp: I_def) show"x ∈ cl X" proof (cases "x = y") case True thus ?thesis using assms x y by (auto simp: I_def) next case False have"y ∈ cl (insert x X - {y})"by fact alsofrom False have"insert x X - {y} = insert x (X - {y})"by auto finallyhave"y ∈ cl (insert x (X - {y})) - cl (X - {y})" using assms False y unfolding I_def by blast hence"x ∈ cl (insert y (X - {y}))" using cl_augment[of "X - {y}" x y] assms False y by (auto simp: I_def) alsofrom y and False have"insert y (X - {y}) = X"by auto finallyshow ?thesis . qed qed
lemma matroid_I: "matroid carrier I" proof (unfold_locales, goal_cases) show"finite carrier"by (rule carrier_finite) next case (4 X Y) have"∀x∈Y. x ∉ cl (Y - {x})" proof (intro ballI) fix x assume x: "x ∈ Y" with4have"cl (Y - {x}) ⊆ cl (X - {x})" by (intro cl_mono) (auto simp: I_def) with4and x show"x ∉ cl (Y - {x})"by (auto simp: I_def) qed with4show ?caseby (auto simp: I_def) next case (5 X Y) have"~(∃X Y. I X ∧ I Y ∧ card X < card Y ∧ (∀x∈Y-X. ¬I (insert x X)))" proof assume *: "∃X Y. I X ∧ I Y ∧ card X < card Y ∧ (∀x∈Y-X. ¬I (insert x X))" (is"∃X Y. ?P X Y")
define n where"n = Max ((λ(X, Y). card (X ∩ Y)) ` {(X, Y). ?P X Y})" have"{(X, Y). ?P X Y} ⊆ Pow carrier × Pow carrier" by (auto simp: I_def) hence finite: "finite {(X, Y). ?P X Y}" by (rule finite_subset) (insert carrier_finite, auto) hence"n ∈ ((λ(X, Y). card (X ∩ Y)) ` {(X, Y). ?P X Y})" unfolding n_def using * by (intro Max_in finite_imageI) auto thenobtain X Y where XY: "?P X Y""n = card (X ∩ Y)" by auto hence finite': "finite X""finite Y" using finite_subset[OF _ carrier_finite] XY by (auto simp: I_def) from XY finite' have"~(Y ⊆ X)" using card_mono[of X Y] by auto thenobtain y where y: "y ∈ Y - X"by blast
have False proof (cases "X ⊆ cl (Y - {y})") case True from y XY have [simp]: "y ∈ carrier"by (auto simp: I_def) assume"X ⊆ cl (Y - {y})" hence"cl X ⊆ cl (cl (Y - {y}))" by (intro cl_mono cl_subset_carrier) alsohave"… = cl (Y - {y})" using XY by (intro cl_cl_absorb) (auto simp: I_def) finallyhave"cl X ⊆ cl (Y - {y})" . moreoverhave"y ∉ cl (Y - {y})" using y I_def XY(1) by blast ultimatelyhave"y ∉ cl X"by blast thus False unfolding I_def using XY y clI' ‹y ∈ carrier›by blast next case False with y XY have [simp]: "y ∈ carrier"by (auto simp: I_def) assume"¬(X ⊆ cl (Y - {y}))" thenobtain t where t: "t ∈ X""t ∉ cl (Y - {y})" by auto with XY have [simp]: "t ∈ carrier"by (auto simp: I_def)
have"t ∈ X - Y" using t y clI[of t "Y - {y}"] by (cases "t = y") (auto simp: insert_absorb) moreoverhave"I (Y - {y})"using XY(1) I_mono[of "Y - {y}" Y] by blast ultimatelyhave *: "I (insert t (Y - {y}))" using clI'[of "Y - {y}" t] t by auto
from XY have"finite Y" by (intro finite_subset[OF _ carrier_finite]) (auto simp: I_def) moreoverfrom y have"Y ≠ {}"by auto ultimatelyhave [simp]: "card (insert t (Y - {y})) = card Y"using‹t ∈ X - Y› y by (simp add: Suc_diff_Suc card_gt_0_iff)
have"∃x∈Y - X. I (insert x X)" proof (rule ccontr) assume"¬?thesis" hence"?P X (insert t (Y - {y}))"using XY * ‹t ∈ X - Y› by auto hence"card (X ∩ insert t (Y - {y})) ≤ n" unfolding n_def using finite by (intro Max_ge) auto alsohave"X ∩ insert t (Y - {y}) = insert t ((X ∩ Y) - {y})" using y ‹t ∈ X - Y›by blast alsohave"card … = Suc (card (X ∩ Y))" using y ‹t ∈ X - Y›‹finite Y›by (simp add: card.insert_remove) finallyshow False using XY by simp qed with XY show False by blast qed thus False . qed with5show ?caseby auto qed (auto simp: I_def)
end
definition cl_in where"cl_in E X = matroid.cl E (indep_in E) X"
lemma cl_eq_cl_in: assumes"X ⊆ carrier" shows"cl X = cl_in carrier X" proof - interpretE: matroid carrier "indep_in carrier" by (intro matroid_subset) auto have"cl X = {x ∈ carrier. rank_of (insert x X) = rank_of X}" unfolding cl_def by auto alsohave"… = {x ∈ carrier. E.rank_of (insert x X) = E.rank_of X}" using rank_of_sub_cong[of carrier] assms by auto alsohave"… = cl_in carrier X" unfolding cl_in_def E.cl_def by auto finallyshow ?thesis . qed
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using * by auto
lemma cl_inI_aux: "x ∈E.cl X ==> x ∈ cl_in E X" unfolding cl_in_def by auto
lemma cl_inD_aux: "x ∈ cl_in E X ==> x ∈E.cl X" unfolding cl_in_def by auto
lemma cl_inI: assumes"X ⊆E" assumes"x ∈E" assumes"rank_of (insert x X) = rank_of X" shows"x ∈ cl_in E X" proof - have"E.rank_of (insert x X) = rank_of (insert x X)""E.rank_of X = rank_of X" using assms rank_of_sub_cong[OF *] by auto thenshow ?thesis unfolding cl_in_def using assms by (auto intro: E.clI) qed
lemma cl_in_altdef: assumes"X ⊆E" shows"cl_in E X = ∪{Y ∈ Pow E. X ⊆ Y ∧ rank_of Y = rank_of X}" unfolding cl_in_def proof (safe, goal_cases LTR RTL) case (LTR x) thenhave"x ∈∪{Y ∈ Pow E. X ⊆ Y ∧E.rank_of Y = E.rank_of X}" usingE.cl_altdef[OF assms] by auto thenobtain Y where Y: "x ∈ Y""Y ∈ Pow E""X ⊆ Y""E.rank_of Y = E.rank_of X"by auto thenshow ?caseusing rank_of_sub_cong[OF *] by auto next case (RTL x Y) thenhave"x ∈∪{Y ∈ Pow E. X ⊆ Y ∧E.rank_of Y = E.rank_of X}" using rank_of_sub_cong[OF *, of X] rank_of_sub_cong[OF *, of Y] by auto thenshow ?caseusingE.cl_altdef[OF assms] by auto qed
lemma cl_in_subset_carrier: "cl_in E X ⊆E" usingE.cl_subset_carrier unfolding cl_in_def .
lemma cl_in_rank_of: assumes"X ⊆E" assumes"x ∈ cl_in E X" shows"rank_of (insert x X) = rank_of X" proof - have"E.rank_of (insert x X) = E.rank_of X" using assms E.cl_rank_of unfolding cl_in_def by auto moreoverhave"E.rank_of (insert x X) = rank_of (insert x X)" using assms rank_of_sub_cong[OF *, of "insert x X"] cl_in_subset_carrier by auto moreoverhave"E.rank_of X = rank_of X" using assms rank_of_sub_cong[OF *] by auto ultimatelyshow ?thesis by auto qed
lemma cl_in_mono: assumes"X ⊆ Y" assumes"Y ⊆E" shows"cl_in E X ⊆ cl_in E Y" usingE.cl_mono[OF assms] unfolding cl_in_def .
lemma cl_in_insert_absorb: assumes"X ⊆E" assumes"x ∈ cl_in E X" shows"cl_in E (insert x X) = cl_in E X" using assms E.cl_insert_absorb unfolding cl_in_def by auto
lemma cl_in_augment: assumes"X ⊆E" assumes"x ∈E" assumes"y ∈ cl_in E (insert x X) - cl_in E X" shows"x ∈ cl_in E (insert y X)" using assms E.cl_augment unfolding cl_in_def by auto
lemma cl_in_subI: assumes"X ⊆E'""E' ⊆E""E⊆ carrier" shows"cl_in E' X ⊆ cl_in E X" proof (safe, goal_cases elem) case (elem x) thenhave"x ∈E'""rank_of (insert x X) = rank_of X" using assms cl_inD[whereE = E' and X = X] by auto thenshow"x ∈ cl_in E X"using assms by (auto intro: cl_inI) qed
context fixesE assumes *: "E⊆ carrier" begin
interpretationE: matroid E"indep_in E" using * by auto
lemma cl_in_sub_cong: assumes"X ⊆E'""E' ⊆E" shows"E.cl_in E' X = cl_in E' X" proof (safe, goal_cases LTR RTL) case (LTR x) thenhave"x ∈E'""E.rank_of (insert x X) = E.rank_of X" using assms E.cl_in_rank_of[whereE = E' and X = X and x = x] E.cl_in_subset_carrier[whereE = E'] by auto moreoverhave"E.rank_of X = rank_of X" using assms rank_of_sub_cong[OF *] by auto moreoverhave"E.rank_of (insert x X) = rank_of (insert x X)" using assms rank_of_sub_cong[OF *, of "insert x X"] ‹x ∈E'›by auto ultimatelyshow ?caseusing assms * by (auto intro: cl_inI) next case (RTL x) thenhave"x ∈E'""rank_of (insert x X) = rank_of X" using * assms cl_inD[whereE = E' and X = X] by auto moreoverhave"E.rank_of X = rank_of X" using assms rank_of_sub_cong[OF *] by auto moreoverhave"E.rank_of (insert x X) = rank_of (insert x X)" using assms rank_of_sub_cong[OF *, of "insert x X"] ‹x ∈E'›by auto ultimatelyshow ?caseusing assms by (auto intro: E.cl_inI) 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.