File size: 4,709 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 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
|