Online.OnlineAlgorithm.run
defimported Lean
Drive the machine across the requests, halting at the first step that emits an output. When the genuine requests are exhausted without a commitment, the machine is given the end-of-input step step _ none — its last chance to decide, since it never knew which request was last — and its (state, output) pair *is* the result. So (run s rs).1 is the terminal state and (run s rs).2 is the decision.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {α σ β : Type*} in def Online.OnlineAlgorithm.run (alg : OnlineAlgorithm α σ β) : σ → List α → σ × Option β
- Defined in
- EconCSLib, `Online.OnlineAlgorithm.run`
- Lean proof
- By Claude (from the file's git history), from github.com/gametheoryinlean/EconCSLib at
1a88f809b538(Copyright (c) 2026 EconCSLib contributors. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.30.0.Online.OnlineAlgorithm.run← Online.OnlineAlgorithm.run (EconCSLib/Algorithm/Online.lean:107): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 1
- Online.OnlineAlgorithmA deterministic online algorithm as a state machine. The state
Statesummarises the relevant past;stepconsumes the current state and…
- Online.OnlineAlgorithmA deterministic online algorithm as a state machine. The state
- Used by 6
- Online.OnlineAlgorithm.runResultThe decision
runcommits to — the second component ofrun. - Online.OnlineAlgorithm.run_cons_noneIf the step on
rdefers (none), the run continues onrs. - Online.OnlineAlgorithm.run_cons_someIf the step on
rhalts with outputo, the run halts there. - Online.OnlineAlgorithm.run_consOnline.OnlineAlgorithm.run_cons
- Online.OnlineAlgorithm.runStatusThe terminal status (state)
runhalts in — the first component ofrun, after the end-of-input step. - Online.OnlineAlgorithm.run_nilOn no requests,
runis exactly the end-of-input step.
- Online.OnlineAlgorithm.runResultThe decision
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {α σ β : Type*} in /-- Drive the machine across the requests, halting at the **first** step that emits an output. When the genuine requests are exhausted without a commitment, the machine is given the **end-of-input** step `step _ none` — its last chance to decide, since it never knew which request was last — and its `(state, output)` pair *is* the result. So `(run s rs).1` is the terminal state and `(run s rs).2` is the decision. -/ def Online.OnlineAlgorithm.run (alg : OnlineAlgorithm α σ β) : σ → List α → σ × Option β | s, [] => alg.step s none | s, r :: rs => match alg.step s (some r) with | (s', some o) => (s', some o) | (s', none) => alg.run s' rs