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