# Market Logic I

[Garrabrant Induction](https://arxiv.org/abs/1609.03543) provides a somewhat plausible sketch of reasoning under computational uncertainty, the gist of which is "build a prediction market". An approximation of classical probability theory emerges. However, this is ***only because we assume classical logic.*** The version of Garrabrant Induction in the paper does this by allowing bets to be placed on *all boolean combinations* of sentences visible to the market. An earlier draft accomplished the same thing via special arbitrage rules, EG, if you own $1\over 5$ of $S$, and you own $1\over 5$ of $\neg S$, then you can trade these to the market-maker for $1\over 5$ of a dollar. (So for example, if the current price of a share of $S$ is $50¢$, and the current price of a share of $\neg S$ is $45¢$, then you can arbitrage by buying $1\over5$ of a share of both (cost $10¢$+$9¢$=$19¢$) and cashing these in to the market maker for $20¢$.) This forces the market to converge towards $\text{price}(S)+\text{price}(\neg S) = \$1$ for all $S$, mimicing classical probability. Similar arbitrage rules can be formulated for the other logical connectives.

This is nice for what it does, but it means *Garrabrant Induction provides no normative evidence for approximating classical probability theory or classical logic.* These are baked-in assumptions, not conditions which emerge naturally from beautiful math.

Sam Eisenstat has (privately) formulated a version of Garrabrant Induction based on *intuitionistic* logic instead. The result does not require the price of a sentence and its negation to sum to 1 (and also violates some other things we expect of probabilities). It has the nice property that *conditional on excluded middle* $S \vee \neg S$, we recover classical probabilities. (This is a natural result to want, since intuitionistic logic plus excluded middle = classical logic.)

This leaves open the question: what logic ***naturally emerges*** if we let the math do the talking, rather than imposing one logic or another?

The following modifies a proposal by Sam Eisenstat, and also takes inspiration from [yesterday's post](https://www.lesswrong.com/posts/j3Cv94eEZTDFiLREW/rescuing-truth-in-mathematics-from-the-liar-s-paradox-using).

* * *

**To lay a foundation for this investigation, I'll sketch something resembling Garrabrant induction, but avoid baking in a specific logic.**

I won't go all the way to defining a proper computable thing. Indeed, I won't even define everything completely. I am doing this in compressed time due to Inkhaven, so I may need to come back and fix the math later. Questions/concerns/corrections are appreciated.

Let's start by imagining there are some market goods. I have in mind something similar to the setting in Skyrms' [*Diachronic Coherence and Radical Probabilism*](https://sites.socsci.uci.edu/~bskyrms/bio/papers/DiachronicCoherence.pdf): market goods can be anything, IE, are not restricted a priori to "propositions". However, in order to guarantee the existence of fixed points (as in Garrabrant Induction), I *will* need to require that the prices are bounded within some range. For simplicity, I'll stipulate that all market goods have the same price-range, namely $[0,1]$. I'll use dollars, so that the maximum price of any good is $\$1$, and prices will typically be denoted in cents. For any good that can be purchased, one can also purchase fractional shares of that good. The *total amount of money in the economy* is bounded to $\$1$ as well, so so everyone's net worth is in cents.

Time proceeds in *days*. On a given day, the market-maker sets the prices for all the market goods, and then the traders look at the prices and decide how much to buy or sell.[^epk73kpq4ji] All transactions go through the market-maker.

On a specific day, a trader's *strategy* is its function from prices to buy/sell orders. Strategies are required to be Kakutani (basically: continuous functions).[^po7n6an4ic] The market-maker knows the traders well and can predict the aggregate trades perfectly (only same-day, not days ahead), and sets the prices so that it has no exposure (no downside risk).[^fl44co6r5ld] This is possible thanks to [Kakutani's fixed point theorem](https://en.wikipedia.org/wiki/Kakutani_fixed-point_theorem). The traders, however, need not be so omniscient. Indeed, they need not be rational in any sense. Traders can update their trading strategies from day to day, in any way they like. (A trader is, essentially, a sequence of trading strategies.)

The number of goods on the market can expand as time goes on. For simplicity, I'll assume that there are $n$ different goods on the market on day $n$. We can also imagine that the number of traders increases over time as well, with the $n$th trader appearing on day $n$ and starting with $\$ {1 \over {2^{n+1}}}$. New traders can also bring nonzero quantities of other goods with them. We'll want to assume that any strategy appears eventually (drawing from some suitably rich class of strategies).

$$$ is, essentially, one of the goods (the good we price everything in terms of). It is natural to suppose $$$ appears on day 1, and always has price 1. A trader's starting portfolio on day $n$ is a function from $n$ to $\mathbb{R}$, indicating how much of the $n$th good the trader currently owns. Owing a negative quantity represents a [short](https://en.wikipedia.org/wiki/Short_(finance)), which means you've promised to provide the good later if demanded.[^rvwd7uirqz] We'll represent this here as a negative contribution to your net worth on day $n$: the net worth of a trader can be calculated by multiplying the quantity in the starting portfolio for that day by the price of that good (summing over all goods). The day's trades don't change the trader's net worth on that day, but net worth tends to change day-to-day as a result of prices changing. Traders grow in net worth if they can anticipate how prices will change day-to-day and sell what will go down in price / buy what will go up in price.

In order to short good $G$, a trader is required to have enough $$$ to fulfill its promise *even if the price of *$G$* rose to *$$1$. Thus, if a trader has $-g$ of $G$, it must keep at least $$g$ on hand. The market-maker will reject buys/sells that violate this constraint. The market-maker also doesn't let a trader buy more than they can afford (IE, $$$ cannot go negative).

If you like, you can imagine that the value of goods can be "revealed" or "pinned" sometimes (as if by government price-fixing), at which point the market-maker is told a price for the good and must keep that price forever after. This is analogous to evidence coming in, in Garrabrant Induction. However, as I discussed in [Judgements](https://www.lesswrong.com/posts/3hs6MniiEssfL8rPz/judgements-merging-prediction-and-evidence), this is not essential.[^te38bnowm5m]

**The goal here is to draw an analogy between the operation of this market and logic.**

Whereas Garrabrant Induction was shackled to classical logic, I've now described a market in a (more-or-less) neutral way. What logic relates to this market, in the same way that classical logic related to Garrabrant Induction?

As a starting-point, notice that guaranteed-no-loss trade goes in the direction of implication. Here, we're interested in trades that *always* make sense, by virtue of what is being traded, rather than trades that make sense by virtue of the current prices. For example, if I had a certificate "$$1$ goes to the owner of this certificate if it rains tomorrow" and you had a certificate "$$1$ goes to the owner of this certificate if it rains tomorrow and is cloudy in the morning" then you should definitely be willing to trade your certificate for mine, since mine gets $$1$ in strictly more cases. This corresponds to the fact that a conjunction implies either of its conjuncts.

This suggests that $$$ is like "true", aka "top", written $\top$, because $$$ is guaranteed to have the maximum price of any good, so one should always be willing to accept $$1$ in exchange for giving up a share of some good.

Shorting is clearly like negation. If you short $c$ shares[^bzdsrzmioml] of $G$, then you must also set aside $$c$ collateral. Thus, the portfolio-contribution associated with shorting is $c($1 -G)$. Compare this to the [formula for negation in Łukasiewicz Logic](https://www.lesswrong.com/posts/j3Cv94eEZTDFiLREW/infinitesimally-false#Continuum_Valued__ukasiewicz_Logic).

I find it helpful to imagine that the market-maker is trying to be maximally helpful, facilitating any trades possible, so long as doing so does not introduce any financial risk. Thus, the market-maker would be willing to give you "$$1$ goes to the owner of this certificate if it rains tomorrow and is cloudy in the morning" in exchange for "$$1$ goes to the owner of this certificate if it rains tomorrow" if that's what you *wanted. *

What we need to do is characterize *the space of things like this.*

**Our task is to study the space of financial derivatives.**

We want to specify a market-maker who is "very helpful", IE, facilitates a broad variety of transactions. These transactions will then give us our logic.

A "derivative" in finance is just a financial instrument that is somehow *derived from* an underlying financial instrument. For example, if we can invest in a good $G$, we can also bet that $G$ will be above $5¢$.

*This went long, so I'll post part 2 tomorrow!* ([posted](https://www.lesswrong.com/posts/2dsTdcZL6a3EAxdbS/market-logic-ii))

[^epk73kpq4ji]: You can think of the market-maker as an easy mathematical modeling choice, which represents the more chaotic process of buyers finding sellers & the price at most points in time converging to a small spread. 

[^po7n6an4ic]: Continuous functions allow you to approximate, but never perfectly implement, strategies such as "buy \(1¢\) of \(S\) if its price is below \(3¢\), sell \(1¢\) if its price is above \(3¢\)". Kakutani maps allow you to implement this strategy precisely, so long as you're OK with indeterminate behavior at \(3¢\).A Kakutani map is actually a relation, not a function; we can think of it as a set-valued function. The output set needs to be nonempty and convex for each input, and the overall relation needs to be closed (contains all its limit points). 

[^fl44co6r5ld]: For example, suppose there are two traders, Alice and Bob, and one good \(G\) (other than \($\)). Alice has \(70¢\) it wants to invest in \(G\), and Bob has \(30¢\) it wants to use to short \(G\).The market-maker sets the price of \(G\) at \(70¢\). Alice buys 1 share of \(G\). This 1 share might be worth up to \($1\) in the future, so if this was the only thing that happened, the market-maker would have an exposure of \(30¢\); that's how much the market-maker could lose if the price rose to \($1\) and then Alice asked to sell the share.Fortunately, Bob is shorting \(G\) with \(30¢\). The market-maker pays Bob \(70¢\) to take an anti-share[7] of \(G\). Bob now has \(100¢\) total, plus an anti-share. The \(100¢\) is exactly enough to act as collateral for the anti-share, so this is the maximum amount that the second trader can short \(G\) using its \(30¢\).No matter what the price of \(G\) changes to, the amount potentially owed to Alice now exactly balances with the amount Bob potentially owes. For example, if the price of \(G\) shifts to \(50¢\), then the market-maker has lost \(20¢\) to Bob (Bob can get rid of the anti-share by paying \(50¢\), and thus, come out \(20¢\) ahead). However, the market-maker has gained \(20¢\) from Alice to make up for it. (Alice purchased the share for \(70¢\), but can only get \(50¢\) back for it now.) 

[^rvwd7uirqz]: In the current formalism, this demand will never actually be called in; the debt of the short is represented directly by the negative value it adds to the net worth.Imagine you're shorting gold and the market-maker says "don't worry, I'll handle the actual exchange of gold; people won't have to come to you to ask for the gold you promised. You'd just have to come to me to buy it anyway. Instead, they'll come to me and I'll give them the gold."You ask: " And then you'll charge me for the gold they buy? But how do you decide who to charge when someone comes for gold? You could screw me over by saying it is my turn on a day when the price of gold is high?"The market-maker says: "Well, to be honest, I won't ever charge you. Instead, I keep track of your debt, and I simply won't let you spend beyond the point where you wouldn't be able to pay off the debt. I calculate this based on the worst-case scenario where the price of gold soared to \(\$1\). Other people I trade with know that I could always come ask for money from you, so they know I'm solvent, and they'll extend me credit because they know I'm good for it, the same way I'm extending credit to you because I know you're good for it."You respond: "That sucks! All transactions have to go through you, so that means it is always as if you've picked the worst possible day, since my effective amount of money to spend is as if the short worked out as badly as possible for me. What is the point of shorting, then? You give me money for selling the good, but in actuality, your policy is such that it is as if my total amount of money has gone down."Market-maker: "You can buy later, which cancels out your short, whenever you'd like me to recognize your actual net worth based on the actual value rather than the worst-case. If you short something when you think it is over-valued, and then you buy it later when the value has reduced, you'll have made money. This isn't really about me having a monopoly on trade; it's just me asking you to set aside enough money that you could pay me back if I needed it." 

[^te38bnowm5m]: We can further imagine, if we like, that any shares[6] and anti-shares[7] must be immediately cashed in for the given value; so for example, if gold is pinned at \(20¢\), and Alice has .5 shares of gold, then Alice loses her shares and gains \(10¢\). If Bob has .25 anti-shares of gold, then Bob loses the anti-shares and also loses \(5¢\).This way, the debts which shorts represent are "called in" at some point.However, this is really unnecessary, since fixing the value of the good has the same effect; we can let traders trade in their shares and anti-shares at their own leisure.Similarly, the whole mechanism of fixing the price of a share is unnecessary. A sufficiently wealthy trader can do it "from within the market" by adopting a strategy which counter-bids any market pressures which would change the price. So, the mechanism of "evidence coming in from outside the market" is merely a device for modeling the influence of an arbitrarily wealthy trader. 

[^bzdsrzmioml]: The plural "shares" is here used in the fractional sense, since traders will almost always be buying fractional shares. 

[^yk0kkskfpwc]: An anti-share is just a negative share, IE, a short.