Download data/lean/OAI/Combinatorics/KServer/Experiments.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 18.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/KServer/Experiments.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/KServer/Experiments.lean
-
curl -L -o Experiments.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/KServer/Experiments.lean
18.9 kB
| import Mathlib | |
| import OAI.Combinatorics.KServer.Amplification | |
| import OAI.Combinatorics.KServer.Ranks | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators | |
| open Finset | |
| namespace KServer.FiniteExperiment | |
| attribute [local instance] Classical.propDecidable | |
| open Finset Episode PosteriorRanks | |
| universe u v | |
| variable {Y : Type u} [MetricSpace Y] [Fintype Y] {k H : β} [NeZero k] | |
| /-- A fixed minimizing labeled trajectory for each complete input. -/ | |
| def optimalTrace (s : Configuration k Y) (Ο : Fin H β Y) : List (Y Γ Fin k) := | |
| serviceTrace (List.ofFn Ο) (optimalCost_attained s (List.ofFn Ο)).choose | |
| omit [Fintype Y] in | |
| lemma optimalTrace_requests (s : Configuration k Y) (Ο : Fin H β Y) : | |
| (optimalTrace s Ο).map Prod.fst=List.ofFn Ο := | |
| serviceTrace_requests _ _ | |
| omit [Fintype Y] in | |
| lemma optimalTrace_cost (s : Configuration k Y) (Ο : Fin H β Y) : | |
| traceCost s (optimalTrace s Ο)=optimalCost s (List.ofFn Ο) := by | |
| rw [optimalTrace,serviceTrace_cost] | |
| exact (optimalCost_attained s (List.ofFn Ο)).choose_spec | |
| omit [Fintype Y] in | |
| lemma optimalTrace_length (s : Configuration k Y) (Ο : Fin H β Y) : | |
| (optimalTrace s Ο).length=H := by | |
| simpa only [List.length_map,List.length_ofFn] using | |
| congrArg List.length (optimalTrace_requests s Ο) | |
| /-- The genuine hidden configuration, frozen when the finite input ends. -/ | |
| def hidden (s : Configuration k Y) (Ο : Fin H β Y) (t : β) : Configuration k Y := | |
| configurationAfter s ((optimalTrace s Ο).take t) | |
| omit [Fintype Y] in | |
| lemma hidden_zero (s : Configuration k Y) (Ο : Fin H β Y) : hidden s Ο 0=s := by | |
| simp [hidden,configurationAfter] | |
| /-- Current designated occurrence in the selected optimum; it is not observed. -/ | |
| def mover (s : Configuration k Y) (Ο : Fin H β Y) (t : Fin H) : Fin k := | |
| ((optimalTrace s Ο)[t.val]'(by rw [optimalTrace_length]; exact t.isLt)).2 | |
| omit [Fintype Y] in | |
| lemma optimalTrace_get_request (s : Configuration k Y) (Ο : Fin H β Y) (t : Fin H) : | |
| ((optimalTrace s Ο)[t.val]'(by rw [optimalTrace_length]; exact t.isLt)).1=Ο t := by | |
| have he := congrArg (fun l : List Y => l[t.val]?) (optimalTrace_requests s Ο) | |
| apply Option.some.inj | |
| simpa only [List.getElem?_map,List.getElem?_eq_getElem | |
| (show t.val<(optimalTrace s Ο).length by rw [optimalTrace_length]; exact t.isLt), | |
| Option.map_some,List.getElem?_ofFn,Fin.isLt,dite_eq_left] using he | |
| omit [Fintype Y] in | |
| lemma hidden_step (s : Configuration k Y) (Ο : Fin H β Y) (t : Fin H) : | |
| hidden s Ο (t.val+1)=serve (hidden s Ο t.val) (mover s Ο t) (Ο t) := by | |
| have ht : t.val<(optimalTrace s Ο).length := by rw [optimalTrace_length]; exact t.isLt | |
| rw [hidden,List.take_succ_eq_append_getElem ht,configurationAfter_append] | |
| simp only [configurationAfter] | |
| rw [optimalTrace_get_request] | |
| rfl | |
| omit [Fintype Y] in | |
| lemma hidden_covers (s : Configuration k Y) (Ο : Fin H β Y) (t : Fin H) : | |
| hidden s Ο (t.val+1) (mover s Ο t)=Ο t := by | |
| rw [hidden_step] | |
| simp [serve] | |
| /-- A finite observation sufficient for exactly the request requestPrefix. -/ | |
| def requestPrefix (Ο : Fin H β Y) (t : β) : Fin H β Option Y := | |
| fun i => if i.val<t then some (Ο i) else none | |
| omit [MetricSpace Y] [Fintype Y] in | |
| lemma prefix_refines (Ο Ο : Fin H β Y) (t : β) | |
| (h : requestPrefix Ο (t+1)=requestPrefix Ο (t+1)) : requestPrefix Ο t=requestPrefix Ο t := by | |
| funext i | |
| by_cases hi : i.val<t | |
| Β· have he := congrFun h i | |
| simpa [requestPrefix,hi,show i.val<t+1 by omega] using he | |
| Β· simp [requestPrefix,hi] | |
| omit [MetricSpace Y] [Fintype Y] in | |
| lemma prefix_request {Ο Ο : Fin H β Y} (t : Fin H) | |
| (h : requestPrefix Ο (t.val+1)=requestPrefix Ο (t.val+1)) : Ο t=Ο t := by | |
| have he := congrFun h t | |
| simpa [requestPrefix] using he | |
| variable {T : Type v} [Fintype T] | |
| /-- Histories include the independent partition tape from time zero. Coding a | |
| finite observation by a natural number is injective, not a loss of information. -/ | |
| def history (t : β) (Ο : (Fin H β Y) Γ T) : β := | |
| (Fintype.equivFin (T Γ (Fin H β Option Y)) (Ο.2,requestPrefix Ο.1 t)).val | |
| omit [MetricSpace Y] in | |
| lemma history_eq_iff (t : β) (Ο z : (Fin H β Y) Γ T) : | |
| history t Ο=history t z β Ο.2=z.2 β§ requestPrefix Ο.1 t=requestPrefix z.1 t := by | |
| unfold history | |
| rw [Fin.val_inj,(Fintype.equivFin _).injective.eq_iff,Prod.mk.injEq] | |
| omit [MetricSpace Y] in | |
| lemma history_refines (t : β) (Ο z : (Fin H β Y) Γ T) | |
| (h : history (t+1) Ο=history (t+1) z) : history t Ο=history t z := by | |
| rw [history_eq_iff] at h β’ | |
| exact β¨h.1,prefix_refines _ _ _ h.2β© | |
| /-- Literal independent product weights, before any requestPrefix is revealed. -/ | |
| def weight (law : FiniteDistribution (Fin H β Y)) (tape : FiniteDistribution T) | |
| (Ο : (Fin H β Y) Γ T) : β := law.val Ο.1*tape.val Ο.2 | |
| omit [MetricSpace Y] in | |
| lemma weight_nonneg (law : FiniteDistribution (Fin H β Y)) (tape : FiniteDistribution T) | |
| (Ο : (Fin H β Y) Γ T) : 0β€weight law tape Ο := | |
| mul_nonneg (law.property.1 _) (tape.property.1 _) | |
| omit [MetricSpace Y] in | |
| lemma weight_sum (law : FiniteDistribution (Fin H β Y)) (tape : FiniteDistribution T) : | |
| β Ο,weight law tape Ο=1 := by | |
| simp only [weight,Fintype.sum_prod_type,βmul_sum,tape.property.2,mul_one,law.property.2] | |
| /-- All ranks queried by the allocation are actual conditional hidden counts. | |
| The online map may depend on the partition tape and request requestPrefix; it never | |
| changes how the old hidden quantity is filtered. -/ | |
| def count (s : Configuration k Y) {V : Type*} (map : β β ((Fin H β Y) Γ T) β Y β V) | |
| (under : V β V β Bool) (v : V) (t : β) (Ο : (Fin H β Y) Γ T) : β := | |
| univ.sum fun i : Fin k => if under v (map t Ο (hidden s Ο.1 t i)) then 1 else 0 | |
| omit [Fintype Y] [Fintype T] in | |
| lemma count_le (s : Configuration k Y) {V : Type*} | |
| (map : β β ((Fin H β Y) Γ T) β Y β V) (under : V β V β Bool) | |
| (v : V) (t : β) (Ο : (Fin H β Y) Γ T) : count s map under v t Οβ€k := by | |
| calc | |
| _ β€ β _i : Fin k,1 := sum_le_sum fun _ _ => by aesop | |
| _ = k := by simp | |
| /-- This concrete process discharges the signed all-step filtering premise. -/ | |
| def ranks (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (tape : FiniteDistribution T) {V : Type*} | |
| (map : β β ((Fin H β Y) Γ T) β Y β V) (under : V β V β Bool) | |
| (v : V) (a : Fin k) : RankTracking.FilteredRanks (weight law tape) := | |
| rankProcess (weight_nonneg law tape) history history_refines (count s map under v) a.val | |
| lemma ranks_drift (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (tape : FiniteDistribution T) {V : Type*} | |
| (map : β β ((Fin H β Y) Γ T) β Y β V) (under : V β V β Bool) | |
| (v : V) (t : β) : | |
| (β a : Fin k,RankTracking.avg (weight law tape) (fun Ο => | |
| |(ranks s law tape map under v a).p (t+1) Ο- | |
| (ranks s law tape map under v a).before (t+1) Ο|)) β€ | |
| RankTracking.avg (weight law tape) (fun Ο => | |
| |(count s map under v (t+1) Ο:β)-count s map under v t Ο|) := | |
| rankProcess_drift (weight_nonneg law tape) history history_refines | |
| (count s map under v) (count_le s map under v) t | |
| omit [Fintype Y] in | |
| lemma hidden_movement (s : Configuration k Y) (Ο : Fin H β Y) (t : Fin H) : | |
| (β i,dist (hidden s Ο t.val i) (hidden s Ο (t.val+1) i))= | |
| dist (hidden s Ο t.val (mover s Ο t)) (Ο t) := by | |
| classical | |
| rw [hidden_step] | |
| simp [serve,Function.update_apply,apply_ite] | |
| omit [Fintype Y] in | |
| lemma hidden_total_cost (s : Configuration k Y) (Ο : Fin H β Y) : | |
| (β t : Fin H,β i,dist (hidden s Ο t.val i) (hidden s Ο (t.val+1) i))= | |
| optimalCost s (List.ofFn Ο) := by | |
| have he (n : β) (hn : nβ€H) : | |
| traceCost s ((optimalTrace s Ο).take n)= | |
| β t β range n,β i,dist (hidden s Ο t i) (hidden s Ο (t+1) i) := by | |
| induction n with | |
| | zero => simp [traceCost] | |
| | succ n ih => | |
| have hlt : n<(optimalTrace s Ο).length := by rw [optimalTrace_length]; omega | |
| rw [List.take_succ_eq_append_getElem hlt,traceCost_append,ih (by omega),sum_range_succ] | |
| congr 1 | |
| rw [hidden_movement s Ο β¨n,by omegaβ©] | |
| simp only [traceCost,add_zero] | |
| rw [optimalTrace_get_request s Ο β¨n,by omegaβ©] | |
| rfl | |
| have htake : (optimalTrace s Ο).take H=optimalTrace s Ο := by | |
| apply List.take_of_length_le | |
| exact (optimalTrace_length s Ο).le | |
| rw [βoptimalTrace_cost,βhtake,he H le_rfl] | |
| exact (Finset.sum_range (fun t : β => β i, | |
| dist (hidden s Ο t i) (hidden s Ο (t+1) i))).symm | |
| lemma expected_hidden_cost (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (tape : FiniteDistribution T) : | |
| (β Ο,weight law tape Ο*(β t : Fin H,β i, | |
| dist (hidden s Ο.1 t.val i) (hidden s Ο.1 (t.val+1) i)))= | |
| β Ο,law.val Ο*optimalCost s (List.ofFn Ο) := by | |
| simp only [hidden_total_cost,weight,Fintype.sum_prod_type] | |
| simp_rw [mul_right_comm (law.val _) (tape.val _),βmul_sum,tape.property.2,mul_one] | |
| /-- True request history alone, for computing the metric posterior independently | |
| of the partition tape. -/ | |
| def requestHistory (t : β) (Ο : Fin H β Y) : β := | |
| (Fintype.equivFin (Fin H β Option Y) (requestPrefix Ο t)).val | |
| omit [MetricSpace Y] in | |
| lemma requestHistory_eq_iff (t : β) (Ο Ο : Fin H β Y) : | |
| requestHistory t Ο=requestHistory t Ο β requestPrefix Ο t=requestPrefix Ο t := by | |
| unfold requestHistory | |
| rw [Fin.val_inj,(Fintype.equivFin _).injective.eq_iff] | |
| omit [MetricSpace Y] in | |
| lemma mass_product (law : FiniteDistribution (Fin H β Y)) (tape : FiniteDistribution T) | |
| (t : β) (Ο : (Fin H β Y) Γ T) : | |
| mass (weight law tape) (history t) (history t Ο)= | |
| mass law.val (requestHistory t) (requestHistory t Ο.1)*tape.val Ο.2 := by | |
| classical | |
| simp only [mass,fiber,sum_filter,history_eq_iff,requestHistory_eq_iff, | |
| Fintype.sum_prod_type,weight] | |
| rw [sum_mul] | |
| apply sum_congr rfl | |
| intro Ο _ | |
| by_cases hp : requestPrefix Ο t=requestPrefix Ο.1 t | |
| Β· simp [hp] | |
| Β· simp [hp] | |
| omit [MetricSpace Y] in | |
| lemma numerator_product (law : FiniteDistribution (Fin H β Y)) (tape : FiniteDistribution T) | |
| (t : β) (Ο : (Fin H β Y) Γ T) (f : (Fin H β Y) β β) : | |
| numerator (weight law tape) (history t) (fun z => f z.1) (history t Ο)= | |
| numerator law.val (requestHistory t) f (requestHistory t Ο.1)*tape.val Ο.2 := by | |
| classical | |
| simp only [numerator,fiber,sum_filter,history_eq_iff,requestHistory_eq_iff, | |
| Fintype.sum_prod_type,weight] | |
| rw [sum_mul] | |
| apply sum_congr rfl | |
| intro Ο _ | |
| by_cases hp : requestPrefix Ο t=requestPrefix Ο.1 t | |
| Β· simp [hp]; ring | |
| Β· simp [hp] | |
| omit [MetricSpace Y] in | |
| /-- The precise independence statement legitimately used by the manuscript. | |
| It does not assert independence of partition events after conditioning on the | |
| tape, nor does it select reset events in a martingale estimate. -/ | |
| lemma posterior_tape_irrelevant (law : FiniteDistribution (Fin H β Y)) | |
| (tape : FiniteDistribution T) (t : β) (Ο : (Fin H β Y) Γ T) | |
| (ht : tape.val Ο.2β 0) (f : (Fin H β Y) β β) : | |
| posterior (weight law tape) (history t) (fun z => f z.1) Ο= | |
| posterior law.val (requestHistory t) f Ο.1 := by | |
| simp only [posterior,numerator_product,mass_product] | |
| exact mul_div_mul_right _ _ ht | |
| /-- Counting measure of a labeled configuration; repetitions contribute separately. -/ | |
| def metricCount (c : Configuration k Y) (y : Y) : β := by | |
| classical | |
| exact β i : Fin k, if c i=y then 1 else 0 | |
| omit [MetricSpace Y] [Fintype Y] [NeZero k] in | |
| lemma metricCount_nonneg (c : Configuration k Y) (y : Y) : 0 β€ metricCount c y := by | |
| classical | |
| exact sum_nonneg fun i _ => by split_ifs <;> norm_num | |
| omit [MetricSpace Y] [NeZero k] in | |
| lemma metricCount_total (c : Configuration k Y) : β y,metricCount c y=(k:β) := by | |
| classical | |
| simp only [metricCount] | |
| rw [sum_comm] | |
| simp | |
| omit [MetricSpace Y] [Fintype Y] [NeZero k] in | |
| lemma metricCount_at (c : Configuration k Y) (y : Y) (h : β i,c i=y) : | |
| 1 β€ metricCount c y := by | |
| classical | |
| obtain β¨i,hiβ© := h | |
| have hs := single_le_sum (s := (univ : Finset (Fin k))) (f := fun j => | |
| if c j=y then (1:β) else 0) (fun j _ => by split_ifs <;> norm_num) (mem_univ i) | |
| simpa [hi,metricCount] using hs | |
| /-- The true-metric posterior after t requests, independent of algorithmic tapes. -/ | |
| def mu (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : β) (Ο : Fin H β Y) (y : Y) : β := | |
| posterior law.val (requestHistory t) (fun Ο => metricCount (hidden s Ο t) y) Ο | |
| lemma mu_nonneg (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : β) (Ο : Fin H β Y) (y : Y) : 0 β€ mu s law t Ο y := | |
| posterior_nonneg law.property.1 _ (fun _ => metricCount_nonneg _ _) _ | |
| lemma mu_total (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : β) (Ο : Fin H β Y) (hΟ : 0<law.val Ο) : β y,mu s law t Ο y=(k:β) := by | |
| unfold mu | |
| rw [βposterior_sum] | |
| exact posterior_fiber_const Ο (fun Ο _ => metricCount_total _) (mass_pos_of_weight law.property.1 _ Ο hΟ).ne' | |
| omit [MetricSpace Y] in | |
| lemma request_of_history (t : Fin H) (Ο Ο : Fin H β Y) | |
| (h : requestHistory (t.val+1) Ο=requestHistory (t.val+1) Ο) : Ο t=Ο t := by | |
| have he := congrFun ((requestHistory_eq_iff _ _ _).mp h) t | |
| simpa [requestPrefix,t.isLt] using he | |
| lemma mu_served (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (hΟ : 0<law.val Ο) : 1 β€ mu s law (t.val+1) Ο (Ο t) := by | |
| have hc : posterior law.val (requestHistory (t.val+1)) (fun _ => (1:β)) Ο=1 := | |
| posterior_fiber_const Ο (fun _ _ => rfl) (mass_pos_of_weight law.property.1 _ Ο hΟ).ne' | |
| rw [βhc] | |
| apply posterior_mono_fiber law.property.1 | |
| intro Ο hΟ | |
| apply metricCount_at | |
| rw [βrequest_of_history t Ο Ο hΟ] | |
| exact β¨mover s Ο t,hidden_covers s Ο tβ© | |
| lemma mu_adapted (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : β) (y : Y) : RankTracking.Adapted (requestHistory t) (fun Ο => mu s law t Ο y) := | |
| posterior_adapted _ _ _ | |
| omit [MetricSpace Y] [Fintype Y] [NeZero k] in | |
| lemma metricCount_move (c : Configuration k Y) (i : Fin k) (x y : Y) : | |
| metricCount (serve c i x) y=metricCount c y-(if c i=y then 1 else 0)+ | |
| (if x=y then 1 else 0) := by | |
| classical | |
| unfold metricCount | |
| rw [βadd_sum_erase univ _ (mem_univ i),βadd_sum_erase univ _ (mem_univ i)] | |
| have he : (β jβuniv.erase i,if serve c i x j=y then (1:β) else 0)= | |
| β jβuniv.erase i,if c j=y then (1:β) else 0 := by | |
| apply sum_congr rfl | |
| intro j hj | |
| simp [serve,Function.update_of_ne (mem_erase.mp hj).1] | |
| rw [he] | |
| simp only [serve,Function.update_self] | |
| ring | |
| /-- Old counting measure filtered through the new true request. -/ | |
| def muBefore (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (y : Y) : β := | |
| posterior law.val (requestHistory (t.val+1)) (fun Ο => metricCount (hidden s Ο t.val) y) Ο | |
| /-- The conditional old-location law of the single designated optimum mover. -/ | |
| def nu (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (y : Y) : β := by | |
| classical | |
| exact posterior law.val (requestHistory (t.val+1)) | |
| (fun Ο => if hidden s Ο t.val (mover s Ο t)=y then 1 else 0) Ο | |
| lemma muBefore_nonneg (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (y : Y) : 0 β€ muBefore s law t Ο y := | |
| posterior_nonneg law.property.1 _ (fun _ => metricCount_nonneg _ _) _ | |
| lemma nu_nonneg (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (y : Y) : 0 β€ nu s law t Ο y := by | |
| apply posterior_nonneg law.property.1 | |
| intro Ο | |
| split_ifs <;> norm_num | |
| lemma nu_total (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (hΟ : 0<law.val Ο) : β y,nu s law t Ο y=1 := by | |
| classical | |
| unfold nu | |
| rw [βposterior_sum] | |
| apply posterior_fiber_const Ο _ (mass_pos_of_weight law.property.1 _ Ο hΟ).ne' | |
| intro Ο _ | |
| simp | |
| lemma nu_le_muBefore (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (y : Y) : nu s law t Ο y β€ muBefore s law t Ο y := by | |
| apply posterior_mono_fiber law.property.1 | |
| intro Ο _ | |
| split_ifs with he | |
| Β· exact metricCount_at _ _ β¨mover s Ο t,heβ© | |
| Β· exact metricCount_nonneg _ _ | |
| lemma muBefore_total (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (hΟ : 0<law.val Ο) : β y,muBefore s law t Ο y=(k:β) := by | |
| unfold muBefore | |
| rw [βposterior_sum] | |
| exact posterior_fiber_const Ο (fun Ο _ => metricCount_total _) (mass_pos_of_weight law.property.1 _ Ο hΟ).ne' | |
| /-- Exact one-mover decomposition used by the pilot potential. -/ | |
| lemma mu_move (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) (hΟ : 0<law.val Ο) (y : Y) : | |
| mu s law (t.val+1) Ο y=muBefore s law t Ο y-nu s law t Ο y+ | |
| (if Ο t=y then 1 else 0) := by | |
| classical | |
| unfold mu muBefore nu | |
| simp_rw [hidden_step,metricCount_move] | |
| rw [posterior_add,posterior_sub] | |
| congr 1 | |
| apply posterior_fiber_const Ο _ (mass_pos_of_weight law.property.1 _ Ο hΟ).ne' | |
| intro Ο hΟ | |
| rw [request_of_history t Ο Ο hΟ] | |
| lemma conditional_moveCost (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) | |
| (t : Fin H) (Ο : Fin H β Y) : | |
| (β y,nu s law t Ο y*dist y (Ο t))= | |
| posterior law.val (requestHistory (t.val+1)) | |
| (fun Ο => dist (hidden s Ο t.val (mover s Ο t)) (Ο t)) Ο := by | |
| classical | |
| unfold nu | |
| simp_rw [βposterior_mul] | |
| rw [βposterior_sum] | |
| unfold posterior numerator | |
| congr 1 | |
| apply sum_congr rfl | |
| intro Ο hΟ | |
| dsimp only | |
| rw [request_of_history t Ο Ο (mem_filter.mp hΟ).2] | |
| simp | |
| /-- The entire physical-drift budget is the expectation of the attained optimum, | |
| not a separate assumed bound or a policy-dependent comparator. -/ | |
| lemma expected_moveCost (s : Configuration k Y) (law : FiniteDistribution (Fin H β Y)) : | |
| (β t : Fin H,β Ο,law.val Ο*(β y,nu s law t Ο y*dist y (Ο t)))= | |
| β Ο,law.val Ο*optimalCost s (List.ofFn Ο) := by | |
| simp_rw [conditional_moveCost] | |
| change (β t : Fin H,RankTracking.avg law.val | |
| (posterior law.val (requestHistory (t.val+1)) | |
| (fun Ο => dist (hidden s Ο t.val (mover s Ο t)) (Ο t))))=_ | |
| simp_rw [posterior_avg law.property.1] | |
| unfold RankTracking.avg | |
| rw [sum_comm] | |
| apply sum_congr rfl | |
| intro Ο _ | |
| rw [βmul_sum] | |
| congr 1 | |
| simp_rw [βhidden_movement] | |
| exact hidden_total_cost s Ο | |
| end KServer.FiniteExperiment | |
| end | |
| end OAI | |