Theory Proper_Venn_Regions
theory Proper_Venn_Regions
imports MLSSmf_Semantics MLSSmf_to_MLSS MLSSmf_HF_Extras
begin
locale proper_Venn_regions =
fixes V :: "'a set"
and π :: "'a β hf"
assumes finite_V: "finite V"
begin
fun proper_Venn_region :: "'a set β hf" where
"proper_Venn_region Ξ± = β¨
HF (π ` Ξ±) - β¨HF (π ` (V - Ξ±))"
lemma proper_Venn_region_nonempty_iff[iff]:
"c ββ proper_Venn_region Ξ± β§ Ξ± β V β· Ξ± = {x β V. c ββ π x} β§ Ξ± β {}"
proof(standard, goal_cases)
case 1
then have "c ββ proper_Venn_region Ξ±" "Ξ± β V" by blast+
show ?case
proof(standard, standard, goal_cases)
case 1
then show ?case
proof
fix x assume "x β Ξ±"
have "c ββ β¨
HF (π ` Ξ±)"
using βΉc ββ proper_Venn_region Ξ±βΊ by auto
then have "c ββ π x"
using βΉx β Ξ±βΊ
by (metis (mono_tags, opaque_lifting) HInter_hempty HInter_iff hempty_iff hmem_HF_iff imageI)
then show "x β {x β V. c ββ π x}"
using βΉΞ± β VβΊ βΉx β Ξ±βΊ by blast
qed
next
case 2
then show ?case
proof
fix x assume "x β {x β V. c ββ π x}"
then have "x β V" "c ββ π x" by blast+
show "x β Ξ±"
proof (rule ccontr)
assume "x β Ξ±"
then have "x β V - Ξ±"
using βΉΞ± β VβΊ βΉx β VβΊ by blast
then have "c ββ β¨HF (π ` (V - Ξ±))"
using βΉc ββ π xβΊ finite_V by auto
then have "c ββ proper_Venn_region Ξ±" by simp
then show False
using βΉc ββ proper_Venn_region Ξ±βΊ by blast
qed
qed
next
case 3
then show ?case
proof (rule ccontr)
assume "Β¬ Ξ± β {}"
then have "Ξ± = {}" by fast
then have "proper_Venn_region Ξ± = 0"
using Zero_hf_def by auto
then show False
using βΉc ββ proper_Venn_region Ξ±βΊ by simp
qed
qed
next
case 2
then have "Ξ± = {x β V. c ββ π x}" "Ξ± β {}" by simp+
then have "Ξ± β V" by blast
moreover
from 2 finite_V have "finite Ξ±" by force
then have "finite (π ` Ξ±)" by blast
then have "finite (π ` (V - Ξ±))"
using finite_V by fast
from βΉΞ± β {}βΊ have "π ` Ξ± β {}" by blast
from 2 have "βx β Ξ±. c ββ π x" by simp
then have "βx β π ` Ξ±. c ββ x" by blast
then have "c ββ β¨
HF (π ` Ξ±)"
using βΉfinite (π ` Ξ±)βΊ βΉπ ` Ξ± β {}βΊ
by (metis HInter_iff hfset_0 hfset_HF hmem_HF_iff)
moreover
have "c ββ β¨HF (π ` (V - Ξ±))"
proof
assume "c ββ β¨HF (π ` (V - Ξ±))"
then obtain x where "c ββ x" "x β π ` (V - Ξ±)" by auto
then have "x β π ` (V) - π ` Ξ±"
using 2 by fastforce
then have "x β π ` Ξ±" by blast
then show False
using βΉc ββ xβΊ 2 βΉx β π ` (V - Ξ±)βΊ by blast
qed
ultimately show ?case by auto
qed
lemma proper_Venn_region_strongly_injective:
assumes "proper_Venn_region Ξ± β proper_Venn_region Ξ² β 0"
and "Ξ± β V"
and "Ξ² β V"
shows "Ξ± = Ξ²"
proof -
from βΉproper_Venn_region Ξ± β proper_Venn_region Ξ² β 0βΊ
obtain c where c: "c ββ proper_Venn_region Ξ±" "c ββ proper_Venn_region Ξ²"
by blast
then have "Ξ± = {x β V. c ββ π x}" "Ξ² = {x β V. c ββ π x}"
using βΉΞ± β VβΊ βΉΞ² β VβΊ
using proper_Venn_region_nonempty_iff by (metis (mono_tags, lifting))+
then show "Ξ± = Ξ²" by presburger
qed
lemma proper_Venn_region_disjoint:
"Ξ± β Ξ² βΉ Ξ± β V βΉ Ξ² β V βΉ proper_Venn_region Ξ± β proper_Venn_region Ξ² = 0"
using proper_Venn_region_strongly_injective by meson
lemma HUnion_proper_Venn_region_union:
assumes "l β Pβ§+ V"
and "m β Pβ§+ V"
shows "β¨HF (proper_Venn_region ` (l βͺ m)) = β¨HF (proper_Venn_region ` l) β β¨HF(proper_Venn_region ` m)"
by (metis HUnion_hunion P_plus_finite assms(1) assms(2) finite_V finite_imageI finite_subset image_Un union_hunion)
lemma HUnion_proper_Venn_region_inter:
assumes "l β Pβ§+ V"
and "m β Pβ§+ V"
shows "β¨HF (proper_Venn_region ` (l β© m)) = β¨HF (proper_Venn_region ` l) β β¨HF(proper_Venn_region ` m)"
proof -
from βΉl β Pβ§+ VβΊ have "finite l"
using finite_V P_plus_finite by (metis finite_subset)
from βΉm β Pβ§+ VβΊ have "finite m"
using finite_V P_plus_finite by (metis finite_subset)
have "β¨HF (proper_Venn_region ` (l β© m)) β€ β¨HF (proper_Venn_region ` l) β β¨HF (proper_Venn_region ` m)"
using proper_Venn_region_disjoint βΉfinite lβΊ βΉfinite mβΊ
by auto
moreover
have "c ββ β¨HF (proper_Venn_region ` (l β© m))" if "c ββ β¨HF (proper_Venn_region ` l) β β¨HF (proper_Venn_region ` m)" for c
proof -
from that have "c ββ β¨HF (proper_Venn_region ` l)" "c ββ β¨HF (proper_Venn_region ` m)" by blast+
then obtain Ξ± Ξ² where "Ξ± β l" "Ξ² β m" and c_mem: "c ββ proper_Venn_region Ξ±" "c ββ proper_Venn_region Ξ²" by auto
with βΉl β Pβ§+ VβΊ βΉm β Pβ§+ VβΊ finite_V have "Ξ± β V" "Ξ² β V" by auto
with proper_Venn_region_strongly_injective c_mem have "Ξ± = Ξ²" by blast
with βΉΞ± β lβΊ βΉΞ² β mβΊ have "Ξ± β l β© m" by blast
with c_mem show ?thesis
using HUnion_iff βΉfinite lβΊ hmem_def by auto
qed
then have "β¨HF (proper_Venn_region ` l) β β¨HF (proper_Venn_region ` m) β€ β¨HF (proper_Venn_region ` (l β© m))" by blast
ultimately show ?thesis by order
qed
text βΉβ_{Ξ±βL_y} v_Ξ± = yβΊ
lemma variable_as_composition_of_proper_Venn_regions:
assumes "y β V"
shows "β¨HF (proper_Venn_region ` β V y) = π y"
proof(standard; standard)
fix c assume c: "c ββ β¨HF (proper_Venn_region ` (β V y))"
then obtain Ξ± where Ξ±: "Ξ± β β V y" "c ββ proper_Venn_region Ξ±"
by auto
then have "y β Ξ±" using βΉy β VβΊ by fastforce
then have "π y β π ` Ξ±" by blast
from finite_V βΉΞ± β β V yβΊ βΉy β VβΊ have "finite Ξ±" "Ξ± β {}" by auto
then have "finite (π ` Ξ±)" "π ` Ξ± β {}" by simp+
with βΉπ y β π ` Ξ±βΊ have "β¨
(HF (π ` Ξ±)) β€ π y"
by (metis HInter_iff hfset_0 hfset_HF hmem_HF_iff hsubsetI)
then show "c ββ π y"
using Ξ± by fastforce
next
fix c assume "c ββ π y"
let ?Ξ± = "{x β V. c ββ π x}"
from βΉc ββ π yβΊ βΉy β VβΊ have "y β ?Ξ±" by blast
then have "?Ξ± β β V y" by auto
then have "?Ξ± β {}" by auto
then have "c ββ proper_Venn_region ?Ξ±"
using proper_Venn_region_nonempty_iff
by (metis (mono_tags, lifting))
moreover
from βΉ?Ξ± β β V yβΊ have "proper_Venn_region ?Ξ± β proper_Venn_region ` β V y" by fast
moreover
have "finite (β V y)" using finite_V by simp
ultimately
show "c ββ β¨HF (proper_Venn_region ` (β V y))"
by (smt (verit, best) HUnion_iff finite_imageI hmem_HF_iff)
qed
lemma proper_Venn_region_subset_variable_iff:
assumes "Ξ± β V"
and "x β V"
and "proper_Venn_region Ξ± β 0"
shows "x β Ξ± β· proper_Venn_region Ξ± β€ π x"
proof
assume "x β Ξ±"
then have "β¨
HF (π ` Ξ±) β€ π x" using βΉΞ± β VβΊ finite_V
by (smt (verit, ccfv_SIG) HInter_iff ball_imageD finite_imageI hemptyE hmem_HF_iff hsubsetI rev_finite_subset)
then show "proper_Venn_region Ξ± β€ π x" by auto
next
assume "proper_Venn_region Ξ± β€ π x"
moreover
from variable_as_composition_of_proper_Venn_regions βΉx β VβΊ
have "π x = β¨HF (proper_Venn_region ` β V x)"
by presburger
ultimately
have "proper_Venn_region Ξ± β€ β¨HF (proper_Venn_region ` β V x)"
by argo
show "x β Ξ±"
proof (rule ccontr)
assume "x β Ξ±"
then have "Ξ± β β V x" by simp
moreover
from βΉproper_Venn_region Ξ± β€ β¨HF (proper_Venn_region ` β V x)βΊ βΉproper_Venn_region Ξ± β 0βΊ
have "proper_Venn_region Ξ± β β¨HF (proper_Venn_region ` β V x) β 0" by fast
then obtain Ξ² where "Ξ² β β V x" "proper_Venn_region Ξ± β proper_Venn_region Ξ² β 0"
by auto
with proper_Venn_region_strongly_injective have "Ξ± = Ξ²"
using βΉΞ² β β V xβΊ βΉΞ± β VβΊ by auto
with βΉΞ² β β V xβΊ have "Ξ± β β V x" by blast
ultimately
show False by blast
qed
qed
end
end