cfahlgren1/math / lean /OAI /Probability /SignedSweeps /FiniteSampling.lean
cfahlgren1's picture
download
raw
5.47 kB
import OAI.Probability.SignedSweeps.TupleNorm
namespace OAI
noncomputable section
namespace SignedSweeps
open scoped BigOperators TensorProduct
open Module
open scoped BigOperators
attribute [local instance] Classical.propDecidable
variable (π•œ : Type*) [Field π•œ] {E : Type*} [AddCommGroup E] [Module π•œ E]
{A B : Type*} [Fintype A] [Fintype B]
def finiteMean (f : A β†’ E) : E := (Fintype.card A : π•œ)⁻¹ β€’ βˆ‘ x, f x
lemma finiteMean_congr {f g : A β†’ E} (h : βˆ€ x, f x = g x) :
finiteMean π•œ f = finiteMean π•œ g := by unfold finiteMean; simp only [h]
lemma finiteMean_equiv (e : A ≃ B) (f : B β†’ E) :
finiteMean π•œ (fun x => f (e x)) = finiteMean π•œ f := by
rw [finiteMean, finiteMean, Fintype.card_congr e, e.sum_comp]
lemma finiteMean_const [CharZero π•œ] [Nonempty A] (x : E) : finiteMean π•œ (fun _ : A => x) = x := by
rw [finiteMean, Finset.sum_const, Finset.card_univ, ← Nat.cast_smul_eq_nsmul π•œ,
smul_smul, inv_mul_cancelβ‚€, one_smul]
exact_mod_cast Fintype.card_ne_zero
lemma finiteMean_prod (f : A Γ— B β†’ E) :
finiteMean π•œ f = finiteMean π•œ (fun a => finiteMean π•œ (fun b => f (a,b))) := by
simp only [finiteMean, Fintype.card_prod, Nat.cast_mul, mul_inv_rev, Fintype.sum_prod_type,
← Finset.smul_sum, smul_smul, mul_comm]
lemma linearMap_finiteMean {F : Type*} [AddCommGroup F] [Module π•œ F]
(T : E β†’β‚—[π•œ] F) (f : A β†’ E) :
T (finiteMean π•œ f) = finiteMean π•œ (fun a => T (f a)) := by
simp only [finiteMean, map_smul, map_sum]
end SignedSweeps
end
noncomputable section
namespace SignedSweeps
open scoped BigOperators TensorProduct
open Module
open scoped BigOperators
attribute [local instance] Classical.propDecidable
variable {π•œ R : Type*} [Field π•œ] [CharZero π•œ] [Ring R] [Algebra π•œ R]
lemma finiteMean_reverse_prod (t : β„•) (A : Fin t β†’ Type*) [βˆ€ i, Fintype (A i)]
[βˆ€ i, Nonempty (A i)] (f : βˆ€ i, A i β†’ R) :
finiteMean π•œ (fun a : βˆ€ i, A i => ((List.ofFn fun i => f i (a i)).reverse).prod) =
((List.ofFn fun i => finiteMean π•œ (f i)).reverse).prod := by
induction t with
| zero =>
simp only [List.ofFn_zero, List.reverse_nil, List.prod_nil]
exact finiteMean_const π•œ 1
| succ t ih =>
rw [← finiteMean_equiv π•œ (Fin.consEquiv A), finiteMean_prod]
have hc (a : A 0) (b : βˆ€ i : Fin t, A i.succ) :
((List.ofFn fun i => f i (Fin.consEquiv A (a,b) i)).reverse).prod =
((List.ofFn fun i : Fin t => f i.succ (b i)).reverse).prod * f 0 a := by
rw [List.ofFn_succ, List.reverse_cons, List.prod_append, List.prod_singleton]
simp only [Fin.consEquiv_apply, Fin.cons_zero, Fin.cons_succ]
simp only [hc]
have hr (a : A 0) :
finiteMean π•œ (fun b : βˆ€ i : Fin t, A i.succ =>
((List.ofFn fun i : Fin t => f i.succ (b i)).reverse).prod * f 0 a) =
((List.ofFn fun i : Fin t => finiteMean π•œ (f i.succ)).reverse).prod * f 0 a := by
change finiteMean π•œ (fun b : βˆ€ i : Fin t, A i.succ =>
LinearMap.mulRight π•œ (f 0 a)
(((List.ofFn fun i : Fin t => f i.succ (b i)).reverse).prod)) = _
rw [← linearMap_finiteMean, ih]
rfl
simp only [hr]
change finiteMean π•œ (fun a : A 0 =>
LinearMap.mulLeft π•œ
(((List.ofFn fun i : Fin t => finiteMean π•œ (f i.succ)).reverse).prod)
(f 0 a)) = _
rw [← linearMap_finiteMean]
rw [List.ofFn_succ, List.reverse_cons, List.prod_append, List.prod_singleton]
rfl
end SignedSweeps
end
noncomputable section
namespace SignedSweeps
open scoped BigOperators TensorProduct
open Module
open scoped BigOperators
attribute [local instance] Classical.propDecidable
abbrev SweepSettings (d : β„•) := βˆ€ i : Fin d, coordinateSubgroup d i
def sampleSweep (d : β„•) (a : SweepSettings d) : SymmetricGroup (2 ^ d) :=
((List.ofFn fun i => (a i).1).reverse).prod
lemma representation_sampleSweep_average {π•œ E : Type*} [Field π•œ] [CharZero π•œ]
[AddCommGroup E] [Module π•œ E] (d : β„•) (ρ : Representation π•œ (SymmetricGroup (2 ^ d)) E) :
finiteMean π•œ (fun a : SweepSettings d => ρ (sampleSweep d a)) =
((List.ofFn fun i : Fin d => (Fintype.card (coordinateSubgroup d i) : π•œ)⁻¹ β€’
βˆ‘ g : coordinateSubgroup d i, ρ g.1).reverse).prod := by
have he (a : SweepSettings d) : ρ (sampleSweep d a) =
((List.ofFn fun i : Fin d => ρ (a i).1).reverse).prod := by
simp only [sampleSweep, map_list_prod, List.map_reverse, List.map_ofFn, Function.comp_def]
simp only [he]
exact finiteMean_reverse_prod d (fun i => coordinateSubgroup d i) (fun i g => ρ g.1)
lemma sweepOperator_eq_sampleMean {d : β„•} (lam : Partition (2 ^ d)) :
sweepOperator lam = finiteMean β„‚ (fun a : SweepSettings d => spechtRepresentation lam (sampleSweep d a)) :=
(representation_sampleSweep_average d (spechtRepresentation lam)).symm
lemma tupleSweep_eq_sampleMean (I : Type*) [Fintype I] (d : β„•) :
tupleSweep I d = finiteMean β„‚ (fun a : SweepSettings d => tupleRepresentation I (2 ^ d) (sampleSweep d a)) :=
(representation_sampleSweep_average d (tupleRepresentation I (2 ^ d))).symm
lemma subsetSweep_eq_sampleMean (d : β„•) :
subsetSweep d = finiteMean ℝ (fun a : SweepSettings d => subsetRepresentation (Fin (2 ^ d)) (sampleSweep d a)) :=
(representation_sampleSweep_average d (subsetRepresentation (Fin (2 ^ d)))).symm
end SignedSweeps
end
end OAI

Xet Storage Details

Size:
5.47 kB
Β·
Xet hash:
35ac1e4834ea51a854f6dd88a2fabfb900c418eb8a1d90da2c9cba43a8614a35

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.