File size: 3,751 Bytes
4a56cd6 | 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 | import OAI.Combinatorics.ContingencyTables.Sampling.Padding
import OAI.Combinatorics.ContingencyTables.Sampling.ResidualMixture
import Mathlib.Tactic.NormNum
namespace OAI
/-!
# Parameter arithmetic for the samplers
The manuscript's padding and rare tabulation estimates give explicit
inequalities for successful unpadding and expected correction cost.
-/
namespace ContingencyTables
open scoped BigOperators
private theorem padding_error_le_half (d s : β) (hd : 14 β€ d) (hs : s β€ d) :
(s : β) * (4 * (d : β) ^ 12 * (d : β) ^ 3 / (d : β) ^ 20) β€ 1 / 2 := by
have hdβ : (0 : β) < d := by exact_mod_cast (show 0 < d by omega)
have hdββ : (14 : β) β€ d := by exact_mod_cast hd
have hs' : (s : β) β€ d := by exact_mod_cast hs
have hfour : (8 : β) β€ (d : β) ^ 4 := by
have h := pow_le_pow_leftβ (by norm_num : (0 : β) β€ 14) hdββ 4
norm_num at h
linarith
have htwenty : (d : β) ^ 20 = (d : β) ^ 16 * (d : β) ^ 4 := by ring
have hpow : (0 : β) β€ (d : β) ^ 16 := by positivity
have hlarge := mul_le_mul_of_nonneg_left hfour hpow
have hnum : 8 * (s : β) * (d : β) ^ 12 * (d : β) ^ 3 β€ (d : β) ^ 20 := by
calc
_ β€ 8 * (d : β) * (d : β) ^ 12 * (d : β) ^ 3 := by gcongr
_ = 8 * (d : β) ^ 16 := by ring
_ β€ (d : β) ^ 20 := by rw [htwenty]; linarith
rw [β mul_div_assoc, div_le_iffβ (pow_pos hdβ 20)]
nlinarith
/-- For the actual choices `L=dΒΉΒ²`, `U=dΒ²β°`, the uniform padded table
unpads successfully with probability at least one half. -/
theorem padding_success_half {I J : Type*} [Fintype I] [Fintype J]
[DecidableEq I] [DecidableEq J]
(r : I β β) (c : J β β) (htotal : β i, r i = β j, c j)
(K : Finset (I Γ J)) (d : β) (hd : 14 β€ d)
(hrows : Fintype.card I β€ d) (hcols : Fintype.card J β€ d)
(hK : K.card β€ d) (hrow : β p β K, d ^ 20 β€ r p.1)
(hcol : β p β K, d ^ 20 β€ c p.2) :
(1 / 2 : β) β€ (Fintype.card (Table r c) : β) /
Fintype.card (Table (paddedRows r (largePadding K (d ^ 12)))
(paddedColumns c (largePadding K (d ^ 12)))) := by
have hdβ : 0 < d := by omega
have hU : 4 * d β€ d ^ 20 := by
have hdβ : 4 β€ d := by omega
have hpow : d β€ d ^ 19 := Nat.le_self_pow (by decide) d
calc
4 * d β€ d * d ^ 19 := Nat.mul_le_mul hdβ hpow
_ = d ^ 20 := by ring
have hL : 2 * d ^ 12 β€ d ^ 20 := by
have hpow : d β€ d ^ 8 := Nat.le_self_pow (by decide) d
have hdβ : 2 β€ d ^ 8 := by omega
calc
2 * d ^ 12 β€ d ^ 8 * d ^ 12 := Nat.mul_le_mul_right _ hdβ
_ = d ^ 20 := by ring
have h := padding_success_fraction r c htotal K (d ^ 12) (d ^ 20) d
hdβ hrows hcols hrow hcol hU hL
have he := padding_error_le_half d K.card hd hK
push_cast at h
linarith
/-- The exponentially costly exact tabulation branch has exponentially
smaller probability for the manuscript's `D=dβΆbΒ²`. -/
theorem rare_tabulation_exponent (d b : β) (hd : 14 β€ d) (_hb : 1 β€ b) :
500 * d * b β€ d ^ 6 * b ^ 2 := by
have hfive : 500 β€ d ^ 5 := by
have h := Nat.pow_le_pow_left hd 5
norm_num at h
omega
have hbβ : b β€ b ^ 2 := Nat.le_self_pow (by decide) b
calc
500 * d * b β€ d ^ 5 * d * b := Nat.mul_le_mul_right b (Nat.mul_le_mul_right d hfive)
_ = d ^ 6 * b := by ring
_ β€ d ^ 6 * b ^ 2 := Nat.mul_le_mul_left _ hbβ
theorem rare_tabulation_cost (d b : β) (hd : 14 β€ d) (hb : 1 β€ b) :
(2 : β) ^ (500 * d * b) / (2 : β) ^ (d ^ 6 * b ^ 2) β€ 1 := by
apply (div_le_one (by positivity)).mpr
exact pow_le_pow_rightβ (by norm_num) (rare_tabulation_exponent d b hd hb)
end ContingencyTables
end OAI
|