File size: 14,905 Bytes
d5b7741 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | import OAI.Combinatorics.ContingencyTables.Transport.ObservableBounds
namespace OAI
/-!
# The manuscript's original omission coordinates
Complementation reverses defect labels and their multipliers. We prove the
actual chain energy, conditional projection, and variance identities before
transferring the variance and observable inequalities back to the original
factorial lift f. The final theorems assume its omission property.
-/
namespace ContingencyTables.ComplementChain
open scoped BigOperators Classical
open CommonBasesFPRAS BinaryContraction DegreeCompletion PairedComplement ObservableVariance ObservableBounds
variable {Γ : Type*} [Fintype Γ] [DecidableEq Γ]
omit [Fintype Γ] [DecidableEq Γ] in
lemma plain_complement (gs : List (Γ × Γ)) (S : Set Γ) :
PlainState gs Sᶜ ↔ PlainState gs S := by
unfold PlainState PairSingle
simp only [Set.mem_compl_iff]
constructor <;> intro h p hp <;> have hh := h p hp <;> tauto
omit [Fintype Γ] [DecidableEq Γ] in
lemma defect_complement (gs : List (Γ × Γ)) (p r : Γ × Γ) (S : Set Γ) :
DefectState gs p r Sᶜ ↔ DefectState gs r p S := by
unfold DefectState PairEmpty PairFull PairSingle
simp only [Set.mem_compl_iff, not_not]
constructor
· rintro ⟨hp,hr,hpr,hep,hfr,hs⟩
refine ⟨hr,hp,hpr.symm,hfr,hep,?_⟩
intro t ht htr htp
have h := hs t ht htp htr
tauto
· rintro ⟨hr,hp,hrp,her,hfp,hs⟩
refine ⟨hp,hr,hrp.symm,hfp,her,?_⟩
intro t ht htp htr
have h := hs t ht htr htp
tauto
omit [Fintype Γ] [DecidableEq Γ] in
lemma state_complement (gs : List (Γ × Γ)) (S : Set Γ) :
ChainState gs Sᶜ ↔ ChainState gs S := by
unfold ChainState
rw [plain_complement]
constructor
· rintro (h | ⟨p,r,h⟩)
· exact Or.inl h
· exact Or.inr ⟨r,p,(defect_complement gs p r S).mp h⟩
· rintro (h | ⟨p,r,h⟩)
· exact Or.inl h
· exact Or.inr ⟨r,p,(defect_complement gs r p S).mpr h⟩
omit [Fintype Γ] [DecidableEq Γ] in
lemma adjacent_complement (S T : Set Γ) : ExchangeAdjacent Sᶜ Tᶜ ↔ ExchangeAdjacent S T := by
have hf (S T : Set Γ) (h : ExchangeAdjacent S T) : ExchangeAdjacent Sᶜ Tᶜ := by
obtain ⟨A,a,b,hab,ha,hb,rfl,rfl⟩ := h
let B := (insert a (insert b A))ᶜ
refine ⟨B,b,a,hab.symm,?_,?_,?_,?_⟩
· simp [B]
· simp [B]
· ext x
simp only [B, Set.mem_compl_iff, Set.mem_insert_iff]
constructor
· intro hx
by_cases hxb : x = b
· exact Or.inl hxb
· exact Or.inr (by tauto)
· intro hx
rcases hx with rfl | hx
· exact not_or.mpr ⟨hab.symm, hb⟩
· tauto
· ext x
simp only [B, Set.mem_compl_iff, Set.mem_insert_iff]
constructor
· intro hx
by_cases hxa : x = a
· exact Or.inl hxa
· exact Or.inr (by tauto)
· intro hx
rcases hx with rfl | hx
· exact not_or.mpr ⟨hab, ha⟩
· tauto
exact ⟨fun h => by simpa using hf Sᶜ Tᶜ h, hf S T⟩
omit [Fintype Γ] [DecidableEq Γ] in
def complementEquiv : Set Γ ≃ Set Γ where
toFun := compl
invFun := compl
left_inv := compl_compl
right_inv := compl_compl
omit [Fintype Γ] [DecidableEq Γ] in
def reverseMultiplier (w : (Γ × Γ) → (Γ × Γ) → ℝ) : (Γ × Γ) → (Γ × Γ) → ℝ :=
fun p r => w r p
lemma multiplier_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (S : Set Γ) :
chainMultiplier gs (reverseMultiplier w) Sᶜ = chainMultiplier gs w S := by
by_cases he : ∃ p r, DefectState gs p r S
· obtain ⟨p,r,h⟩ := he
rw [chainMultiplier_defect gs _ Sᶜ ((defect_complement gs r p S).mpr h),
chainMultiplier_defect gs w S h]
rfl
· have hec : ¬ ∃ p r, DefectState gs p r Sᶜ := by
rintro ⟨p,r,h⟩
exact he ⟨r,p,(defect_complement gs p r S).mp h⟩
simp only [chainMultiplier, dite_eq_right he, dite_eq_right hec]
lemma weight_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ)
(f : Set Γ → ℝ) (S : Set Γ) :
chainWeight gs (reverseMultiplier w) (complementWeight f) Sᶜ = chainWeight gs w f S := by
simp only [chainWeight, multiplier_complement, complementWeight, compl_compl]
lemma chain_sum_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ)
(f J : Set Γ → ℝ) :
(∑ S ∈ chainStates gs, chainWeight gs (reverseMultiplier w) (complementWeight f) S * J S) =
∑ S ∈ chainStates gs, chainWeight gs w f S * J Sᶜ := by
simp only [chainStates, Finset.sum_filter]
apply Fintype.sum_equiv complementEquiv
intro S
change (if ChainState gs S then _ else 0) = (if ChainState gs Sᶜ then _ else 0)
rw [state_complement]
by_cases h : ChainState gs S
· simp only [ite_eq_left h]
have hw := weight_complement gs w f Sᶜ
simp only [compl_compl] at hw
rw [hw]
simp only [complementEquiv, Equiv.coe_fn_mk, compl_compl]
· simp only [ite_eq_right h]
lemma total_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (f : Set Γ → ℝ) :
chainTotal gs (reverseMultiplier w) (complementWeight f) = chainTotal gs w f := by
simpa only [chainTotal, mul_one] using chain_sum_complement gs w f (fun _ => 1)
lemma mean_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (f H : Set Γ → ℝ) :
chainMean gs (reverseMultiplier w) (complementWeight f) (complementWeight H) = chainMean gs w f H := by
unfold chainMean
rw [total_complement, chain_sum_complement]
simp only [complementWeight, compl_compl]
lemma variance_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (f H : Set Γ → ℝ) :
chainVariance gs (reverseMultiplier w) (complementWeight f) (complementWeight H) =
chainVariance gs w f H := by
unfold chainVariance
rw [total_complement, mean_complement, chain_sum_complement]
simp only [complementWeight, compl_compl]
lemma conductance_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ)
(f : Set Γ → ℝ) (ST : Set Γ × Set Γ) :
chainConductance gs (reverseMultiplier w) (complementWeight f) (ST.1ᶜ,ST.2ᶜ) =
chainConductance gs w f ST := by
simp only [chainConductance, multiplier_complement, complementWeight, compl_compl]
lemma energy_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (f H : Set Γ → ℝ) :
restrictedEnergy (chainEdges gs) (chainConductance gs (reverseMultiplier w) (complementWeight f))
(complementWeight H) ∅ ∅ =
restrictedEnergy (chainEdges gs) (chainConductance gs w f) H ∅ ∅ := by
have hr (ST : Set Γ × Set Γ) : EdgeRespects ∅ ∅ ST := by simp [EdgeRespects, Respects]
unfold restrictedEnergy
simp only [hr, ite_true, chainEdges, Finset.sum_filter]
congr 1
let E : (Set Γ × Set Γ) ≃ (Set Γ × Set Γ) := Equiv.prodCongr complementEquiv complementEquiv
apply Fintype.sum_equiv E
intro ST
change (if ChainState gs ST.1 ∧ ChainState gs ST.2 ∧ ExchangeAdjacent ST.1 ST.2 then _ else 0) =
(if ChainState gs ST.1ᶜ ∧ ChainState gs ST.2ᶜ ∧ ExchangeAdjacent ST.1ᶜ ST.2ᶜ then _ else 0)
rw [state_complement, state_complement, adjacent_complement]
by_cases h : ChainState gs ST.1 ∧ ChainState gs ST.2 ∧ ExchangeAdjacent ST.1 ST.2
· simp only [ite_eq_left h]
have hc := conductance_complement gs w f (ST.1ᶜ,ST.2ᶜ)
simp only [compl_compl] at hc
rw [hc]
rfl
· simp only [ite_eq_right h]
lemma dirichlet_complement (gs : List (Γ × Γ)) (w : (Γ × Γ) → (Γ × Γ) → ℝ) (f H : Set Γ → ℝ) :
chainDirichlet gs (reverseMultiplier w) (complementWeight f) (complementWeight H) =
chainDirichlet gs w f H := by
unfold chainDirichlet
rw [total_complement, energy_complement]
lemma plain_mass_complement (gs : List (Γ × Γ)) (hgs : SlotsFresh gs ∅)
(hcover : pairSupport gs = Set.univ) (f : Set Γ → ℝ) :
slotTotal gs (complementWeight f) ∅ = slotTotal gs f ∅ := by
exact slotTotal_complement gs f ∅ ∅ (by simp) (by simpa using hgs) (by simpa using hcover)
lemma defect_mass_complement (gs : List (Γ × Γ)) (hgs : SlotsFresh gs ∅)
(hcover : pairSupport gs = Set.univ) (f : Set Γ → ℝ)
(p r : Γ × Γ) (hp : p ∈ gs) (hr : r ∈ gs) (hpr : p ≠ r) :
slotDefect gs (complementWeight f) ∅ p r = slotDefect gs f ∅ r p := by
exact slotDefect_complement gs f ∅ ∅ (by simp) (by simpa using hgs) (by simpa using hcover) p r hp hr hpr
lemma projection_complement (gs : List (Γ × Γ)) (hgs : SlotsFresh gs ∅)
(hcover : pairSupport gs = Set.univ) (f H : Set Γ → ℝ) :
observableProjection gs (complementWeight f) (complementWeight H) =
complementWeight (observableProjection gs f H) := by
have hmul : (fun S => complementWeight f S * complementWeight H S) =
complementWeight (fun S => f S * H S) := rfl
funext S
change observableProjection gs (complementWeight f) (complementWeight H) S =
observableProjection gs f H Sᶜ
by_cases he : ∃ p r, DefectState gs p r S
· obtain ⟨p,r,h⟩ := he
have hc : DefectState gs r p Sᶜ := (defect_complement gs r p S).mpr h
rw [observableProjection_defect gs _ _ S h, observableProjection_defect gs f H Sᶜ hc]
unfold defectMean
rw [hmul, defect_mass_complement gs hgs hcover _ p r h.1 h.2.1 h.2.2.1,
defect_mass_complement gs hgs hcover f p r h.1 h.2.1 h.2.2.1]
· have hec : ¬ ∃ p r, DefectState gs p r Sᶜ := by
rintro ⟨p,r,h⟩
exact he ⟨r,p,(defect_complement gs p r S).mp h⟩
simp only [observableProjection, dite_eq_right he, dite_eq_right hec, complementWeight]
lemma slotVariance_complement (gs : List (Γ × Γ)) (hgs : SlotsFresh gs ∅)
(hcover : pairSupport gs = Set.univ) (f H : Set Γ → ℝ) :
slotVariance gs (complementWeight f) (complementWeight H) ∅ = slotVariance gs f H ∅ := by
unfold slotVariance
change slotTotal gs (complementWeight (fun S => f S*(H S)^2)) ∅ -
(slotTotal gs (complementWeight (fun S => f S*H S)) ∅)^2/slotTotal gs (complementWeight f) ∅ = _
rw [plain_mass_complement gs hgs hcover, plain_mass_complement gs hgs hcover,
plain_mass_complement gs hgs hcover]
/-- The actual manuscript variance theorem in original omission coordinates. -/
theorem omission_twoLift_transversal_variance (gs : List (Γ × Γ)) (f g H : Set Γ → ℝ)
(w : (Γ × Γ) → (Γ × Γ) → ℝ) (q : ℝ) (hq : 0 ≤ q)
(hf : DegreePositive f gs.length) (hg : DegreePositive g gs.length)
(hsigf : OmissionProperty f gs.length) (hsigg : AdditionProperty g gs.length)
(hgs : SlotsFresh gs ∅) (hcover : pairSupport gs = Set.univ)
(hw : ∀ p r, 0 < w p r)
(hgood : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r →
slotTotal gs f ∅/(4*slotDefect gs f ∅ p r) ≤ w p r)
(hagree : ∀ S, PlainState gs S → f S = g S)
(hcompare : ∀ S, ChainState gs S → f S ≤ q*g S) :
slotVariance gs f H ∅ ≤ (gs.length : ℝ)*(1+8*(gs.length : ℝ)*q^2)*
restrictedEnergy (chainEdges gs) (chainConductance gs w f) H ∅ ∅ := by
have hcard := slots_ground_card gs hgs hcover
have hhalf : Fintype.card Γ - gs.length = gs.length := by omega
have hfc : DegreePositive (complementWeight f) gs.length := by
simpa only [hhalf] using complement_degreePositive f gs.length (by omega) hf
have hgc : DegreePositive (complementWeight g) gs.length := by
simpa only [hhalf] using complement_degreePositive g gs.length (by omega) hg
have hsf : AdditionProperty (complementWeight f) gs.length := by
simpa only [OmissionProperty, hhalf] using hsigf
have hsg : OmissionProperty (complementWeight g) gs.length := by
have hcc : complementWeight (complementWeight g) = g := by funext S; simp [complementWeight]
simpa only [OmissionProperty, hhalf, hcc] using hsigg
have hgood' : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r →
slotTotal gs (complementWeight f) ∅/(4*slotDefect gs (complementWeight f) ∅ p r) ≤ reverseMultiplier w p r := by
intro p hp r hr hpr
rw [plain_mass_complement gs hgs hcover, defect_mass_complement gs hgs hcover f p r hp hr hpr]
exact hgood r hr p hp hpr.symm
have ht := validDegree_twoLift_transversal_variance gs (complementWeight f) (complementWeight g)
(complementWeight H) (reverseMultiplier w) q hq hfc hgc hsf hsg hgs hcover
(fun p r => hw r p) hgood'
(fun S hS => hagree Sᶜ ((plain_complement gs S).mpr hS))
(fun S hS => hcompare Sᶜ ((state_complement gs S).mpr hS))
rwa [slotVariance_complement gs hgs hcover f H, energy_complement gs w f H] at ht
/-- The paper's observable Poincaré theorem for the literal first factorial
lift, assuming its omission property only at the actual subset degree. -/
theorem omission_observable_poincare (gs : List (Γ × Γ)) (hgs : SlotsFresh gs ∅) (hne : gs ≠ [])
(hcover : pairSupport gs = Set.univ) (w : (Γ × Γ) → (Γ × Γ) → ℝ)
(hw : ∀ p r, 0 < w p r) (f H : Set Γ → ℝ)
(hf : DegreePositive f gs.length) (hsig : OmissionProperty f gs.length)
(q : ℝ) (hq : 1 ≤ q)
(hlower : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r → slotTotal gs f ∅/(4*slotDefect gs f ∅ p r) ≤ w p r)
(hupper : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r → w p r ≤ 4*slotTotal gs f ∅/slotDefect gs f ∅ p r) :
chainVariance gs w f (observableProjection gs f H) ≤
observableConstant gs.length q * chainDirichlet gs w f H := by
have hcard := slots_ground_card gs hgs hcover
have hhalf : Fintype.card Γ - gs.length = gs.length := by omega
have hfc : DegreePositive (complementWeight f) gs.length := by
simpa only [hhalf] using complement_degreePositive f gs.length (by omega) hf
have hsf : AdditionProperty (complementWeight f) gs.length := by
simpa only [OmissionProperty, hhalf] using hsig
have hl : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r →
slotTotal gs (complementWeight f) ∅/(4*slotDefect gs (complementWeight f) ∅ p r) ≤ reverseMultiplier w p r := by
intro p hp r hr hpr
rw [plain_mass_complement gs hgs hcover, defect_mass_complement gs hgs hcover f p r hp hr hpr]
exact hlower r hr p hp hpr.symm
have hu : ∀ p ∈ gs, ∀ r ∈ gs, p ≠ r →
reverseMultiplier w p r ≤ 4*slotTotal gs (complementWeight f) ∅/slotDefect gs (complementWeight f) ∅ p r := by
intro p hp r hr hpr
rw [plain_mass_complement gs hgs hcover, defect_mass_complement gs hgs hcover f p r hp hr hpr]
exact hupper r hr p hp hpr.symm
have ht := validDegree_observable_poincare gs hgs hne hcover (reverseMultiplier w)
(fun p r => hw r p) (complementWeight f) (complementWeight H) hfc hsf q hq hl hu
rwa [projection_complement gs hgs hcover, variance_complement, dirichlet_complement] at ht
end ContingencyTables.ComplementChain
end OAI
|