Independencesystems
*) section‹Independence systems› theory Indep_System imports Main begin
lemma finite_psubset_inc_induct: assumes"finite A""X ⊆ A" assumes"∧X. (∧Y. X ⊂ Y ==> Y ⊆ A ==> P Y) ==> P X" shows"P X" proof - have wf: "wf {(X,Y). Y ⊂ X ∧ X ⊆ A}" by show ?thesis proof (induction X rule: wf_induct[OF wf, case_names step]) case (step X) thenshow ?caseusing assms(3)[of X] by blast qed qed
text‹
An \emph{independence system} consists of a finite ground set together with an independence
predicate over the sets of this ground set. At least one set of the carrier is independent and
subsets of independent sets are also independent. ›
locale indep_system = fixes carrier :: "'a set" fixes indep :: "'a set ==> bool" assumes carrier_finite: "finite carrier" assumes indep_subset_carrier: "indep X ==> X ⊆ carrier" assumes indep_ex: "∃X. indep X" assumes indep_subset: "indep X ==> Y ⊆ X ==> indep Y" begin
lemma indep_empty [simp]: "indep {}" using indep_ex indep_subset by auto
subsection‹Sub-independence systems›
text‹
A subset of the ground set induces an independence system. ›
definition indep_in where"indep_in E X ⟷ X ⊆E∧ indep X"
lemma indep_inI: assumes"X ⊆E" assumes"indep X" shows"indep_in E X" using assms unfolding indep_in_def by auto
lemma indep_in_subI: "indep_in E X ==> indep_in E' (X ∩E')" using indep_subset unfolding indep_in_def by auto
lemma dep_in_subI: assumes"X ⊆E'" shows"¬ indep_in E' X ==>¬ indep_in E X" using assms unfolding indep_in_def by auto
lemma indep_in_subset_carrier: "indep_in E X ==> X ⊆E" unfolding indep_in_def by auto
lemma indep_in_subI_subset: assumes"E' ⊆E" assumes"indep_in E' X" shows"indep_in E X" proof - have"indep_in E moreover have "X ∩E = X" using assms indep_in_subset_carrier by auto ultimately show ?thesis by auto qed
lemma indep_in_supI: assumes "X ⊆E'" "E' ⊆E" assumes "indep_in E X" shows "indep_in E' X" proof - have "X ∩E' = X" using assms by auto then show ?thesis using assms indep_in_subI[where E = E and E' = E' and X = X] by auto qed
lemma indep_in_indep: "indep_in E X ==> indep X" unfolding indep_in_def by auto
lemma indep_system_subset [simp, intro]: assumes "E⊆ carrier" shows "indep_system E (indep_in E)" unfolding indep_system_def indep_in_def using finite_subset[OF assms carrier_finite] indep_subset by auto
text ‹ We will work a lot with different sub structures. Therefore, every definition `foo' will have a counterpart `foo\_in' which has the ground set as an additional parameter. Furthermore, every result about `foo' will have another result about `foo\_in'. With this, we usually don't have to work with @{command interpretation} in proofs. \<close>
context fixes E assumes "E⊆ carrier"
E: indep_system E "indep_in E"
using ‹E⊆ carrier› by auto
indep_in_sub_cong:
assumes "E' ⊆E"
shows "E.indep_in E' X ⟷ indep_in E' X"
unfolding E.indep_in_def indep_in_def using assms by auto
indep_not_basis:
assumes "indep X"
assumes "¬ basis X"
shows "∃x ∈ carrier - X. indep (insert x X)" by(auto simp add: get_ancestors_si_defof cchild] intro!: bind_pure_I
using assms basisI by auto
basis_subset_eq:
assumes "basis B1"
assumes "basis B2"
assumes "B1⊆ B2"
shows "B1 = B2"
(rule ccontr)
assume "B1≠ B2"
then obtain x where x: "x ∈ B2 - B1" using assms by auto
then have "insert x B1⊆ B2" using assms by auto
then have "indep (insert x B1)" using assms basis_indep[of B2] indep_subset by auto
moreover have "x ∈ carrier - B1" using assms x basis_subset_carrier by auto
ultimately show False using assms basisD by auto
basis_in where
"basis_in E X ⟷ indep_system.basis E (indep_in E) X"
basis_iff_basis_in: "basis B ⟷ basis_in carrier B"
-
interpret E: indep_system carrier "indep_in carrier"
by auto
show "basis B ⟷ basis_in carrier B"
unfolding basis_in_def
proof (standard, goal_cases LTR RTL)
case LTR
show ?case
proof (rule E.basisI)
show "indep_in carrier B" using LTR basisD indep_subset_carrier indep_inI by auto
next
fix x
assume "x ∈ carrier - B"
then have "¬ indep (insert x B)" using LTR basisD by auto
then show "¬ carrier (insert x B)" using indep_inD by auto
qed
next
case RTL
show ?case
proof (rule basisI)
show "indep B" using RTL E.basis_indep indep_inD by blast
next
fix x
assume "x ∈ carrier - B"
then have "¬ indep_in carrier (insert x B)" using RTL E.basisD by auto
then show "¬ indep (insert x B)" using indep_subset_carrier indep_inI by blast
qed
qed
fixes E
assumes "E⊆ carrier"
E: indep_system E "indep_in E"
using ‹E⊆ carrier› by auto
basis_inI_aux: "E.basis X ==> basis_in E X"
unfolding basis_in_def by auto
basis_inD_aux: "basis_in E X ==>E.basis X"
unfolding basis_in_def by auto
not_basis_inD_aux: "¬ basis_in E X ==>¬E.basis X"
using basis_inI by auto
basis_in_sub_cong:
assumes "E' ⊆E"
shows "E.basis_in E' B ⟷ basis_in E' B"
(safe, goal_cases LTR RTL)
case LTR
show ?case
proof (rule basis_inI)
show "E' ⊆ carrier" using assms * by auto
next
show "indep_in E' B"
using * assms LTR E.basis_in_subset_carrier E.basis_in_indep_in indep_in_sub_cong by auto
next
fix x
assume "x ∈E' - B"
then show "¬ indep_in E' (insert x B)"
using * assms LTR E.basis_in_max_indep_in E.basis_in_subset_carrier indep_in_sub_cong by auto
qed
case RTL
show ?case
proof (rule E.basis_inI)
show "E' ⊆E" using assms by auto
next
show "E.indep_in E' B"
using * assms RTL basis_in_subset_carrier basis_in_indep_in indep_in_sub_cong by auto
next
fix x
assume "x ∈E' - B"
then show "¬E.indep_in E' (insert x B)"
using * assms RTL basis_in_max_indep_in basis_in_subset_carrier indep_in_sub_cong by auto
qed
‹Circuits›
‹
A \emph{circuit} is a minimal dependent set, i.\,e.\ a set which becomes independent on removing
any element of the ground set. ›
circuit where "circuit X ⟷ X ⊆ carrier ∧¬ indep X ∧ (∀x ∈ X. indep (X - {x}))"
circuitI:
assumes "X ⊆ carrier"
assumes "¬ indep X"
assumes "∧x. x ∈ X ==> indep (X - {x})"
shows "circuit X"
using assms unfolding circuit_def by auto
circuit_subset_carrier: "circuit X ==> X ⊆ carrier"
unfolding circuit_def by auto
circuit_finite [simp] = finite_subset[OF circuit_subset_carrier carrier_finite]
circuit_dep: "circuit X ==>¬ indep X"
unfolding circuit_def by auto
circuit_min_dep: "circuit X ==> x ∈ X ==> indep (X - {x})"
unfolding circuit_def by auto
circuit_nonempty: "circuit X ==> X ≠ {}"
using circuit_dep indep_empty by blast
dep_not_circuit:
assumes "X ⊆ carrier"
assumes "¬ indep X"
assumes "¬ circuit X"
shows "∃x ∈ X. ¬ indep (X - {x})"
using assms circuitI by auto
circuit_subset_eq:
assumes "circuit C1"
assumes "circuit C2"
assumes "C1⊆ C2"
shows "Cshow ?case
(rule ccontr)
assume "C1≠ C2"
then obtain x where "x ∉ C1" "x ∈ C2" using assms by auto
then have "indep C1" using indep_subset ‹C1⊆ C2› circuit_min_dep[OF ‹circuit C2›, of x] by auto
then show False using assms circuitD by auto
circuit_in where
"circuit_in E X ⟷ indep_system.circuit E (indep_in E) X"
fixes E
assumes "E⊆ carrier"
E: indep_system E "indep_in E"
using ‹E⊆ carrier› by auto
circuit_inI_aux: "E.circuit X ==> circuit_in E X"
unfolding circuit_in_def by auto
circuit_inD_aux: "circuit_in E X ==>E.circuit X"
unfolding circuit_in_def by auto
not_circuit_inD_aux: "¬ circuit_in E X ==>¬E.circuit X"
using circuit_inI_aux by auto
circuit_in_subI:
assumes "E' ⊆E" "E⊆ carrier"
assumes "circuit_in E' C"
shows "circuit_in E C"
(rule circuit_inI)
show "E⊆ carrier" using assms by auto
show "C ⊆E" using assms circuit_in_subset_carrier[of E' C] by auto
show "¬ indep_in E C"
using assms
circuit_in_dep_in[where E = E' and X = C]
circuit_in_subset_carrier dep_in_subI[where E' = E' and E = E]
by auto
fix x
assume "x ∈ C"
then show "indep_in E (C - {x})"
using assms circuit_in_min_dep_in indep_in_subI_subset by auto
circuit_in_supI:
assumes "E' ⊆E" "E⊆ carrier" "C ⊆E'"
assumes "circuit_in E C"
shows "circuit_in E' C"
(rule circuit_inI)
show "E' ⊆ carrier" using assms by auto
show "C ⊆E'" using assms by auto
have "¬ indep_in E C" using assms circuit_in_dep_in by auto
then show "¬ indep_in E' C" using assms dep_in_subI[of C E] by auto
fix x
assume "x ∈ C"
then have "indep_in E (C - {x})" using assms circuit_in_min_dep_in by auto
then have "indep_in E' ((C - {x}) ∩E')" using indep_in_subI by auto
moreover have "(C - {x}) ∩E' = C - {x}" using assms circuit_in_subset_carrier by auto
ultimately show "indep_in E' (C - {x})" by auto
fixes E
assumes *: "E⊆ carrier"
E: indep_system E "indep_in E"
using * by auto
circuit_in_sub_cong:
assumes "E' ⊆E"
shows "E.circuit_in E' C ⟷ circuit_in E' C"
(safe, goal_cases LTR RTL)
case LTR
show ?case
proof (rule circuit_inI)
show "E' case None
next
show "C ⊆E'"
using assms LTR E.circuit_in_subset_carrier by auto
next
show "¬ indep_in E' C"
using assms LTR E.circuit_in_dep_in indep_in_sub_cong[OF *] by auto
next
fix x
assume "x ∈ C"
then show "indep_in E' (C - {x})"
using assms LTR E.circuit_in_min_dep_in indep_in_sub_cong[OF *] by auto
qed
case RTL
show ?case
proof (rule E.circuit_inI)
show "E' ⊆E" using assms * by auto
next
show "C ⊆E'"
using assms * RTL circuit_in_subset_carrier by auto
next
show "¬E.indep_in E' C"
using assms * RTL circuit_in_dep_in indep_in_sub_cong[OF *] by auto
next
fix x
assume "x ∈ C"
then show "E.indep_in E' (C - {x})"
using assms * RTL circuit_in_min_dep_in indep_in_sub_cong[OF *] by auto
qed
circuit_imp_circuit_in:
assumes "circuit C"
shows "circuit_in carrier C"
(rule circuit_inI)
show "C ⊆ carrier" using circuit_subset_carrier[OF assms] .
show "¬ indep_in carrier C" using circuit_dep[OF assms] indep_in_indep by auto
fix x
assume "x ∈ C"
then have "indep (C - {x})" using circuit_min_dep[OF assms] by auto
then show "indep_in carrier (C - {x})" using circuit_subset_carrier[OF assms] by (auto intro: indep_inI)
auto
‹Relation between independence and bases›
‹
A set is independent iff it is a subset of a basis. ›
indep_imp_subset_basis:
assumes "indep X"
shows "∃B. basis B ∧ X ⊆ B"
using assms
(induction X rule: psubset_inc_induct)
case carrier
show ?case using indep_subset_carrier[OF assms] .
case (step X)
{
assume "¬ basis X"
then obtain x where "x ∈ carrier" "x ∉ X" "indep (insert x X)"
using step.prems indep_not_basis by auto
then have ?case using step.IH[of "insert x X"] indep_subset_carrier by auto
}
then show ?case by auto
indep_iff_subset_basis: "indep X ⟷ (∃B. basis B ∧ X ⊆ B)"
using indep_imp_subset_basis subset_basis_imp_indep by auto
basis_ex: "∃B. basis B"
using indep_imp_subset_basis[OF indep_empty] by auto
fixes E
assumes *: "E⊆ carrier"
E: indep_system E "indep_in E"
using * by auto
indep_in_imp_subset_basis_in:
assumes "indep_in E X"
shows "∃B. basis_in E B ∧ X ⊆ B"
unfolding basis_in_def usiusing E.indep_imp_subset_basis[OF asassms] .
indep_in_iff_subset_basis_in: "indep_in E X ⟷ (∃B. basis_in E B ∧ X ⊆ B)"
using indep_in_imp_subset_basis_in subset_basis_in_imp_indep_in by auto
basis_in_ex: "∃B. basis_in E B"
unfolding basis_in_def using E.basis_ex .
basis_in_subI:
assumes "E' ⊆E" "E⊆ carrier"
assumes "basis_in E' B"
shows "∃B' ⊆E - E'. basis_in E (B ∪ B')"
-
have "indep_in E B" using assms basis_in_indep_in indep_in_subI_subset by auto
then obtain B' where B': "basis_in E B'" "B ⊆ B'"
using assms indep_in_imp_subset_basis_in[of B] by auto
show ?thesis
proof (rule exI)
have "B' - B ⊆E - E'"
proof
fix x
assume *: "x ∈ B' - B"
then have "x ∈E" "x ∉ B"
using assms ‹basis_in E B'› basis_in_subset_carrier[of E] by auto
moreover {
assume "x ∈E'"
moreover have "indep_in E (insert x B)"
using * assms indep_in_subset[OF _ basis_in_indep_in] B' by auto
ultimately have "indep_in E' (insert x B)"
using assms basis_in_subset_carrier unfolding indep_in_def by auto
then have False using assms * ‹x ∈E'› basis_in_max_indep_in by auto
}
ultimately show "x ∈E - E'" by auto
qed
moreover have "B ∪ (B' - B) = B'" using ‹B ⊆ B'› by auto
ultimately show "B' - B ⊆E - E' ∧ basis_in E (B ∪ (B' - B))"
using ‹basis_in E B'› by auto
qed
basis_in_supI:
assumes "B ⊆E'" "E' ⊆E" "E⊆ carrier"
assumes "basis_in E B"
shows "basis_in E' B"
(rule basis_inI)
show "E' ⊆ carrier" using assms by auto
show "indep_in E' B"
proof -
have "indep_in E' (B ∩E')"
using assms basis_in_indep_in[of E B] indep_in_subI by auto
moreover have "B ∩E' = B" using assms by auto
ultimately show ?thesis by auto
qed
show "∧x. x ∈E' - B ==>¬ indep_in E' (insert x B)"
using assms basis_in_subset_carrier basis_in_max_indep_in dep_in_subI[of _ EE'] by auto
‹Relation between dependence and circuits›
‹
A set is dependent iff it contains a circuit. ›
dep_imp_supset_circuit:
assumes "X ⊆ carrier"
assumes "¬ indep X"
shows "∃C. circuit C ∧ C ⊆ X"
using assms
(induction X rule: remove_induct)
case (remove X)
{
assume "¬ circuit X"
then obtain x where "x ∈ X" "¬ indep (X - {x})"
using remove.prems dep_not_circuit by auto
then obtain C where "circuit C" "C ⊆ X - {x}"
using remove.prems remove.IH[of x] by auto
then have ?case by auto
}
then show ?case using remove.prems by auto
(auto simp add: carrier_finite finite_subset)
supset_circuit_imp_dep:
assumes "circuit C ∧ C ⊆ X"
shows "¬ indep X"
using assms indep_subset circuit_dep by auto
dep_iff_supset_circuit:
assumes "X ⊆ carrier"
shows "¬ indep X ⟷ (∃C. circuit C ∧ C ⊆ X)"
using assms dep_imp_supset_circuit supset_circuit_imp_dep by auto
fixes E
assumes "E⊆ carrier"
E: indep_system E "indep_in E"
using ‹E⊆ carrier› by auto
dep_in_imp_supset_circuit_in:
assumes "X ⊆E"
assumes "¬ indep_in E X"
shows "∃C. circuit_in E C ∧ C ⊆ X"
unfolding circuit_in_def using E.dep_imp_supset_circuit[OF assms] .
supset_circuit_in_imp_dep_in:
assumes "circuit_in E C ∧ C ⊆ X"
shows "¬ indep_in E X"
using assms E.supset_circuit_imp_dep unfolding circuit_in_def by auto
dep_in_iff_supset_circuit_in:
assumes "X ⊆E"
shows "¬ indep_in E X ⟷ (∃C. circuit_in E C ∧ C ⊆ X)"
using assms dep_in_imp_supset_circuit_in supset_circuit_in_imp_dep_in by auto
‹Ranks›
lower_rank_of :: "'a set ==> nat" where
"lower_rank_of carrier' ≡ Min {card B | B. basi
upper_rank_of :: "'a set ==> nat" where
"upper_rank_of carrier' ≡ Max {card B | B. basis_in carrier' B}"
collect_basis_finite: "finite (Collect basis)"
-
have "Collect basis ⊆ {X. X ⊆ carrier}"
using basis_subset_carrier by auto
moreover have "finite …"
using carrier_finite by auto
ultimately show ?thesis using finite_subset by auto
fixes E
assumes *: "E⊆ carrier"
E: indep_system E "indep_in E"
using * by auto
collect_basis_in_finite: "finite (Collect (basis_in E))"
unfolding basis_in_def using E.collect_basis_finite .
lower_rank_of_le: "lower_rank_of E≤ card E"
-
have "∃ {card B | B. basis_in E B}. n ≤
using card_mono[OF E.carrier_finite basis_in_subset_carrier[OF *]] basis_in_ex[OF *] by auto
moreover have "finite {card B | B. basis_in E B}"
using collect_basis_in_finite by auto
ultimately show ?thesis
unfolding lower_rank_of_def using basis_ex Min_le_iff by auto
upper_rank_of_le: "upper_rank_of E≤ card E"
-
have "∀n ∈ {card B | B. basis_in E B}. n ≤ card E"
using card_mono[OF E.carrier_finite basis_in_subset_carrier[OF *]] by auto
then show ?thesis
unfolding upper_rank_of_def using basis_in_ex[OF *] collect_basis_in_finite by auto
fixes E'
assumes **: "E' ⊆E"
E'1: indep_system E' "indep_in E'"
using * ** by auto E'2: indep_system E' "E.indep_in E'"
using * ** by auto
lower_rank_of_sub_cong:
shows "E.lower_rank_of E' = lower_rank_of E'"
-
have "∧B. E'1.basis B ⟷E'2.basis B"
using ** basis_in_sub_cong[OF *, of E']
unfolding basis_in_def E.basis_in_def by auto
then show ?thesis
unfolding lower_rank_of_def E.lower_rank_of_def
using basis_in_sub_cong[OF * **]
by auto
upper_rank_of_sub_cong:
shows "E.upper_rank_of E' = upper_rank_of E'"
-
have "∧B. E'1.basis B ⟷E'2.basis B"
using ** basis_in_sub_cong[OF *, of E']
unfolding basis_in_def E.basis_in_def by auto
then show ?thesis
unfolding upper_rank_of_def E.upper_rank_of_def
using basis_in_sub_cong[OF * **]
by auto
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.