OAI/Combinatorics/KServer/Behavior.lean
112 declarations, 0 contain sorry, 0 declared as axioms
Explicit causal realization of finite hidden-state algorithms.
This discharges a policy-existence interface needed both by correlated rounding and by the fictitious-prefix episode extraction. It is not a competitiveness premise: the machine below is arbitrary and its behavioral policy is constructed.
- def
OAI.KServer.matchSumline 14 - lemma
OAI.KServer.exists_minimum_matchingline 17 - def
OAI.KServer.matchingPermline 23 - def
OAI.KServer.matchingline 26 - lemma
OAI.KServer.matching_leline 28 - lemma
OAI.KServer.matching_nonnegline 32 - lemma
OAI.KServer.matching_selfline 36 - lemma
OAI.KServer.matching_triangleline 40 - lemma
OAI.KServer.matching_symmetricline 54 - lemma
OAI.KServer.matchSum_serveline 66 - def
OAI.KServer.lazyChoiceline 83Source documentation
A causal minimum-matching choice. Repeated actual and virtual positions are retained: only the permutation of occurrence labels is used.
def lazyChoice (A C : Configuration k X) (r : X) (hc : ∃ i, C i = r) : Fin k := by …
Mentions: OAI.KServer.Configuration
- lemma
OAI.KServer.lazyChoice_coveredline 87 - lemma
OAI.KServer.lazyChoice_costline 92 - def
OAI.KServer.continuationCostline 118Source documentation
Expected continuation from a specified (possibly null) history.
def continuationCost {k : ℕ} {X : Type u} [MetricSpace X] (A : Policy k X) (s : Configuration k X) (h : List (X × Fin k)) (σ : List X) : ℝ := …Mentions: OAI.KServer.Policy, OAI.KServer.Configuration
- lemma
OAI.KServer.continuationCost_nilline 122 - lemma
OAI.KServer.continuationCost_consline 126 - def
OAI.KServer.lazySimulationline 151 - lemma
OAI.KServer.lazySimulation_strongline 155 - def
OAI.KServer.simulatedMovementline 165Source documentation
Simulated movement measured by occurrence matching, exactly Section02.
def simulatedMovement (C : List X → Configuration k X) (pre : List X) : List X → ℝ | [] => 0 | r :: σ => matching (C pre) (C (pre ++ [r])) + simulatedMovement C (pre ++ [r]) σ
Mentions: OAI.KServer.Configuration, OAI.KServer.matching
- lemma
OAI.KServer.lazySimulation_boundline 169 - theorem
OAI.KServer.causal_lazy_simulationline 203Source documentation
Actual policy exists, is strongly lazy, and obeys the matching potential bound for every finite horizon under one common causal rule. No distributional input or future knowledge is used. This is the deterministic/private-seed kernel of source
lem:lazy-simulation.theorem causal_lazy_simulation : StronglyLazy start (lazySimulation start C hcover) ∧ ∀ σ, expectedCost (lazySimulation start C hcover) start σ ≤ matching start (C []) + simulatedMovement C [] σ := by …Mentions: OAI.KServer.StronglyLazy, OAI.KServer.lazySimulation, OAI.KServer.matching, OAI.KServer.simulatedMovement
- lemma
OAI.KServer.optimalCost_le_serviceline 219 - lemma
OAI.KServer.optimalCost_nonnegline 223 - lemma
OAI.KServer.optimalCost_attainedline 226 - lemma
OAI.KServer.matching_serve_leline 236 - theorem
OAI.KServer.offline_lazy_comparisonline 247Source documentation
Source lazy simulation applied purely pathwise, without a causality premise; this is the comparison needed for repeated initial tuples.
theorem offline_lazy_comparison (A C : Configuration k X) (σ : List X) (j : Fin σ.length → Fin k) : ∃ w : Fin σ.length → Fin k, serviceCost A σ w ≤ matching A C + serviceCost C σ j := by …Mentions: OAI.KServer.Configuration, OAI.KServer.matching
- theorem
OAI.KServer.optimalCost_change_startline 272Source documentation
Exact source bound
OPT_t ≤ OPT_s + M(s,t); no distinctness is used.theorem optimalCost_change_start (s t : Configuration k X) (σ : List X) : optimalCost t σ ≤ optimalCost s σ + matching s t := by …Mentions: OAI.KServer.Configuration, OAI.KServer.matching
- lemma
OAI.KServer.optimalCost_le_expectedCostline 281 - def
OAI.KServer.historyProbabilityline 291 - lemma
OAI.KServer.historyProbability_nonnegline 296 - lemma
OAI.KServer.historyProbability_appendline 302 - lemma
OAI.KServer.historyProbability_singletonline 312 - structure
OAI.KServer.HiddenMachine.Dataline 326 - def
OAI.KServer.HiddenMachine.stepline 338 - def
OAI.KServer.HiddenMachine.evolveline 341 - def
OAI.KServer.HiddenMachine.weightsline 345 - def
OAI.KServer.HiddenMachine.massline 347 - def
OAI.KServer.HiddenMachine.outMassline 349 - lemma
OAI.KServer.HiddenMachine.step_nonnegline 352 - lemma
OAI.KServer.HiddenMachine.evolve_nonnegline 359 - lemma
OAI.KServer.HiddenMachine.weights_nonnegline 365 - lemma
OAI.KServer.HiddenMachine.mass_nonnegline 368 - lemma
OAI.KServer.HiddenMachine.outMass_nonnegline 371 - lemma
OAI.KServer.HiddenMachine.evolve_appendline 374 - lemma
OAI.KServer.HiddenMachine.weights_appendline 383 - lemma
OAI.KServer.HiddenMachine.mass_appendline 388 - lemma
OAI.KServer.HiddenMachine.step_sumline 392 - lemma
OAI.KServer.HiddenMachine.outMass_sumline 407 - lemma
OAI.KServer.HiddenMachine.outMass_le_massline 410 - def
OAI.KServer.HiddenMachine.policyline 416Source documentation
Null histories are filled by a fixed legal label, not by any future input.
def policy : Policy k X := fun h r => …
Mentions: OAI.KServer.Policy
- lemma
OAI.KServer.HiddenMachine.mass_mul_policyline 424 - theorem
OAI.KServer.HiddenMachine.history_lawline 435Source documentation
Exact finite-history law of the realized behavioral policy.
theorem history_law (h : List (X × Fin k)) : historyProbability (policy M) [] h=mass M h := by …Mentions: OAI.KServer.historyProbability, OAI.KServer.HiddenMachine.policy, OAI.KServer.HiddenMachine.mass
- def
OAI.KServer.HiddenMachine.machineCostline 447Source documentation
The machine's literal finite expected movement, prior to forgetting its private state. Physical configurations are determined by visible histories.
def machineCost (start : Configuration k X) (h : List (X × Fin k)) (s : S) : List X → ℝ | [] => 0 | r::σ => ∑ s', M.transition h r s s' * (dist (configurationAfter start h (M.output h r s s')) r + machineCost start (h++[(r,M.output h r s s')]) s' σ)Mentions: OAI.KServer.Configuration, OAI.KServer.configurationAfter
- lemma
OAI.KServer.HiddenMachine.machineCost_nonnegline 454 - lemma
OAI.KServer.HiddenMachine.branch_sumline 465Source documentation
Weighted branch disintegration; a finite algebraic identity, including zero-likelihood branches, rather than an assumed conditional kernel.
lemma branch_sum (h : List (X × Fin k)) (r : X) (w : S → ℝ) (f : Fin k → S → ℝ) : (∑ i : Fin k, ∑ s', step M h r i w s' * f i s') = ∑ s, w s * ∑ s', M.transition h r s s' * f (M.output h r s s') s' := by …Mentions: OAI.KServer.HiddenMachine.step
- theorem
OAI.KServer.HiddenMachine.realization_costline 483Source documentation
Forgetting a finite private state preserves exactly all finite expected costs. No finite-horizon policy family is identified without constructing its single behavioral continuation.
theorem realization_cost (start : Configuration k X) (h : List (X × Fin k)) (σ : List X) : mass M h * continuationCost (policy M) (configurationAfter start h) h σ = ∑ s, weights M h s * machineCost M start h s σ := by …Mentions: OAI.KServer.Configuration, OAI.KServer.HiddenMachine.mass, OAI.KServer.continuationCost, OAI.KServer.HiddenMachine.policy, OAI.KServer.configurationAfter, OAI.KServer.HiddenMachine.weights, OAI.KServer.HiddenMachine.machineCost
- theorem
OAI.KServer.HiddenMachine.exists_realizationline 509Source documentation
The requested externally visible policy, valid on every finite horizon.
theorem exists_realization (start : Configuration k X) : ∃ A : Policy k X, ∀ σ : List X, expectedCost A start σ = ∑ s, M.initial s * machineCost M start [] s σ := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy, OAI.KServer.HiddenMachine.machineCost
- lemma
OAI.KServer.HiddenMachine.policy_strongline 520 - def
OAI.KServer.HiddenMachine.lazyFallbackline 542Source documentation
A null-history fallback that satisfies strong laziness at every history.
def lazyFallback (start : Configuration k X) (h : List (X × Fin k)) (r : X) : Fin k := by …
Mentions: OAI.KServer.Configuration
- lemma
OAI.KServer.HiddenMachine.lazyFallback_coveredline 547 - def
OAI.KServer.HiddenMachine.lazyMachineline 558Source documentation
Source's matching simulation, with the entire virtual private state kept. There is no illegal conditioning of a marginal coupling on realized ancestors.
def lazyMachine : Data k X S where …
Mentions: OAI.KServer.HiddenMachine.Data
- lemma
OAI.KServer.HiddenMachine.lazyMachine_strongline 569 - def
OAI.KServer.HiddenMachine.virtualCostline 576Source documentation
Virtual movement under exactly the same finite hidden-state experiment.
def virtualCost (h : List (X × Fin k)) (s : S) : List X → ℝ | [] => 0 | r::σ => ∑ s', M.transition h r s s' * (matching (V (h.map Prod.fst) s) (V (h.map Prod.fst++[r]) s')+ virtualCost (h++[(r,(lazyMachine M start V hcover).output h r s s')]) s' σ)Mentions: OAI.KServer.matching, OAI.KServer.HiddenMachine.lazyMachine
- lemma
OAI.KServer.HiddenMachine.lazyMachine_boundline 582 - theorem
OAI.KServer.HiddenMachine.causal_random_lazy_simulationline 621Source documentation
Fully constructed randomized causal strong-lazy simulation with arbitrary finite correlated private states and an arbitrary initial virtual mismatch. It is uniform over all fixed finite request sequences, including all horizons.
theorem causal_random_lazy_simulation : ∃ A : Policy k X, StronglyLazy start A ∧ ∀ σ : List X, expectedCost A start σ ≤ (∑ s, M.initial s*matching start (V [] s))+ ∑ s, M.initial s*virtualCost M start V hcover [] s σ := by …Mentions: OAI.KServer.Policy, OAI.KServer.StronglyLazy, OAI.KServer.matching, OAI.KServer.HiddenMachine.virtualCost
- abbrev
OAI.KServer.BoundedSimulation.Memoryline 655Source documentation
Finite private memory, sufficient for a fixed local experiment. The final policy is extended to all requests; compactness below removes this bound.
abbrev Memory (H k : ℕ) := Fin H → Fin k
- def
OAI.KServer.BoundedSimulation.labelAtline 657 - def
OAI.KServer.BoundedSimulation.historyline 660 - lemma
OAI.KServer.BoundedSimulation.history_appendline 663 - lemma
OAI.KServer.BoundedSimulation.history_lengthline 667 - def
OAI.KServer.BoundedSimulation.updateline 670 - lemma
OAI.KServer.BoundedSimulation.labelAt_updateline 674 - lemma
OAI.KServer.BoundedSimulation.history_updateline 679 - lemma
OAI.KServer.BoundedSimulation.history_stepline 693 - def
OAI.KServer.BoundedSimulation.transitionline 700 - lemma
OAI.KServer.BoundedSimulation.transition_sumline 703 - lemma
OAI.KServer.BoundedSimulation.transition_integrateline 710 - def
OAI.KServer.BoundedSimulation.machineline 719 - def
OAI.KServer.BoundedSimulation.virtualline 737 - lemma
OAI.KServer.BoundedSimulation.virtual_coversline 740 - lemma
OAI.KServer.BoundedSimulation.virtual_stepline 745 - lemma
OAI.KServer.BoundedSimulation.virtual_cost_boundline 756Source documentation
Exact virtual continuation bound, honoring the entire private label history. In particular the virtual policy is not falsely conditioned only on the real server positions or on the current request.
lemma virtual_cost_bound (h : List (X × Fin k)) (s : Memory H k) (σ : List X) (hb : h.length+σ.length ≤ H) : HiddenMachine.virtualCost (machine H A pre) start (virtual H virtualStart) (virtual_covers H virtualStart) h s σ ≤ continuationCost A (virtual H virtualStart (h.map Prod.fst) s) (pre++history (h.map Prod.fst) s) σ := by …Mentions: OAI.KServer.BoundedSimulation.Memory, OAI.KServer.HiddenMachine.virtualCost, OAI.KServer.BoundedSimulation.machine, OAI.KServer.BoundedSimulation.virtual, OAI.KServer.BoundedSimulation.virtual_covers, OAI.KServer.continuationCost, OAI.KServer.BoundedSimulation.history
- theorem
OAI.KServer.BoundedSimulation.finite_horizon_simulationline 797Source documentation
Realizes a supplied behavioral policy from a different actual start, up to any prescribed finite horizon; its construction is causal on all histories. The bound is uniform in the horizon, permitting the global compactness step.
theorem finite_horizon_simulation : ∃ B : Policy k X, StronglyLazy start B ∧ ∀ σ : List X, σ.length ≤ H → expectedCost B start σ ≤ matching start virtualStart+ continuationCost A virtualStart pre σ := by …Mentions: OAI.KServer.Policy, OAI.KServer.StronglyLazy, OAI.KServer.matching, OAI.KServer.continuationCost
- theorem
OAI.KServer.BoundedSimulation.global_simulationline 817Source documentation
One global causal simulator on an arbitrary metric. The finite-memory constructions above incur the same initial matching, so compactness selects a single policy valid for every finite horizon. No finiteness of X is required.
theorem global_simulation : ∃ B : Policy k X, ∀ σ : List X, expectedCost B start σ ≤ matching start virtualStart+ continuationCost A virtualStart pre σ := by …Mentions: OAI.KServer.Policy, OAI.KServer.matching, OAI.KServer.continuationCost
- def
OAI.KServer.mixtureLikelihoodline 838 - lemma
OAI.KServer.mixtureLikelihood_nonnegline 842 - lemma
OAI.KServer.weightedLikelihood_leline 847 - lemma
OAI.KServer.mixtureLikelihood_appendline 852 - def
OAI.KServer.mixturePolicyline 865Source documentation
The posterior distribution over the private mixture index is normalized only at reached histories; all null histories receive the same fixed pure rule.
def mixturePolicy : Policy k X := fun h r => …
Mentions: OAI.KServer.Policy
- lemma
OAI.KServer.mixturePolicy_recurrenceline 879 - lemma
OAI.KServer.historyProbability_mixtureline 898 - lemma
OAI.KServer.historyProbability_ofFnline 906 - theorem
OAI.KServer.pathProbability_mixtureline 919 - theorem
OAI.KServer.expectedCost_mixtureline 928 - lemma
OAI.KServer.exists_binary_mixtureline 945Source documentation
One private coin implements a convex combination simultaneously for all inputs.
lemma exists_binary_mixture (s : Configuration k X) (A B : Policy k X) (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : ∃ D : Policy k X, ∀ σ, expectedCost D s σ = a * expectedCost A s σ + b * expectedCost B s σ := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy
- theorem
OAI.KServer.nonpositive_vector_of_distributionalline 961Source documentation
The finite convex-separation implication used in source Lemma finite-set. Its premise is an explicit distributional estimate, not an assumed online policy existence theorem. The lemma itself is an unconditional convex-geometric fact.
theorem nonpositive_vector_of_distributional {ι : Type*} [Fintype ι] (S : Set (ι → ℝ)) (hne : S.Nonempty) (hcmp : IsCompact S) (hconv : Convex ℝ S) (hdist : ∀ w : ι → ℝ, (∀ i, 0 ≤ w i) → (∑ i, w i = 1) → ∃ v ∈ S, ∑ i, w i * v i ≤ 0) : ∃ v ∈ S, ∀ i, v i ≤ 0 := by … - theorem
OAI.KServer.finite_policy_of_distributionalline 1044Source documentation
Source finite-set separation, directly on the compact behavioral policy space. Finite random-seed conversion proved above supplies its convexity.
theorem finite_policy_of_distributional {ι : Type*} [Fintype ι] (s : Configuration k X) (σ : ι → List X) (bound : ι → ℝ) (hdist : ∀ w : ι → ℝ, (∀ i, 0 ≤ w i) → (∑ i, w i = 1) → ∃ A : Policy k X, ∑ i, w i * expectedCost A s (σ i) ≤ ∑ i, w i * bound i) : ∃ A : Policy k X, ∀ i, expectedCost A s (σ i) ≤ bound i := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy
- theorem
OAI.KServer.global_policy_of_finite_lawsline 1078Source documentation
Quantifier-exact combination of finite separation and product compactness. No law-dependent or horizon-dependent policy is silently asserted: the entire quantitative distributional premise is displayed, and remains to be obtained from the new finite-law construction and amplification.
theorem global_policy_of_finite_laws {k : ℕ} [NeZero k] {X : Type u} [MetricSpace X] (s : Configuration k X) (bound : List X → ℝ) (hdist : ∀ F : Finset (List X), ∀ w : F → ℝ, (∀ i, 0 ≤ w i) → (∑ i, w i = 1) → ∃ A : Policy k X, ∑ i : F, w i * expectedCost A s i.val ≤ ∑ i : F, w i * bound i.val) : ∃ A : Policy k X, ∀ σ, expectedCost A s σ ≤ bound σ := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy
- def
OAI.KServer.mapHistoryline 1100Source documentation
Relabeling requests, leaving server labels unchanged.
def mapHistory {k : ℕ} {X : Type u} {Y : Type v} (f : X → Y) (h : List (X × Fin k)) : List (Y × Fin k) := h.map (fun p => (f p.1,p.2)) - lemma
OAI.KServer.mapHistory_compline 1103 - lemma
OAI.KServer.mapHistory_idline 1108 - lemma
OAI.KServer.map_serveline 1111 - lemma
OAI.KServer.serviceCost_mapline 1120Source documentation
Executing an identical label string through an isometry preserves every individual path cost, without any assumption on the ambient metric.
lemma serviceCost_map {k : ℕ} {X : Type u} {Y : Type v} [MetricSpace X] [MetricSpace Y] (f : X → Y) (hf : Isometry f) (s : Configuration k X) (σ : List X) (j : Fin σ.length → Fin k) : serviceCost (f ∘ s) (σ.map f) (fun i => j ⟨i.val,by simpa using i.isLt⟩) = serviceCost s σ j := by …Mentions: OAI.KServer.Configuration
- def
OAI.KServer.retractPolicyline 1137Source documentation
Ambient extension by a retraction. The extension is deliberately arbitrary on requests outside the finite submetric, while agreeing exactly on all its histories. It is one policy, not a collection indexed by horizons.
def retractPolicy {k : ℕ} {X : Type u} {Y : Type v} (f : X → Y) (A : Policy k Y) : Policy k X := …Mentions: OAI.KServer.Policy
- lemma
OAI.KServer.pathProbability_retractline 1141 - lemma
OAI.KServer.expectedCost_retractline 1163 - lemma
OAI.KServer.optimalCost_mapline 1180 - def
OAI.KServer.FiniteDistinctLawBoundline 1199Source documentation
The exact conclusion needed from source §10's episode amplification, on finite metrics only. This definition is an open obligation, not an assumption asserted by the development, and is not the main theorem.
def FiniteDistinctLawBound (k : ℕ) (α : ℝ) : Prop := …
- theorem
OAI.KServer.distinct_policy_from_finite_submetricsline 1210Source documentation
Every finite family of requests lies in an actual finite submetric. Metric restriction preserves the finite laws, movement costs and offline minima needed for product compactness.
theorem distinct_policy_from_finite_submetrics {k : ℕ} [NeZero k] (α : ℝ) (hfinite : FiniteDistinctLawBound.{u} k α) {X : Type u} [MetricSpace X] (s : Configuration k X) (hs : Function.Injective s) : ∃ A : Policy k X, ∀ σ, expectedCost A s σ ≤ α*optimalCost s σ := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy
- theorem
OAI.KServer.repeat_start_transferline 1267Source documentation
Source §10, repeated initial positions. This is a proved transformation of policies, not a competitiveness assumption: the sole input is the virtual policy's actual bound, and the real policy is constructed by finite filtering and compactness above. Its additive constant is independent of every input.
theorem repeat_start_transfer {k : ℕ} [NeZero k] {X : Type u} [MetricSpace X] (s u : Configuration k X) (α : ℝ) (hα : 0 ≤ α) (A : Policy k X) (hA : ∀ σ, expectedCost A u σ ≤ α*optimalCost u σ) : ∃ B : Policy k X, ∀ σ, expectedCost B s σ ≤ α*optimalCost s σ+(α+1)*matching s u := by …Mentions: OAI.KServer.Configuration, OAI.KServer.Policy, OAI.KServer.matching
- lemma
OAI.KServer.source_log_comparisonline 1279 - theorem
OAI.KServer.main_reductionline 1289Source documentation
Arbitrary-metric transfer and repeated starting positions reduce the competitive estimate to a finite amplified-law bound, with constants uniform over all request horizons.
theorem main_reduction : (∃ d : ℝ, 0 ≤ d ∧ ∀ k : ℕ, 2 ≤ k → FiniteDistinctLawBound.{u} k (d*(1+Real.log (k+1))^2)) → ReductionStatement.{u} := by …