# Passing Troll Bridge

In an earlier discussion about the Troll Bridge problem, [Abram mentioned](https://agentfoundations.org/item?id=1711) a Lobian proof that a logical induction based agent would converge to not crossing the bridge.

It looked rather sketchy, though, and further discussion by Paul in the comments revealed that Troll Bridge might be passable.

(as a quick refresher, Troll Bridge is the decision problem where action 1, ie, attempting to cross the bridge, will result in crossing the bridge for a utility of 1, unless you tried to cross the bridge because your exploration step was active, in which case, the troll blows up the bridge, and you get a utility of 0. Refraining from attempting to cross the bridge, which is action 2, will give a utility of 0.5, more about it will be typed up soon.)

**Results:**

The variant of logical induction that Abram mentioned, where the probabilities jump to 100% as soon as something gets proved, probably converges to failure on Troll Bridge.

The vanilla variant of logical induction that was discussed in the [Logical Induction paper](https://intelligence.org/files/LogicalInduction.pdf) has an unexpected and novel sort of Lobian loophole that appears to allow converging to failure on Troll Bridge, and also *might* be usable to introduce the [spurious counterfactual problem](https://intelligence.org/files/UDTSearchOrder.pdf) from proof-based decision theory into the logical inductor decision theory setting. This same loophole also renders the "proof" that different logical inductors may converge to different actions in 5-and-10 [(mentioned here)](https://agentfoundations.org/item?id=1399) invalid, and I strongly suspect that sufficiently interesting proof orderings may be used to make any given logical inductor converge to taking either the 10 dollars or the 5 dollars, and vice-versa.

There's a new variant of logical induction I came up with (a minor and somewhat hacky variant) that allows proofs about "you could have an enforcing trader that makes large bets on getting certain outcomes" to go through, and in particular, it seems to allow victory on troll bridge if you set up the initial set of traders right. (modulo a few very reasonable assumptions, and one thing that I wasn't *quite* able to prove but seems extremely likely) It's a custom-designed and horribly hacky solution, and I'd expect the True Solution to involve (somehow) dropping exploration steps entirely, but the process of constructing it did turn up that unexpected loophole mentioned in the above paragraph, and also was good for training an ability to prove bounds about what a logical inductor does, so I might as well present it. Fair warning, the appendix involves a lot of digging into the fine details of the logical inductor algorithm.

**Setup:**
$\newcommand{\wbest}[1]{sup_{\mathbb{W}\in PC(D_{#1})}}$
$\newcommand{\wworst}[1]{inf_{\mathbb{W}\in PC(D_{#1})}}$
$\newcommand{\bud}[2]{B#1_{#2}}$
$\newcommand{\totrade}{(\overline{\mathbb{P}})}$
$$\mathcal{B}^{Tb}_{n}\totrade$$ is the $n$'th trade of the trader $T$ equipped with a "budget filter" of $b$, against the market $\totrade$. It is defined as follows:

if: $\mathbb{W}(\sum_{i\le m}\mathcal{B}^{Tb}_{i}\totrade)=-b$ for some $m<n$, and $\mathbb{W}\in PC(D_{m})$, then $\mathcal{B}^{Tb}_{n}\totrade=0$. Otherwise,
$$\mathcal{B}^{Tb}_{n}\totrade=T_{n}\totrade*\wworst{n}\left(max\left(1,\frac{mag(T_{n})}{b+\mathbb{W}(\sum_{i\le n-1}\mathcal{B}^{Tb}_{i}\totrade}\right)\right)^{-1}$$

Also, $mag(T_{n}\totrade)$ is the total number of shares traded on that turn, it acts as an upper and lower bound on the value of the trade, as assessed by any possible world. You'll notice that this definition looks *very* similar to the one from the logical induction paper, but it's actually doing something rather different.

The Lobian loophole I mentioned for vanilla logical induction is that, if there's a proof of $\phi$, then the standard definition of budgeted traders on page 52 of the [logical induction paper](https://intelligence.org/files/LogicalInduction.pdf) implies that traders can buy *as many shares as they want* of $\phi$ without having their trade scaled down by the budgeting filter, because all the worlds agree that this trader isn't losing money. So, if we have some enforcing trader that's laying very large bets for "if we take the 10 dollars in the 5-and-10 problem, we get mauled by wolves", then if a proof of "taking 10 dollars means we get 10 dollars and not mauled by wolves" were to appear, then there can be some plucky little trader that just waits for that event, and names as big a number as they possibly can (the largest number nameable rises at a double-exponential rate with the day of the trader), and buy that many shares of "taking the 10 dollars will pay out" and completely dwarf the efforts of the enforcing trader and everyone else, who is losing money on whatever bet they try to make to steer things away from taking the 10 dollars. Thus, the action of taking the 10 dollars will be taken. This links "a proof of an outcome" to "the outcome actually comes about", which is the key requirement for Lobian arguments to go through. However, we don't want that for passing troll bridge. If the appearance of a proof of non-bridge-crossing promptly cancels the power of the enforcer trader, then we're unable to prove that the enforcer trader will always be able to make the agent cross the bridge.

This particular modification to the budgeting gets around that. The agent is only allowed to move a certain number of shares at a time, corresponding to its score and its allowable budget, and past that, the trade will be scaled down. Now, this limit on the number of shares moved means that the resulting market is actually vulnerable to some poly-time traders that lay very rapidly-increasing bets on settled sentences to exploit the (narrowing, but too slowly) gap between what was proved and what the beliefs are. Well, if this modification to the budgeting leaves the market open to being exploited by a poly-time trader, then it can't be a logical inductor!

However, interestingly enough, *literally every single theorem/good property in the logical induction paper* can be proved with this modification on the budgeting. Why? Well, we only get inexploitability guarantees against traders that keep the magnitude of their trades smaller than their minimum possible wealth, plus some constant. Pretty much all the traders in the logical induction paper have this property, as an accidental side effect of making sure they didn't go unboundedly into debt. The $\epsilon$-ROI lemma has this property, and this propagates forward to net every single theorem that calls upon the $\epsilon$-ROI lemma. Theorem 4.5.10 also has this property, and those two are enough to immediately reprove all theorems outside of those in section G. The trading strategy in Lemma G.1.1 preserves this property as long as the magnitude of all the component traders is uniformly bounded (by 1, let's say), and the definition of all the other traders used in section G can be modified to both exploit the market (if it's exploitable), and only move at most 1 share per turn.

So, although this modification to the budgeted traders, and the resulting sequence of market states made by approximate fixed-pointing technically *isn't* a logical inductor, it has all the nice properties we proved about one.

**Proof:**
The set of traders will be composed of an "enforcer" $E$, and a "supertrader" $S$ defined in the usual way, and the market state will be arrived at by the usual fixed-point procedure. We will be interpreting the sequence of rounds as a game between $E$ and $S$. The score of a player in this game is the magnitude of the largest trade they are theoretically able to make. The enforcer, equipped with a starting budget of $X$ dollars, is defined as follows:

$$E_{n}:=\mathcal{B}^{TX}_{n}$$
$$T_{n}:=A_{n}*\sum_{i=0}^{n-1}X*ind_{.005}\left(\frac{\mathbb{P}_{n}(U_{n}>\frac{i}{n}\wedge A_{n}=1)}{max(\mathbb{P}_{n}(A_{n}=1),\epsilon)}<.51\right)*\left((U_{n}>\frac{i}{n}\wedge A_{n}=1)-\frac{\mathbb{P}_{n}(U_{n}>\frac{i}{n}\wedge A_{n}=1)}{max(\mathbb{P}_{n}(A_{n}=1),\epsilon)}(A_{n}=1)\right)$$
$A_{n}$ is an indicator function that's 0 if n is before an "awakening day" and 1 afterward.

Let's go over some properties of $E$. Because it's budgeted at $X$, its starting score is $X$. By the way the budgeting operator works, if it makes a trade, the score will drop by the worst-case value of that trade. Looking at it, what it does is start buying any components of $\mathbb{E}(U_{n}|A_{n}=1)$ that are priced below 51 cents, and it'll escalate to spending its entire starting endowment by the time the price on any of the components drop to 50.5 cents. Thus, if $E$ doesn't spend its entire budget or starting endowment, whichever is lower, on a turn, the price of all components will be 50.5 cents and above, so $\mathbb{E}(U_{n}|A_{n}=1)>.505)$. There is some day $n$ by which $|\mathbb{E}(U_{n}|A_{n}=2)-.5|<.005$ forevermore, so, assuming that this trader never escalates to spending all its money, and "wakes up" after that day, as implemented by that indicator function $A_{n}$, it will be able to ensure that the agent always attempts and succeeds at crossing the bridge (except on exploration steps).

So, now all that's left is showing that this trader will (with high probability), not escalate to spending all its money. Because we are taking an (approximate) fixed-point of $E$ and the supertrader $S$, and at the fixed-point, the total number of shares bought and sold is (approximately) zero, the magnitude of the enforcer's trade is (approximately) equal to the magnitude of the supertrader's trade. (it's late at night and I'm not feeling like accounting for this and it almost certainly doesn't make a difference). As this trader will escalate to whatever level of trading is required to keep the expected value of crossing the bridge above .505, the supertrader can only force a loss/budget overdraw once its score/maximum allowable trade rises above that of the enforcers.

Now, the game is as follows. On turn $n$, the enforcer and supertrader have scores of
$$X_{n}:=X+\wworst{n}\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$$
and
$$C_{n}:=7-\wbest{n}\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$$
respectively, the latter is by Lemma 1. (well, technically, this is an upper-bound on the score of the supertrader, but it'll do). Then, they lay their bets. Two things are important to note. One is that we'll be making a simplifying assumption where the value of the utility is completely uncertain until a proof of the utility gained on that day is observed in the theorem prover, this shouldn't change things too much. Thus, if someone spent 5 dollars on shares saying that the value of $\phi>k$ for varying values of k, the lowest possible value would be -5 and the highest possible value would be the number of purchased shares-5 before an observation of the value of $\phi$ came in, and that would immediately settle all the component bets. The second thing to note is that $\delta_{n}$ will be defined as the set of days $n-1$ and before where a trade was made that now has had its value revealed because an observation of the utility gained on that day has made it to the theorem prover on day $n+1$, and it wasn't present on day n. It is then easy to verify that the change in score from day n to day n+1 is as follows.
$$\Delta X=\wworst{n+1}\mathbb{W}\left(\sum_{m\in\delta_{n}}E_{m}\totrade\right)-\wworst{n}\left(\sum_{m\in\delta_{n}}E_{m}\totrade\right)+\wworst{n+1}\mathbb{W}(E_{n}\totrade)$$
$$\Delta C=-\wbest{n+1}\mathbb{W}\left(\sum_{m\in\delta_{n}}E_{m}\totrade\right)+\wbest{n}\left(\sum_{m\in\delta_{n}}E_{m}\totrade\right)-\wbest{n+1}\mathbb{W}(E_{n}\totrade)$$

Now, we'll impose one further key assumption. The proof-searching process must be either unbiased or biased in favor of crossing, ie, the sequence of proofs of the form "on day n, the bridge was crossed/not crossed" is a psuedorandom sequence with probability $\frac{\epsilon}{2}$ or less of the proof being "exploration step into the bridge occurred". It's possible to screw over the enforcer by deferring information of successful bridge-crossings to some really sparse subsequence, but making proofs of bridge-explosions denser, so this basically says that you get information about passing or not-passing the bridge in a way that isn't biased towards particular outcomes. Direct observation of the utility on day n immediately after the n'th trade is made and the n'th action is selected is a very easy way to get this property, but this generalization handles delays in feedback.

So, now that all these preliminaries are out of the way, we can see that the the reveal of theorems from day $n$ to day $n+1$ is always negative-expected-value for $S$ and positive-expected value for $E$, and the most recent trade only locks up slightly more value from $E$ than from $S$. Conditional on a particular trade being in $\delta_{n}$, the expected value of the trade to $E$ (remember, we're assuming the pseudorandom sequence of exploration steps is truly random and taking an expectation over that) is bounded below by $mag(E_{m}\totrade)*(.495(1-\epsilon)-.51\frac{\epsilon}{2})$, and the expected value of the trade to $S$ is bounded above by $mag(E_{m}\totrade)*(.51\frac{\epsilon}{2}-.495(1-\epsilon))$. (we don't account for the trader exploring into remaining on its side of the bridge because the conditional contract that $E$ bought and $S$ sold has 0 value in that world) Also note that if $PC(D_{n+1})$ settles the most recent trade, the same analysis applies to it, and if $PC(D_{n+1})$ doesn't settle the most recent trade, then $\wworst{n+1}\mathbb{W}(E_{n}\totrade)$ is at minimum $-.51mag(E_{m}\totrade)$ and $-\wbest{n+1}\mathbb{W}(E_{n}\totrade)$ is at maximum $-.505mag(E_{m}\totrade)$.

This may seem quite complicated, but the essence of it is that these two traders are playing a game. The super-trader can sell shares in "the bridge will be succesfully crossed" for at most 51 cents. However, until the share has its value assessed, the super-trader is only allowed to sell a finite amount of them to the enforcer (because score is tied to the maximum number of shares that can be moved). Also, there's a $1-\epsilon$ chance that the share will turn out be worth 1 dollar, so this action is negative-expected value for the supertrader.

I'm not sure of the exact result required to prove this, but there are results under the name of "Gambler's Ruin" that any gambler playing a negative-expected-value game will eventually go broke regardless of strategy. I'm extremely confident that there's a similar result that any gambler playing a negative-expected-value game against another player with a sufficiently larger bankroll will (with very high probability) fail to ever attain the same wealth as the other player.

Thus, we have showed that, assuming unbiased finding of theorems, and assuming the gambler's ruin conjecture above goes through, there's a value of $X$ that can be assigned to the enforcer to ensure with arbitrarily high "probability" that the bridge will be crossed forevermore after the enforcer wakes up, except on exploration steps.

**Lemma 1**

The maximum magnitude trade that $S$ can make is bounded above by $7-\wbest{n}\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$.

Alright, time for some definitions. As a quick recap:

if: $\mathbb{W}(\sum_{i\le m}\mathcal{B}^{Tb}_{i}\totrade)=-b$ for some $m<n$, and $\mathbb{W}\in PC(D_{m})$, then $\mathcal{B}^{Tb}_{n}\totrade=0$. Otherwise,
$$\mathcal{B}^{Tb}_{n}\totrade=T_{n}\totrade*\wworst{n}\left(\frac{1}{max(1,\frac{mag(T_{n})}{b+\mathbb{W}(\sum_{i\le n-1}\mathcal{B}^{Tb}_{i}\totrade})}\right)$$

The budgeted version of a trader on day n is $\bud{T}{n}$, and the resulting trade they make is $\bud{T}{n}\totrade$. This is defined as 

$$\sum_{b\in\mathbb{N}^{+}}\zeta(b)*\mathcal{B}^{Tb}_{n}\totrade$$

$\zeta$ is some probability measure over $\mathbb{N}^{+}$ such that $\sum_{b\in\mathbb{N}^{+}}b\zeta(b)$ is finite. A popular choice is the inverse exponential base 2, as was used in the original logical induction paper. This makes $\sum_{b\in\mathbb{N}^{+}}b\zeta(b)=2$, but it generalizes. Pretty much, the budgeted version of a trader is when you take a trader and weighted-sum together every possible budget level "filter" on them.

The score $s_{b}$ of a budgeted trader on day n is $\wworst{n}\mathbb{W}(\sum_{i\le n-1}\mathcal{B}^{Tb}_{i}\totrade)$. The "debt level" $d$ of a budgeted trader on day n is the largest budget such that all traders with a smaller budget go bankrupt.

$$argmax\left(b\in\mathbb{N}^{+}|\forall b'\le b:\exists m<n:\wworst{m}\mathbb{W}\left(\sum_{i\le m}\mathcal{B}^{Tb'}_{i}\totrade\right)=-b'\right)$$

So, to begin with, note that 

$$\forall b\le d:\mathcal{B}^{Tb}_{n}\totrade=0$$

By the definition of $\bud{T}{n}$,

$$mag(\bud{T}{n}\totrade)=\sum_{b>d}\zeta(b)*mag(\mathcal{B}^{Tb}_{n}\totrade)$$

Now, we can split it up into two cases. In case one, for all $\mathbb{W}\in PC(D_{n})$, 

$$mag(T_{n}\totrade)\le b+\mathbb{W}\left(\sum_{i\le n-1}\mathcal{B}^{Tb}_{i}\totrade\right)$$

And thus, $mag(\mathcal{B}^{Tb}_{n}\totrade)=mag(T_{n})$ by the definition of $\mathcal{B}$. In the second case, there is a $\mathbb{W}\in PC(D_{n})$ which minimizes $b+\mathbb{W}(\sum_{i\le n-1}\mathcal{B}^{Tb}_{n}\totrade)$ to less than $mag(T_{n}\totrade)$, thus by the definition of $\mathcal{B}$, we get
 
$$mag(T_{n}\totrade)*\left(\frac{mag(T_{n}\totrade)}{b+\mathbb{W}(\sum_{i\le n-1}\mathcal{B}^{Tb}_{i}\totrade)}\right)^{-1}=b+s_{b}$$

Therefore, $mag(\bud{T}{n}\totrade)=\sum_{b>d}\zeta(b)*min(s_{b}+b,mag(T_{n}\totrade))$, and we get the bound

$$mag(\bud{T}{n}\totrade)<\sum_{d<b,b\in\mathbb{N}^{+}}(\zeta(b)*(s_{b}+b))\le\sum_{b\in\mathbb{N}^{+}}(\zeta(b)*s_{b})+\sum_{b\in\mathbb{N}^{+}}(\zeta(b)*b)$$

There's one piece $\zeta(b)*s_{b}$, which looks as if it could be unbounded although it has a dependence on the minimum wealth of the trader, and another piece $\zeta(b)*b$ which is bounded by a constant by the definition of $\zeta$. The first term will now be bounded.

The supertrader works by finding a fixed point over $\sum_{T\in\mathbb{M}}\xi(T)\bud{T}{n}$. This particular proof will work in a very similar way as Vadim's earlier proof of a bound relating $\wbest{n}$ and $\wworst{n}$ for any trader in a logical inductor. The only differences are that we will explicitly account for the imperfect fixed-point finding, and also there's a second component that isn't a supertrader so we need to account for the flow of shares and cash in and out.

The argument for the bound is fairly simple. In the fixed point, the number of shares traded on each side of the trade must cancel out to (approximately) 0, unless the probability/price is 0 or 1. For all the worlds, the winners are balanced out by losses elsewhere. Also, by the way the budgeting works, there's a finite amount of points that can be earned from driving a particular opponent unboundedly into debt. Call the trade made by the entire logical inductor on day n $S_{n}\totrade$. It is defined by: (note that $\xi$ is a probability distribution over all turing machines)

$$S_{n}\totrade:=\sum_{t\le n}\xi(t)\bud{T}{n}\totrade$$

To begin with, because of the approximate fixed-poitn finding of the logical induction algorithm,

$$1\ge sup_{n\in\mathbb{N}^{+}}sup_{\mathbb{W}\in PC(D_{n})}\mathbb{W}\left(\sum_{m<n}S_{m}\totrade+\sum_{m<n}E_{m}\totrade\right)$$

$$=sup_{n\in\mathbb{N}^{+}}sup_{\mathbb{W}\in PC(D_{n})}\mathbb{W}\left(\sum_{m<n}\sum_{t\le m}\xi(t)\bud{T}{m}\totrade+\sum_{m<n}E_{m}\totrade\right)$$

Now, given an arbitrary n and an arbitrary world, we can divide the traders into two groups, $win$ which has positive value as assessed by the world, and $lose$ which has negative value as assessed by the world.

$$1-\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)\ge\mathbb{W}\left(\sum_{t<n,t\in win}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)+\mathbb{W}\left(\sum_{t<n,t\in lose}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)$$

Fix a particular day $n$, and consider the world in $PC(D_{n})$ which maximizes $\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$ . In short, we are assuming that the minimum possible amount of value has been given away by the enforcer.  By the above inequality,

$$\mathbb{W}\left(\sum_{t<n,t\in win}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)\le 1-\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)-\mathbb{W}\left(\sum_{t<n,t\in lose}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)$$

That third term is negative, so making it as negative as possible (this corresponds to all the losing traders going infinitely into debt), gives an upper bound on the value of all the winning traders. The budgeted traders cannot go infinitely into debt, because they shrink down their trading magnitude each time they lose value. The maximum debt a trader $\bud{T}{m}$ can have is $\sum_{b\in\mathbb{N}^{+}}b\zeta(b)$, which we already established was a constant. Thus,

$$\mathbb{W}\left(\sum_{t<n,t\in win}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)\le 1-\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)+\sum_{t<n,t\in lose}\xi(t)\sum_{b\in\mathbb{N}^{+}}b\zeta(b)$$

Seperately,

$$\sum_{t<n,t\in win}\xi(t)\wworst{n}\mathbb{W}\left(\sum_{t\le m<n}\bud{T}{m}\totrade\right)\le\mathbb{W}\left(\sum_{t<n,t\in win}\sum_{t\le m<n}\xi(t)\bud{T}{m}\totrade\right)$$

and

$$\wworst{n}\mathbb{W}\left(\sum_{t\le m<n}\bud{T}{m}\totrade\right)\ge\sum_{b\in\mathbb{N}^{+}}\zeta(b)*\wworst{n}\mathbb{W}\left(\sum_{t\le m<n}\mathcal{B}^{Tb}_{m}\totrade\right)=\sum_{b\in\mathbb{N}^{+}}\zeta(b)s_{b}$$

By putting all these inequalities together, we get

$$1-\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)+\sum_{t<n,t\in lose}\xi(t)\sum_{b\in\mathbb{N}^{+}}b\zeta(b)\ge\sum_{t<n,t\in win}\xi(t)\sum_{b\in\mathbb{N}^{+}}\zeta(b)s_{b}$$

As a quick reminder,

$$mag(\bud{T}{n}\totrade)<\sum_{b\in\mathbb{N}^{+}}(\zeta(b)*s_{b})+\sum_{b\in\mathbb{N}^{+}}(\zeta(b)*b)$$

Now, we will put all this together to bound the number of trades that a logical inductor can make on a given turn.

$$mag\left(\sum_{t\le n}\xi(t)BT_{n}\totrade\right)=\sum_{t\le n,t\in win}\xi(t)mag(BT_{n}\totrade)+\sum_{t\le n,t\in lose}\xi(t)mag(BT_{n}\totrade)$$

$$<\sum_{t\le n,t\in win}\xi(t)\left(\sum_{b\in\mathbb{N}^{+}}\zeta(b)s_{b}+\sum_{b\in\mathbb{N}^{+}}b\zeta(b)\right)+
\sum_{t\le n,t\in lose}\xi(t)\left(\sum_{b\in\mathbb{N}^{+}}\zeta(b)s_{b}+\sum_{b\in\mathbb{N}^{+}}b\zeta(b)\right)$$

As we can see, the terms with $b\zeta(b)$ are constants by definition. The term with $\zeta(b)s_{b}$ on the left was bounded above by 1-$\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$+a constant. The term with $\zeta(b)s_{b}$ on the right is negative because of how we defined the set $lose$.

By setting $\zeta(b)$ to $2^{-b}$, we get

$$mag\left(\sum_{t\le n}\xi(t)BT_{n}\totrade\right)<2+(1-\wbest{n}\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)+2)+0+2=7-\wbest{n}\mathbb{W}\left(\sum_{m<n}E_{m}\totrade\right)$$