File size: 2,841 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 | import OAI.Probability.MatroidProphet.Residual.Tail
import OAI.Probability.MatroidProphet.Residual.Comparison
namespace OAI
namespace MatroidProphet
open Finset
variable {Ξ± : Type*} [DecidableEq Ξ±]
noncomputable def tripleMaskExpectation (p q r : Ξ± β β) (V : Finset Ξ±)
(f : Finset Ξ± β Finset Ξ± β Finset Ξ± β β) : β :=
bitsExpectation p V (fun D => bitsExpectation q V (fun C => bitsExpectation r V (f D C)))
lemma tripleMaskExpectation_mono (p q r : Ξ± β β)
(hp0 : β e, 0 β€ p e) (hp1 : β e, p e β€ 1)
(hq0 : β e, 0 β€ q e) (hq1 : β e, q e β€ 1)
(hr0 : β e, 0 β€ r e) (hr1 : β e, r e β€ 1)
(V : Finset Ξ±) {f g : Finset Ξ± β Finset Ξ± β Finset Ξ± β β}
(h : β D β V, β C β V, β T β V, f D C T β€ g D C T) :
tripleMaskExpectation p q r V f β€ tripleMaskExpectation p q r V g := by
apply bitsExpectation_mono p hp0 hp1
intro D hD
apply bitsExpectation_mono q hq0 hq1
intro C hC
exact bitsExpectation_mono r hr0 hr1 V (fun T hT => h D hD C hC T hT)
lemma tripleMaskExpectation_add (p q r : Ξ± β β) (V : Finset Ξ±)
(f g : Finset Ξ± β Finset Ξ± β Finset Ξ± β β) :
tripleMaskExpectation p q r V (fun D C T => f D C T + g D C T) =
tripleMaskExpectation p q r V f + tripleMaskExpectation p q r V g := by
simp only [tripleMaskExpectation, bitsExpectation_add]
lemma tripleMaskExpectation_mul (p q r : Ξ± β β) (V : Finset Ξ±) (c : β)
(f : Finset Ξ± β Finset Ξ± β Finset Ξ± β β) :
tripleMaskExpectation p q r V (fun D C T => c * f D C T) =
c * tripleMaskExpectation p q r V f := by
simp only [tripleMaskExpectation, bitsExpectation_mul_const]
lemma tripleMask_sample_to_rank (p q r : Ξ± β β)
(hp0 : β e, 0 β€ p e) (hp1 : β e, p e β€ 1)
(hq0 : β e, 0 β€ q e) (hq1 : β e, q e β€ 1)
(hr0 : β e, 0 β€ r e) (hr1 : β e, r e β€ 1)
(V : Finset Ξ±) (Ο z error : Finset Ξ± β Finset Ξ± β Finset Ξ± β β)
(Y : β)
(hdet : β D β V, β C β V, β T β V, Ο D C T β€ densityThreshold * z D C T + error D C T)
(hsafe : retainedFraction * Y - (V.card : β) / densityThreshold β€ tripleMaskExpectation p q r V Ο)
(herr : tripleMaskExpectation p q r V error β€ 2 * residualDelta * V.card) :
(retainedFraction * Y - ((2 : β)^23)β»ΒΉ * V.card) / densityThreshold β€
tripleMaskExpectation p q r V z := by
have hcompare := tripleMaskExpectation_mono p q r hp0 hp1 hq0 hq1 hr0 hr1 V hdet
rw [tripleMaskExpectation_add, tripleMaskExpectation_mul] at hcompare
have hc := mul_le_mul_of_nonneg_right residual_error_constant (Nat.cast_nonneg V.card)
have hkpos : 0 < densityThreshold := constants_positive.2.1
apply (div_le_iffβ hkpos).2
rw [div_eq_mul_inv] at hsafe
nlinarith
end MatroidProphet
end OAI
|