File size: 4,079 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 92 93 94 | import OAI.Combinatorics.LowSpaceSubsetSum.Storage.PermutationSamplerCoupling
import OAI.Combinatorics.LowSpaceSubsetSum.Compression.CompressionSoundness
namespace OAI
/-! # Input-only bounded permutation and prime draws for compression -/
noncomputable section
namespace LowSpaceSubsetSum.CompressionData
variable {n : β} (D : CompressionData n)
/-- Compression draws one permutation and one prime. Its residue counter is
enumerated deterministically by `compressionTrial`. -/
def sampler (_D : CompressionData n) (hn : 168000000 β€ n) :
SamplerCoupling (CompressionSetup.TrialHistory n) :=
(permutationCoupling n n).bind (fun _ => CompressionSetup.PrimeSpace n)
(fun _ => primeCoupling (by unfold compressionPrimeExponent; omega) n)
theorem sampler_uniform (hn : 168000000 β€ n) :
(D.sampler hn).idealLaw = D.trialLaw hn := by
rw [sampler, SamplerCoupling.bind_idealLaw, permutationCoupling_uniform]
simp only [primeCoupling_uniform]
rfl
theorem sampler_failure (hn : 168000000 β€ n) :
(D.sampler hn).failure β€ n / (2 : β) ^ (n ^ 3) + Real.exp (-((n : β) ^ 2 / 4)) := by
have hprime : compressionPrimeExponent n β€ n := by
unfold compressionPrimeExponent
omega
have h := SamplerCoupling.bind_failure_le (permutationCoupling n n)
(fun _ => CompressionSetup.PrimeSpace n)
(fun _ => primeCoupling (by unfold compressionPrimeExponent; omega) n)
(Real.exp (-((n : β) ^ 2 / 4))) (fun _ => primeCoupling_failure _ hprime)
exact h.trans (add_le_add (permutationCoupling_failure n n) le_rfl)
private theorem prime_tail (hn : 168000000 β€ n) :
Real.exp (-((n : β) ^ 2 / 4)) β€ 1 / (2 : β) ^ (2 * n) := by
have hnR : (16 : β) β€ n := by exact_mod_cast (show 16 β€ n by omega)
have htwo : (2 : β) β€ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : β)]
have hp : (2 : β) ^ (2 * n) β€ Real.exp ((n : β) ^ 2 / 4) := by
calc
_ β€ (Real.exp 1) ^ (2 * n) := pow_le_pow_leftβ (by norm_num) htwo _
_ = Real.exp ((2 * n : β) : β) := by rw [β Real.exp_nat_mul]; simp
_ β€ _ := Real.exp_le_exp.mpr (by push_cast; nlinarith)
rw [Real.exp_neg, β one_div]
exact one_div_le_one_div_of_le (by positivity) hp
theorem sampler_failure_pow (hn : 168000000 β€ n) :
(D.sampler hn).failure β€ 1 / (2 : β) ^ n := by
have hcube : 3 * n β€ n ^ 3 := by
have hs : 3 β€ n ^ 2 := by nlinarith [show 16 β€ n by omega]
calc
3 * n β€ n ^ 2 * n := Nat.mul_le_mul_right n hs
_ = n ^ 3 := by ring
have hrange : (n : β) / (2 : β) ^ (n ^ 3) β€ 1 / (2 : β) ^ (2 * n) := by
apply (div_le_div_iffβ (by positivity) (by positivity)).mpr
rw [one_mul]
calc
_ β€ (2 : β) ^ n * 2 ^ (2 * n) :=
mul_le_mul_of_nonneg_right (by exact_mod_cast (Nat.lt_two_pow_self (n := n)).le)
(by positivity)
_ = (2 : β) ^ (3 * n) := by rw [β pow_add]; congr 1; omega
_ β€ _ := pow_le_pow_rightβ (by norm_num) hcube
have hp := prime_tail hn
have hb := D.sampler_failure hn
have htwo : (2 : β) β€ 2 ^ n := by
simpa using pow_le_pow_rightβ (by norm_num : (1 : β) β€ 2) (by omega : 1 β€ n)
calc
_ β€ 2 / (2 : β) ^ (2 * n) := by
simp only [div_eq_mul_inv, one_mul] at hrange hp hb β’
linarith
_ β€ 1 / (2 : β) ^ n := by
apply (div_le_div_iffβ (by positivity) (by positivity)).mpr
rw [one_mul, two_mul n, pow_add]
exact mul_le_mul_of_nonneg_right htwo (by positivity)
/-- Every ideal compression event loses at most the unconditional exhaustion
probability. No event is conditioned on successful sampling. -/
theorem sampler_event (hn : 168000000 β€ n)
(P : CompressionSetup.TrialHistory n β Prop) :
(D.trialLaw hn).probability P - 1 / (2 : β) ^ n β€
(D.sampler hn).boundedLaw.probability (fun o => β h, o = some h β§ P h) := by
have h := (D.sampler hn).event_lower P
rw [D.sampler_uniform hn] at h
exact (sub_le_sub_left (D.sampler_failure_pow hn) _).trans h
end LowSpaceSubsetSum.CompressionData
end
end OAI
|