File size: 3,084 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
import OAI.Dynamics.ConditionalShuffle.Exchangeable

namespace OAI

noncomputable section
open scoped Classical
namespace Thorp.Conditional

lemma physicalFlow_finSum {Ξ± : Type*} [Fintype Ξ±] (d : β„•) (B : Position (d+1) β†’ Bool)
    (a : Ξ± β†’ ℝ) (w : Ξ± β†’ Position (d+1) β†’ ℝ) (c : Position d β†’ Bool) (y) :
    physicalFlow d B (fun x => βˆ‘ i, a i * w i x) c y =
      βˆ‘ i, a i * physicalFlow d B (w i) c y := by
  rw [physicalFlow_resampling, mean_sum]
  simp only [mean_const_mul, physicalFlow_resampling]

lemma physicalFlow_nonneg (d : β„•) (B : Position (d+1) β†’ Bool)
    (w : Position (d+1) β†’ ℝ) (hw : βˆ€ x, 0 ≀ w x) (c : Position d β†’ Bool) (y) :
    0 ≀ physicalFlow d B w c y := by
  rw [physicalFlow_resampling]
  exact mean_nonneg (fun r => hw _)

lemma rawIterate_nonneg (d : β„•) (v : RawState (d+1)) (hv : βˆ€ x, 0 ≀ v.weight x)
    (t : β„•) (Ο‰ : SweepHistory d t) (y) : 0 ≀ (rawIterate d v t Ο‰).weight y := by
  induction t generalizing y with
  | zero => exact hv y
  | succ t ih => exact physicalFlow_nonneg d _ _ (ih (Fin.init Ο‰)) _ y

lemma rawIterate_finSum {Ξ± : Type*} [Fintype Ξ±] (d : β„•) (B : Position (d+1) β†’ Bool)
    (a : Ξ± β†’ ℝ) (w : Ξ± β†’ Position (d+1) β†’ ℝ) (t : β„•) (Ο‰ : SweepHistory d t) (y) :
    (rawIterate d ⟨B,fun x => βˆ‘ i, a i * w i x⟩ t Ο‰).weight y =
      βˆ‘ i, a i * (rawIterate d ⟨B,w i⟩ t Ο‰).weight y := by
  induction t generalizing y with
  | zero => rfl
  | succ t ih =>
      change physicalFlow d (rawIterate d ⟨B,_⟩ t (Fin.init Ο‰)).free
        (rawIterate d ⟨B,_⟩ t (Fin.init Ο‰)).weight (Ο‰ (Fin.last t)) y = _
      have hw : (rawIterate d ⟨B,fun x => βˆ‘ i, a i * w i x⟩ t (Fin.init Ο‰)).weight =
          fun z => βˆ‘ i, a i * (rawIterate d ⟨B,w i⟩ t (Fin.init Ο‰)).weight z := by
        funext z; exact ih (Fin.init Ο‰) z
      rw [hw, physicalFlow_finSum]
      apply Finset.sum_congr rfl; intro i _
      congr 1
      change physicalFlow d _ _ _ y = physicalFlow d _ _ _ y
      congr 1
      funext x
      erw [rawIterate_free, rawIterate_free]
      rfl

lemma rawPoint_nonneg (d t : β„•) (B : Position (d+1) β†’ Bool) (a : Position (d+1))
    (Ο‰ : SweepHistory d t) (y) :
    0 ≀ (rawIterate d (rawPoint (d+1) B a) t Ο‰).weight y :=
  rawIterate_nonneg d _ (fun x => by dsimp [rawPoint]; split <;> norm_num) t Ο‰ y

lemma rawIterate_point_decomposition {Ξ± : Type*} [Fintype Ξ±] (d : β„•)
    (B : Position (d+1) β†’ Bool) (e : Ξ± β†’ Position (d+1)) (a : Ξ± β†’ ℝ)
    (t : β„•) (Ο‰ : SweepHistory d t) (y) :
    (rawIterate d ⟨B,fun x => βˆ‘ i, if x = e i then a i else 0⟩ t Ο‰).weight y =
      βˆ‘ i, a i * (rawIterate d (rawPoint (d+1) B (e i)) t Ο‰).weight y := by
  have hw : (fun x => βˆ‘ i, if x = e i then a i else 0) =
      (fun x => βˆ‘ i, a i * (rawPoint (d+1) B (e i)).weight x) := by
    funext x
    apply Finset.sum_congr rfl; intro i _
    simp only [rawPoint]
    split <;> simp
  rw [hw]
  exact rawIterate_finSum d B a (fun i => (rawPoint (d+1) B (e i)).weight) t Ο‰ y

end Thorp.Conditional

end

end OAI