math / data /lean /OAI /Dynamics /ConditionalShuffle /RawLinear.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.08 kB
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