Download data/lean/OAI/Dynamics/ConditionalShuffle/CycleIterate.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.99 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/ConditionalShuffle/CycleIterate.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Dynamics/ConditionalShuffle/CycleIterate.lean
-
curl -L -o CycleIterate.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/ConditionalShuffle/CycleIterate.lean
2.99 kB
| import OAI.Dynamics.ConditionalShuffle.OverlayDistance | |
| namespace OAI | |
| noncomputable section | |
| open scoped Classical | |
| namespace Thorp.Conditional.OverlayEnergy | |
| def cycles (g : β) (v : RawState (g+3)) : (n : β) β (Fin n β CycleCoins g) β RawState (g+3) | |
| | 0, _ => v | |
| | n+1, Ο => cycle g (cycles g v n (Fin.init Ο)) (Ο (Fin.last n)) | |
| def cyclesPerm (g : β) : (n : β) β (Fin n β CycleCoins g) β State (g+3) | |
| | 0, _ => 1 | |
| | n+1, Ο => cyclePerm g (Ο (Fin.last n)) * cyclesPerm g n (Fin.init Ο) | |
| lemma cycles_free (g : β) (v : RawState (g+3)) (n : β) (Ο : Fin n β CycleCoins g) (y) : | |
| (cycles g v n Ο).free y = v.free ((cyclesPerm g n Ο).symm y) := by | |
| induction n generalizing y with | |
| | zero => rfl | |
| | succ n ih => | |
| rw [cycles, cycle_free, ih] | |
| rfl | |
| lemma cycles_count (g : β) (v : RawState (g+3)) (n : β) (Ο : Fin n β CycleCoins g) : | |
| freeCount (cycles g v n Ο).free = freeCount v.free := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => exact (cycle_count g _ _).trans (ih (Fin.init Ο)) | |
| lemma cycles_mass (g : β) (v : RawState (g+3)) (n : β) (Ο : Fin n β CycleCoins g) : | |
| (β x, (cycles g v n Ο).weight x) = β x, v.weight x := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => exact (cycle_mass g _ _).trans (ih (Fin.init Ο)) | |
| lemma cycles_support (g : β) (v : RawState (g+3)) | |
| (hw : β x, v.free x = false β v.weight x = 0) (n : β) (Ο : Fin n β CycleCoins g) : | |
| β x, (cycles g v n Ο).free x = false β (cycles g v n Ο).weight x = 0 := by | |
| induction n with | |
| | zero => exact hw | |
| | succ n ih => exact cycle_support g _ (ih (Fin.init Ο)) _ | |
| lemma cycles_energy_le (g : β) (v : RawState (g+3)) (n : β) (Ο : Fin n β CycleCoins g) : | |
| rawEnergy (cycles g v n Ο) β€ rawEnergy v := by | |
| induction n with | |
| | zero => exact le_rfl | |
| | succ n ih => exact (cycle_energy_le g _ _).trans (ih (Fin.init Ο)) | |
| lemma cycles_expected_energy (g : β) (v : RawState (g+3)) | |
| (hw : β x, v.free x = false β v.weight x = 0) (hz : β x, v.weight x = 0) | |
| (hf : Fintype.card (Position (g+3)) β€ 64 * freeCount v.free) | |
| (hk : freeCount v.free β€ 2^g) | |
| (hs : 256*(g+4) β€ Fintype.card (Position (g+3))) (n : β) : | |
| mean (fun Ο : Fin n β CycleCoins g => rawEnergy (cycles g v n Ο)) β€ | |
| rawEnergy v * coefficient g ^ n := by | |
| induction n with | |
| | zero => simp only [cycles, mean_const, pow_zero, mul_one, le_refl] | |
| | succ n ih => | |
| rw [mean_function_snoc] | |
| simp only [cycles, Fin.init_snoc, Fin.snoc_last] | |
| have hh := mean_le_mean (fun Ο : Fin n β CycleCoins g => cycle_expected_energy g | |
| (cycles g v n Ο) (cycles_support g v hw n Ο) ((cycles_mass g v n Ο).trans hz) | |
| (by rwa [cycles_count]) (by rwa [cycles_count]) hs) | |
| rw [mean_mul_const] at hh | |
| exact hh.trans ((mul_le_mul_of_nonneg_right ih (coefficient_nonneg g)).trans_eq (by | |
| rw [pow_succ, mul_assoc])) | |
| end Thorp.Conditional.OverlayEnergy | |
| end | |
| end OAI | |