FourCell.lean
1module23public import Mathlib.Basic.Real.Basic4import Mathlib.Tactic.FieldSimp5import Mathlib.Tactic.LinearCombination6import Mathlib.Tactic.Linarith7import Mathlib.Tactic.Positivity8import Mathlib.Tactic.Ring910@[expose] public section1112/-!13The normalized four-cell inequality in Appendix A of14"Quantum Subentropy: Subadditivity and Sharp Bounds on Discrimination Error".1516These are scalar real inequalities. No subentropy functional or quantum state17is defined here; the analytic and matrix bridges are separate targets.18-/1920namespace SubentropyCertificates.FourCell2122def U (a b c d : ℝ) : ℝ := (a + b) * (c + d)23def V (a b c d : ℝ) : ℝ := (a + c) * (b + d)24def W (a b c d : ℝ) : ℝ := a*b + a*c + a*d + b*c + b*d + c*d25def X (a b c d : ℝ) : ℝ := a*b*c + a*b*d + a*c*d + b*c*d26def Y (a b c d : ℝ) : ℝ := a*b*c*d27def E (a b c d : ℝ) : ℝ := a*d + b*c2829def rowDen (a b c d t : ℝ) : ℝ := 1 + t + U a b c d * t^230def colDen (a b c d t : ℝ) : ℝ := 1 + t + V a b c d * t^231def cellDen (a b c d t : ℝ) : ℝ :=32 1 + t + W a b c d * t^2 + X a b c d * t^3 + Y a b c d * t^43334def numerator (a b c d t : ℝ) : ℝ :=35 E a b c d * t^2 + (2*E a b c d - X a b c d) * t^3 +36 (E a b c d - 2*X a b c d - Y a b c d + 2*U a b c d*V a b c d) * t^4 +37 (-X a b c d - 2*Y a b c d + 2*U a b c d*V a b c d) * t^5 +38 (-Y a b c d + U a b c d*V a b c d*W a b c d) * t^6 +39 U a b c d*V a b c d*X a b c d * t^7 +40 U a b c d*V a b c d*Y a b c d * t^84142/-- The expansion in Appendix A, before dividing by positive denominators. -/43theorem numerator_identity (a b c d t : ℝ) :44 rowDen a b c d t * colDen a b c d t * (1 + t + cellDen a b c d t) -45 (1 + t) * cellDen a b c d t * (rowDen a b c d t + colDen a b c d t) =46 numerator a b c d t := by47 unfold rowDen colDen cellDen numerator U V W X Y E48 ring4950/-- Grouping the two diagonals gives the quartic identity used in the proof. -/51theorem uv_identity (a b c d : ℝ) (hnorm : a+b+c+d = 1) :52 U a b c d * V a b c d = X a b c d + (a*d-b*c)^2 := by53 unfold U V X54 linear_combination (a*b*c + a*b*d + a*c*d + b*c*d) * hnorm5556/-- The only difficult coefficient estimate in Appendix A. -/57theorem xw_lower_bound (a b c d : ℝ)58 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)59 (hnorm : a+b+c+d = 1) :60 4 * Y a b c d ≤ X a b c d * W a b c d := by61 let m := a*d62 let n := b*c63 let s := a+d64 let k := b+c65 have hm : 0 ≤ m := mul_nonneg ha hd66 have hn : 0 ≤ n := mul_nonneg hb hc67 have hs : 0 ≤ s := add_nonneg ha hd68 have hk : 0 ≤ k := add_nonneg hb hc69 have hsk : s+k = 1 := by dsimp [s, k]; linarith70 have hms : 0 ≤ s^2-4*m := by dsimp [s, m]; nlinarith [sq_nonneg (a-d)]71 have hnk : 0 ≤ k^2-4*n := by dsimp [k, n]; nlinarith [sq_nonneg (b-c)]72 have hx : X a b c d = m*k+n*s := by dsimp [X, m, n, k, s]; ring73 have hw : W a b c d = m+n+s*k := by dsimp [W, m, n, k, s]; ring74 have hy : Y a b c d = m*n := by dsimp [Y, m, n]; ring75 have hxpos : 0 ≤ m*k+n*s := by positivity76 have hfirst : (m*k+n*s)*(s*k) ≤ (m*k+n*s)*(m+n+s*k) := by77 exact mul_le_mul_of_nonneg_left (by linarith) hxpos78 have hsecond : 4*(m*n)*(s+k) ≤ (m*k+n*s)*(s*k) := by79 nlinarith [mul_nonneg (mul_nonneg hm hs) hnk,80 mul_nonneg (mul_nonneg hn hk) hms]81 rw [hsk] at hsecond82 rw [hx, hw, hy]83 nlinarith8485/-- The polynomial is bounded below by its quadratic term. -/86theorem numerator_lower_bound (a b c d t : ℝ)87 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)88 (hnorm : a+b+c+d = 1) (ht : 0 ≤ t) :89 E a b c d * t^2 ≤ numerator a b c d t := by90 have ha1 : a ≤ 1 := by linarith91 have hc1 : c ≤ 1 := by linarith92 have hd1 : d ≤ 1 := by linarith93 have hu : 0 ≤ U a b c d := by unfold U; positivity94 have hv : 0 ≤ V a b c d := by unfold V; positivity95 have hw : 0 ≤ W a b c d := by unfold W; positivity96 have hx : 0 ≤ X a b c d := by unfold X; positivity97 have hy : 0 ≤ Y a b c d := by unfold Y; positivity98 have hmn : a*d ≤ 1 := le_trans (mul_le_of_le_one_right ha hd1) ha199 have he_y : Y a b c d ≤ E a b c d := by100 have hbc : 0 ≤ b*c := mul_nonneg hb hc101 have hmul := mul_le_of_le_one_left hbc hmn102 dsimp [Y, E]103 nlinarith [mul_nonneg ha hd]104 have hx_e : X a b c d ≤ E a b c d := by105 have h1 := mul_nonneg (mul_nonneg ha hd) (show 0 ≤ 1-b-c by linarith)106 have h2 := mul_nonneg (mul_nonneg hb hc) (show 0 ≤ 1-a-d by linarith)107 dsimp [X, E]108 nlinarith109 have huv := uv_identity a b c d hnorm110 have hcoeff4 : 0 ≤ E a b c d - 2*X a b c d - Y a b c d +111 2*U a b c d*V a b c d := by nlinarith [sq_nonneg (a*d-b*c)]112 have hcoeff5 : 0 ≤ -X a b c d - 2*Y a b c d +113 2*U a b c d*V a b c d := by114 have h1 : 0 ≤ a*d*(b+c-b*c) := by115 have hbc := mul_le_of_le_one_right hb hc1116 exact mul_nonneg (mul_nonneg ha hd) (by linarith)117 have h2 : 0 ≤ b*c*(a+d-a*d) := by118 have had := mul_le_of_le_one_right ha hd1119 exact mul_nonneg (mul_nonneg hb hc) (by linarith)120 have hexpand : X a b c d - 2*Y a b c d =121 a*d*(b+c-b*c) + b*c*(a+d-a*d) := by unfold X Y; ring122 nlinarith [sq_nonneg (a*d-b*c)]123 have hcoeff6 : 0 ≤ -Y a b c d + U a b c d*V a b c d*W a b c d := by124 have hbound := xw_lower_bound a b c d ha hb hc hd hnorm125 have hprod := mul_nonneg (sq_nonneg (a*d-b*c)) hw126 nlinarith [congrArg (fun z : ℝ => z * W a b c d) huv]127 have hcoeff3 : 0 ≤ 2*E a b c d - X a b c d := by linarith128 have htail : 0 ≤129 (2*E a b c d - X a b c d) * t^3 +130 (E a b c d - 2*X a b c d - Y a b c d + 2*U a b c d*V a b c d) * t^4 +131 (-X a b c d - 2*Y a b c d + 2*U a b c d*V a b c d) * t^5 +132 (-Y a b c d + U a b c d*V a b c d*W a b c d) * t^6 +133 U a b c d*V a b c d*X a b c d * t^7 +134 U a b c d*V a b c d*Y a b c d * t^8 := by positivity135 unfold numerator136 linarith137138/-- All seven numerator coefficients are nonnegative, including boundary cases. -/139theorem numerator_nonneg (a b c d t : ℝ)140 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)141 (hnorm : a+b+c+d = 1) (ht : 0 ≤ t) :142 0 ≤ numerator a b c d t := by143 have h := numerator_lower_bound a b c d t ha hb hc hd hnorm ht144 have he : 0 ≤ E a b c d * t^2 := by unfold E; positivity145 linarith146147/-- Appendix A's normalized four-cell scalar inequality. -/148theorem normalized_four_cell (a b c d t : ℝ)149 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)150 (hnorm : a+b+c+d = 1) (ht : 0 ≤ t) :151 1 / rowDen a b c d t + 1 / colDen a b c d t ≤152 1 / cellDen a b c d t + 1 / (1+t) := by153 have hr : 0 < rowDen a b c d t := by unfold rowDen U; positivity154 have hc' : 0 < colDen a b c d t := by unfold colDen V; positivity155 have hp : 0 < cellDen a b c d t := by unfold cellDen W X Y; positivity156 have hz : 0 < 1+t := by positivity157 have hnum := numerator_nonneg a b c d t ha hb hc hd hnorm ht158 have hid := numerator_identity a b c d t159 have hleft : 1 / rowDen a b c d t + 1 / colDen a b c d t =160 (rowDen a b c d t + colDen a b c d t) /161 (rowDen a b c d t * colDen a b c d t) := by162 field_simp [ne_of_gt hr, ne_of_gt hc']163 ring164 have hright : 1 / cellDen a b c d t + 1 / (1+t) =165 (1+t+cellDen a b c d t) / (cellDen a b c d t * (1+t)) := by166 field_simp [ne_of_gt hp, ne_of_gt hz]167 rw [hleft, hright]168 apply (div_le_div_iff₀ (mul_pos hr hc') (mul_pos hp hz)).mpr169 nlinarith170171/-- The same inequality with the actual reciprocal-product denominators. -/172theorem normalized_four_cell_products (a b c d t : ℝ)173 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)174 (hnorm : a+b+c+d = 1) (ht : 0 ≤ t) :175 1 / ((1+(a+b)*t)*(1+(c+d)*t)) +176 1 / ((1+(a+c)*t)*(1+(b+d)*t)) ≤177 1 / ((1+a*t)*(1+b*t)*(1+c*t)*(1+d*t)) + 1/(1+t) := by178 have hr : rowDen a b c d t = (1+(a+b)*t)*(1+(c+d)*t) := by179 unfold rowDen U180 linear_combination -t * hnorm181 have hc' : colDen a b c d t = (1+(a+c)*t)*(1+(b+d)*t) := by182 unfold colDen V183 linear_combination -t * hnorm184 have hp : cellDen a b c d t = (1+a*t)*(1+b*t)*(1+c*t)*(1+d*t) := by185 unfold cellDen W X Y186 linear_combination -t * hnorm187 simpa only [hr, hc', hp] using normalized_four_cell a b c d t ha hb hc hd hnorm ht188189/-- Strictness follows from the quadratic coefficient when both diagonals have mass. -/190theorem normalized_four_cell_products_strict (a b c d t : ℝ)191 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)192 (hnorm : a+b+c+d = 1) (ht : 0 < t) (he : 0 < E a b c d) :193 1 / ((1+(a+b)*t)*(1+(c+d)*t)) +194 1 / ((1+(a+c)*t)*(1+(b+d)*t)) <195 1 / ((1+a*t)*(1+b*t)*(1+c*t)*(1+d*t)) + 1/(1+t) := by196 have hr : 0 < rowDen a b c d t := by unfold rowDen U; positivity197 have hc' : 0 < colDen a b c d t := by unfold colDen V; positivity198 have hp : 0 < cellDen a b c d t := by unfold cellDen W X Y; positivity199 have hz : 0 < 1+t := by positivity200 have hbound := numerator_lower_bound a b c d t ha hb hc hd hnorm (le_of_lt ht)201 have hnum : 0 < numerator a b c d t := lt_of_lt_of_le (by positivity) hbound202 have hid := numerator_identity a b c d t203 have hrprod : rowDen a b c d t = (1+(a+b)*t)*(1+(c+d)*t) := by204 unfold rowDen U205 linear_combination -t * hnorm206 have hcprod : colDen a b c d t = (1+(a+c)*t)*(1+(b+d)*t) := by207 unfold colDen V208 linear_combination -t * hnorm209 have hpprod : cellDen a b c d t = (1+a*t)*(1+b*t)*(1+c*t)*(1+d*t) := by210 unfold cellDen W X Y211 linear_combination -t * hnorm212 rw [← hrprod, ← hcprod, ← hpprod]213 have hleft : 1 / rowDen a b c d t + 1 / colDen a b c d t =214 (rowDen a b c d t + colDen a b c d t) /215 (rowDen a b c d t * colDen a b c d t) := by216 field_simp [ne_of_gt hr, ne_of_gt hc']217 ring218 have hright : 1 / cellDen a b c d t + 1 / (1+t) =219 (1+t+cellDen a b c d t) / (cellDen a b c d t * (1+t)) := by220 field_simp [ne_of_gt hp, ne_of_gt hz]221 rw [hleft, hright]222 apply (div_lt_div_iff₀ (mul_pos hr hc') (mul_pos hp hz)).mpr223 nlinarith224225noncomputable def rowKernel (a b c d t : ℝ) : ℝ := 1 / ((1+(a+b)*t)*(1+(c+d)*t))226noncomputable def columnKernel (a b c d t : ℝ) : ℝ := 1 / ((1+(a+c)*t)*(1+(b+d)*t))227noncomputable def cellKernel (a b c d t : ℝ) : ℝ :=228 1 / ((1+a*t)*(1+b*t)*(1+c*t)*(1+d*t))229noncomputable def totalKernel (a b c d t : ℝ) : ℝ := 1 / (1+t*(a+b+c+d))230231/-- Vanishing cross mass is exactly support in a single row or column. -/232theorem cross_zero_iff_marginal_zero (a b c d : ℝ)233 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) :234 E a b c d = 0 ↔ a+b = 0 ∨ c+d = 0 ∨ a+c = 0 ∨ b+d = 0 := by235 constructor236 · intro he237 have had : a*d = 0 := by unfold E at he; nlinarith [mul_nonneg ha hd, mul_nonneg hb hc]238 have hbc : b*c = 0 := by unfold E at he; nlinarith [mul_nonneg ha hd, mul_nonneg hb hc]239 rcases mul_eq_zero.mp had with ha0 | hd0240 · rcases mul_eq_zero.mp hbc with hb0 | hc0241 · exact Or.inl (by linarith)242 · exact Or.inr (Or.inr (Or.inl (by linarith)))243 · rcases mul_eq_zero.mp hbc with hb0 | hc0244 · exact Or.inr (Or.inr (Or.inr (by linarith)))245 · exact Or.inr (Or.inl (by linarith))246 · rintro (h | h | h | h)247 · have ha0 : a = 0 := by linarith248 have hb0 : b = 0 := by linarith249 simp [E, ha0, hb0]250 · have hc0 : c = 0 := by linarith251 have hd0 : d = 0 := by linarith252 simp [E, hc0, hd0]253 · have ha0 : a = 0 := by linarith254 have hc0 : c = 0 := by linarith255 simp [E, ha0, hc0]256 · have hb0 : b = 0 := by linarith257 have hd0 : d = 0 := by linarith258 simp [E, hb0, hd0]259260/-- Positive cross mass is equivalent to positivity of all four marginal entries. -/261theorem cross_pos_iff_marginals_pos (a b c d : ℝ)262 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) :263 0 < E a b c d ↔ 0 < a+b ∧ 0 < c+d ∧ 0 < a+c ∧ 0 < b+d := by264 constructor265 · intro he266 have hp : 0 < a*d ∨ 0 < b*c := by267 by_cases h : 0 < a*d268 · exact Or.inl h269 · right; unfold E at he; linarith270 rcases hp with hp | hp271 · rcases mul_pos_iff.mp hp with ⟨ha', hd'⟩ | ⟨ha', hd'⟩272 · exact ⟨by linarith, by linarith, by linarith, by linarith⟩273 · linarith274 · rcases mul_pos_iff.mp hp with ⟨hb', hc'⟩ | ⟨hb', hc'⟩275 · exact ⟨by linarith, by linarith, by linarith, by linarith⟩276 · linarith277 · rintro ⟨hr1, hr2, hc1, hc2⟩278 have he : 0 ≤ E a b c d := by unfold E; positivity279 by_contra h280 have hz : E a b c d = 0 := by linarith281 rcases (cross_zero_iff_marginal_zero a b c d ha hb hc hd).mp hz with h | h | h | h <;>282 linarith283284private theorem normalized_kernel_rescaling (a b c d t M : ℝ)285 (hM : a+b+c+d = M) (hMpos : 0 < M) :286 rowKernel (a/M) (b/M) (c/M) (d/M) (t*M) = rowKernel a b c d t ∧287 columnKernel (a/M) (b/M) (c/M) (d/M) (t*M) = columnKernel a b c d t ∧288 cellKernel (a/M) (b/M) (c/M) (d/M) (t*M) = cellKernel a b c d t ∧289 totalKernel (a/M) (b/M) (c/M) (d/M) (t*M) = totalKernel a b c d t := by290 have hn : a/M+b/M+c/M+d/M = 1 := by291 rw [← add_div, ← add_div, ← add_div, hM, div_self (ne_of_gt hMpos)]292 have hscale (x : ℝ) : x/M*(t*M) = x*t := by293 calc294 _ = x*t*(M/M) := by ring295 _ = x*t := by rw [div_self (ne_of_gt hMpos), mul_one]296 refine ⟨?_, ?_, ?_, ?_⟩297 · simp only [rowKernel, ← add_div, hscale]298 · simp only [columnKernel, ← add_div, hscale]299 · simp only [cellKernel, hscale]300 · simp only [totalKernel, hn, mul_one, hM]301302/-- The non-strict inequality in the manuscript's four-cell lemma, for any mass. -/303theorem four_cell (a b c d t : ℝ)304 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) (ht : 0 ≤ t) :305 rowKernel a b c d t + columnKernel a b c d t ≤306 cellKernel a b c d t + totalKernel a b c d t := by307 by_cases hz : a+b+c+d = 0308 · have ha0 : a = 0 := by linarith309 have hb0 : b = 0 := by linarith310 have hc0 : c = 0 := by linarith311 have hd0 : d = 0 := by linarith312 simp [rowKernel, columnKernel, cellKernel, totalKernel, ha0, hb0, hc0, hd0]313 · let M := a+b+c+d314 have hMpos : 0 < M := by dsimp [M]; exact lt_of_le_of_ne (by positivity) (Ne.symm hz)315 have hn : a/M+b/M+c/M+d/M = 1 := by316 rw [← add_div, ← add_div, ← add_div, show a+b+c+d = M from rfl,317 div_self (ne_of_gt hMpos)]318 have h := normalized_four_cell_products (a/M) (b/M) (c/M) (d/M) (t*M)319 (by positivity) (by positivity) (by positivity) (by positivity) hn (by positivity)320 have h' : rowKernel (a/M) (b/M) (c/M) (d/M) (t*M) +321 columnKernel (a/M) (b/M) (c/M) (d/M) (t*M) ≤322 cellKernel (a/M) (b/M) (c/M) (d/M) (t*M) +323 totalKernel (a/M) (b/M) (c/M) (d/M) (t*M) := by324 simpa only [rowKernel, columnKernel, cellKernel, totalKernel, hn, mul_one] using h325 rcases normalized_kernel_rescaling a b c d t M rfl hMpos with ⟨hr, hc', hp, hz'⟩326 simpa only [hr, hc', hp, hz'] using h'327328theorem four_cell_eq_of_cross_zero (a b c d t : ℝ)329 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) (he : E a b c d = 0) :330 rowKernel a b c d t + columnKernel a b c d t =331 cellKernel a b c d t + totalKernel a b c d t := by332 rcases (cross_zero_iff_marginal_zero a b c d ha hb hc hd).mp he with h | h | h | h333 · have ha0 : a = 0 := by linarith334 have hb0 : b = 0 := by linarith335 simp [rowKernel, columnKernel, cellKernel, totalKernel, ha0, hb0, add_comm]336 ring337 · have hc0 : c = 0 := by linarith338 have hd0 : d = 0 := by linarith339 simp [rowKernel, columnKernel, cellKernel, totalKernel, hc0, hd0, add_comm]340 ring341 · have ha0 : a = 0 := by linarith342 have hc0 : c = 0 := by linarith343 simp [rowKernel, columnKernel, cellKernel, totalKernel, ha0, hc0]344 ring345 · have hb0 : b = 0 := by linarith346 have hd0 : d = 0 := by linarith347 simp [rowKernel, columnKernel, cellKernel, totalKernel, hb0, hd0]348 ring349350theorem four_cell_strict_of_cross_pos (a b c d t : ℝ)351 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d)352 (ht : 0 < t) (he : 0 < E a b c d) :353 rowKernel a b c d t + columnKernel a b c d t <354 cellKernel a b c d t + totalKernel a b c d t := by355 let M := a+b+c+d356 have hmarg := (cross_pos_iff_marginals_pos a b c d ha hb hc hd).mp he357 have hMpos : 0 < M := by dsimp [M]; linarith [hmarg.1, hmarg.2.1]358 have hn : a/M+b/M+c/M+d/M = 1 := by359 rw [← add_div, ← add_div, ← add_div, show a+b+c+d = M from rfl,360 div_self (ne_of_gt hMpos)]361 have he' : 0 < E (a/M) (b/M) (c/M) (d/M) := by362 calc363 0 < E a b c d * (M⁻¹*M⁻¹) := by positivity364 _ = E (a/M) (b/M) (c/M) (d/M) := by unfold E; simp only [div_eq_mul_inv]; ring365 have h := normalized_four_cell_products_strict (a/M) (b/M) (c/M) (d/M) (t*M)366 (by positivity) (by positivity) (by positivity) (by positivity) hn (by positivity) he'367 have h' : rowKernel (a/M) (b/M) (c/M) (d/M) (t*M) +368 columnKernel (a/M) (b/M) (c/M) (d/M) (t*M) <369 cellKernel (a/M) (b/M) (c/M) (d/M) (t*M) +370 totalKernel (a/M) (b/M) (c/M) (d/M) (t*M) := by371 simpa only [rowKernel, columnKernel, cellKernel, totalKernel, hn, mul_one] using h372 rcases normalized_kernel_rescaling a b c d t M rfl hMpos with ⟨hr, hc', hp, hz⟩373 simpa only [hr, hc', hp, hz] using h'374375/-- Strictness is exactly positivity of both entries of both binary marginals. -/376theorem four_cell_strict_iff (a b c d t : ℝ)377 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) (ht : 0 < t) :378 (rowKernel a b c d t + columnKernel a b c d t <379 cellKernel a b c d t + totalKernel a b c d t) ↔380 0 < a+b ∧ 0 < c+d ∧ 0 < a+c ∧ 0 < b+d := by381 rw [← cross_pos_iff_marginals_pos a b c d ha hb hc hd]382 constructor383 · intro h384 have he : 0 ≤ E a b c d := by unfold E; positivity385 by_contra h'386 have hz : E a b c d = 0 := by linarith387 have heq := four_cell_eq_of_cross_zero a b c d t ha hb hc hd hz388 linarith389 · exact four_cell_strict_of_cross_pos a b c d t ha hb hc hd ht390391/-- Equality holds precisely at t = 0 or for support in one row or column. -/392theorem four_cell_eq_iff (a b c d t : ℝ)393 (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) (hd : 0 ≤ d) (ht : 0 ≤ t) :394 (rowKernel a b c d t + columnKernel a b c d t =395 cellKernel a b c d t + totalKernel a b c d t) ↔396 t = 0 ∨ a+b = 0 ∨ c+d = 0 ∨ a+c = 0 ∨ b+d = 0 := by397 rw [← cross_zero_iff_marginal_zero a b c d ha hb hc hd]398 constructor399 · intro heq400 by_cases ht0 : t = 0401 · exact Or.inl ht0402 · right403 have htpos : 0 < t := lt_of_le_of_ne ht (Ne.symm ht0)404 have he : 0 ≤ E a b c d := by unfold E; positivity405 by_contra h'406 have hpos : 0 < E a b c d := lt_of_le_of_ne he (Ne.symm h')407 have hlt := four_cell_strict_of_cross_pos a b c d t ha hb hc hd htpos hpos408 linarith409 · rintro (ht0 | he0)410 · simp [rowKernel, columnKernel, cellKernel, totalKernel, ht0]411 · exact four_cell_eq_of_cross_zero a b c d t ha hb hc hd he0412413end SubentropyCertificates.FourCell
Axioms used
Choose a statement to see which axioms its proof uses.
numerator_identityuv_identityxw_lower_boundnumerator_lower_boundnumerator_nonnegnormalized_four_cellnormalized_four_cell_productsnormalized_four_cell_products_strictcross_zero_iff_marginal_zerocross_pos_iff_marginals_posfour_cellfour_cell_eq_of_cross_zerofour_cell_strict_of_cross_posfour_cell_strict_ifffour_cell_eq_iff