AIXI
Exploring the Bayesian optimal policy for history based reinforcement learning.
By David Quarel (Australian National University)
- Formalize the agent-environment interaction, value functions, and the Bayes-optimal policy that defines AIXI.
- Derive the explicit expectimax form of AIXI.
- Prove on-policy value convergence and that AIXI cannot be fooled in deterministic environments.
- Prove the self-optimizing property via likelihood-ratio martingales and change of measure.
Much of this material is drawn from (Hutter et al. 2024). The book provides fuller explanations, additional context, and proofs omitted here.
Difficulty ratings. Each subproblem is tagged with a rating in square brackets using Knuth's scale (Knuth 1973): roughly, [00] trivial, [10] 15–minute pencil-and-paper, [20] 1–2 hours, [30] several hours to a day, [40] a significant research result. Intermediate values are possible. See Appendix B for the full scale.
Problems marked () are less interesting/insightful and while the result may be used later, I would recommend skipping them on a first pass.
Overview
AIXI is the action half of Universal AI: it lifts the Bayesian mixture from Solomonoff induction — learning to predict — to learning to act. Now the agent takes actions that shape what it observes, and AIXI is the Bayes-optimal policy over a universal mixture of environments. It learns to act as well as if it knew the true environment . Under the universal choice — = all lower-semicomputable environments, prior — the assumption "" again becomes "the universe is computable."
Prerequisites
- Solomonoff Induction — start there first. The Bayesian mixture, posterior updates, and dominance carry over directly; AIXI reuses them in the action setting.
- Comfort with discrete probability (conditional distributions, chain rule, expectations).
- Familiarity with sequential decision-making / reinforcement learning (agents, rewards, discounting, value functions) is useful but not assumed.
Goal and Roadmap
This exercise sheet builds towards three main results:
- On-policy value convergence (Section 7): the Bayesian mixture learns to predict the value of any fixed policy as well as the true environment .
- AIXI can't be fooled (Section 8): in deterministic environments, the Bayes-optimal agent is guaranteed non-zero value whenever optimal value is non-zero.
- Self-optimizing property (Section 11, advanced stretch goal): the Bayes-optimal policy learns to act as well as if it knew , provided that any learnable policy can achieve this. This is the central theoretical justification for the AIXI agent.
A good target is to complete Section 7 and 8. The self-optimizing property (Sections 9–11) requires substantial additional machinery (supermartingales, change of measure) and is an advanced stretch goal.
Critical path. The three results share a common foundation (Sections 0–4) and then diverge:
In summary:
- Sections 0–4 establish the Bayesian RL framework: measure algebra, mixture properties, existence of optimal policies, dominance, and linearity.
- Section 5 derives the explicit expectimax form of AIXI.
- Sections 6–7 prove on-policy value convergence: and become indistinguishable for any fixed .
- Section 8 shows AIXI can't be fooled: the Bayes-optimal agent achieves non-zero value whenever optimal value is non-zero (in deterministic environments).
- Sections 9–11 (advanced stretch goal) prove the self-optimizing property: if any policy can learn to act optimally, inherits this.
Setup
An agent interacts with an environment in discrete time steps .
Definition 0.1 (Spaces and notation). - : finite set of actions
- : finite set of observations
- : finite set of rewards
- : set of percepts;
- : set of all histories of length
- : set of all finite histories
- : set of all infinite histories
- : set of all probability distributions over set
- : Iverson bracket: if is true, if false
- : current time step; : finite horizon;
- : arbitrary integer indices
- : concatenation
- : the empty string/history
- : history segment from time to
- : history up to (but not including) time
Definition 0.2 (Policy ). A policy maps each history to a probability distribution over actions. Given history :
- is a distribution over ,
- is the probability of choosing action ,
- the agent samples .
A policy is deterministic if for all . We write .
Definition 0.3 (Environment ). An environment maps each history–action pair to a distribution over percepts. Given history and action :
- is a distribution over ,
- is the probability of percept ,
- the environment samples .
We write . This satisfies the chain rule: or in the form we will usually use, . An environment is deterministic if for all (each percept is produced with certainty). We denote the true (unknown) environment by .
Definition 0.4 (Interaction measure ). When policy interacts with environment , the joint probability of a history segment given past is
0. Properties of Measures
Exercise 0.1 (Factorization) [05]. Show that .
Solution
Expanding the definition: .
Key observation: is the same regardless of the environment. When comparing and , the policy factors cancel.
Exercise 0.2 (Chain rule) [05]. Show that .
Solution
From the definition , split off the last factor:
Exercise 0.3 (∗) (Marginalizing percepts) [03]. Show that .
Solution
From Definition 0.4, the one-step interaction is . Summing over :
Interpretation: after summing out the environment's response, only the agent's action probability remains.
Exercise 0.4 (∗) (Deterministic interaction measure) [05]. Let be a deterministic policy, i.e. at each history there is a unique action with . Show that, provided is consistent with (i.e. for every ):
i.e. on -consistent futures the interaction measure reduces to the environment measure: every policy factor is .
Solution
Since is deterministic, . By hypothesis is -consistent, so every such bracket equals . From Definition 0.4:
where the last equality is the natural segment extension of .
Exercise 0.5 [05]. (General chain rule for ) Show that for any :
Solution
Split the defining product at index :
identifying each block as a conditional via the same expansion: the past for step is the given history extended by the first chunk .
Note: for a deterministic policy, Exercise 0.4 simplifies this further: each factor becomes just .
The Bayesian Mixture and Value Function
Definition 0.1 (Model class, prior, and Bayesian mixture ). Let be a countable class of environments with prior weights satisfying . We assume .
The Bayesian mixture is defined as
One can show that the one-step predictive distribution can be written as
where the posterior weight is
See Appendix A for a worked example.
Definition 0.2 (Expectation ). For a function of a finite future segment :
For functions of the infinite future (like the value function), with a sequence , where depends only on , we define ,
Definition 0.3 (Discounted return ). Fix a discount factor , held constant throughout. The discounted return at time step , up to horizon , is
Since is fixed we drop it and write . It satisfies the recursion , with and for . The infinite-horizon return is the pointwise limit
with the clean recursion and no boundary cases.
Definition 0.4 (Value function1). The value of policy in environment with horizon given history is
The infinite-horizon value is the pointwise limit . We write for short.
The optimal value is for , with . 2 An optimal policy satisfies . The Bayes-optimal policy is .
Remark (AIXI). All results in this sheet hold for any countable and prior weights . AIXI is a special case of the Bayes-optimal policy for the particular choice the class of all lower-semicomputable chronological semimeasures, and prior , where is the Kolmogorov complexity of : the length of the shortest program that computes . The resulting agent is written , or simply AI.
Why this ? By including every computable environment, the assumption reduces to "the universe is computable": as weak an assumption as one can make.
Why this prior? The prior is dominant: for any other computable prior , there exists a constant such that for all .
Caveat: The constant depends on the choice of universal Turing machine , and adversarial choices of can make AIXI behave arbitrarily badly (Leike & Hutter 2015).
See (Hutter et al. 2024): Chapter 2.7 for Kolmogorov complexity, Chapters 3.7–3.8 for the model class and universal prior, and Chapter 7.4 for AIXI itself.
1. Properties of the Bayesian Mixture
Exercise 1.1 (∗) (Posterior update) [10]. Show that the posterior updates multiplicatively:
Hint
Use the definitions of and , and apply Exercise 0.2.
Solution
Exercise 1.2 [15]. (One-step predictive distribution of ) Starting from , derive the one-step predictive form:
Hint
Write , expand the numerator, and use Exercise 0.2.
Solution
The one-step conditional is the ratio of joint to marginal: .
Expanding the numerator using :
Exercise 1.3 (Bounded value) [10]. Show that for any .
Hint
Recall the formula for geometric series: .
Solution
Since , each discounted reward sum is bounded:
The interaction measure satisfies and , so the value function is a weighted average of terms in :
For : since for all finite , the limit also lies in .
Exercise 1.4 (∗) [15]. (Multi-step posterior linearity of ) Extend Exercise 1.2 to multi-step histories: show that for finite ,
Hint
Apply the general chain rule (Exercise 0.5) to , then use factorization (Exercise 0.1).
Solution
Start from the definition . Apply the general chain rule (Exercise 0.5) to both sides: and . Dividing by :
Now multiply both sides by . By factorization (Exercise 0.1), and likewise for each :
2. Existence of Optimal Policies
Recall that is defined as a supremum over all policies. In general, a supremum need not be achieved: for example, , but no attains this value. This problem shows that in our setting, the supremum is attained, so an optimal policy with exists.
Exercise 2.1 [05]. Consider a single time step. Given history and a function , show that , and that the supremum is attained by the deterministic policy that places all probability on an action achieving the maximum.
Solution
Let , which exists because is finite. So .
Upper bound. For any : .
Lower bound. The deterministic with achieves .
Combining: , attained by .
Exercise 2.2 (Bellman equation) [15]. Show that for finite and :
Hint
Use the general chain rule (Exercise 0.5) to peel off the first step,
Break up the sum , and factor out using for any history .
Solution
Step 1: Factor the future. Write : .
Step 2: Split the reward sum. This is just the return recursion (Definition 0.3): , where is the return given .
Step 3: Substitute into the definition of .
Consider the inner term . We can expand as:
as doesn't depend on , and . Inserting this above, we obtain:
Exercise 2.3 (∗) (Backward induction) [20]. Using the Bellman equation from Exercise 2.2 and Exercise 2.1, show by backward induction on that for each finite , a deterministic optimal policy exists.
Solution
We induct on , showing that for every history , a deterministic policy achieves .
Base case (): At the continuation term vanishes (the value from time is an empty sum), so the Bellman equation gives . Splitting the step via gives . This has the form with , which is independent of . By Exercise 2.1, the supremum over is , attained by the deterministic policy playing .
Inductive step: Suppose that for every history of length , there exists a deterministic policy achieving from time onwards. Substituting this optimal continuation into the Bellman equation from Exercise 2.2 gives
Splitting the step via and grouping the percept sum into the action weight:
where is independent of (the continuation value is fixed by the inductive hypothesis). By Exercise 2.1, , attained by the deterministic policy playing at time , then following .
Exercise 2.4 (Bellman optimality equation) [10]. Using Exercise 2.3, show that for finite :
where and .
Solution
By Exercise 2.3, a deterministic optimal policy exists with . Substituting into the Bellman equation from Exercise 2.2 (using on both sides):
Splitting the step via :
Since is deterministic, let denote the unique action with . Then:
Define . Then . We must have : if some had , then the policy that plays at and follows elsewhere would achieve value , contradicting . Hence:
Exercise 2.5 (∗) [15]. (Existence of ) Show that the pointwise limit exists for all histories .
Hint
Show by expanding . Use this and Exercise 1.3 and Monotone Convergence Theorem to obtain the result.
Solution
We show for all . Since , it suffices to show for every . Expanding the definition:
For the first term, marginalize over (which does not depend on):
So .
Since is non-decreasing in and bounded in by Exercise 1.3, the monotone convergence theorem gives that exists for each .
Exercise 2.6 (Infinite-horizon Bellman optimality equation) [10]. Show that the Bellman optimality equation (Exercise 2.4) extends to :
Solution
By Exercise 2.4, for every finite :
By Exercise 2.5, each converges pointwise to as . Since and are finite, the and are over finitely many convergent terms, so:
Exercise 2.7 (∗) (Optimal policy for infinite horizon) [25]. Show that a deterministic policy exists achieving for all .
Approach:
(a) Define as the greedy policy (the action from Exercise 2.6).
(b) Write two Bellman equations: one for , one for .
(c) Define and obtain a recursive equation for it.
(d) Iterate out to the finite horizon, noting (why?)
(e) Bound the tail, take .
Solution
Step 1: Define the greedy policy. For each history , let
which exists because is finite. Define the deterministic policy . By Exercise 2.6, the infinite-horizon Bellman optimality equation becomes:
Step 2: Error recursion. The Bellman equation (Exercise 2.2) holds for any policy, so for at finite horizon :
Subtracting this from the equation in Step 1, the terms cancel:
The error at time is times a weighted average of errors at time .
Step 3: Iterate the contraction. Write for the error. Step 2 gives:
Applying the same recursion at time (with greedy action at history ):
After iterations, summing over all percept sequences :
where is the history segment generated by . By Exercise 0.4, the product of -conditionals is . At the boundary, (summing over no rewards past horizon ), so . Therefore:
Step 4: Take . Since , we have , i.e. .
3. Dominance of the Bayesian Mixture
Exercise 3.1 [03]. Show that for every .
Solution
.
Exercise 3.2 [10]. Conclude that for any and any policy .
Solution
By Exercise 0.1: .
4. Properties of
Exercise 4.1 [15]. Show that for finite :
Hint
Use the multi-step posterior linearity of (Exercise 1.4).
Solution
By Exercise 1.4: . Multiply both sides by and sum over all :
In the last step we exchanged and ; this is valid because both are sums of non-negative terms (or, for finite , the sum over is finite). So:
Fact 4.1 (Dominated convergence for sums). If as for each , and for all with , then . (For finite sums this is trivial.)
Exercise 4.2 (∗) (Infinite-horizon linearity) [17]. Show that the result extends to :
Hint
Take in the finite-horizon result. You will need Fact 4.1 to exchange limit and sum for countably infinite .
Solution
The left side converges: by definition.
For the right side, we need to push through . If is finite this is immediate. For countably infinite , we apply Fact 4.1 (dominated convergence for sums):
- For each : as by definition.
- Domination: for all , since (Exercise 1.3).
- Summability: .
So Fact 4.1 gives:
Exercise 4.1 shows is linear in . The optimal value is only convex: a single policy must perform well across all simultaneously, rather than being tailored to each individually.
Exercise 4.3 (∗) [10]. (Convexity of ) Using Exercise 4.1, show that for finite :
Hint
Apply Exercise 4.1 with , the Bayes-optimal policy for .
Solution
By Exercise 2.3, a deterministic Bayes-optimal policy exists with . Applying Exercise 4.1 with :
Since is optimal for but not necessarily for each individual , we have for each . Since :
Exercise 4.4 (∗) [15]. (Non-linearity of ) Show by example that the inequality in Exercise 4.3 can be strict, i.e. is not linear in .
Hint
Consider : predicting a two-headed coin vs. a two-tailed coin.
Solution
Coin-flip prediction. Let , with , horizon . Environment always shows outcome , and the agent is rewarded for a correct prediction:
In the optimal policy plays , achieving . In the outcome is a fair coin flip, so no policy predicts better than chance: . Therefore:
5. The Expectimax Form of AIXI
We have specified AIXI only implicitly, as the Bayes-optimal policy (Definition 0.4). We now unroll this definition into the explicit expectimax expression: an alternating sequence of maximizations over actions and -expectations over percepts.
Exercise 5.1 (Expectimax form of AIXI) [20]. By iterating the finite-horizon Bellman optimality equation (Exercise 2.4), show that
and hence, collecting the percept factors with the chain rule (Exercise 0.2) and taking (Exercise 2.5 and 2.7), that AIXI selects the action
Hint
Prove the first display by backward induction on from down to , using the finite-horizon Bellman optimality equation (Exercise 2.4) and the return recursion (Definition 0.3). At each step the leftover reward term is constant in the deeper variables; carry it inward using and .
Solution
Abbreviate the one-step predictor , and write the expectimax operator over steps as
the alternating "maximize over the action, average over the percept" chain, with the weights built in; the single step is . Two facts:
- (E1) Composition: , by nesting the definition.
- (E2) Affine pass-through: for any and not depending on ,
since each layer has (so ) and for .
We prove by backward induction on that
Base case . Here and (the return past the horizon is empty, ). The Bellman optimality equation (Exercise 2.4) for gives
Inductive step. Assume the claim at time , i.e. for every length- history (recall ). The Bellman optimality equation (Exercise 2.4) at time reads
Substituting the inductive hypothesis and pulling out ,
As and do not depend on , property (E2) carries them inside the inner operator, and the return recursion (Definition 0.3) gives
Recombining the two operators by (E1),
which expands back into the layers of the first display.
Infinite horizon and the action. Taking (Exercise 2.5 and 2.7), and the chain extends indefinitely, so . Collecting the per-step factors by the chain rule (Exercise 0.2, iterated), . A Bayes-optimal action maximizes this expression; peeling the outer off as an and dropping the positive constant (which does not move the maximizer) gives the stated action.
On-Policy Value Convergence
The following problems prove the first two main results: on-policy value convergence (Section 7), and that AIXI can't be fooled in deterministic environments (Section 8). The path to the self-optimizing property (advanced stretch goal) resumes at Section 9.
6. Bounding Expectation Differences by Total Variation
Definition 6.1 (Total variation distance). The total variation distance between probability measures and on a countable set is , where .
Definition 6.2 (Expectation under ). For a probability measure on a countable set and a function , the expectation of under is .
The following technical lemma is needed for the on-policy value convergence proof.
Exercise 6.1 (∗) [15]. Let . Show that .
Hint
Define and decompose the expectation difference as a sum over and its complement .
Solution
Write out the expectation difference using Definition 6.2:
Define and , and split the sum:
Bounding the sum over . On , and , so:
Bounding the sum over . On , and , so every term :
Combining. .
The other direction. Swapping and : define . The same argument gives .
Therefore .
7. On-Policy Value Convergence of Bayes
The following definitions are needed for the on-policy value convergence theorem.
Definition 7.1 (Probability of events). A finite-length event is a set of histories of fixed length . Its probability under is
An event on infinite histories is any set built from finite-length events by countable unions, intersections, and complements.3 Probabilities of such events are uniquely determined by two properties:
- Normalization: .
- Countable additivity: if are pairwise disjoint events, then .
From these, all standard rules of probability can be derived (e.g. , etc.), though we will not prove them here. Two derived properties we use explicitly:
- Complement: .
- Monotone limits: if , then .
Further useful notions:
- Conditional probability: The probability of event given observed history is
Example 7.2 (A fair coin shows 1 infinitely often). Let , , and let be a fair coin that ignores the action: for all . Consider the event .
Step 1: Build from finite-prefix events. For each , the set is a finite-length event. For each and , the set is also a finite-length event (determined by time ). Define ("all zeros from time onwards"): this is an infinite-history event, built as a countable intersection of finite-length events. Then ("eventually all zeros").
Step 2: Compute . Since (adding more constraints), the monotone limit property (for decreasing sets) gives:
(The probability is independent of , since ignores actions.)
Step 3: By countable additivity: , so . A fair coin shows 1 infinitely often, almost surely.
As such, (the set of all infinite histories containing only finitely many 1s) is a -measure-zero set. Such histories "exist" as infinite sequences, but occur with probability zero.
Definition 7.3 (Covering4). We say covers if is positive everywhere is: for all events . Equivalently: any event that rules out, also rules out. By Section 3, covers .
Definition 7.4 (Convergence -almost surely). Let be a sequence of functions, where depends on the history of length . We write -almost surely (-a.s.) if
This set is built from finite-prefix conditions: , so its probability is well-defined (Definition 7.1).
Example 7.5 (Unpacking ""). The set looks intimidating, but it reads naturally from the inside out:
- is a finite-length event: "at time , the function is at least away from zero."
- : "at some time , is at least away from zero."
- : "for every , there is some where is at least from zero", i.e., exceeds infinitely often.
- : "for some , exceeds infinitely often."
This last condition is exactly : convergence means that for every , for all sufficiently large . Its negation is that some is exceeded infinitely often.
Each layer is a countable union or intersection of the previous, so the whole set is a well-defined event on infinite histories.
The Bayesian agent uses the mixture because the true environment is unknown. A natural question: does planning with eventually become as good as planning with ? The following theorem says yes: the value of any fixed policy , as evaluated by , converges to the value under the true environment , along histories that actually generates.5 This tells us that the Bayesian mixture "learns" to predict the true environment's value, on policy.
Theorem 7.6 (On-policy value convergence; (Hutter et al. 2024, Theorem 7.3.1)). For any and any policy : as , -almost surely. That is, the set of infinite histories along which the value difference does not vanish has -probability zero:
The proof reduces to a finite-horizon TV bound (Exercise 7.1), a covering argument (Exercise 7.2), and the Blackwell–Dubins theorem (Exercise 7.3). The only ingredient we do not prove is Blackwell–Dubins itself, which we state as a given fact.
Exercise 7.1 (Finite-horizon TV bound on value difference) [10]. Using Section 6, show that for finite :
where is the set of all future history segments .
Solution
We want to apply Section 6. Identify:
- , the finite set of future history segments .
- and , the conditional measures over .
- , which satisfies by Exercise 1.3 (so ).
Then is exactly (for ) or (for ). Applying Section 6:
Exercise 7.2 (Covering) [05]. Show that covers (Definition 7.3).
Hint
Use Section 3.
Solution
By Section 3, for all histories and all . So for any event : . Hence covers .
To complete the proof, we need the TV distance on finite segments to vanish -a.s. as . This follows from the following deep result, which we state without proof:
Fact 7.7 (Blackwell–Dubins merging of opinions (Blackwell & Dubins 1962)). If covers , then -almost surely, where the supremum ranges over all measurable events (including events on infinite histories).
The proof of Blackwell–Dubins requires the Radon–Nikodym derivative and Levy's martingale convergence theorem: tools from measure theory that are beyond the scope of this sheet. See (Hutter et al. 2024, Chapter 3.9) for discussion.
Exercise 7.3 (On-policy convergence) [15]. Using Fact 7.7, Exercise 7.1 and Exercise 7.2, prove Theorem 7.6.
Solution
Step 1: Finite-horizon bound. By Exercise 7.1, for each finite :
where the second inequality uses that the sup over subsets of is at most the sup over all measurable events.
Step 2: Take . The LHS converges to (by definition of the infinite-horizon value as the pointwise limit). The RHS does not depend on . Hence
Step 3: Take . By Exercise 7.2, covers . By Fact 7.7 (Blackwell–Dubins) with and , the RHS tends to as , -a.s. Therefore
Exercise 7.4 (∗) [40]. Prove Fact 7.7.
Hint
See (Blackwell & Dubins 1962). The proof uses the Radon–Nikodym derivative , Levy's martingale convergence theorem, and the Lebesgue decomposition. No elementary proof is known that avoids graduate-level measure theory.
8. AIXI Cannot Be Fooled in Deterministic Environments
Theorem 8.1 (AIXI cannot act poorly in good environments). If is deterministic and for all along the history generated by and , then for all . (Hutter et al. 2024, Theorem 7.4.10)
Exercise 8.1 [10]. Show that .
Hint
Use linearity of (Exercise 4.2).
Solution
By definition, for any policy . By Exercise 4.2 (linearity of in the environment):
Choose , the deterministic optimal policy for whose existence is guaranteed by Exercise 2.7:
Every term is non-negative ( and ). Dropping all terms except :
Exercise 8.2 [15]. Show when is deterministic, and combine with Exercise 8.1 to prove Theorem 8.1.
Solution
From Definition 0.1, the posterior weight is:
Since is deterministic, for the history that actually generates, for each (the environment produces each percept with certainty). So:
Meanwhile, for each (it is a probability), so .
Therefore .
Combining with Exercise 8.1:
Remark. With the Solomonoff prior, may be astronomically small. The result guarantees non-zero value, not near-optimal value.
Sections 9–11: Self-Optimizing Policy (Finite Model Class)
We now prove: if any policy can learn to act optimally, also learns. We restrict to finite where each is a proper probability measure.
9. Likelihood Ratios Are Martingales
The following definition and theorem state the main goal of Sections 9–11.
Definition 9.1 (Self-optimizing). Fix a historic policy . A policy is self-optimizing for with respect to if for every : as , -almost surely.
The percepts are sampled from ; the historic actions come from , which may differ from .
Theorem 9.2 (Self-optimizing; (Hutter et al. 2024, Theorem 7.5.2)). Let be finite and fix a historic policy . If there exists a self-optimizing for with respect to , then is also self-optimizing for with respect to : for any , -almost surely.
Definition 9.3 (Supermartingale). A sequence of functions (each depending on the history ) is a -supermartingale if for all ; that is,
If equality holds, it is a -martingale.
Intuition. A supermartingale is a quantity whose expected future value, given the present, is no larger than its current value: it cannot "drift upward on average." A martingale is the equality case: expected future value equals current value. The key example is the likelihood ratio : how much more (or less) likely the observed history is under than under the true environment . Under , this ratio is a martingale: the true environment does not, on average, favour any alternative over itself. Non-negativity plus the (super)martingale structure forces to converge (by Doob's theorem below), which is the engine behind the self-optimizing proof: it lets us separate environments that remain plausible () from those that are eventually ruled out (), and handle each case differently in Section 11.
Fact 9.4 (Doob's supermartingale convergence). If is a non-negative -supermartingale, then there exists a function of the infinite history such that as , with , for -almost every infinite history . That is:
For each , define the likelihood ratio
is a function of the history , not a number: different histories give different values. Throughout this section and the next, any unqualified statement of the form "" or "" is shorthand for "" or "" holding -almost surely, i.e. on every infinite history outside a set of -measure zero. We will not track these null sets explicitly; their countable union over all claims is still a -null set.
Exercise 9.1 [15]. Show that is a -martingale: .
Hint
Write . Sum over ; cancels, leaving .
Solution
We need to compute . Conditioning on means and are the random quantities (sampled from and respectively). First, write pointwise as a function of history in terms of :
using the chain rule (Exercise 0.2) for both and . Now take the conditional expectation. Since depends only on , it comes out of the expectation:
In the last step, cancels. Since is a probability measure, for every ; and . Therefore:
Since (a ratio of non-negative quantities), is a non-negative -martingale, in particular, a non-negative -supermartingale.
Exercise 9.2 [05]. Apply Fact 9.4 to conclude -a.s.
Solution
is a non-negative -supermartingale by Exercise 9.1. By Fact 9.4 (Doob's convergence theorem), converges -a.s. to a finite limit: .
Exercise 9.3 [10]. Define . Show and .
Solution
From the definition:
By Section 3: , so .
Since is finite, is a finite sum of convergent sequences, so -a.s., with .
10. Change of Measure
Exercise 10.1 [15]. Let be a set of finite histories of length . Show:
Hint
Use Exercise 0.1 to show .
Solution
By Exercise 0.1, and . For any history with , the policy factors cancel:
For histories with : since , some , which forces too (the same -factor appears in ). So both sides are zero.
Summing over :
Exercise 10.2. (Given.) The identity extends to infinite histories: for any event ,
This says that plays the role of the Radon–Nikodym derivative on the space of infinite histories. The proof rests on two ingredients beyond the scope of this worksheet:
- martingale convergence (closed martingale / Levy's upward theorem): since for every , the non-negative -martingale is uniformly integrable, so in , not merely -a.s. This lets us pass the limit through the expectation.
- Uniqueness of measure extension (Caratheodory / – theorem): both sides of the identity are finite measures on ; the finite-history identity (Exercise 10.1) shows they agree on all cylinder events , and cylinders generate the full event -algebra, so agreement extends uniquely to every event.
We omit the proof and use this identity freely below.
Exercise 10.3 (Markov inequality for change of measure) [15]. Let be an event of infinite histories. For any , show that
Hint
On , pointwise. Take -expectations and apply Exercise 10.2.
Solution
Let . On , , so pointwise
Take -expectations and apply Exercise 10.2:
Since , . Dividing by gives .
Interpretation. A likelihood ratio of at least forces and measures of an event to be comparable: of the event can exceed of it only by the factor . In particular, if vanishes on , so does on the part where the likelihood ratio stays bounded away from zero.
11. Proving the Self-Optimizing Property
Fix a policy that is self-optimizing for with respect to (Definition 9.1): its existence is the hypothesis of Theorem 9.2. For each , define the suboptimality gap
As with , we write without its argument when convenient: " -a.s." means on every infinite history outside a -null set, and similarly for "" etc.
Exercise 11.1 (Chain of inequalities) [20]. Show:
Hint
Use and Exercise 4.2.
Solution
We establish two inequalities and chain them.
First inequality: isolate the -term. For each , the optimal value is at least the value of any policy: , so . Since the posterior weights , every term in is non-negative. The -term is one such term:
Second inequality: replace with . By definition of the optimal value, . Expanding both sides using infinite-horizon linearity (Exercise 4.2, applied to the fixed policies and ):
Rearranging: .
Chaining:
Exercise 11.2 (Vanishing posterior) [10]. Show: if then -a.s.
Hint
Show and use Exercise 9.3.
Solution
From the posterior weight formula, dividing numerator and denominator by :
where and are evaluated at the length- history .
If , then -a.s. (Exercise 9.2). Since always (Exercise 9.3), the ratio -a.s.
Exercise 11.3 (Transferring convergence) [20]. Let , the set of infinite histories on which the suboptimality gap fails to vanish. Show that .
Hint
Self-optimizing (Definition 9.1) gives . Apply Exercise 10.3 with and to conclude for each . Then note and take the countable union (Definition 7.1).
Solution
Step 1: is -null. By the self-optimizing assumption (Definition 9.1), under the suboptimality gap vanishes, so .
Step 2: Apply Exercise 10.3. For each , take and :
Step 3: Countable union. The level sets of form a nested increasing family: . Intersecting with gives , a countable union. By countable subadditivity (Definition 7.1):
What this says. " -a.s. on " is shorthand for exactly this event statement: among infinite histories on which the likelihood ratio stays bounded away from zero, all but a -null subset are ones where . We do not claim convergence on histories where : that case is handled separately in Exercise 11.2 via the posterior weight.
Exercise 11.4 (Single-term convergence) [10]. Combine Exercise 11.2 and Exercise 11.3 to show -a.s.
Solution
Fix . We show -a.s. by considering two exhaustive cases:
Case 1: . By Exercise 11.2, . Since (Exercise 1.3), the product .
Case 2: . By Exercise 11.3, . Since (posterior weights are at most 1), the product .
These two cases cover all infinite histories (-a.s.), so -a.s.
Exercise 11.5 (Self-Optimizing Theorem) [15]. Combine Exercise 11.4, Exercise 11.1, Exercise 9.3 to finally prove the main result of Theorem 9.2.
Hint
.
Solution
Since is finite, we can sum Exercise 11.4 over all :
From Exercise 11.1:
So -a.s.
It remains to divide by . From Exercise 9.3:
Fix an infinite history outside the (single) -null set on which fails. Along this history:
- , a finite positive number (with by Exercise 9.3).
- Hence , so eventually .
Dividing the convergence by this positive (per-history) lower bound, and using :
This completes the proof of Theorem 9.2.
Remark. We do not need to know which policy is self-optimizing, or whether it is computable. Mere existence suffices. For countable , this final step is harder: a countable sum of -a.s.-convergent sequences need not converge -a.s. The general proof uses a "convergence of mixture tails" argument (Hutter 2005, Lem. 5.28).
Further reading
- Hutter, An Introduction to Universal Artificial Intelligence (2024): Chapter 2.7 (Kolmogorov complexity), Chapters 3.7–3.8 (the model class and universal prior), and Chapter 7.4 (AIXI).
- Hutter, Universal Artificial Intelligence: Sequential Decisions Based on Algorithmic Probability (Springer, 2005) — the original book-length treatment; Lem. 5.28 handles the countable- self-optimizing case.
- Blackwell & Dubins, Merging of Opinions with Increasing Information (Ann. Math. Statist., 1962) — the merging-of-opinions theorem behind on-policy value convergence.
- Leike & Hutter, Bad Universal Priors and Notions of Optimality (COLT 2015) — adversarial choices of the universal Turing machine can make AIXI behave arbitrarily badly.
A. Worked Example: Bayesian Mixture and Value Function
Setup.
- Actions: (predict the next coin flip)
- Observations: (actual coin flip)
- Rewards: , with
- Model class: (two-headed coin, fair coin)
- Prior:
Before any interaction (, ):
After observing a head (), the posterior updates:
Updated prediction: .
Value function. Continuing the same setup, suppose the agent always predicts (policy ).
Under : always correct, every step: .
Under : correct half the time: .
The mixture value (by Exercise 4.2) is: .
As the agent observes more heads (), the posterior on increases towards 1, and . This is on-policy value convergence (Theorem 7.6) in action.
B. Knuth's Difficulty Scale
Each subproblem carries a difficulty rating in square brackets, following Knuth's rating scheme for exercises (Knuth 1973) in slightly adapted form. The rating assumes that the material in the preceding problems (on which the subproblem depends) has been understood. In-between values are possible.
[00] Very easy. Solvable from the top of your head.
[10] Easy. Needs 15 minutes to think, possibly pencil and paper.
[20] Average. May take 1–2 hours to answer completely.
[30] Moderately difficult or lengthy. May take several hours to a day.
[40] Quite difficult or lengthy. Often a significant research result.
[50] Open research problem. An obtained solution should be published.
Problems marked () are enrichment: they are off the critical path to the three main results (Theorem 7.6, Theorem 8.1, Theorem 9.2) and can be skipped on a first pass without loss of continuity.
References
D. Blackwell and L. Dubins (1962). Merging of opinions with increasing information. Annals of Mathematical Statistics.
Marcus Hutter (2005). Universal Artificial Intelligence: Sequential Decisions based on Algorithmic Probability. Springer.
Marcus Hutter, David Quarel, and Elliot Catt (2024). An Introduction to Universal Artificial Intelligence. Chapman & Hall.
D. E. Knuth (1973). The Art of Computer Programming, Volume I: Fundamental Algorithms. Addison-Wesley.
Jan Leike and Marcus Hutter (2015). Bad Universal Priors and Notions of Optimality. CoRR.
Footnotes
-
See Appendix A for a worked example. For simplicity, we consider only geometric discounting. ↩
-
The optimal value is defined as a over policies. In general, a supremum need not be attained (e.g. but no achieves it). Section 2 shows that the sup is attained in our setting. ↩
-
We are deliberately avoiding a formal treatment of measure theory here. Not all subsets of are measurable; we restrict to "nice" (measurable) sets built from finite-prefix conditions via countable set operations, which suffice for everything in this sheet. For a rigorous treatment using -algebras and probability measures, see (Hutter et al. 2024, Chapter 2.2). ↩
-
The standard name is absolute continuity of with respect to , written . ↩
-
If the true environment is then we don't care about the behaviour of the Bayesian agent on histories that have -probability zero: such histories will never be observed anyway. ↩