Independencesystems
*) section‹Independence systems›j] 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 (rule wf_bounded_set[where ub = "λ_. A"and f = id]) (auto simp add: ‹finite A›) 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 ==> by (auto simp add: e_deio_eq_def 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]: " {}"
using indep_ex indep_subset by auto
‹Sub-independence systems›
‹
A subset of the ground set induces an independenc using ‹ rvars_eq eq› ›
indep_in where "indep_in E X ⟷ X ⊆E∧ indep X"
indep_inI:
assumes "X ⊆E"
assumes "indep X"
shows "indep_in E X"
using assms unfolding indep_in_def by auto
indep_in_subI: "indep_in E X ==> indep_in E' (X ∩
using indep_subset unfolding indep_in_def by auto
dep_in_subI:
assumes "X ⊆E'"
shows "¬ indep_in E' X ==>¬ indep_in E X"
using assms unfolding indep_in_def by auto
indep_in_subset_carrier: "indep_in E X ==> X ⊆E"
unfolding indep_in_def by auto
indep_in_subI_subset:
assumes "E' ⊆E"
assumes "indep_in E' X"
shows "indep_in E X"
-
have "indep_in E (X ∩E)" using assms indep_in_subI by auto
moreover have "X ∩E = X" using assms indep_in_subset_carrier by auto
ultimately show ?thesis by auto
indep_in_supI:
assumes "X ⊆E'" "E' ⊆E"
assumes "indep_in E X"
shows "indep_in E' X"
-
have "X "X 🚫
java.lang.NullPointerException
indep_in_indep: "indep_in E X ==> indep X"
unfolding indep_in_def by auto
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 carr using <>x ‹ rvars_eq eq›lhs eq ∉ rvars_eq eq›
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. ›
context fixesE assumes"E⊆ begin
interpretation E: indep_system E "indep_in E" using ‹E⊆ carrier› by auto
lemma 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
text ‹ A \emph{basis} is a maximal independent set, i.\,e.\ an independent set which becomes dependent on inserting any element of the ground set. \<close>
definition basis where " X ⟷ indep X ∧ (∀x ∈ carrier - X. ¬ indep (insert x X))"
basisI:
assumes "indep X"
assumes "∧ carrier - X ==>
shows "basis X"
using assms unfolding basis_def by auto
basis_indep: "basis X ==> indep X"
unfolding basis_def by auto
basis_max_indep: "basis X ==> x ∈ carrier - X ==>¬ indep (insert x X)"
unfolding basis_def by auto
indep_not_basis:
assumes "indep X"
assumes "¬ basis X"
shows "∃
using assms basisI by auto
basis_subset_eq:
assumes "basis B1"
assumes "basis B2"
assumes "B1⊆ B2"
shows "B1 = B2"
(rule ccontr)
java.lang.NullPointerException
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 B{lhs eq} \<unionj})"
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"
have *:"cef rh q) (lhseq) 0
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 "¬ indep_in 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"
enhe"\not>inep_n cre insrtxB)"ui TL<>.
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: "Eusing ‹
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_aux by auto
basis_in_sub_cong:
assumes "E' ⊆Eusing 🚫 eq›
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 ∈ rvars_eq eq ==>ar ( x =0
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 ‹
any element of the ground set. ›
circuit where "circuit X ⟷ X ⊆ carrier ∧¬ indep X ∧ (∀x ∈ X. indep (X - {x}))"
circuitI:
assumes "X ⊆ carrier"
assumes "¬of "lhs eq"" 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 ==>
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
circui:
assumes "circuit C1"
assumes "circuit C2"
assumes "C1⊆ C2"
shows "C1 = C2"
(rule ccontr)
assume "C1≠ C‹ rvarseq›lhs eq ∉ rvars_eq eq›
then obtain x where "x ∉ C1" "x ∈ C2" using assms by auto
java.lang.NullPointerException
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›
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"
(rh(pi eqx\^ < "
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"
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
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⊆>)"
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' ⊆
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
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
then show "E.indep_in E' (C - {x})"
using assms * RTL circuit_in_min_dep_in indep_in_sub_cong[OF *] by auto
qed
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
‹
‹
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_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 .
bst_var v lp' lp ≡ + (coeff lp v) *R lplp' - (coe lp v) *R (Var v)"
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 autoefin "subst_var_eq_code = SubstVar.subst_var_eq subst_var"
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 ‹SubstVar ubs rewrites
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"
"SbstVar.subst_var_e subst_var = subst_var_eq_code"
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›
‹j lp' lp
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 "¬\<>x lp xj *R Var x'rbrak> ==>∈
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› <> j *R lp' - co lxj"
dep_in_imp_supset_circuit_in:
assumes "X ⊆E"
assumes "¬ indep_in E X"
shows "∃C. circuit_in E C ∧efl \<>j *R lp' - coeff lp x*R ^sub)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 ∧" ∉
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. basis_in carrier' B}"
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 "∃n ∈ {card B | B. basis_in E B}. n ≤ card E"
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
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[
fixes E'
assumes **: "E' ⊆E"
E'1: indep_system E' "indep_in E'"
* * b uo 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'lp x = 0"
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.