Download data/lean/OAI/Combinatorics/EditApproximation/Probability/SampledRegret.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.71 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Probability/SampledRegret.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Probability/SampledRegret.lean
-
curl -L -o SampledRegret.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Probability/SampledRegret.lean
4.71 kB
| import OAI.Combinatorics.EditApproximation.Geometry.ChildIncrements | |
| import OAI.Combinatorics.EditApproximation.Probability.ExactSampling | |
| import OAI.Combinatorics.EditApproximation.Probability.FiniteSampling | |
| namespace OAI | |
| /-! | |
| # Exact sampled action costs | |
| The sampler's finite law translates the computed rational vector into its | |
| expected linear cost. Correlation with a group-estimation failure is not | |
| excluded or needed in this identity. | |
| -/ | |
| namespace EditApproximation | |
| open Finset | |
| theorem uniformMean_mono {Ξ© : Type*} [Fintype Ξ©] (f g : Ξ© β β) | |
| (h : β Ο, f Ο β€ g Ο) : uniformMean f β€ uniformMean g := by | |
| exact div_le_div_of_nonneg_right (sum_le_sum fun Ο _ => h Ο) (Nat.cast_nonneg _) | |
| theorem uniformMean_add {Ξ© : Type*} [Fintype Ξ©] (f g : Ξ© β β) : | |
| uniformMean (fun Ο => f Ο + g Ο) = uniformMean f + uniformMean g := by | |
| simp only [uniformMean, sum_add_distrib, add_div] | |
| theorem uniformMean_mul {Ξ© : Type*} [Fintype Ξ©] (a : β) (f : Ξ© β β) : | |
| uniformMean (fun Ο => a * f Ο) = a * uniformMean f := by | |
| simp only [uniformMean, β mul_sum, mul_div_assoc] | |
| theorem uniformMean_const {Ξ© : Type*} [Fintype Ξ©] [Nonempty Ξ©] (a : β) : | |
| uniformMean (fun _ : Ξ© => a) = a := by | |
| simp only [uniformMean, sum_const, card_univ, nsmul_eq_mul] | |
| have hcard : (Fintype.card Ξ© : β) β 0 := by exact_mod_cast Fintype.card_ne_zero | |
| exact mul_div_cancel_leftβ a hcard | |
| theorem uniformMean_sum {Ξ© ΞΉ : Type*} [Fintype Ξ©] (indices : Finset ΞΉ) (f : ΞΉ β Ξ© β β) : | |
| uniformMean (fun Ο => β i β indices, f i Ο) = β i β indices, uniformMean (f i) := by | |
| unfold uniformMean | |
| rw [sum_comm, sum_div] | |
| theorem finiteRationalOptimizer_sampler_linear_mean {ΞΉ : Type*} | |
| (coordinates : Finset ΞΉ) (vertices : List (ΞΉ β β)) (linear : ΞΉ β β) | |
| (G K : β) (hK : 0 < K) (payoff : ΞΉ β β) : | |
| let : NeZero (optimizerTriangularMass K) := β¨Nat.ne_of_gt (optimizerTriangularMass_positive K hK)β© | |
| uniformMean (fun integer : Fin (optimizerTriangularMass K) => | |
| β i β coordinates, payoff i * | |
| (finiteOptimizerSelection coordinates vertices linear G (triangularChoice K integer).val i : β)) = | |
| β i β coordinates, payoff i * (finiteRationalOptimizer coordinates vertices linear G K i : β) := by | |
| let : NeZero (optimizerTriangularMass K) := β¨Nat.ne_of_gt (optimizerTriangularMass_positive K hK)β© | |
| dsimp only | |
| unfold uniformMean | |
| rw [Fintype.card_fin, sum_comm, sum_div] | |
| apply sum_congr rfl | |
| intro i _ | |
| rw [β mul_sum, mul_div_assoc] | |
| congr 1 | |
| have hmean := finiteRationalOptimizer_sampler_mean coordinates vertices linear G K hK i | |
| exact_mod_cast hmean | |
| theorem actionVector_child_cost_identity {Ξ² Ο : Type*} [Fintype Ξ²] [Nonempty Ξ²] | |
| [DecidableEq Ξ²] [DecidableEq Ο] (band : Finset (Ξ² β Ο)) | |
| (mass : Ξ² β β) (hpos : β child, 0 < mass child) | |
| (table : β β Ξ² Γ Ο β β) (ΞΊ : β) (t : β) | |
| {action : Ξ² β Ο} (ha : action β band) : | |
| -((β child, mass child : β) : β) * | |
| (β i β bandCoordinates band, | |
| ((childGain mass table t i : β) + (1 - (ΞΊ : β)) * childDecrement mass table t i) * | |
| (actionVector mass action i : β)) = | |
| (β child, (table (t + 1) (child, action child) : β)) + | |
| (ΞΊ : β) * ((β child, (table t (child, action child) : β)) - | |
| β child, (table (t + 1) (child, action child) : β)) := by | |
| have hidentity := actionVector_cost_identity band mass hpos | |
| (fun i => (ΞΊ : β) * table t i + (1 - (ΞΊ : β)) * table (t + 1) i) ha | |
| have hgain i : (childGain mass table t i : β) + (1 - (ΞΊ : β)) * childDecrement mass table t i = | |
| -((ΞΊ : β) * table t i + (1 - (ΞΊ : β)) * table (t + 1) i) / (mass i.1 : β) := by | |
| have hid := childGain_decrement_identity mass table ΞΊ t i | |
| exact_mod_cast hid | |
| simp_rw [hgain] | |
| rw [hidentity] | |
| simp only [sum_add_distrib, β mul_sum] | |
| ring | |
| theorem actionVector_comparator_cost_identity {Ξ² Ο : Type*} [Fintype Ξ²] [Nonempty Ξ²] | |
| [DecidableEq Ξ²] [DecidableEq Ο] (band : Finset (Ξ² β Ο)) | |
| (mass : Ξ² β β) (hpos : β child, 0 < mass child) | |
| (table : β β Ξ² Γ Ο β β) (t : β) | |
| {action : Ξ² β Ο} (ha : action β band) : | |
| -((β child, mass child : β) : β) * | |
| (β i β bandCoordinates band, | |
| ((childGain mass table t i : β) + childDecrement mass table t i) * | |
| (actionVector mass action i : β)) = | |
| β child, (table (t + 1) (child, action child) : β) := by | |
| simpa only [Rat.cast_zero, sub_zero, one_mul, zero_mul, add_zero] using | |
| actionVector_child_cost_identity band mass hpos table 0 t ha | |
| end EditApproximation | |
| end OAI | |