Download data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactMatrixLimits.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactMatrixLimits.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactMatrixLimits.lean
-
curl -L -o ExactMatrixLimits.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ContingencyTables/Sampling/ExactMatrixLimits.lean
1.9 kB
| import OAI.Combinatorics.ContingencyTables.Sampling.ExactMatrixTrial | |
| namespace OAI | |
| /-! # Limiting output law of the executed matrix rejection loop -/ | |
| namespace ContingencyTables.ExactMatrixTrial | |
| open MatchingFPRAS MatchingFPRAS.PhysicalStream DensePrograms | |
| open ExactIntegerChoice ResidualMixture FirstSuccess | |
| open scoped BigOperators Classical | |
| noncomputable section | |
| lemma prefix_mass {K : β} (candidates : Lookup) (w : Fin K β β) | |
| (hw : 0<totalWeight w) (N : β) (X : MatrixCode) : | |
| (OnlineIntegerRetry.prefixExperiment (f := trial) (candidates,List.ofFn w) N).mean | |
| (fun o => if o=some X then 1 else 0)= | |
| β i : Fin K,if lookup (candidates,i.val)=X then | |
| (retryIntegerLaw w hw (Nat.le_pow_clog (by decide : 1<2) (totalWeight w)) N).mass (some i) | |
| else 0 := by | |
| rw [prefix_mean candidates w hw,Fintype.sum_option] | |
| simp only [Option.map_none,reduceCtorEq,ite_false,mul_zero,zero_add,Option.map_some, | |
| Option.some.injEq,mul_ite,mul_one,mul_zero] | |
| /-- The integer rejection loop tends to the exact weighted pushforward, | |
| including repeated matrix codes in a candidate list. -/ | |
| theorem prefix_limit {K : β} (candidates : Lookup) (w : Fin K β β) | |
| (hw : 0<totalWeight w) (X : MatrixCode) : | |
| Filter.Tendsto (fun N => | |
| ((OnlineIntegerRetry.prefixExperiment (f := trial) (candidates,List.ofFn w) N).mean | |
| (fun o => if o=some X then 1 else 0):β)) | |
| Filter.atTop (nhds ((β i : Fin K,if lookup (candidates,i.val)=X then normalized w i else 0:β):β)) := by | |
| simp_rw [prefix_mass candidates w hw,Rat.cast_sum] | |
| apply tendsto_finsetSum | |
| intro i _ | |
| by_cases hi : lookup (candidates,i.val)=X | |
| Β· simp only [hi,ite_true] | |
| exact retryIntegerLaw_limit w hw _ (clog_power_lt_twice (totalWeight w) hw) i | |
| Β· simp only [hi,ite_false,Rat.cast_zero] | |
| exact tendsto_const_nhds | |
| end | |
| end ContingencyTables.ExactMatrixTrial | |
| end OAI | |