Bandits.ArrayModel.hist_apply_last
No docstring.
-
๐ : Type u_1m๐ : MeasurableSpace ๐A measurable space is a space equipped with a ฯ-algebra.Nonempty ๐StandardBorelSpace ๐A standard Borel space is a measurable space arising as the Borel sets of some Polish topology.DecidableEq ๐ -
๐ก : Type u_2m๐ก : MeasurableSpace ๐ก
-
alg : Learning.Algorithm Unit ๐ ๐กA stochastic, sequential algorithm. -
ฯ : probSpace ๐ ๐กProbability space for the array model of stochastic bandits. -
n : โ
hist alg ฯ (n + 1) (Fin.last n) = ((), action alg n ฯ, reward alg n ฯ)MeasurableSpace : Type u_6 โ Type u_6A measurable space is a space equipped with a ฯ-algebra.
Nonempty : Sort u โ Prop`Nonempty ฮฑ` is a typeclass that says that `ฮฑ` is not an empty type, that is, there exists an element in the type. It differs from `Inhabited ฮฑ` in that `Nonempty ฮฑ` is a `Prop`, which means that it does not actually carry an element of `ฮฑ`, only a proof that *there exists* such an element. Given `Nonempty ฮฑ`, you can construct an element of `ฮฑ` *nonconstructively* using `Classical.choice`.
StandardBorelSpace : (ฮฑ : Type u_1) โ [MeasurableSpace ฮฑ] โ PropA standard Borel space is a measurable space arising as the Borel sets of some Polish topology. This is useful in situations where a space has no natural topology or the natural topology in a space is non-Polish. To endow a standard Borel space `ฮฑ` with a compatible Polish topology, use `letI := upgradeStandardBorel ฮฑ`. One can then use `eq_borel_upgradeStandardBorel ฮฑ` to rewrite the `MeasurableSpace ฮฑ` instance to `borel ฮฑ t`, where `t` is the new topology.
DecidableEq : Sort u โ Sort (max 1 u)Propositional equality is `Decidable` for all elements of a type. In other words, an instance of `DecidableEq ฮฑ` is a means of deciding the proposition `a = b` is for all `a b : ฮฑ`.
Learning.Algorithm : (๐ : Type u_5) โ
(๐ : Type u_6) โ
(๐จ : Type u_7) โ [MeasurableSpace ๐] โ [MeasurableSpace ๐] โ [MeasurableSpace ๐จ] โ Type (max (max u_5 u_6) u_7)A stochastic, sequential algorithm. At each round, it sees an observation in `๐`, then takes an action in `๐`, and finally receives feedback in `๐จ`. The action is a random function of the past rounds and the current observation.Go to its page
Unit : TypeThe canonical type with one element. This element is written `()`. `Unit` has a number of uses: * It can be used to model control flow that returns from a function call without providing other information. * Monadic actions that return `Unit` have side effects without computing values. * In polymorphic types, it can be used to indicate that no data is to be stored in a particular field.
Bandits.ArrayModel.probSpace : Type u_1 โ Type u_2 โ Type (max u_1 u_2)Probability space for the array model of stochastic bandits.Go to its page
Nat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
Eq : {ฮฑ : Sort u_1} โ ฮฑ โ ฮฑ โ PropThe equality relation. It has one introduction rule, `Eq.refl`.
We use `a = b` as notation for `Eq a b`.
A fundamental property of equality is that it is an equivalence relation.
```
variable (ฮฑ : Type) (a b c d : ฮฑ)
variable (hab : a = b) (hcb : c = b) (hcd : c = d)
example : a = d :=
Eq.trans (Eq.trans hab (Eq.symm hcb)) hcd
```
Equality is much more than an equivalence relation, however. It has the important property that every assertion
respects the equivalence, in the sense that we can substitute equal expressions without changing the truth value.
That is, given `h1 : a = b` and `h2 : p a`, we can construct a proof for `p b` using substitution: `Eq.subst h1 h2`.
Example:
```
example (ฮฑ : Type) (a b : ฮฑ) (p : ฮฑ โ Prop)
(h1 : a = b) (h2 : p a) : p b :=
Eq.subst h1 h2
example (ฮฑ : Type) (a b : ฮฑ) (p : ฮฑ โ Prop)
(h1 : a = b) (h2 : p a) : p b :=
h1 โธ h2
```
The triangle in the second presentation is a macro built on top of `Eq.subst` and `Eq.symm`, and you can enter it by typing `\t`.
For more information: [Equality](https://lean-lang.org/theorem_proving_in_lean4/quantifiers_and_equality.html#equality)
Conventions for notations in identifiers:
* The recommended spelling of `=` in identifiers is `eq`.Bandits.ArrayModel.hist : {๐ : Type u_1} โ
{๐ก : Type u_2} โ
{m๐ : MeasurableSpace ๐} โ
{m๐ก : MeasurableSpace ๐ก} โ
[Nonempty ๐] โ
[StandardBorelSpace ๐] โ
[DecidableEq ๐] โ
Learning.Algorithm Unit ๐ ๐ก โ Bandits.ArrayModel.probSpace ๐ ๐ก โ (n : โ) โ Learning.Hist Unit ๐ ๐ก nHistory of actions and rewards before time `n` in the array model.Go to its page
HAdd.hAdd : {ฮฑ : Type u} โ {ฮฒ : Type v} โ {ฮณ : outParam (Type w)} โ [self : HAdd ฮฑ ฮฒ ฮณ] โ ฮฑ โ ฮฒ โ ฮณ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.
Fin.last : (n : โ) โ Fin (n + 1)The greatest value of `Fin (n+1)`, namely `n`. Examples: * `Fin.last 4 = (4 : Fin 5)` * `(Fin.last 0).val = (0 : Nat)`
Prod.mk : {ฮฑ : Type u} โ {ฮฒ : Type v} โ ฮฑ โ ฮฒ โ ฮฑ ร ฮฒConstructs a pair. This is usually written `(x, y)` instead of `Prod.mk x y`. Conventions for notations in identifiers: * The recommended spelling of `(a, b)` in identifiers is `mk`.
Unit.unit : UnitThe only element of the unit type. It can be written as an empty tuple: `()`.
Bandits.ArrayModel.action : {๐ : Type u_1} โ
{๐ก : Type u_2} โ
{m๐ : MeasurableSpace ๐} โ
{m๐ก : MeasurableSpace ๐ก} โ
[Nonempty ๐] โ
[StandardBorelSpace ๐] โ
[DecidableEq ๐] โ Learning.Algorithm Unit ๐ ๐ก โ โ โ Bandits.ArrayModel.probSpace ๐ ๐ก โ ๐Action taken at time `n` in the array model.Go to its page
Bandits.ArrayModel.reward : {๐ : Type u_1} โ
{๐ก : Type u_2} โ
{m๐ : MeasurableSpace ๐} โ
{m๐ก : MeasurableSpace ๐ก} โ
[Nonempty ๐] โ
[StandardBorelSpace ๐] โ
[DecidableEq ๐] โ Learning.Algorithm Unit ๐ ๐ก โ โ โ Bandits.ArrayModel.probSpace ๐ ๐ก โ ๐กReward received at time `n` in the array model.Go to its page
Code
lemma hist_apply_last [DecidableEq ๐] (alg : Algorithm Unit ๐ ๐ก) (ฯ : probSpace ๐ ๐ก) (n : โ) :
hist alg ฯ (n + 1) (Fin.last n) = ((), action alg n ฯ, reward alg n ฯ)Proof
by rw [hist_succ, Fin.snoc_last]
Meaning last changed in v4.35.0-rc2-1-g61e506b (2026-09-22), the 4th recorded change.
Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file ยท open it in the Lean web editor.
Dependency graph
Audit surface: 12 project declarations, 61 external constants
โ Proved: no sorry anywhere in its closure
This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.