File size: 2,030 Bytes
f0f05de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Combinatorics.BalancedRyser.Local.InjectionExposure
import OAI.Combinatorics.BalancedRyser.Probability.FiniteUniformConditioning

namespace OAI

namespace Balanced.InjectionExposure

variable {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J]
  [Nonempty (I ↪ J)]

theorem original_uniform_conditioned (K : Finset I) (base : I ↪ J)
    (h : ∃ e ∈ (↑(completions K base) : Set (I ↪ J)),
      e ∈ (PMF.uniformOfFintype (I ↪ J)).support) :
    (PMF.uniformOfFintype (I ↪ J)).filter (↑(completions K base)) h =
      PMF.uniformOfFinset (completions K base) (completions_nonempty K base) := by
  classical
  let S := completions K base
  have : Nonempty (↑S : Set (I ↪ J)) := ⟨⟨base, by simp [S]⟩⟩
  rw [uniform_filter_eq_subtype_map]
  ext e
  by_cases he : e ∈ completions K base
  · rw [PMF.map_apply, tsum_eq_single (⟨e, he⟩ : (↑S : Set (I ↪ J)))]
    · simp only [PMF.uniformOfFintype_apply, PMF.uniformOfFinset_apply,
        he, ite_true]
      exact congrArg (fun n : ℕ => (n : ENNReal)⁻¹)
        (Fintype.card_coe (completions K base))
    · intro f hf
      rw [ite_eq_right]
      intro hef
      exact hf (Subtype.ext hef.symm)
  · rw [PMF.uniformOfFinset_apply_of_notMem (completions_nonempty K base) he,
      PMF.map_apply]
    apply ENNReal.tsum_eq_zero.mpr
    intro f
    rw [ite_eq_right]
    intro hef
    exact he (hef ▸ f.property)

theorem original_conditioned_next_event (K : Finset I) (base : I ↪ J)
    (h : ∃ e ∈ (↑(completions K base) : Set (I ↪ J)),
      e ∈ (PMF.uniformOfFintype (I ↪ J)).support)
    (i : I) (hi : i ∉ K) (P : J → Prop) [DecidablePred P] :
    (((PMF.uniformOfFintype (I ↪ J)).filter (↑(completions K base)) h).toOuterMeasure
      {e | P (e i)}).toReal =
        (((remaining K base).filter P).card : ℝ) / ((remaining K base).card : ℝ) := by
  rw [original_uniform_conditioned K base h]
  exact next_event_probability K base i hi P

end Balanced.InjectionExposure

end OAI