File size: 2,347 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.FiniteBits

namespace OAI

namespace MatroidProphet
open Finset
variable {Ξ± : Type*} [DecidableEq Ξ±]

theorem bitsExpectation_restrict (q : Ξ± β†’ ℝ) (W V : Finset Ξ±) (hV : V βŠ† W)
    (f : Finset Ξ± β†’ ℝ)
    (hf : βˆ€ S S', (βˆ€ e ∈ V, e ∈ S ↔ e ∈ S') β†’ f S = f S') :
    bitsExpectation q W f = bitsExpectation q V f := by
  induction W using Finset.strongInductionOn with
  | _ W ih =>
    by_cases hW : W βŠ† V
    Β· rw [subset_antisymm hW hV]
    · obtain ⟨e, heW, heV⟩ := Finset.not_subset.mp hW
      have hVerase : V βŠ† W.erase e := by
        intro x hx
        exact mem_erase.mpr ⟨fun h => heV (h β–Έ hx), hV hx⟩
      have heq : bitsExpectation q (W.erase e) (fun S => f (insert e S)) =
          bitsExpectation q (W.erase e) f := by
        apply bitsExpectation_congr
        intro S _
        apply hf
        intro x hx
        have hxe : x β‰  e := fun h => heV (h β–Έ hx)
        simp [hxe]
      have hs := bitsExpectation_insert q (W.erase e) e (notMem_erase e W) f
      rw [insert_erase heW, heq, ih (W.erase e) (erase_ssubset heW) hVerase] at hs
      linarith

lemma bitsExpectation_sum {ΞΉ : Type*} (q : Ξ± β†’ ℝ) (V : Finset Ξ±) (I : Finset ΞΉ)
    (f : ΞΉ β†’ Finset Ξ± β†’ ℝ) :
    bitsExpectation q V (fun S => βˆ‘ e ∈ I, f e S) = βˆ‘ e ∈ I, bitsExpectation q V (f e) := by
  simp only [bitsExpectation, mul_sum]
  rw [sum_comm]

lemma bitsExpectation_mem (q : Ξ± β†’ ℝ) (V : Finset Ξ±) (e : Ξ±) (he : e ∈ V) :
    bitsExpectation q V (fun S => if e ∈ S then 1 else 0) = q e := by
  rw [bitsExpectation_restrict q V {e} (singleton_subset_iff.mpr he)
    (fun S => if e ∈ S then 1 else 0) (by
      intro S S' h
      simp only [h e (mem_singleton_self e)])]
  rw [show ({e} : Finset Ξ±) = insert e βˆ… from rfl,
    bitsExpectation_insert q βˆ… e (notMem_empty e)]
  simp [bitsExpectation_empty]

lemma bitsExpectation_card_inter (q : Ξ± β†’ ℝ) (V K : Finset Ξ±) (hKV : K βŠ† V) :
    bitsExpectation q V (fun S => ((K ∩ S).card : ℝ)) = βˆ‘ e ∈ K, q e := by
  have hsum (S : Finset Ξ±) : ((K ∩ S).card : ℝ) =
      βˆ‘ e ∈ K, if e ∈ S then (1 : ℝ) else 0 := by
    simp
  simp_rw [hsum]
  rw [bitsExpectation_sum]
  exact sum_congr rfl (fun e he => bitsExpectation_mem q V e (hKV he))

end MatroidProphet

end OAI