<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Felix Breuer's Blog]]></title>
  <link href="http://blog.felixbreuer.net/atom.xml" rel="self"/>
  <link href="http://blog.felixbreuer.net/"/>
  <updated>2013-04-28T22:57:15-07:00</updated>
  <id>http://blog.felixbreuer.net/</id>
  <author>
    <name><![CDATA[Felix Breuer]]></name>
    <email><![CDATA[felix@fbreuer.de]]></email>
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Funding Vaccine Production]]></title>
    <link href="http://blog.felixbreuer.net/2013/04/28/vaccines.html"/>
    <updated>2013-04-28T23:35:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2013/04/28/vaccines</id>
    <content type="html"><![CDATA[<p><em><a href="http://www.fund-io.com">Fund I/O</a> can be extremely useful in funding projects with a social or environmental impact: producing vaccines, for example. One challenge of vaccine production is getting the market for a new vaccine to scale to the point where the vaccine becomes affordable. Because prospective buyers expect prices to drop, many will wait with their purchase, which may even prevent the market from reaching the required size. Fund I/O offers an original solution to this problem, by giving buyers incentives to buy now. This can provide a viable alternative to difficult-to-negotiate advance market commitments.</em></p>

<p>Fund I/O can be used not only for digital goods, but for anything that has large fixed costs and low marginal costs. This includes physical goods that have a large social impact, such as vaccines. Here is how this might work.</p>

<p>Suppose a vaccine for a certain disease has already been developed. Now it needs to be produced at scale to reach millions of people world wide. The problem is vaccine production requires a substantial investment to get going. This means, if a supplier were to produce just 100,000 doses of the vaccine, each dose might be prohibitively expensive. But at a scale of 10 million doses, each dose could be very cheap. As long as the market is small, the price for the vaccine will be very high so that only few people will be able to afford it. But once the market grows, the price will drop, and many more people will be able to afford the vaccine.</p>

<p>This creates a chicken and egg problem: To get the price down, many people would need to buy the vaccine. But for many people to buy the vaccine, the price would need to drop. So how can we get the market started?</p>

<p>One approach to getting the market started are <a href="http://en.wikipedia.org/wiki/Advance_market_commitments">advance market commitments</a>. A couple of large buyers of the vaccine, such as governments or charitable donors, make a joint commitment to buying a large number of doses at a specified price. The idea is that by guaranteeing a certain demand for the vaccine in advance, the market can be jump-started at a volume attractive to suppliers and at a price attractive to buyers.</p>

<p>There is a catch, however: Because, the price for the vaccine will drop over time, buyers have an incentive to wait. Those who start buying early will pay a premium. It you wait, you pay less, and the later you get in, the more you save. Even if everyone wants to buy the vaccine, those who manage to start buying last will pay the least. Early adopters effectively subsidize late entrants.</p>

<p>You can imagine that this leads to quite a lot of maneuvering over who gets to be the last. Especially because the market for governments buying vaccines has several features that exacerbate the problem: First, very large sums of money are at stake. Second, buyers (such a governments) are often frugal, by necessity. Third, implicitly subsidizing other parties may be unpopular, even if it is for a good cause such as getting more vaccines to more people. And finally, the only benefits of entering early are measured in terms of impact (saving lives) and not profit (return on investment), which often makes spending money harder instead of easier - unfortunately. Advance market commitments can help a lot in this setting: by forming a coalition of first movers, the financial disadvantage to buying early is reduced considerably. But the incentive to get in later remains, and this makes it often very hard to establish such a coalition.</p>

<p>Here Fund I/O can help. In fact, Fund I/O was <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">designed</a> to solve exactly this chicken-and-egg problem. Using Fund I/O, buyers do not have an incentive to wait. To achieve this, all you need to do is apply the refund mechanism used in the second phase of the <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">Fund I/O model</a>. Buyers can purchase immediately and still benefit from economies of scale as the market matures. Through the refund mechanism, they can rest assured they will benefit from decreasing prices in just the same way as a late entrant.</p>

<p>This solution makes jump-starting markets much easier, by offering a smooth transition from a low volume/high price market to a high volume/low price market. Moreover, it does not require complicated negotiations aimed at getting buyers to commit to making purchases now, even though it would be in their financial interest to wait. The Fund I/O mechanism guarantees the same financial benefits as an advance market commitment involving <em>all</em> potential buyers, present and future, but it can be set in motion by just a few interested parties right away. Agreements are not made at a negotiating table but on a platform of exchange that incentivises all participants to reveal their true valuation for the vaccine.</p>

<p>Of course there are many more details to be addressed here, both as far as the theoretical model and practical issues are concerned. I will deal with these as I go along. In the next post, I&#8217;ll start with a detailed example of this use-case of Fund I/O in action.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="business"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="crowdfunding"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="impact"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Crowdfunding Model for Open Source Software?]]></title>
    <link href="http://blog.felixbreuer.net/2013/04/24/crowdfunding-for-open-source.html"/>
    <updated>2013-04-24T00:55:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2013/04/24/crowdfunding-for-open-source</id>
    <content type="html"><![CDATA[<p>I think we need more crowdfunding projects for open source software! And here is one, for example: <a href="http://www.yorba.org/">Yorba</a>, the guys behind <a href="http://www.yorba.org/projects/shotwell/">Shotwell</a>, are currently running an <a href="http://www.indiegogo.com/projects/geary-a-beautiful-modern-open-source-email-client">Indigogo campaign</a> to fund the development of their open source email client <a href="http://www.yorba.org/projects/geary/">Geary</a>. As of this writing, they have raised about \$50,000 of their \$100,000 goal and the rush of the last 24 hours has just begun. So, please head <a href="http://www.indiegogo.com/projects/geary-a-beautiful-modern-open-source-email-client">over there</a> now and consider making a dontation. You can always come back here to read on!</p>

<h2>Why Funding Open Source Software is Difficult on Kickstarter</h2>

<p>Crowdfunding has taken off, for physical goods as well as for software-related products like <a href="http://blog.felixbreuer.net/2012/12/31/kickstarter.html">games</a>. So why do we see so few open source project take advantage of crowdfunding? In fact, Kickstarter is based on the Street Performer Protocol (SPP), a method for raising funds that was originally intended as a model for financing open source software, and that had some early successes such as making <a href="http://www.blender.org/">Blender</a> open source. Could it be that rewards-based crowdfunding as on Kickstarter simply does not work as well for open source software?</p>

<p>There is one subtle difference between open source and closed source projects on Kickstarter, and this difference may be crucial: The successful game projects on Kickstarter have no intention of giving away their core product for free. This makes pledges pre-sales instead of donations. Open source projects on the other hand announce right away that their product is going to be free. Does this influence backer behavior?</p>

<p>It is certainly true that many crowdfunding campaigns are successful because some altruistic backers pledge huge amounts of money to the project - much more than they would need to pledge to get a copy of the product for themselves. But projects rarely can be funded through such altruistic contributions alone. Take a look at <a href="http://www.kickstarter.com/projects/portalarium/shroud-of-the-avatar-forsaken-virtues-0">Shrouds of the Avatar</a>, for example: <em>the large majority of backers pledged the minimum amount required to receive a copy of the game</em>. These backers are obviously price conscious and don&#8217;t pledge more than they have to. I will call these backers <em>rational</em>, in the economic sense. This means that they are self-interested and act to maximize their own welfare.</p>

<p>This leads me to the following working hypothesis:</p>

<blockquote><p><strong>Crowdfunding projects need contributions from both rational and altruistic backers to raise large amounts of money.</strong></p></blockquote>

<p>This would explain why open source projects appear (so far) to be less successful than other creative projects at raising money via crowdfunding: Because open source software is (going to be) free, rational backers don&#8217;t pledge anything.</p>

<p>In fact, there is research in the economics literature on the optimal behavior of an entirely rational backer who is faced with the decision of backing an open source project. The amount he or she is willing to pledge is determined by the probability of their pledge being pivotal and getting the project funded. Backers correctly observe that this probability decreases with the total number of backers interested in a project. A consequence is that - if all backers were rational - the amount of money open source projects can expect to raise grows only <em>proportional to the square root of the number of people interested in the project</em>. In contrast, the amount a closed source project can raise grows <em>linearly</em> in the number of people interested in the project. <em>This can quickly lead to a difference of several orders of magnitude!</em></p>

<p>(Now, before anyone gets a wrong impression: I do not think that people behave entirely rationally or that they should behave rationally. It is vital for our society that people act out of altruistic motives. And it is great that crowdfunding has found a way to get altruism to scale, so that we can make great things happen. I think we should look for more ways in which we can integrate altruism into our economic activities. All I am saying is that there is a reason that our entire economic system is built on the assumption that people tend to behave rationally. Our goal should be to find economic models that incorporate both altruistic and rational motives.)</p>

<h2>Fund I/O as a Model for Funding Open Source Software</h2>

<p><a href="http://www.fund-io.com">Fund I/O</a> is a new crowdfunding model based on the <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">Average Cost Threshold Protocol</a> (ACTP). (If you are not yet familiar with Fund I/O, you may want to check out <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">this example</a> before continuing here.) When I developed the ACTP, one of my goals was to find a crowdfunding model that would work for open source software. And in many ways Fund I/O achieves precisely that:</p>

<ul>
<li>Most importantly, Fund I/O gets rational backers to reveal how much they would truly be willing to pay for the software.</li>
<li>This allows open source project to raise as much money as closed source projects.</li>
<li>Moreover a project can raise <em>more</em> money on Fund I/O than using the Kickstarter model, because it lets the market determine the optimal price of the product.</li>
<li>At the same time, Fund I/O still allows altruistic backers to dontate as much as they want to the project. (This requires Fund I/O to be used with the option of allowing each backer to set their own minimum price level.)</li>
<li>Finally, Fund I/O provides a clear path towards the relase of the software product under an open source license.</li>
</ul>


<p>Now, you may have noticed that I did not quite say Fund I/O &#8220;works&#8221; for open source software. In fact, I do not think the Fund I/O model gives me everything I would personally want from an open source funding model. However, I do think it works much better than anything that is currently out there. So let me first explain in what way it <em>does</em> work for open source software. In the next section I will then go on to explain the limitations I see.</p>

<p>Fund I/O works <em>great</em> for open source projects <em>if</em> your project meets the following assumptions:</p>

<ul>
<li>Your goal is to finance the creation of version 1.0 - no more.</li>
<li>You are willing to release your software under a closed license at first.</li>
</ul>


<p>Then you just run through the <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">three phases of the Fund I/O mechanism</a> (with individual minimal price levels) and at the end:</p>

<ul>
<li>you have completed the software you wanted to write,</li>
<li>you have released the software and its source code under an open source license, free for everyone to use and modify,</li>
<li>your costs were covered right from the start and</li>
<li>you even made a certain profit that you can determine in advance.</li>
</ul>


<p>The release under an open source license happens if and only if there is enough altruism among your customers to finance the costs of production through voluntary donations. However, this absolutely not the same as simply using the SPP. First of all, your project gets made if there is enough <em>rational</em> interest in your software. It just won&#8217;t be open sourced unless there is enough altruistic interest. Second, Fund I/O achieves a smooth transition from the state where there are few users who would need to donate very large amounts to the state where there are many users who need to donate just a couple of dollars. This lessens the burden on any individual donor considerably. Moreover, the donation is a sunk cost for the customer: donating means forgoing future refunds instead of paying money now. All of these factors make it much easier to gather the required donations, than using the SPP, even if Fund I/O is used with individual minimal price levels. If a fixed minimal price level is used for everyone, then gathering the required donations gets easier still.</p>

<h2>Caveats</h2>

<p>Now, I believe the above could work great for developing, say, an open source game. But for open source software I see a couple of caveats.</p>

<p>First of all, the user base of the software has to be willing to use closed source software during the second phase of the protocol. If a substantial number of users will never run anything but free software, then you are of course out of luck. I do not think this will be a problem; it was not a problem for <a href="http://www.lighttable.com/">Light Table</a> during its crowdfunding campaign.</p>

<p>Second, it has to be reasonable to make the software non-free during the second phase. This means that the software is for sale and according to the license users are not allowed to pass copies of the software along to their friends. This is a stronger restriction than just not releasing the source code and may turn off more of the free software crowd. More importantly, this limits viral marketing effects during the crowdfunding and sales phases. People have to buy the product to try it out. (Even though a demo could certainly be offered.)</p>

<p>Of course the whole point of Fund I/O is that because of the refund mechanism, there is less of a disincentive to buying than in a classical sales context. In particular, if a customer sets their minimal price level to zero, then they get a full refund in case the software is released as open source. But in a world where many people expect application software (as opposed to games) to be free, this may be a hurdle. I&#8217;d be optimistic and say that the compromise of making software non-free for a limited amount of time, according to a transparent mechanism, in order to cover the costs of development is convincing enough to assuage these concerns.</p>

<p>Finally, and most importantly from my point of view, software requires maintenance. Application software needs to be developed continually. A game may be &#8220;done&#8221; after the 7th patch or so, but application software never is. If the only goal is to fund the creation of a version 1.0, then this is not a problem. But what if you are looking for a way to finance the development of open source software throughout its entire lifecycle?</p>

<p>An obvious modification to Fund I/O for financing several consecutive versions would be to run a new campaign for each major version. The mechanism could easily be adjusted to make a part of the revenues from the version 2.0 sales refunds for version 1.0. And once 1.0 is free, buyers/backers of subsequent versions could stop paying refunds to version 1.0 owners. The problems I see with this are therefore not theoretical, but practical in nature. The company developing the software would have to maintain several versions of the software side-by-side, they would have to backport security patches and provide support, and they would have to finance these activities from their version 2.0 revenues. While all of these concerns appear in commercial (and open source) software development anyway, they are exacerbated by keeping different versions under different licenses around - just because of the funding scheme.</p>

<p>Ultimately, it will depend on the particular project which of these considerations are relevant, and which variant of Fund I/O makes the best fit. Personally, I view Fund I/O as a toolbox that can be tailored to fit many different needs.</p>

<h2>Conclusion</h2>

<p>I hope to have convinced you that crowdfunding open source software is possible at much bigger scale than we have seen so far. What we have to do to make this happen is to find a crowdfunding model that takes the backers&#8217; diverse patterns of economic behavior into account. I think Fund I/O is a step in the right direction, but can certainly be improved upon with regard to funding open source software.</p>

<p>What do you think would be the challenges when applying Fund I/O to open source software? How would you modify Fund I/O to make it more applicable to open source software? Comments and questions are welcome!</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="business"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="crowdfunding"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="open"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="source"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A different way to think about business]]></title>
    <link href="http://blog.felixbreuer.net/2013/04/21/a-different-business-model.html"/>
    <updated>2013-04-21T15:55:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2013/04/21/a-different-business-model</id>
    <content type="html"><![CDATA[<p>Throughout my conversations about <a href="http://www.fund-io.com">Fund I/O</a> over the past couple of weeks, one thing has become clear: Fund I/O implies a radically different way of thinking about business.</p>

<p><strong>What is the Fund I/O business model?</strong> Fund I/O is a business model for the production of goods with substantial economies of scale. In a nutshell:</p>

<ul>
<li>Financing is provided through presales made during a crowdfunding campaign.</li>
<li>The producer commits in advance to a pricing scheme that passes savings due to economies of scale on to customers directly, by lowering prices as fast as possible.</li>
<li>Early buyers are guaranteed to get a refund when the price drops, so that they have no incentive to wait with their purchase.</li>
</ul>


<p>If you are looking for details, good places to start are <a href="http://www.fund-io.com">fund-io.com</a> and this <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">example</a>.</p>

<p><strong>What makes Fund I/O different from the conventional way of doing business?</strong> Suppose you run a company and want to produce a product that benefits from economies of scale. Here is what Fund I/O means to you:</p>

<ul>
<li>You finance your product entirely through presales. You do not have take on a loan, you do not have to pay interest, and you do not have to maximize profit for your investors. This drastically reduces your risk and your cost of capital. The presales appear as a non-interest bearing liability on your balance sheet, and the primary interest of your financiers is to receive a great product, not to get paid.</li>
<li>You place an absolute limit on the profit you can make off a product. This limit can be chosen arbitrarily, but by choosing a refund scheme you are committing to an absolute limit on your profits. Note that because you used presales from customers to finance production you are making a profit without having invested any capital yourself, so from that point of view your return on investment is infinite, even if your maximum profits are not!</li>
<li>You obtain a tremendous amount of market information: By committing to a refund scheme, you give your customers an incentive to reveal exactly how much they are willing to pay for your product. This translates into higher sales, more revenue and faster growth.</li>
</ul>


<p>Through the combination of crowdfunding, a clear price reduction scheme with a limit on profits and a refund mechanism, Fund I/O manages to align the interests of key stakeholders and it provides them with a mechnism to communicate truthfully about value: It resolves the fundamental conflict of interest between investors who want to maximize their profits and customers who want to minimize what they have to pay.</p>

<p><strong>What makes Fund I/O different from other crowdfunding schemes?</strong> There are basically two different crowdfunding models out there: reward-based crowdfunding and equity crowdfunding.</p>

<p><em>Equity crowdfunding</em> is not that different from the conventional business model. Financiers are still interested in return on investment. The key difference is that investors often have another stake in the business in addition to their profit interests. For example, they may be not only investors but customers at the same time, or they may have an interest in the social impact of the business. But still the business is obliged to maximize profits on behalf of its investors, which gives customers incentives to understate their valuation of the products the business is offering.</p>

<p><em>Reward-based crowdfunding</em> makes customers the financiers of a product, aligning the interests of two key stakeholders. But it still does not provide a mechanism to communicate about value. In reward-based crowdfunding, creators have to fix the price a priori and often a <a href="http://www.kickstarter.com/projects/portalarium/shroud-of-the-avatar-forsaken-virtues-0">majority</a> of backers pledge just this price and no more. The success of reward-based crowdfunding hinges on the generosity of backers who self-select for price targeting by willingly paying a large premium for the product. This type of altruism (whether motivated by appreciation of the project, the thrill of being part of something great or the enjoyment of receiving secondary merchandise) is great, if it suffices to finance the project. Fund I/O can be tweaked to captialize on this type of gift economy as well, but the main contribution of Fund I/O lies elsewhere: Fund I/O makes crowdfunding work in cases where the capital requirements of a project are large or where the potential customers are price sensitive. Fund I/O provides the mechanism that allows producers and customers to join forces in order to create great products, even if all parties involved need to avoid paying more than they have to.</p>

<p><strong>What problem does Fund I/O solve?</strong> From the point of view of a business, Fund I/O reduces risk, aligns interests of stakeholders, provides a wealth of market information and generates more sales. Moreover Fund I/O provides financing alternatives to debt and equity and conventional crowdfunding. This is particularly useful in cases where debt and equity are too expensive, too risky or simply unavailable and when altruistic contributions made through a rewards-based crowdfunding campaign do not suffice.</p>

<p>However, this is just one angle on the question: &#8220;What problem does Fund I/O solve?&#8221; Over the next days, I will post other answers, taking the point of view of a customer, or examining the applicability of Fund I/O to non-profit projects aimed at social impact. One very technical answer is already <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">written up</a>: Fund I/O provides a practical implementation of an incentive compatible, individually rational mechanism for the private provision of excludable public goods that is asymptotically optimal.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="business"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="crowdfunding"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Introducing Fund I/O]]></title>
    <link href="http://blog.felixbreuer.net/2013/04/20/fund-io.html"/>
    <updated>2013-04-20T23:33:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2013/04/20/fund-io</id>
    <content type="html"><![CDATA[<p><a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">Fair crowdfunding</a> has a new home: <a href="http://www.fund-io.com">Fund I/O</a>.</p>

<p><img src="http://blog.felixbreuer.net/files/2013-04-20-fund-io.png" alt="Fund I/O" /></p>

<p>As you may have seen, I have been blogging recently about a new crowdfunding mechanism for public goods, the <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">Average Cost Threshold Protocol</a>. Since the last post on the topic, I have spent quite some time discussing this idea with people, and have decided to give this idea into a project dubbed <strong>Fund I/O</strong> with an own website <a href="http://www.fund-io.com">fund-io.com</a> and an own <a href="https://twitter.com/fund_io">Twitter account</a>.</p>

<p>To get updates about his project and idea, you can subscribe to a (very-low volume) mailing list on the project website, or just follow this blog. I&#8217;ll keep posting whatever I have to say on the subject of fair crowdfunding on this blog. (If and when Fund I/O gets its own blog, I will make an announcement here.)</p>

<p>Finally, in case you are wondering, Fund I/O is not a startup. (Not yet, anyway.) The current goal of Fund I/O is to try some variant of the ACTP in practice. If you have got just the right project in need of a revolutionary funding mechansim, let me know!</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="crowdfunding"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="goods"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="public"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Visualizing the GCD]]></title>
    <link href="http://blog.felixbreuer.net/2013/03/22/gcd.html"/>
    <updated>2013-03-22T22:53:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2013/03/22/gcd</id>
    <content type="html"><![CDATA[<p>
There are many beautiful geometric interpretations of the GCD and visualizations 
of the Euclidean algorithm out there, see for example <a href="http://en.wikipedia.org/wiki/Euclidean_algorithm">here</a>, 
<a href="http://www.geogebratube.org/student/m1087">here</a> and <a href="http://mathworld.wolfram.com/GreatestCommonDivisor.html">here</a>.
I have written about this myself <a href="http://blog.felixbreuer.net/2011/08/23/visualising-numbers-part1.html">some time ago</a>.
But I find that some of the pictures become much clearer when lifted into the third dimension.
</p>

<p>
[Note: I am using Sage Cells to produce the pictures in this post.
This has the advantage that you, dear reader, can interact with the
pictures by modifying the Sage code. However, this will probably not 
run everywhere. It certainly won&#8217;t work in most RSS readers&#8230;]
</p>
  
<p>
Here is the graph of the GCD! First a little static preview&#8230;
</p>

<img src="http://blog.felixbreuer.net/files/2013-03-22-gcd.png" alt="Graph of the GCD"></img>

<p>
&#8230; and now a proper interactive graph. Be sure to rotate the image to get a 3d
impression. (Requires Java&#8230;)
</p>

    <script src="http://sagecell.sagemath.org/static/jquery.min.js"></script>
    <script src="http://sagecell.sagemath.org/embedded_sagecell.js"></script>
    <script>
$(function () {
    // Make *any* div with class 'compute' a Sage cell
    sagecell.makeSagecell({inputLocation: 'div.sagecompute',
                           linked:         false,
                           autoeval:       true,
                           evalButtonText: 'Run!'});
});
    </script>

<div class="sagecompute">
def mygcd(a,b,depth=0):
    if a &gt; b:
        return mygcd(a-b,b,depth+1)
    if a &lt; b:
        return mygcd(a,b-a,depth+1)
    if a == b:
        return [a, depth]
def drawgcd(boxsize=10):
    M = boxsize
    s = Set([QQ(p)/QQ(q) for p in xrange(1,M) for q in xrange(1,M)])
    lines = []
    for x in s:
        p = x.numerator()
        q = x.denominator()
        l = min(M/p,M/q)
        [gcd,depth] = mygcd(p,q)
        lines.append(line3d([(p,q,1),(l*p,l*q,l)], 
                     rgbcolor=Color(depth/M,1,0.8,space=&quot;hsv&quot;).rgb()))
    return reduce(lambda a,b: a+b, lines)
drawgcd(10)
</div>

<p>
What precisely are we seeing here? The gcd is a function 
$\mathrm{gcd}:\mathbb{N}^2\rightarrow\mathbb{N}$. Its graph is a (countable)
set of points in $\mathbb{N}^3$. This graph is precisely the set of integer points
contained in one of the (countably many) lines indicated in the above picture.
The value of the gcd is given by the vertical axis.
</p>

<p>
Now, what are those lines? Suppose $a$ and $b$ are two natural numbers that are
relatively prime, i.e., $\gcd(a,b)=1$. Then we know that 
$\gcd(ka,kb)=k$ for any positive integer $k$. So all (positive) integer 
points on the line through the origin and $(a,b,1)$ are in the graph of the gcd.
Conversely, for any numbers $x,y$ with $gcd(x,y)=z$, we know that
$\gcd(\frac{x}{z},\frac{y}{z})=1$, that is, the point $(x,y,z)$ lies on the
line through the origin and $(\frac{x}{z},\frac{y}{z},1)$. So by drawing all these
lines, we can be sure we hit all the integer points in the graph of the gcd.
</p>

<p>
What I find very beautiful about this is that when looking at this picture from
the right angle, you can see the binary tree structure of this set of
lines. It is precisely this binary tree that we walk along when running the
Euclidean algorithm. The lines in the above
picture are color coded by their depth in this &#8220;Euclidean&#8221; binary tree. 
</p>

<p>
The version of the Euclidean algorithm I like best this one. Suppose
you want to find $\gcd(a,b)=1$. If $a&gt;b$, compute $\gcd(a-b,b)$. If
$a&lt;b$, compute $\gcd(a,b-a)$. If $a=b$, we are done and the number
$a=b$ is the gcd. At each point in the algorithm we make a choice,
depending on whether $a&gt;b$ or $a&lt;b$. If we keep track of these
choices by writing down a 1 in the former case and a 0 in the latter,
then, for any pair (a,b), we get a word of 0s and 1s that describes a
path through a binary tree. As we walk from one pair $(a,b)$ to the
next in this fashion, we trace out a path in the plane: For each 1 we
take a horizontal step and for each 0 we take a vertical step. This
path can look as follows.
</p>

<div class="sagecompute">
a = 31
b = 19
def gcd1(a,b):
    # returns the gcd, a list of choices and a drawing
    if a &gt; b:
        [gcd, path, drawing] = gcd1(a-b,b)
        return [gcd, path+[1], drawing+point2d([a,b])+line2d([[a-b,b],[a,b]])]
    if a &lt; b:
        [gcd, path, drawing] = gcd1(a,b-a)
        return [gcd, path+[0], drawing+point2d([a,b])+line2d([[a,b-a],[a,b]])]
    if a == b:
        return [a, [], point2d([a,b])]
[gcd,path,drawing] = gcd1(a,b)
print &quot;The gcd of %d and %d is %d.&quot; % (a,b,gcd)
print &quot;During the computation the Euclidean algorithm, makes the following choices:&quot;
print path
drawing
</div>

<p>
Now comes the twist. We can turn the Euclidean algorithm upside down.
Instead of walking from the point $(a,b)$ to a point of the form
$(g,g)$ and thus finding the gcd, we can also start from the point $(1,1)$
and walk to a point of the form $(\frac{a}{g},\frac{b}{g})$ to find
the gcd $g$. (Why $(\frac{a}{g},\frac{b}{g})$? Well,
$(\frac{a}{g},\frac{b}{g})$ is the primitive lattice vector in the
direction of $(a,b)$. In terms of the graph at the top,
$(\frac{a}{g},\frac{b}{g},1)$ is the starting point of the ray through
$(a,b,\gcd(a,b))$.)
</p>

<p>
How do we get there? We start out by fixing the lattice basis with
&#8220;left&#8221; basis vector $(0,1)$ and &#8220;right&#8221; basis vector $(1,0)$. Their
sum $(1,1)$, which I call the &#8220;center&#8221;, is a primitive lattice vector. Now we ask ourselves: is
the point $(a,b)$ to the left or to the right of the line through
the center? If it is to the left of that line, we continue with the basis
$(0,1)$ and $(1,1)$. If it is to the right of that line, we continue
with the basis $(1,1)$ and $(1,0)$ and recurse: We take the sum of
our two new basis vectors as the new center and ask if $(a,b)$ lies to the left or to
the right of the line through the center, and continue accordingly. If
$(a,b)$ lies <em>on</em> the line through the center, we are done: the gcd of
$a$ and $b$ is the factor by which I have to multiply the center to get
to $(a,b)$.
</p>

<p>
As we follow this algorithm, we draw the path from one center to the next, until we reach
$(\frac{a}{g},\frac{b}{g})$. Then we get the following picture. It looks
almost like a straight line from $(1,1)$ to our goal, but it is only
straight whenever we take two consecutive left turns or two
consecutive right turns. Whenever we alternate between right and left,
we have a proper angle, it only gets difficult to see this angle the farther out
we get. If we write down a sequence of 1s and 0s, corresponding to
the left and right turns we take, we get the exact same sequence as
with the standard Euclidean algorithm.
</p>

<div class="sagecompute">
a = 31
b = 19
def gcd2(a,b,left=vector([0,1]),right=vector([1,0])):
    center = right + left
    if b/a &lt; center[1]/center[0]:
        [gcd, path, drawing] = gcd2(a,b,center,right)
        return [gcd, path+[1], drawing+point2d(center)+line2d([center,right+center])]
    if b/a &gt; center[1]/center[0]:
        [gcd, path, drawing] = gcd2(a,b,left,center)
        return [gcd, path+[0], drawing+point2d(center)+line2d([center,left+center])]
    if b/a == center[1]/center[0]:
        return [a/center[0], [], point2d(center)]
[gcd,path,drawing] = gcd2(a,b)
print &quot;The gcd of %d and %d is %d.&quot; % (a,b,gcd)
print &quot;During the computation the reverse Euclidean algorithm, makes the following choices:&quot;
print path
drawing
</div>

<p>
The obvious next step is to draw the complete binary trees given by the above two visualizations of the Euclidean algorithm (up to a certain maximum depth). Drawing the first tree gives a big mess, because many of the edges of the tree overlap. You can clean up the picture by removing the lines and drawing only the points: In the code below comment the first definition of <code>thisdrawing</code> and uncomment the second. This then gives you a picture of all primitive lattice points (pairs of relatively prime numbers) in the plane at depth at most <code>maxdepth</code> in the tree.
</p>

<div class="sagecompute">
maxdepth = 7
def drawtreehelper(a,b,parenta,parentb,depth):
    thisdrawing = [point2d([a,b]),line2d([[parenta,parentb],[a,b]])]
    #thisdrawing = [point2d([a,b])]
    if depth == 0:
        return thisdrawing
    else:
        return thisdrawing + drawtreehelper(a+b,b,a,b,depth-1) + drawtreehelper(a,b+a,a,b,depth-1)
def drawtree(depth):
    return [point2d([1,1])] + drawtreehelper(2,1,1,1,depth) + drawtreehelper(1,2,1,1,depth)
reduce(lambda a,b:a+b,drawtree(maxdepth))
</div>

<p>
The second variant of the Euclidean algorithm gives a much nicer picture, revealing the fractal nature of the set of primitive lattice points. The nodes of the tree, i.e., the points drawn in the picture are the starting points of the rays plotted in the 3d graph of the gcd given at the beginning of this post. In this way, this drawing of the tree gives the precise structure of the binary tree intuitively visible in the three-dimensional graph. One thing you may want to try is to increase the <code>maxdepth</code> of the tree to 10. (Warning: this may take much longer to render!) Note how far out from the origin some of the points at depths 10 are.
<p>

<div class="sagecompute">
maxdepth = 7
unitmatrix = matrix([[1,0],[0,1]])
lefttransform = matrix([[1,0],[1,1]])
righttransform = matrix([[1,1],[0,1]])
thevector = vector([1,1])
def drawtreehelper2(basis,parent,depth):
    #thisdrawing = [point2d([a,b]),line2d([[parenta,parentb],[a,b]])]
    thispoint = basis*thevector
    #print thispoint,parent
    thisdrawing = [point2d(thispoint),line2d([thispoint,parent])]
    if depth == 0:
        return thisdrawing
    else:
        left = matrix
        return thisdrawing + drawtreehelper2(basis*lefttransform,thispoint,depth-1) + drawtreehelper2(basis*righttransform,thispoint,depth-1)
def drawtree2(depth):
    return [point2d(thevector)] + drawtreehelper2(lefttransform,thevector,depth) + drawtreehelper2(righttransform,thevector,depth)
reduce(lambda a,b:a+b,drawtree2(maxdepth))
</div>

<p>
The reader may have observed that the binary tree described in this post gives us a very nice way
of enumerating the rational numbers. Calkin and Wilf made this
observation in the paper <a href="http://www.math.upenn.edu/~wilf/website/recounting.pdf">Recounting the Rationals</a>, whence it is sometimes called the Calkin-Wilf tree, even though Euclid tree might be a better name as it is given by the Euclidean algorithm itself. 
As we have seen above, a look through the lens of lattice geometry tells us how to draw this tree 
in the plane and how to find it in the graph of the GCD.
</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="sage"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="visualization"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Incentives of Fair Crowdfunding]]></title>
    <link href="http://blog.felixbreuer.net/2013/02/09/incentives.html"/>
    <updated>2013-02-09T16:55:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2013/02/09/incentives</id>
    <content type="html"><![CDATA[<p>Can <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">fair crowdfunding</a> resolve the conflict over copyright? Or, as <a href="http://craphound.com/">Cory Doctorow</a> put it yesterday:</p>

<blockquote><p><strong>Does the <a href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html">Average Cost Threshold Protocol</a> incentivize content creators to &#8220;sue the Internet&#8221;?</strong></p></blockquote>

<p><strong>Very short answer:</strong> The incentive for creators to sue the Internet is very small (much smaller than usual) but not zero.</p>

<p><strong>Short answer:</strong> The Average Cost Threshold Protocol (ACTP) drastically reduces the incentive of content creators to sue people, as creators&#8217; costs are covered from the start. Moreover it drastically reduces the incentive for people to copy content outside of what is allowed by the protocol, because buyer&#8217;s payments are used to lower the price (for themselves and others) and to eventually release the content under a copyleft license.</p>

<p>That said, there is a &#8220;sales phase&#8221; in the protocol where such incentives exist, even if they are limited. However, this drawback is outweighed by the protocol&#8217;s key advantages:</p>

<ul>
<li>Creators can expect to raise significantly more money than with funding models that employ only copyleft licenses.</li>
<li>Creators and users agree from the outset on a clear path towards release of the content under a copyleft license.</li>
</ul>


<p>Moreover the protocol can be modified so that creators have <em>no incentive whatsoever to sue the Internet</em> - however, in this case creators also lack an economic incentive to deliver a great product.</p>

<p><strong>Long answer:</strong> Here are the key reasons why creators have very little incentive to sue the internet, if they choose to adopt the ACTP.</p>

<ul>
<li>The protocol guarantees that creators&#8217; costs are covered before content is ever released. This drastically reduces the creators&#8217; financial risk, which in turn reduces the threat unlicensed copies pose to creators.</li>
<li>Costs are covered by users, not investors. This frees creators from having to worry about paying back loans or maximizing their return on equity. Thus the creators&#8217; economic goal is to maximize user value not shareholder value.</li>
<li>The ACTP provides a clear path towards releasing the content under a copyleft license. By adopting the ACTP, creators subscribe willingly to this goal.</li>
<li>Creators&#8217; profits are maximized if and only if the content is released under a copyleft license, at the end of ACTP. This means that creators&#8217; have an incentive to work towards the goal of releasing the content for free.</li>
</ul>


<p>That being said, the ACTP does have a &#8220;sales phase&#8221; where the content is available only under a &#8220;closed&#8221; copyright license and people have to buy access. In this sales phase, users have an economic incentive to obtain unlicensed copies.</p>

<ul>
<li>Creators receive a share of the revenues earned during the sales phase as profit. They thus have an incentive to sue people who avoid paying for access in the sales phase.</li>
<li>However, if there are enough buyers to &#8220;free&#8221; the content and cause its release under a copyleft license, then the creators do not care how many people made unlicensed copied during the sales phase: their profits in this case are fixed from the start.</li>
<li>The ACTP could be modified so that creators do not receive <em>any</em> profits during the sales phase. All revenues from sales could go towards lowering the price by refunding previous buyers/backers. In this case creators <em>do not have any incentive whatsoever to sue the Internet, at any point in time</em>. However, I do not think that this is a good idea. Because in this case, creators&#8217; do not receive any revenue after the initial fundraising campaign and thus they have no economic incentive to make their product shine and promote it accordingly.</li>
</ul>


<p>Moreover, the ACTP provides incentives for <em>users</em> to actively participate in the sales phase of the protocol by paying, instead of by making or obtaining unlicensed copies:</p>

<ul>
<li>In the short term, the more people pay, the faster the price will drop. As a buyer this means you yourself will get a larger refund and at the same time you will enable other people to afford access.</li>
<li>In the long run, the more people pay, the sooner will the content be released freely, under a copyleft license.</li>
</ul>


<p>The sales phase thus becomes a cooperative game among users, where they can help each other by lowering the price in the short term and ultimately &#8220;freeing&#8221; the content for everyone. This of course has the drawback that it might cause cooperative users (who buy) to sue uncooperative users (who make or obtain unlicensed copies). But the amount of refund money cooperative users stand to loose from unlicensed copies is very limited, so I hope this is not going to be an issue. Users who obtain unlicensed copies hurt themselves by making it less likely that the content is eventually going to be officially released under a copyleft license.</p>

<p>But why should we have a &#8220;sales phase&#8221; at all? Would it not be better to release the content under a copyleft license right away? The reason is a phenomenon that has been well-studied in the economics literature: By restricting access to content during the sales phase, it is possible to raise significantly larger amounts of funds for the creation of digital content than would otherwise be possible. In economics jargon: It is significantly easier to raise funds for the private provision of a <a href="http://www.unc.edu/~normanp/efficientmechanisms.pdf">public good with use exclusions</a> than for the private provision of a pure public good without use exclusions. The amount of money we can raise for content that is going to published under a copyleft license from the start grows on the order of $\sqrt{n}$ where $n$ is the number of people in the economy. If we introduce use exclusions, on the other hand, the amount of money grows on the order of $n$. This is a difference of several orders of magnitude, with a huge potential impact in practice! (I will write more about these results in a future post. In the meantime I recommend <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">this post</a> and these <a href="http://www.unc.edu/~normanp/efficientmechanisms.pdf">two</a> <a href="http://www.jstor.org/discover/10.2307/3648602?uid=3739560&amp;uid=2&amp;uid=4&amp;uid=3739256&amp;sid=21101630628393">articles</a>.) The ACTP aims to strike a balance between the conflicting goals of publishing free content and raising funds by employing use exclusions in an intermediate phase and providing a clear path towards release under a copyleft license.</p>

<p><strong>Bottom-line:</strong> The ACTP does a far better job of aligning incentives than any other mechanism for funding digital content that I know. I think it goes a long way towards resolving the economic conflict over copyright and I can&#8217;t wait to put it into practice and try it out.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="copyleft"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="crowdfunding"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="goods"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="public"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fair Crowdfunding of Digital Goods]]></title>
    <link href="http://blog.felixbreuer.net/2013/02/06/digital-goods.html"/>
    <updated>2013-02-06T13:45:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2013/02/06/digital-goods</id>
    <content type="html"><![CDATA[<p>We live in a wonderful age! So much that we value - music, movies, books, games, software, designs, research, art, ideas - can be stored in digital form. Once these digital goods are created, they could in principle be made available to everyone at virtually no extra cost. So why don&#8217;t we? Why do we fight about copyright instead?</p>

<p>The reason is a conflict of economic interests. On the one hand we need to fund the creation of digital goods. On the other hand, our creation can do the most good if it is made available to literally everyone. But how can we convince people to pay for a digital good, if they know that eventually everybody can download a copy for free? What we need is a new idea that addresses both of these issues: the public welfare <em>and</em> the profitability of creating digital goods.</p>

<p>In this regard crowdfunding platforms are very promising, as they can in principle be used to fund digital goods that are then made freely available to everybody. However, <a href="http://blog.felixbreuer.net/2012/12/31/kickstarter.html">a closer look</a> reveals that in practice the digital goods financed by crowdfunding campaigns are often sold like apples - as if they could not be copied at all. Here is one idea how we can do better:</p>

<p><strong>The <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">Average Cost Threshold Protocol</a> is a fair crowdfunding mechanism that takes economic interests of both users and creators into account.</strong></p>

<p>How it works is best explained by way of a concrete example. Suppose a company wants to raise \$1,000,000 to finance the production of a computer game. They start a crowdfunding campaign on a website implementing the Average Cost Threshold Protocol. The website starts collecting pledges until a deadline is reached. Suppose on the day of the deadline the pledge look as in picture below. In particular, we find that there are 20,000 people who pledged \$50 each or more. If all of them pay exactly \$50, then the company&#8217;s costs will be covered and everybody will have paid the same amount. Moreover \$50 is the <em>lowest</em> price that covers costs: for example 24,000 people would be willing to pay \$40, but that yields only \$960,000. This lowest price now becomes the <em>threshold price</em>: everybody who pledged at least \$50 pays exactly \$50 and they become backers, who will receive a copy of the game once it is finished. All others do not pay anything and do not get a copy. The principle is simple: <strong>the costs of production are distributed equally among all those who get access</strong>. The threshold price is chosen such that it provides access to the largest number of people at the lowest possible price such that the costs of production are covered.</p>

<p><img src="http://blog.felixbreuer.net/files/2013-02-05-actp1.png" alt="Backers pay the average cost of the product." /></p>

<p>Now that the game is released, more people have heard about it and want to purchase access. Typically, the company would simply sell copies and keep the revenues as profit. But here comes the twist! Instead of paying a fixed price, interested buyers submit pledges on what they would be <em>willing</em> to pay for the game. Suppose there are another 10,000 people who each pledge \$40 or more. Then we <em>drop</em> the price to \$40 dollars and charge each newcomer \$40 for a copy of the game. The revenues of \$400,000 are split 50-50. One half goes as profit to the company. The other half goes to the original backers, who each get a refund of \$10. Following this principle <strong>the price keeps dropping the more people buy the game</strong> and thanks to the refunds <strong>everybody who gets access is guaranteed to pay the same price</strong> no matter <em>how much</em> they pledge or <em>when</em> they pledge.</p>

<p><img src="http://blog.felixbreuer.net/files/2013-02-05-actp2.png" alt="Revenues from sales are used to refund earlier buyers, thus reducing the price." /></p>

<p>The more people buy the game, the lower the price for everyone. And the lower the price, the more people can afford to buy the game! What if this virtuous cycle takes off and the game becomes really popular? At this point another feature of the mechanism kicks in: At the very beginning of the crowdfunding campaign a <em>price of freedom</em> of \$10 is announced. This means that <strong>as soon as the threshold price drops to the price of freedom of \$10, the game is made available to <em>everyone</em></strong>, the whole world, no matter if they paid or not. This includes the release of the game <strong>under a copyleft license</strong> as well as the publication of all source code and assets, to allow people to freely modify the game. In the example, the price of freedom of \$10 is reached if the game becomes so popular that at least 180,000 people buy the game. In this scenario, the company has not only covered its costs, but on top of that it also made a profit of \$800,000. (This amounts to an infinite (!) return on investment as the customers contributed all the funding for the project!) The public gains a game they are free to use and modify. And the backers and buyers of the project spent only \$10 each, both to gain early access to the game and to make all of this happen.</p>

<p><img src="http://blog.felixbreuer.net/files/2013-02-05-actp3.png" alt="If the threshold price reaches the price of freedom, the digital good is released under a copyleft license." /></p>

<p>We can even go one step further and <strong>allow every customer to set their own price of freedom</strong>, that is, the price below which they do not care to receive refunds. With this small modification, it is entirely <em>rational for people to pledge exactly as much as they are really willing to pay</em> for the game. This is a truly amazing property that most other methods of raising funds do not satisfy. In a retail sales context, on Kickstarter, in you-name-your-price mechanisms like the Humble Bundle, customers always have an incentive to understate how much the product is worth to them. Here, even entirely self-interested customers have an incentive to tell the truth, at every point during the process. This is not the end of the story, though! The Average Cost Threshold Protocol has a host of <a href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html">variations and wonderful theoretical properties</a>.</p>

<p>As you can see, there is a lot of room to improve upon existing methods for funding digital goods. In a world where digital goods make up an ever increasing percentage of the global economic output this can have a profound impact on our economic lives. With new ideas and experiments we can come up with business models that can raise large amounts of money to finance the creation of high-quality digital goods and at the same time make sure that as many people as possible get access. In particular, we can provide a clear path towards releasing digital goods under a copyleft license. This way, <strong>everybody can benefit from the economic power of copying!</strong></p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="goods"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="public"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Simple Proof-by-Picture]]></title>
    <link href="http://blog.felixbreuer.net/2013/01/20/proof-by-picture.html"/>
    <updated>2013-01-20T13:45:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2013/01/20/proof-by-picture</id>
    <content type="html"><![CDATA[<p><a href="https://plus.google.com/108555951104006647024">Christopher Smy</a> <a href="https://plus.google.com/108555951104006647024/posts/FrUsWKtE6Qj">asked</a> for a geometric proof of the identity $$1^3+\ldots+n^3 = (1+\ldots+n)^2.$$
Because I like that sort of thing, I couldn&#8217;t resist drawing a picture:</p>

<p><img src="http://blog.felixbreuer.net/files/2013-01-20-identity.png" alt="Proof by Picture" /></p>

<p>If you like that sort of thing, check out <a href="http://vimeo.com/10014698">this video</a> or these <a href="http://blog.felixbreuer.net/2011/08/23/visualising-numbers-part1.html">lecture</a> <a href="http://blog.felixbreuer.net/2011/08/30/visualising-numbers-part2.html">notes</a>.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="proof"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Average Cost Threshold Protocol for Funding Public Goods]]></title>
    <link href="http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol.html"/>
    <updated>2013-01-20T13:45:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2013/01/20/average-cost-threshold-protocol</id>
    <content type="html"><![CDATA[<p><a href="http://blog.felixbreuer.net/2012/12/31/kickstarter.html">A while ago</a>, I started a series of posts on finding new ways to fund public goods. Crowd-funding platforms, which have been enormously successful in 2012, promise a new way of financing creative projects and many of them employ the Street Performer Protocol, which was originally invented with a view towards financing public goods such as open source software projects. However, a <a href="http://blog.felixbreuer.net/2012/12/31/kickstarter.html">closer look</a> at the way the Street Performer Protocol is used on <a href="http://www.kickstarter.com/">Kickstarter</a> reveals that it is rarely employed to finance goods published under a copyleft license. Rather pledges are treated as pre-orders for goods sold as if they were classic private goods. I think we can do better than that!</p>

<p>In this post, I want to describe a different way to fund the private provision of public goods: the <strong>Average Cost Threshold Protocol</strong>.</p>

<p>Before we get started, let me clarify what I mean by the term <a href="http://en.wikipedia.org/wiki/Public_good">public good</a>. The term does <em>not</em> have the egalitarian meaning of a <a href="http://en.wikipedia.org/wiki/Common_good">common good</a> that is shared by everyone and that all members of a community are entitled to. Rather, a public good is any good that has a specific economic property: If a public good is provided to one person, it could also be provided to everybody else <em>at no additional cost</em>. Note that I am not saying the public good actually <em>is</em> provided to everyone. It may very well be that some people are excluded from using the public good. Also, I am not saying that nobody has to pay anything for the public good.</p>

<p>Practically all digital goods are natural public goods. This includes movies, music, ebooks, online lectures, scientific articles, software and computer games. These can, in principle, be copied at virtually no cost. Often, legal or technical restrictions are placed on copying these goods, as producers want to raise money for the provision of these goods by selling these goods as private goods (or by selling advertising tied to these goods). This post is about finding better ways to fund the creation of such digital goods. As my running example of a public good, I am going to use a computer game. Not because games are the most important type of public good, but simply because they are widely popular, require no maintenance after their release (or after, say, the tenth patch) and because a number of computer games have been very successful on Kickstarter, which shows that the audience is open to experimenting with new funding mechanisms.</p>

<h2>The Theory of Average Cost Pricing of Public Goods</h2>

<p>A very natural variation of threshold pledge systems like the Street Performer Protocol is a <em>fixed fee mechanism with average cost prices</em>. In this section I will present the theory behind this mechanism, before turning to its practical implementation (and a practical example!) in the next section.</p>

<p>The basic idea is very straightforward:</p>

<ol>
<li>Everybody interested in a given project makes a <em>pledge</em>, saying they are willing to contribute a certain amount of money to funding the project. If somebody is not interested in contributing that just don&#8217;t pledge anything.</li>
<li>After all pledges have been made, we distribute the costs of the project <em>equally</em> among as many people as possible: <em>Everybody pays exactly the average cost of the project, as long as they pledged at least as much.</em> More precisely, we figure out the <em>smallest</em> price $p$ such that if everybody who pledged at least $p$ pays <em>exactly</em> the price $p$, then the costs of the project are covered <em>exactly</em>. Nobody pays more than $p$ and if somebody pledged less than $p$ they don&#8217;t have to pay anything.</li>
<li>If there is no such price $p$, for example because people pledged too little, then the project is not funded and nobody pays anything!</li>
<li>In case the project is funded, the money raised is used to create the public good. But <em>only those people who paid get access</em> to the public good! (Here we assume that the public good in question is excludable.)</li>
</ol>


<p>Points 1 and 3 are very similar to the Street Performer Protocol (SPP) and what happens on Kickstarter. Point 2 is crucially different, as in the SPP and on Kickstarter everybody pays what they pledged and not the price $p$. Point 4 is what happens in many projects on Kickstarter, as I observed in my last post, but it is very different from the idea behind the SPP, which was intended to fund pure public goods without use exclusions. There is another vital difference to what happens on Kickstarter that will become clear in the next section.</p>

<p>The fixed fee mechanism with average cost prices has crucial theoretic advantages:</p>

<ul>
<li><em>Everybody has an incentive to pledge exactly what the project is actually worth to them.</em> The technical term for this <em>incentive compatibility</em>. Note that the SPP is not incentive compatible: there, people have an incentive to understate the value the project has for them, in order to pay less. (This is called &#8220;free riding&#8221; in the public goods literature.)</li>
<li><em>Nobody is forced to contribute anything if they don&#8217;t want to.</em> In other words, no matter what happens, after we have used this mechanism, everybody will be at least as well-off as before. This is called <em>individual rationality</em>. Many mechanisms for funding public goods, both practical ones, such as taxation by the government, and theoretical ones, such as the Groves-Clarke mechanism, are not individually rational. But for the private provision of public goods in which people participate voluntarily, individual rationality is essential.</li>
<li><em>If the fundraising is successful, we raise exactly as much money as is needed to fund the project.</em> That is, the mechanism not only <em>covers costs</em> but moreover it <em>balances the budget</em>.</li>
</ul>


<p>Of course this mechanism also has a key disadvantage: <em>We exclude people form using the public good even though the public good could be provided to them at no extra cost.</em> In technical terms we say the mechanism is <em>inefficient</em>. This, however, is <em>unavoidable</em> as there are theoretical results such as the Myerson-Satterthwaite Theorem which says, roughly, that there does not exist a mechanism for the provision of public goods that is incentive compatible, individually rational and efficient. This result tells us that the first best solution of giving everybody access to the public is impossible to attain. The good news is, though, that in face this impossibility result, the fixed fee mechanism with average cost prices is the best possible alternative:</p>

<ul>
<li>According to <a href="http://www.unc.edu/~normanp/efficientmechanisms.pdf">a result</a> by Peter Norman the above mechanism is (asymptotically, in a large economy) <em>the most efficient one</em> among all mechanisms that are incentive compatible, individually rational and guarantee budget balance.</li>
<li>If the cost of funding the public good is small in comparison to the total size of the economy and the number of people interested in the public good, then the average cost will approach zero. This allows us to get arbitrarily close to giving everyone access to the public good. See also <a href="http://www.jstor.org/stable/3648602">this paper</a> by Martin Hellwig.</li>
</ul>


<p>Regarding the history of the fixed fee mechanism with average cost prices, I want to mention that average cost prices have been studied for a very long time in the context of monopoly economics and a number of authors have examined fixed fee mechanisms in the context of public goods. However, as far as I was able to find out, <a href="http://www.unc.edu/~normanp/efficientmechanisms.pdf">the paper</a> by <a href="http://www.unc.edu/~normanp">Peter Norman</a> is the first instance where this exact mechanism has been studied in a public good setting.</p>

<p>Of course there is a lot more to say about these results and I plan to write more about the technical details in the future. But today, I want to talk about <em>how this mechanism could work in practice</em> and present <em>a practical implementation</em> which I dub the <strong>Average Cost Threshold Protocol</strong>.</p>

<h2>The Average Cost Threshold Protocol in Practice</h2>

<p>Suppose a company wants to create a computer game and they need money to cover their costs, which total, say, $1 million. They decide to use the above mechanism to raise the funds and so they start a project on a website like Kickstarter which provides all the necessary infrastructure. The project is open to receive pledges for 30 days and at the end of that period the pledges are tallied to see if the project can be funded according to the above rule. (Strictly speaking, setting a deadline is not necessary, but given that many crowd-funding projects raise a large part of their funds the days immediately before the deadline, it seems like a good idea to make use of this psychological effect.)</p>

<p>Many people chip in and pledge various amounts. There are 20,000 people who pledge \$50 or more. So setting a price of \$50 would exactly cover the costs of the game. However, there are only 23,000 people who pledge \$40 or more, so setting a price of \$40 would raise only \$0.92 million which does not cover the costs of the game. Let us assume that \$50 is the lowest price that covers the costs of the game.</p>

<p>Thus, the price is fixed at \$50 dollars. Everybody who pledged \$50 or more now has to pay exactly \$50 dollars. The people who pay these \$50 are now called backers. The total amount raised is \$1 million which covers the costs of the game. This money is used to create the game, and once it is finished, every backer receives a copy.</p>

<p>So far so good. But what about all the other people who would like to play the game? In all likelihood, there are many more people out there who would be happy to pay \$50 to get a copy! Maybe they heard about the project only after the fundraising ended, so they did not have a chance to become a backer. Or maybe they wanted to wait and see how the game turned out before committing to the purchase. Or maybe they did not have \$50 to spare back then, but they do now. Whatever their reasons, it makes perfect sense to provide these people with the public good - we just have to find a way that is consistent with our mechanism.</p>

<p>How do games companies currently do it on Kickstarter? Well, they just sell copies of the game. And <em>the companies keep the revenues from these sales for their own profit</em>. There is nothing wrong with creators making a profit from their work. The problem here is that <em>this breaks our mechanism</em>! Suppose there are another 20,000 people (let&#8217;s call them buyers as opposed to backers) who pay \$50 for the game and these revenues are the profits of the company. Now there are a total of 40,000 people (buyers + backers) who have paid \$50 each, which amounts to a total of \$2 million dollars. However distributing the total cost of the game (\$1 million) among 40,000 people would lead to an average cost of just \$25! So, in this scenario, if the company decides to sell the game <em>for profit</em> after it is finished, people would pay <em>twice</em> the average cost, which is very different from what our mechanism specifies.</p>

<p>So let&#8217;s suppose we take our mechanism seriously. What would need to happen with the profits from selling the game? Suppose we have 20,000 backers plus 20,000 buyers. As we observed above, distributing the costs of \$1 million equally among those 40,000 people would lead to an average cost of just \$25. But the backers already paid \$50! So here is what needs to happen according to the mechanism: <em>The buyers need to pay just \$25 each. And these revenues need to be given to the backers instead of the company.</em> This makes sure that everybody pays exactly the average cost of the public good.</p>

<p>But now the price of the good has dropped by 50% and the product is gaining ever more public attention. So now there are, say, 40,000 additional people out there who would be willing to pay \$25 for the game. Here is what the mechanism tells us to do: Charge each of the 40,000 newcomers \$12.50 and give the proceeds to the 40,000 people who purchased the game first. This way, everybody just paid \$12.50.</p>

<p>You can now see where this is going:</p>

<ul>
<li>As more and more people buy the public good, the average cost of the good drops.</li>
<li>The price of the good drops, making the good available to more and more people.</li>
<li>In this process, early buyers are refunded for the high price they paid in the beginning.</li>
<li>In particular, because of the transfers from late buyers to early buyers, nobody has an incentive to wait with their purchase until prices drop.</li>
</ul>


<p>All we need for this to work is for the website that coordinates this process to manage these transfer payments. Of course actually distributing money among many different bank accounts whenever a single purchase is made would incur way too much transaction costs. But the website could simply keep track of purchases and how revenue needs to be redistributed and allow customers to withdraw funds every once in a while. The transaction costs could be passed on to backers/buyers directly or could they could simply be financed from the interest the website earns from keeping the payments for some time.</p>

<p>It is also important to note that the infrastructure for pledging available on the website should still be used for sales, even after the product is finished. This way, if the current price for the game is still \$40, people who would be willing to pay \$20 for the product could submit this &#8220;bid&#8221; on the website. If enough people pledge \$20, the price of the product will actually drop and they will get a copy. The important thing is that <em>people have an incentive to reveal the true price they are willing to pay</em>! This is in contrast to a classical sales context, where customers have an incentive to understate their true valuation to get the company to lower their price.</p>

<h2>The Benefits in Summary</h2>

<p>The Average Cost Threshold Protocol is a practical mechanism for funding public goods that allow use exclusions. It is an implementation of the well-known fixed fee mechanism with average cost prices, and thus it enjoys many desirable properties:</p>

<ul>
<li>It is in everybody&#8217;s own best interest to pledge exactly what they are willing to pay. This is true even in hindsight!</li>
<li>The protocol makes everybody better off. In particular, nobody is forced to pay anything.</li>
<li>The costs of the project are guaranteed to be covered for the company.</li>
<li>Among all possible mechanisms with these properties this one is optimal, that is, it creates the most value for society as a whole.</li>
</ul>


<p>Beyond these theoretical merits, the practical protocol suggested above has a number of additional benefits:</p>

<ul>
<li>Prices to the public good are lowered continuously, in order to provide the widest possible audience with access to the public good as quickly as possible.</li>
<li>At all times throughout the process, everybody has paid exactly the same price for access to the public good. So nobody has an incentive to wait with their purchase for prices to drop.</li>
<li>In the sales-phase, it is in the interest of customers to bid what they would be willing to pay, even before prices drop. This allows the mechanism to lower prices more quickly, via optimal price targeting.</li>
<li>Everybody benefits from getting more people to buy access. Even today, backers of crowd-funding projects often provide significant marketing services to their projects through word of mouth, long after fundraising has ended. Using this protocol, backers are not only personally rewarded for this engagement, but they also help to give more people access at lower prices.</li>
</ul>


<p>Of course this is not the end of the story! There are a number of variants of this mechanism that are worth exploring.</p>

<h2>Variations of the Protocol</h2>

<p>There are a number of aspects of the basic version of the Average Cost Threshold Protocol presented above which can be improved further.</p>

<p><strong>1)</strong> Most importantly, the public good provided by the protocol is still subject to use exclusions. We would really like to actually provide a pure public good that <em>everybody</em> has access to, no matter if they paid anything or not. But if we modified the mechanism so that people <em>know</em> the good <em>is</em> eventually going to be provided for free, the economic incentive to contribute something would disappear. Remember, this is the essence of the Myerson-Satterthwaite impossibility theorem!</p>

<p>Nonetheless, there are a number of ways <strong>the protocol could be modified to fund the creation of a pure public good without use exclusions</strong>. For example, we could set a &#8220;reserve price&#8221; of, say, \$5 dollars. If the price of the good falls below \$5, the good becomes a pure public good available to everyone for free. Now, of course, everyone who did pay \$5 has paid \$5 too much, which would destroy incentive compatibility in a strict sense. But as \$5 is a relatively small loss, backers who care about the project may very well be ready to accept this loss and gain the warm glow-effect of having made the public good available for everyone. Instead of fixing a common reserve price of \$5 for everyone, backers might also set their own individual reserve price when buying the product. (This of course would require the redistribution scheme to be adjusted.)</p>

<p>A completely different option would be to set a fixed &#8220;expiration date&#8221; of the use exclusions, for example, three years after the release of the finished product. Buyers would then purchase early access to the product, which is a common business model already today. The difference is that this early access would come with a guarantee that the product will become a pure public good eventually.</p>

<p>Of course such modifications would ruin some of the nice game theoretical properties of the mechanism. But these theorems hinge on the assumption that all backers are entirely rational anyway. And humans are not entirely rational, they are also benevolent and they tend to be tremendously enthusiastic about creative projects they like. So there is room enough for such small changes to work, even if they don&#8217;t fit into the rational framework.</p>

<p><strong>2)</strong> Companies or creative individuals funding a project using the &#8220;vanilla&#8221; Average Cost Threshold Protocol as defined above enjoy the tremendous benefit of having their costs covered in advance by payments very similar to pre-purchases. They are not funded through equity and they have no liabilities, which means they have no investors that they need to satisfy through profits and they have no debt that they need to pay off. But that does not mean that all is well.</p>

<p>First of all, after the project is funded and the company received the payment to cover their costs, they are not going to receive any further payments, whatsoever. This means that they have no further economic incentives to make the project succeed. They may have incentives in terms of their creative ambition, their reputation as a company, their individual careers or simply their personal integrity. But the economic incentives to make the product shine, to market it well, to finish it on time and on budget or even to complete the project all - they are all gone. This is clearly not in the interest of anybody! Therefore it is a good idea to allow the company to make some profits in order to create the corresponding economic incentives.</p>

<p>Moreover, no matter how accurately the company projected the costs of the project at the outset, the actual development may run over budget. Projects often (always?) do. So despite the fact that the initial fundraising is expected to cover costs in advance, the company still faces financial risks. To make these financial risks worthwhile to the company, it stands to reason that the company is allowed to make some profit.</p>

<p>Fortunately <strong>it is straightforward to allow the company to make a profit and at the same time allow the public to enjoy decreasing prices</strong>. The rule is simple: Half of the payment a new buyer makes goes to the previous backers, the other half is profit for the company. An example. Initially, 20,000 backers paid \$50 each to raise \$1 million. Now, 10,000 additional buyers want access. According to the original protocol, everybody would have to pay \$33.33 now. But instead, we ask the newcomers to pay \$40. Half of that is the profit of the company, which amounts to \$200,000 in total. The other half goes towards refunding the original 20,000 backers so that everybody paid just \$40 in total. In this way, prices will decrease steadily with an increasing number of buyers. But still, the company stands to make an unlimited profit from creating a great product! This amounts to a reasonable compromise between the interests of the company and the social goal of giving access to as many people as possible.</p>

<p>The great thing about this variation is that it preserves many of the nice game-theoretic properties of the original mechanism. In particular, this modified mechanism is still incentive compatible and individually rational. It still covers costs by producing a budget surplus instead of a balanced budget. It is less efficient than before, because fewer people get access for the same amount of money. But still, as the number of buyers grows, the price goes to zero, enabling everybody to afford access if the public good becomes popular enough.</p>

<p>Of course, nobody says that revenues always have to be split 50-50 among the company and its backers. Any other ratio would do. The ratio could change over time. Or each backer could choose their own ratio (similar to what the <a href="http://www.humblebundle.com/">Humble Bundle</a> is doing), leading to a democratic vote on how revenues should be split. Also, this idea can be combined with the first variation presented above to create a protocol that produces both profits for the company and a public good without use exclusions, provided the good becomes popular enough. In this case the profits for the company are bounded and it is not entirely rational for buyers to reveal their true valuation, but still this promises to be an excellent compromise.</p>

<p><strong>3)</strong> From a game theoretic perspective it is important (though not indispensable) that everybody pays the same price. However, from a practical perspective that may not be desirable. Some backers may <em>want</em> to be charged more than other backers. Maybe because they want to show how much they value the project. Maybe the company decides to offer rewards for backers who pay much. Most importantly, there is a real possibility that projects cannot be funded without backers who self-select to pay a very large premium on the average cost. The public interest in the project may not be broad enough to get the costs covered on an average cost pricing basis, but the interest may well be deep enough to cover costs if some people are allowed to pay more.</p>

<p>A special case is the money the company itself puts into the development. Companies and creators running crowd-funding projects often put a significant amount of personal wealth into their projects. Usually, these are funds that do not show up during the fundraising campaign. But an effective mechanism for funding public goods should explicitly incorporate a facility to account for this common practice.</p>

<p>Again there are several ways to <strong>allow backers to pay more than the average cost during the initial fundraising campaign</strong>. (Note that backers can always <em>pledge</em> as much as they want, but in the original protocol, they will never <em>pay</em> more than the average cost.) One way to accommodate this is via the variable reserve price mechanism mentioned above. Backers who <em>want</em> to pay a lot could simply set their personal reserve price to exactly the same amount as their pledge. Then, they could get charged the entire amount if the fundraising campaign is successful.</p>

<p>However, the above variation would also imply that these backers are not refunded anything. This may well be in the interest of very enthusiastic backers, but it would not fit the needs of the company who wants to recoup the large investment it made into the project in this way. Also there may be backers who are willing to make a very large payment, if the project can&#8217;t be funded otherwise, but would like to be refunded if the project turns out to be widely popular in the long run. To accommodate these interests, one could allow backers to specify that they want to be charged more during the fundraising campaign. Later on, the revenues earned from sales of the product could be used to refund backers in proportion to the payment they made during fundraising. This way large backers could eventually recoup their investment if the project is widely successful.</p>

<p>While it may generally not be rational for backers to make such large payments, the presence of this option does not change the fact that for the average backer the protocol remains incentive compatible and individually rational. As before, this variation can also be combined with the variations 1) and 2) mentioned above.</p>

<h2>Conclusion</h2>

<p>The Average Cost Threshold Protocol and its variations promise to yield an effective mechanism for the private funding of public goods. Even if this particular mechanism is not the ultimate answer, it shows that there is a lot of room out there for improving upon existing crowd-funding mechanisms in this regard. I hope that more people apply their creativity to invent new ways of making the private provision of public goods attractive. In a world where public goods make up an increasing share of the global economic output, such a mechanism could change the way we do business and interact with each other&#8217;s creative work.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="goods"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="public"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Enumerating Colorings, Tensions and Flows in Cell Complexes]]></title>
    <link href="http://blog.felixbreuer.net/2013/01/01/cellcomplexes.html"/>
    <updated>2013-01-01T19:10:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2013/01/01/cellcomplexes</id>
    <content type="html"><![CDATA[<p>My latest math paper has <a href="http://arxiv.org/abs/1212.6539">hit the arXiv</a>. It is called <em>Enumerating Colorings, Tensions and Flows in Cell Complexes</em> and it is joint work with <a href="http://math.sfsu.edu/beck/">Matthias Beck</a>, <a href="http://www.math.ku.edu/~jmartin/">Jeremy Martin</a> and Logan Godkin. It has been great working with all of them. I am particularly pleased that this is my first joint paper with Matthias, the great guy who brought me to San Francisco!</p>

<p>This paper is a continuation of the work that Matthias Beck and <a href="http://www.math.binghamton.edu/zaslav/">Thomas Zaslavsky</a> started on using inside-out polytopes to prove reciprocity results for counting polynomials and that <a href="http://page.mi.fu-berlin.de/sanyal/">Raman Sanyal</a> and I adapted to the case of modular counting functions. In the present work we generalize all of this considerably, by proving a whole collection of combinatorial reciprocity theorems for flow, tension and chromatic quasipolynomials defined on cell complexes, i.e., in terms of arbitrary integer matrices. The fact that the Ehrhart theory methods developed for the graph case <em>do</em> generalize to cell complexes is a testament to the remarkable power of the geometric approach to combinatorics. Head over <a href="http://arxiv.org/abs/1212.6539">here</a> to hear the full story!</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="article"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="research"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Kickstarter and the Funding of Public Goods]]></title>
    <link href="http://blog.felixbreuer.net/2012/12/31/kickstarter.html"/>
    <updated>2012-12-31T01:30:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2012/12/31/kickstarter</id>
    <content type="html"><![CDATA[<p><em>In this post, I kick off a series on the private provision of public goods, by taking a good look at Kickstarter and the Street Performer Protocol.</em></p>

<p>Crowd funding really took off in 2012. From my personal perspective, the most visible embodiment of this trend was the emergence of Kickstarter as a means of funding game development projects. <a href="http://www.kickstarter.com/projects/doublefine/double-fine-adventure">Double Fine Adventure</a> was one of the first projects that brought this concept to public attention by raising $3.3 million. This was quickly followed by the success of such projects as <a href="http://www.kickstarter.com/projects/stoic/the-banner-saga">The Banner Saga</a> ($723k), <a href="http://www.kickstarter.com/projects/1613260297/shadowrun-returns">Shadowrun Returns</a> ($1.8m), <a href="http://www.kickstarter.com/projects/cig/star-citizen">Star Citizen</a> ($2.1m) and <a href="http://www.kickstarter.com/projects/obsidian/project-eternity">Project Eternity</a> ($4.0m). Of all of these, I think The Banner Saga stands out, as it is a very original project by a comparatively unknown team, whereas the other projects capitalized on well-established concepts and the fame of their celebrity project-leaders.</p>

<p>When I first encountered Kickstarter, I became very excited, not just because of the addictive warm-glow effect of making great projects happen, but also because Kickstarter struck me as the first large-scale, widely popular implementation of the <a href="http://en.wikipedia.org/wiki/Threshold_pledge_system">Street Performer Protocol</a>. The Street Performer Protocol is a brand name coined in the 90s by Steven Schear, John Kelsey and Bruce Schneier for a very simple and very old mechanism for fundraising: Artists announce that they will do a public performance if the audience as a whole pays a fixed total amount (or more). If enough spectators chip in to reach this threshold, the artists collect the money and perform. Otherwise, nobody pays anything and there is no performance. This is essentially how Kickstarter operates.</p>

<p>Now, back in the 90s, the Street Performer Protocol (SPP) was heralded as a mechanism for funding <a href="http://en.wikipedia.org/wiki/Public_good">public goods</a>. A public good is a good that, once it is created, can be enjoyed by anybody without being &#8220;used up&#8221;. (See the end of this post for more details on the term.) Software and computer games make excellent examples of public goods in that they can be copied perfectly at a vanishingly small cost.</p>

<p>Commercial publishers of software and games often impose legal and technical restrictions on copying. They create use-exclusions in order to be able to sell the software like a classical private good. While this is a perfectly valid business model, it seems wasteful because it prevents people from using the software who could benefit from it at no additional cost. By contrast, the open source / free software model of software development ensures that free copying is possible, both legally and technically. But if software is to be made available as a public good without use-exclusions, how is its development to be funded? People hoped the SPP might provide an answer to this question, and, sure enough, the SPP soon had important successes. For example, in 2002, Ton Roosendaal managed to raise €100,000 in order to buy the rights to the 3d software <a href="http://www.blender.org/">Blender</a> (that he created) from the creditors of his bankrupt company NaN and released Blender under the GPL. But despite such isolated successes the SPP did not gain widespread adoption, and cross-subsidies remained/became the primary source of funding for open source software projects.</p>

<p>With all of this in mind, I became very excited when I discovered how successful Kickstarter was. Did we finally have a working way of financing the private provision of public goods directly? My enthusiasm led me to contribute funds to a couple of projects on Kickstarter, which has been a great experience all around. But. This experience also made it clear that, contrary to my first hopes, Kickstarter is <em>not</em> about the provision of public goods and it is not used to implement the SPP - at least judging by the way it is used in the game development community.</p>

<p>None of the games mentioned above are going to be released as a public good when they are completed. Instead, they are going to be sold, with the profit to be shared by the development studio, possible publishers and whatever investors they may have. The Kickstarter backers are not investors in this context. Their pledge is not a contribution towards the creation of a public good, it just buys a single license for a future product and <a href="http://www.gamesbrief.com/2012/07/kickstarter-after-the-kick-but-before-the-start/">is thus seen as, merely, a pre-order</a>. From this point of view, customers buy a product years in advance that they know virtually nothing about. Moreover they self-select for price targeting by voluntarily paying much more than price of the pre-order. (This price targeting is significant. All aforementioned projects had individual backers pledging more than $10,000 dollars and a significant percentage of backers pledged more than double the price of the respective pre-order.) In exchange for these additional funds, they get additional merchandise of limited value and the warm-glow effect of being part of a project they care about.</p>

<p>To be sure, this long-term pre-order model of funding games does potentially have great positive effects. When an audience not only buys the product but funds the creation process from the start, stakeholders become the key financiers of the project, which may lead to fewer conflicts of interest. Development teams achieve greater creative independence, they can follow their instincts and have to worry less about mass market appeal and investor interests. In the most optimistic scenario, this can lead to a more satisfying experience, both for the developers and for the customers.</p>

<p>Nonetheless, treating a Kickstarter pledge as a &#8220;pre-order&#8221; sounds just wrong to me, for several reasons. First of all, backers take on a large amount of risk with their pledge. They have no guarantees that the product is going to be delivered, they have no influence on the creation process, they have no information about the product they are buying, the price they pay is, on average, way above the final market price of the product, and they receive none of the revenues made by selling the final product. In short, if Kickstarter is used to create software that is going to be sold for-profit, then backers make a huge investment, reap none of the profits that arise from their investment, carry a large share of the risk, and end up paying much more than customers who buy the product after it has been released.</p>

<p>To be clear: I do think that all of the aforementioned projects are run by development studios with the best intentions. And while contributing on Kickstarter does have a warm-glow effect that can be addictive, I am convinced that most backers are rational in their decision. The huge transfer payment from backers to developers inherent in the pre-order funding model described above is a deliberate decision to fund art that would not be created without such a payment. But for studios to dismiss this huge gift as a pre-order and then to sell the resulting product exclusively for their own profit strikes a wrong chord with me.</p>

<p>Now, the pre-order model is certainly not the only way Kickstarter is used. The are projects, such as <a href="http://www.chris-granger.com/">Chris Granger</a>&#8217;s wonderful <a href="http://www.kickstarter.com/projects/ibdknox/light-table">Light Table</a> project, that were created with the explicit purpose of producing open source software. The Light Table Kickstarter project raised $316,720 and makes a prime example of the use of the Street Performer Protocol for funding a public good. I do hope that other Kickstarter projects will have the courage to ask backers for money, even if they pledge to make their final product open source upon release. In my view, this would be a much fairer deal. Projects such as LightTable (and Blender ten years ago) show that this can work, despite the fact that it is not rational in a strict economic sense for an individual backer to donate money to such a development project. If this mode of using Kickstarter catches on, we will have a truly new way of financing public goods. Such a mechanism would have a huge impact, given that an ever-growing share of the global economy deals in virtual goods that could in principle be turned into public goods.</p>

<p>So, I do still have hopes for more public good projects on Kickstarter. But hope is not good enough!</p>

<p>Therefore, I will use this post to kick off a <strong>series of posts on the economics of public goods</strong>, dealing with questions such as: What other mechanisms for funding public goods are out there? What tools do we need to analyse such mechanisms? What are the theoretical limits? <strong>How would a funding platform for the private provision of public goods have to work in order to be widely successful?</strong></p>

<p style="font-size:90%"><i>Addendum: One paragraph introduction to public goods.</i> A public good is a good that, once it is created, can be enjoyed by anybody without being &#8220;used up&#8221;. Anyone can stand by and watch a street performance, once it is happening. Anyone can walk on a street, once it is built. And anyone can make a copy of a digital movie, once it has been created, without anyone having &#8220;less&#8221; of the movie. Of course this is not quite true. A performance may become too crowded for new arrivals to see anything, and a street may become too congested for anybody to walk or drive. So, under extreme conditions there is some rivalry in the consumption of these good, but in most cases one more onlooker or one more pedestrian does not &#8220;cost&#8221; anything, which makes these goods non-rival. Now, as far as digital movies are concerned, their copying is perfectly non-rival as both copies are identical and nobody has &#8220;less&#8221; of the movie. However, there are often many legal and technological barriers in place to prevent consumers from copying. That is, the industry tries (with moderate success) to exclude consumers from obtaining a copy the movie, if they did not pay for it. When these restrictions are not in place, there is nothing preventing a consumer from making a copy, and the movie becomes a public good without use-exclusions. A pure public good is perfectly non-rival and non-excludable. In practice, public goods often have some limited rivalry, but it may still be instructive to think about them as public goods as they are non-rival in most cases. For my purposes, I do not include non-excludability in my definition of a public good, as the role of use-exclusions in the funding of public goods is precisely what I want to discuss.</p>



]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="fund-io"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="goods"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="public"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Towards a standard file format for formal sketches of mathematical articles]]></title>
    <link href="http://blog.felixbreuer.net/2012/06/17/proof.html"/>
    <updated>2012-06-17T23:32:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2012/06/17/proof</id>
    <content type="html"><![CDATA[<p>The large-scale formalization of mathematics has been a long-time <a href="http://www.cs.ru.nl/~freek/qed/qed.html">dream of many</a>. Personally, I would love to accompany every mathematical research article I write with a formal version, including formal proofs, and I think widespread formalization is <a href="http://blog.felixbreuer.net/2012/02/27/beyondtheorems.html">important for the mathematical community</a> in general.</p>

<p>However, as long as current automatic proof systems are <a href="http://www.ams.org/notices/200811/tx081101408p.pdf">unable</a> to do even high school mathematics on their own, this dream will not turn into reality. Yet, we do not need to wait for automatic proof systems to get better. On the contrary, there is something that we can do <em>now</em> that will help <em>both</em> the formalization of mathematics and the improvement of automatic proof systems:</p>

<blockquote><p>We need to create a standard file format for formal sketches of mathematical articles.</p></blockquote>

<p>In the rest of this post, I will explain what I mean by this and why I think this is useful. Note, however, that these ideas are very much a work in progress. Also, I should say that my perspective is that of a mathematician working in discrete geometry and combinatorics. I am not a logician and I am no expert in interactive or automatic theorem proving, and I have begun to explore the world of formal proof systems <a href="http://blog.felixbreuer.net/2012/06/11/hol.html">only recently</a>. Nonetheless, I think that the one thing that could make writing formal mathematical proofs more accessible to a working mathematician like me is a standard file format for formal sketches of mathematical articles.</p>

<h2>Formal Sketches</h2>

<p>With a mathematical article I mean an informal mathematical article on some topic of current research interest, as might be found in a journal or on the arXiv. With a formal sketch I mean a formal version of such an informal mathematical article with the following properties:</p>

<ul>
<li>A formal sketch contains the definitions, theorems and proofs given in the informal mathematical article.</li>
<li>The formal sketch is human-readable and human-writable.</li>
<li>Moreover, reading or writing a formal sketch of an informal mathematical article should not be significantly more difficult than reading or writing the informal article itself.</li>
<li>Definitions and theorems in the formal sketch are given in a fixed logic without any ambiguity.</li>
<li>Proofs in the formal sketch are formal proof sketches in the following sense: A formal proof sketch is not a complete formal proof and it is not a human readable representation of a given formal proof. Instead, a formal proof sketch serves as advice for constructing a formal proof by breaking the task of constructing a formal proof down into smaller, easier steps. The purpose of a formal proof sketch is to help an automatic proof system to construct a complete formal proof.</li>
<li>Formal proof sketches are independent of any particular automatic proof system and any fixed library of definitions and theorems. Formal sketches of mathematical articles follow a decentralized open-world approach to formalizing mathematical theory.</li>
</ul>


<p>I do <em>not</em> claim that current automatic proof systems will actually be able to construct a formal proof from a formal proof sketch. This goal may still be many years away. Current automatic proof systems will still require additional prover-specific human help to construct formal proofs. Nonetheless, I argue that it is still beneficial to create a standard file format for formal proof sketches <em>now</em>.</p>

<p>The creation of a standard file format for formal sketches of mathematical articles will, I hope, accomplish two things:</p>

<ul>
<li>A standard file format for formal sketches of mathematical articles will make it more attractive for everyday mathematicians to formalize their mathematical articles. This will facilitate the creation of a large body of formalized real-world mathematics. Moreover, this effect will become more pronounced as automatic proof systems become more powerful.</li>
<li>A standard file format for formal sketches of mathematical articles will encourage competition between automatic theorem provers and innovation in automated reasoning. Formal sketches may serve as a benchmark for comparing the capabilities of different provers. The availability of an interesting set of formal proof sketches will also make improvements in the automated reasoning capabilities of current provers more relevant.</li>
</ul>


<p>These two effects mutually reinforce each other. This has the potential to create a positive feedback loop that will help the large scale formalization of mathematics to take off, finally.</p>

<p>Of course, a large effort will be required to get this process going. One means of bootstrapping this process may be the creation of a supplemental file format for the annotation of formal proof sketches with prover-specific advice. Nonetheless, I think that the creation of such an ecosystem is possible and that the potential benefits justify the effort. As outlined above, the foundation of this system is a standard file format for formal sketches of mathematical articles.</p>

<p>In the remainder of this post I will discuss how such a standard file format might look like.</p>

<h2>What file formats are out there already?</h2>

<p>Fortunately, there is already a rough consensus on what a formal, human-readable, declarative language that resembles ordinary mathematics should look like. Many people tried to come up with their own version of such a language and, independently, they arrived at essentially the same result, a common <em>mathematical vernacular</em>. This argument has been made by Freek Wiedijk in a wonderful <a href="http://www.cs.ru.nl/~freek/notes/mv.pdf">article</a> where he compares the languages of the Hyperproof, <a href="http://www.mizar.org/">Mizar</a> and <a href="http://www.cl.cam.ac.uk/research/hvg/isabelle/">Isabelle</a>/<a href="http://isabelle.in.tum.de/Isar/">Isar</a> systems and points out the common structure behind their differences in surface syntax. His <a href="http://www.cs.ru.nl/~freek/miz3/miz3.pdf">miz3</a> syntax for <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/">HOL Light</a> is another example of this mathematical vernacular.</p>

<p>This mathematical vernacular is a format for formal proofs with a very precise meaning. Formal sketches, on the other hand, should live at a higher level of abstraction. In particular they should be intentionally vague in specifying how, exactly, to prove &#8220;the next step&#8221; in a declarative proof. Freek has introduced the notion of a <a href="http://www.cs.ru.nl/~freek/notes/sketches.pdf">formal proof sketch</a> and given some <a href="http://www.cs.ru.nl/~freek/notes/sketches1.pdf">very nice examples</a>. A formal proof sketch, in his sense, is an abbreviated version of a full formal proof in the Mizar language, in which some intermediate steps and justifications have been removed. It turns out that using such abbreviations, one can arrive at a document that is very close to a natural language version of the proof and that still accurately reflects the structure of the underlying formal proof. A formal proof sketch is correct if it can be extended to a formal proof in the Mizar language just by adding labels, justifications and intermediate steps.</p>

<p>Freek intends formal proof sketches to serve only as a means for presenting a formal proof. He expressly does not intend formal proof sketches &#8220;to be a &#8216;better way&#8217; of writing formal proofs&#8221;. In this post, however, I use the terms &#8220;formal sketch&#8221; and &#8220;formal proof sketch&#8221; with the explicit intent of employing these sketches as a tool for authoring and archiving formal proofs.</p>

<p>In the context of this prior work, a formal sketch in the sense of this post would be the following: A document containing definitions, theorems and proofs, where the proofs are written in an abbreviated version of the mathematical vernacular. Such a document would be correct, if the proofs can be extended to full formal proofs in the mathematical vernacular by adding labels, intermediate steps and additional justifications. Such a formal document would not serve as an abbreviated representation of an underlying formal proof. Rather, it would serve as formal but ambiguous and incomplete advice to the (human or machine) reader for constructing a formal proof.</p>

<p>The purpose of creating a standard file format for formal sketches based on the mathematical vernacular is to share formal sketches across different proof systems. In this regard, the <a href="http://www.gilith.com/research/opentheory/">OpenTheory</a> project has done vital pioneering work. The OpenTheory article format is a low-level format for encoding proofs in a fixed logic. This file format can be read, written and interpreted by several different provers. The OpenTheory article format is prover independent in the sense that in order to use the proofs contained in an OpenTheory article, a prover only has to use a version of higher order logic that can simulate the <a href="http://www.gilith.com/research/papers/stdlib.pdf">primitive inference rules</a> defined in the <a href="http://www.gilith.com/research/opentheory/article.html">OpenTheory article standard</a>. OpenTheory demonstrates that sharing of proof documents among provers is possible. The creation of a standard for formal sketches of mathematical articles would aim to do the same at higher level of abstraction.</p>

<p>OpenTheory achieves prover independence by compiling prover-specific proof tactics down to elementary inferences. The only way to achieve prover independence at the high level of abstraction that formal sketches aim for, is by removing all prover-specific tactics and library-specific references from the justifications of the declarative proof steps. (Incidentally, this removal of justifications is also Freek&#8217;s key step in converting a declarative formal proof into a formal proof sketch.) In this way, the higher level of abstraction is &#8220;bought&#8221; at the cost of introducing ambiguities into the formal proof sketch.</p>

<p>In terms of previous work, a standard for formal sketches of mathematical articles could thus be described by the slogan &#8220;OpenTheory for formal sketches of Mizar-style articles&#8221;. In the next section, however, I want to change tack and describe the properties a format for formal sketches should have, by drawing analogies to informal mathematical articles as they are used today. In particular, I will argue that informal mathematical articles are successful precisely because they are ambiguous.</p>

<h2>What properties should the file format have?</h2>

<p>The research articles that mathematicians all over the world write every day have several astonishing properties. Compared to most other texts humans write, even in the sciences, mathematical articles are extremely formal. Yet, compared to formal proofs in the sense of proof theory, mathematical articles are extremely informal, ambiguous, imprecise and even erroneous. There are three aspects of this inherent ambiguity of mathematical articles that I want to call particular attention to.</p>

<ul>
<li>Even though mathematical articles build on a huge amount of previous results, they manage to refer to this huge body of knowledge without becoming too verbose. This feat is achieved by three means: Mathematical articles typically 1) assume background knowledge on part of the reader, 2) include brief preliminary sections that summarize the most important parts of the required background knowledge, and 3) state the most important previous results they draw on as explicit theorems.</li>
<li>Mathematical proofs are written in a declarative rather than in a procedural style. They consist of a sequence of true assertions, rather than a sequence of instructions on how exactly to get from one assertion to the next. This allows readers to make use of their own background knowledge and understanding of the subject matter and avoids a commitment to any particular set of rules.</li>
<li>To make sense of a mathematical article in all its details requires an often significant effort on the part of the reader. Every mathematician has been in the situation of spending hours trying to understand a step in a proof that was (apparently) obvious to the author. This is made necessary by the previous two properties of mathematical articles mentioned above.</li>
</ul>


<p>All three of these properties make mathematical articles <em>more successful</em> at communicating mathematical ideas. Mathematical articles would be less readable today and completely unintelligible 50 years from now, if they were extremely verbose, required the reader to refer to a particular textbook while reading and forced the reader to follow exactly the same train of thought the author used.</p>

<p>I think there is something we can learn from this:</p>

<blockquote><p>Mathematical articles have been successful at communicating mathematics in the last centuries precisely because they are ambiguous. Formal mathematical articles have to embrace this ambiguity if they are to become successful.</p></blockquote>

<p>Concretely, this has the following implications for a formal format for mathematical articles.</p>

<ul>
<li>Formal mathematical articles have to avoid binding themselves to any particular library of theorems or any particular proof system.</li>
<li>Formal mathematical articles should be written in a declarative style.</li>
<li>Formal mathematical articles have to place the burden of working out the details on the reader, no matter if the reader is a human or an automatic proof system.</li>
</ul>


<p>These general considerations point to a declarative format for formal proof sketches in the Mizar style in which the explicit references to external theorems and prover specific tactics have been removed as far as possible.</p>

<p>From a pragmatic point of view, the removal of most explicit references to libraries and provers from formal sketches has two huge advantages for mathematicians wanting to formalize their articles:</p>

<ul>
<li>Mathematicians do not have to learn a (huge) dictionary or &#8220;API&#8221; to get started with formalization.</li>
<li>Mathematicians do not have to fear that their formal sketches will become unreadable when the current generation of provers becomes obsolete.</li>
</ul>


<p>These two factors, the tie-in and the steeper learning curve associated with binding a formal sketch to a particular API, are the two factors that keep me personally, as an everyday mathematician, from starting to formalize my research. (The <a href="http://vimeo.com/22669718">danger</a> that formal proofs break as prover technology changes is particularly problematic.) The removal of these two deterrents would, I hope, make formalization attractive to many other mathematicians as well.</p>

<h2>The ingredients of a specification</h2>

<p>So far, these are blue-sky ideas and it is way to early to try to turn these into an explicit specification of a formal sketch format (FSF). But, to get the ball rolling, I want to list some ingredients for such a specification that, I think, will be important for success, based on the above considerations.</p>

<p>As explained above, the starting point for FSF is a Mizar-style declarative proof language in the spirit of the mathematical vernacular. Proofs in FSF are abbreviated by omitting intermediate steps and in particular justifications. Prover-specific justifications are not allowed in formal sketches at all. To make FSF work, this basic concept should be extended in the following ways.</p>

<p>First of all, as this whole idea revolves about creating a cross-prover file format, close integration with OpenTheory is desirable. In particular:</p>

<ul>
<li>FSF should use the same logical foundation as OpenTheory.</li>
<li>The packaging mechanism should be essentially the same as in OpenTheory. An FSF article imports theorems as axioms and promises to produce a bunch of new theorems as a result (if the reader/prover is clever enough). Note that while the set of exports is uniquely determined by the FSF article, the set of imports is <em>not</em> uniquely determined by the FSF article, but depends on the reader/prover as well.</li>
<li>The benchmark for whether a prover $P$ &#8220;understands&#8221; formal sketch $S$ should be this: Is $P$ able to transform $S$ into an OpenTheory article $O$ on its own? $O$ is not uniquely determined by $S$, in particular its imports may depend on $P$. However, all imports of $O$ should be available in $P$&#8217;s library.</li>
<li>FSF should have built-in support for citing theorems from the OpenTheory library.</li>
</ul>


<p>The formal sketch format should not tie itself to OpenTheory exclusively, however, as independence of any particular system is crucial for the success of FSF. Instead:</p>

<ul>
<li>FSF has to embrace an open-world model.</li>
<li>FSF has to allow all kinds of references to mathematics outside of a given formal sketch article, including references to theorems that are ambiguous or not machine-readable. Examples include:

<ul>
<li>informal citations of an informal mathematical source, like &#8220;Proposition 2.1 in Herbert Wilf, generatingfunctionology, 3rd Edition&#8221;,</li>
<li>explicitly stated theorems,</li>
<li>references to open libraries such as Isabelle&#8217;s <a href="http://afp.sourceforge.net/">Archive of Formal Proofs</a>, and even</li>
<li>free format URLs.</li>
</ul>
</li>
</ul>


<p>It is important to note that automatic systems processing FSF should not be <em>required</em> to make sense of any of these. A mathematician does not check <em>all</em> references cited in a given article either.</p>

<p>As mentioned before, current provers will probably not be able to &#8220;understand&#8221; any interesting formal sketch at this time. While the hope is that provers will achieve that goal at least for some formal sketches in the not too distant future, there is definitely going to be a transition period in which provers need additional advice to cope with a given formal sketch. To this end, a supplemental file format for annotating FSF articles should be developed.</p>

<ul>
<li>An annotation file $A$ for an FSF article $S$ will consist of prover-specific advice for some steps of the proofs contained in $S$.</li>
<li>There can be many annotation files for any given article $S$. Different annotation files may give contradictory proof advice.</li>
<li>It is important that annotations reside in different files than the sketch $S$ itself, so that annotations may be changed, extended or removed while keeping $S$ fixed. Also, this prevents $S$ from becoming unnecessarily verbose.</li>
<li>As explained above, FSF articles should have explicit justifications only in places where humans would mention these justifications in informal mathematical articles. However, independently of the number of justifications, FSF articles can be made easier for provers to &#8220;understand&#8221; if they contain many small intermediate steps. While these small steps may be very useful in early FSF articles, they pose the danger of making an FSF article less readable for humans. Therefore:

<ul>
<li>It should be possible to move these &#8220;small steps&#8221; into annotation files.</li>
<li>In the case that these &#8220;small steps&#8221; are kept in the formal sketch itself, the file format should contain hints indicating which parts of a proof should be &#8220;hidden&#8221; or <a href="http://www.cs.ru.nl/~freek/notes/sketches.pdf">&#8220;folded&#8221;</a> at a first reading.</li>
</ul>
</li>
</ul>


<p>The goal is of course to progressively remove annotations as provers become more powerful, until the annotations can be omitted entirely.</p>

<p>People tend to have very strong opinions about the surface syntax of any data format. As Freek pointed out, even the different variations of Mizar-style file formats that are out there attach different meanings to the same keywords. Therefore:</p>

<ul>
<li>The FSF specification should fix one data model for formal sketches.</li>
<li>FSF should allow for different serialization formats of this data model.</li>
<li>The FSF specification should provide at least two different serialization formats:

<ul>
<li>a Mizar-style plain text serialization for human editing, and</li>
<li>a plain text serialization that lends itself to easy machine processing (using JSON, XML or Lisp-style S-expressions).</li>
</ul>
</li>
</ul>


<p>The formal sketch format needs to be supported by a convenient infrastructure. In particular, it will be useful to create</p>

<ul>
<li>an open repository for formal proof sketches, and</li>
<li>standard interfaces for processing a proof sketch plus annotations with the most popular provers.</li>
</ul>


<p>One might even imagine facilities to &#8220;mix-and-match&#8221; provers: Use HOL to do the first step in a proof, use Isabelle for the second and have both produce low-level output in OpenTheory format in the process. But of course the realization of such fancy ideas is even further off than a basic version of FSF. Which brings me to the conclusion of this post.</p>

<h2>Next steps</h2>

<p>Where to go from here? Before trying to go for a formal specification, a proof-of-concept is needed. Therefore, I plan to do the following:</p>

<ul>
<li>Create a rough draft of a formal sketch format and an accompanying format for annotations.</li>
<li>Convert a couple of Freek&#8217;s formal proof sketches into this formal sketch format.</li>
<li>Implement a basic interface for compiling the example sketches plus annotations into OpenTheory articles - for two different provers.</li>
<li>Create annotations so that the formal proof sketches actually compile with these two different provers.</li>
<li>Begin experiments on how the provers in question can be improved to do these same proofs with fewer annotations.</li>
</ul>


<p>At that point, we will have a clearer idea of how the formal sketch format should look and what needs to be done to get this positive feedback loop of more prover-independent formalized mathematics and more powerful automatic provers going.</p>

<p>Comments on these ideas and help in this process are very welcome!</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="formal"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="proof"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="software"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Euro crisis - links and thoughts]]></title>
    <link href="http://blog.felixbreuer.net/2012/06/15/euro.html"/>
    <updated>2012-06-15T23:24:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2012/06/15/euro</id>
    <content type="html"><![CDATA[<p>As a German currently living in the US, I am amazed how completely different the discussions about the Euro crisis are inside and outside Germany. I am disappointed in the German media for completely ignoring the arguments that commentators outside Germany make. I am shocked that German economists keep conflating moral and economic issues and turn a deaf ear to sound economic advice without even engaging in a dialog. And the petty, angry and even hateful user-comments that dominate German news websites make me sad.</p>

<p>I would like to recommend a few articles on the current economic crisis and the Euro crisis in particular that give a much sounder picture of what is going on than can be found in the German news media at large.</p>

<ul>
<li><a href="http://krugman.blogs.nytimes.com/">Paul Krugman</a> - End this depression now!</li>
<li>Jospeh Stigliz - <a href="http://www.project-syndicate.org/commentary/after-austerity">After austerity</a></li>
<li>James Surowiecki - <a href="http://www.newyorker.com/talk/financial/2012/06/04/120604ta_talk_surowiecki">The fairness trap</a></li>
<li>Mark Cliffe - <a href="http://schekman.files.wordpress.com/2012/06/rapport-emu-roads-to-survival-5-juni-2012.pdf">Roads to survival</a></li>
<li>George Soros - <a href="http://www.georgesoros.com/interviews-speeches/entry/remarks_at_the_festival_of_economics_trento_italy/">Remarks at the festival of economics, Trento Italy</a></li>
<li>Martin Wolf - <a href="http://blogs.ft.com/martin-wolf-exchange/2012/06/07/the-german-response/#ixzz1xQcBNxxc">The German response</a></li>
<li>Dani Rodrik - <a href="http://www.project-syndicate.org/commentary/the-end-of-the-world-as-we-know-it">The end of the world as we know it</a></li>
<li>Gustav Horn - <a href="http://www.zeit.de/wirtschaft/2012-05/sparkurs-europa-kritik/komplettansicht">Die Rettung in Europa ist nahe!</a></li>
<li>The Economist - <a href="http://www.economist.com/node/21555916">The choice</a> and <a href="http://www.economist.com/node/21556577">Start the engines, Angela</a></li>
</ul>


<p>Here is the gist of what I take away from all this:</p>

<p>I can understand the reflex to say &#8220;if you have lived beyond your means, you have to tighten your belt and save&#8221;. On the level of a single household or a single company that is sound advice. But it does not make sense at the level of an entire economy. As Paul Krugman puts it: &#8220;Your spending is my income and my spending is your income.&#8221; This means that I can only save (i.e, earn more than I spend) if there is somebody else who lives beyond his means (i.e., spends more than he earns). Therefore, it is simply <em>impossible</em> for everybody to save at the same time. But this is exactly what people, companies and governments all over the world are trying to do right now. People and companies try to save because of bleak economic prospects, governments try to save because they think they need to be austere. This creates a vicious cycle in which everybody tries to spend less then everybody else. The result is a depression in which <em>nobody</em> manages to save.</p>

<p>We are in a depression that is caused by a lack of demand. Therefore, propping up the supply side will not help in getting us out of this depression. So while structural reforms in the European periphery are certainly important, structural reforms alone will not get us out of this crisis, as long as demand remains depressed. And the austerity politics that Germany in particular is hell-bent on pursuing only depress demand even more.</p>

<p>This lack of demand creates massive unemployment (which further depresses demand). This is no accident. On the contrary, mass unemployment is the official goal of austerity politics. Austerity politics in Europe seek to achieve &#8220;internal devaluation&#8221; in the European periphery: Mass unemployment is supposed to reduce wages which in turn will restore the competitiveness of the periphery. Unfortunately, this does not work because of a phenomenon called &#8220;downward nominal wage rigidity&#8221;, which basically means that wages decrease less in a depression than they would increase in a boom. Moreover, the idea of internal devaluation disregards the catastrophic effect that mass unemployment has for the people, especially when they are young. The unemployed have to cope with huge psychological and economic pain (which even results in higher suicide rates). Also, the skills of the unemployed deteriorate which has a negative long-term effect on the economy as a whole.</p>

<p>An alternative means of balancing the differences in productivity between the core and the periphery is to create modest inflation in the core while keeping the inflation rate in the periphery close to zero. This would devalue the euro, making European exports more competitive on the world market. It would also create less unemployment and put less pressure on the demand in the periphery, allowing structural reforms to actually translate into economic activity.</p>

<p>Note that so far this has little to do with the rescue packages that seem to be the only thing that European crisis management revolves around. In fact, I think it is pointless for Germany to finance the debt of peripheral countries as long as there remains the slightest chance that peripheral governments might default. We have to make government default in Europe impossible, in exactly the same way that all other countries that are in control of their own currency do it as well: The ECB has to guarantee European sovereign debt, acting as a lender of last resort. Yes, this may amount to printing money. Yes, this will create inflation, but controlled inflation helps reducing the debt burden. Yes, this devalues the Euro, but that stimulates exports. Yes, this would amount to an implicit transfer payment from Germany to the periphery, but I am not against transfers. I am all for transfers as long as they make sense. And yes, of course this introduces a moral hazard that requires further political and financial integration to be kept in check.</p>

<p>German public opinion about the ever-recurring bail-out packages ranges from weary to hostile, because people rightly observe that these bail-out packages do not work but cost billions. Curiously, however, the reasons why these packages fail - from the refusal to change the ECBs role to the self-defeating mechanics of austerity - are rarely discussed in German media. Thus, most people do not realize that Merkel&#8217;s austerity is the cause of the problem. Instead, they are of the opinion that the compromises that Europeans extract from Merkel are to blame. As long as this self-serving ignorance of the German media continues, Germans will keep supporting Merkel&#8217;s policy and Merkel will keep being the hardliner that Germans expect her to be, even if Germany drops into recession.</p>

<p>Germans feel that they are being taken advantage of. The reasons for this lie in recent German domestic policy. The hard social security and labor market reforms that Schröder introduced with his Agenda 2010 hurt. Badly. And it took years for them to bring about economic benefits. And just now, when the sharp austerity measures that Germans themselves endured are starting to bear fruit and lead Germany into this economic boom, other countries ask Germany to step up and pay the bill for them. They didn&#8217;t do their homework and now they don&#8217;t want to endure what Germany has endured. Of course this is not entirely true, but I would claim that this is what is going on in the &#8220;German subconsciousness&#8221;. It also explains the Germans&#8217; insistence on structural reform and their focus long-term economic outlook: these are the measures that worked for them, so these are the only measures that will work for anyone else. &#8220;There is no easy way out, so do not ask us to pay for short-term relief.&#8221;</p>

<p>Unfortunately, what worked for Germany in the previous decade cannot work for Europe today. There are many reasons for this. The most important one is that Germany could flourish because of its export-oriented economy. It could behave like a household that tries to earn more and spend less, because there were other countries who spent more than they earned. Now, we are in a global depression, where everybody spends too little. So the only way out is to lead Europe like an economy, not like a household. And this means stimulating demand.</p>

<p>Of course this will have to be at the expense of Germany. Whether this is fair or not is beside the point. It is necessary, if we do not want the world to slide into a Second Great Depression. Of course, all the unfairness entailed in and all the moral hazard created in this process will have to be addressed: No, it is not fair that the 99% pay for a crisis that the 1% caused and from which they even profited. No, it does not make sense that Germans have to work until they are 67 years old or even longer, just so that the French can enjoy an early retirement at the age of 60. And no, one country should not borrow without limit at the expense of another. But these issues can only be resolved through tighter European integration and cooperation. Trying to force tighter integration now, in the middle of this self-inflicted depression, will succeed only in fostering anti-European sentiment on all sides, without accomplishing anything.</p>

<p>Europe is worth paying for. And even those who do not agree should realize that this crisis will cost Germany huge amounts of money, one way or another. But when we invest these resources we have to make it count. Any workable solution needs to have widespread support in Europe. To that end we have to finally start listening to each other. We need to create a true European public and start a true dialog across national boundaries.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="economics"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="opinion"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="politics"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Formal proof - first steps with HOL Light]]></title>
    <link href="http://blog.felixbreuer.net/2012/06/11/hol.html"/>
    <updated>2012-06-11T01:12:13-07:00</updated>
    <id>http://blog.felixbreuer.net/2012/06/11/hol</id>
    <content type="html"><![CDATA[<p>
Recently, I have <a href="http://blog.felixbreuer.net/2012/02/27/beyondtheorems.html">philosophized</a> about how the mathematical community needs to move beyond (new) theorems as their currency of research. One different form of currency that I personally find particularly interesting are formal proofs. So, in the last few weeks I have spent some time getting my feet wet with one of the <a href="http://www.cs.ru.nl/~freek/comparison/comparison.pdf">formal proof systems</a> out there: <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/">HOL Light</a>.
</p>

<p>
To learn HOL light, I decided to pick a simple theorem (from the theory of formal power series) and try to formalize it, both in a procedural and in a declarative style. In this blog post, I document what I have learned during this exercise.
</p>

<p>My point of view is that of an everyday mathematician, who would like to use formal proof systems to produce formal proofs to go along with his everyday research papers. I realize of course, that this is not practical yet, given the current state of formal proof systems. But my goal is to get an idea of just how far away this dream is from reality.
</p>

<p>
During my experiments the <a href="https://lists.sourceforge.net/lists/listinfo/hol-info">hol-info</a> mailing list was a huge help. In particular, I would like to thank Freek Wiedijk, Petros Papapanagiotou and John Harrison.
</p>

<p>
I will begin by giving a short summary of the informal proof and its two formal versions. This should give you a general idea of what all of this is about. If you want more details, you can then refer to the other parts of this post. Here is an outline:
</p>

<ul>
<li><a href="#summary">Summary: One Theorem and Three Proofs</a></li>
<li><a href="#hol">Meeting HOL Light</a></li>
<li><a href="#defs">Formal Definitions</a></li>
<li><a href="#proc">A Procedural Proof</a></li>
<li><a href="#miz">Mizar in HOL: miz3</a></li>
<li><a href="#decl">A Declarative Proof</a></li>
<li><a href="#hacking">Making Declarative Proofs more Self-Contained</a></li>
</ul>

<p>
So, without further ado, let&#8217;s start with a summary.
</p>

<h2><a name="summary"></a>Summary: One Theorem and Three Proofs</h2>

<p>
The theorem that I want to prove formally is simply that every formal power series with non-zero constant term has a reciprocal - and this reciprocal has a straightforward recursive definition. In everyday, informal mathematical language, this theorem and its proof might be stated like this.
</p>

<p>
<b>Theorem.</b> Let $f=\sum_{n\geq 0} a_n x^n$ be a formal power series with $a_0\not = 0$. Then, the series $g=\sum_{n\geq 0} b_n x^n$ with
\begin{eqnarray*}
b_0 & = & \frac{1}{a_0} \cr
b_n & = & -\frac{1}{a_0}\sum_{k = 1}^n a_k b_{n-k} \; \forall n\geq 1
\end{eqnarray*}
is a reciprocal of $f$, i.e., $f\cdot g = 1$.
</p>

<p>
<i>Proof.</i> To see that $g$ is a reciprocal of $f$, we have to show that
\[
f\cdot g = \sum_{n \geq 0} \sum_{k=0}^n a_k b_{n-k} = 1
\]
which means that for all $n\in\mathbb{Z}_{\geq 0}$ we have
\[
\sum_{k=0}^n a_k b_{n-k} = \left\{ \begin{array}{ll} 1 & \text{if } n=0 \cr 0 & \text{if } n\geq 1  \end{array} \right.
\]
To show this, we proceed by induction. If $n=0$, then we have
\[
\sum_{k=0}^n a_k b_{n-k} = a_0 b_0 = a_0 \frac{1}{a_0} = 1
\]
as desired. For the induction step, let $n\in\mathbb{Z}_{\geq 0}$ and assume that the identity holds for $n$. We are now going to show that it also holds for $n+1$. To this end we calculate
\begin{eqnarray*}
\sum_{k=0}^{n+1} a_k b_{n+1-k}
& = &
a_0 b_{n+1} + \sum_{k=1}^{n+1} a_k b_{n+1-k}
&#92; &=&
a_0 \left( -\frac{1}{a_0}\sum_{k = 1}^{n+1} a_k b_{n+1-k} \right)
+ \sum_{k=1}^{n+1} a_k b_{n+1-k}
&#92; &=&
0.
\end{eqnarray*}
<i>End of Proof.</i>
</p>

<p>
This proof is very simple and straightforward. Therefore, many authors would try to be more terse. For example, in Wilf&#8217;s classic text book with the wonderful title <a href="http://www.math.upenn.edu/~wilf/DownldGF.html">generatingfunctionology</a> this theorem is Proposition 2.1 and its proof does not even state the above calculation explicitly. Personally, I think the above proof is just about the right length.
</p>

<p>
You may have noticed that in the above proof, we did not use the induction hypothesis in the induction step. Indeed, the above proof can be done just using case analysis, without induction at all. I will nonetheless stick with the induction version of the proof, because it is more idiomatic when formalized in HOL Light.
</p>

<p>
Now, let&#8217;s see how the above proof looks when rendered in a formal proof language. In fact, we are going to do this proof in two formal proof languages: a procedural and a declarative one.
</p>

<p>
We first need to make some definitions for working with generating functions (aka formal power series). I chose to model a generating function $f$ simply as a function $f:\mathbb{N}\rightarrow\mathbb{R}$. So, if $f$ corresponds to $\sum_{n\geq 0} a_n x^n$ in the power series notation, then $f(n)=a_n$. With this approach, addition, multiplication and various other things can be defined as follows. See the section on <a href="#defs">Formal Definitions</a> below for details.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gf_plus = new_definition `gf_plus = \(f:num-&gt;real) (g:num-&gt;real) (n:num). (f n) + (g n) :real`;; 
</span><span class='line'>let gf_times = new_definition `gf_times = \(f:num-&gt;real) (g:num-&gt;real) (n:num). (sum (0 .. n) (\k. (f k)*(g (n-k)))) :real`;;
</span><span class='line'>let gf_one = new_definition `gf_one = \(n:num). if n = 0 then &1 else &0`;;
</span><span class='line'>let gf_reciprocal = new_definition `gf_reciprocal = \(f:num-&gt;real) (g:num-&gt;real). gf_times f g = gf_one`;;
</span><span class='line'>let recip = define `recip f (0:num) =  ((&1:real)/(f 0) :real) /\  recip f (n+1) = -- (&1/(f 0)) * sum (1..(n+1)) (\k. (f k) * recip f ((n + 1) - k))`;;</span></code></pre></td></tr></table></div></figure>

<p>
With these definitions, the theorem we are trying to prove is this:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>`!(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)`</span></code></pre></td></tr></table></div></figure>

<p>
Note how the recursive formula for the reciprocal of $f$ has been wrapped in the definition of <code>recip</code>. The relation <code>gf_reciprocal</code> is used abbreviate the statement that <code>recip f</code> is a reciprocal of <code>f</code>.
</p>

<p>
Now we are ready to give the two formal versions of our above proof of this theorem. We start with the procedural version. It looks like this:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let GF_RECIP_EXPLICIT_FORM = prove (`!(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)`,
</span><span class='line'>  GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[gf_reciprocal;gf_times;gf_one] THEN REWRITE_TAC[FUN_EQ_THM] 
</span><span class='line'>  THEN INDUCT_TAC THEN ASM_SIMP_TAC[NUMSEG_SING;SUM_SING] THEN CONV_TAC NUM_REDUCE_CONV 
</span><span class='line'>  THEN REWRITE_TAC[recip] THEN SIMP_TAC[REAL_ARITH `x * &1 / x = x / x`] THEN ASM_SIMP_TAC[REAL_DIV_REFL] 
</span><span class='line'>  THEN REWRITE_TAC[MATCH_MP (SPEC `(\k. f k * recip f (x - k))` SUM_CLAUSES_LEFT) (SPEC_ALL LE_0);SUB_0;ADD_0;ADD_AC;ADD1;recip] 
</span><span class='line'>  THEN (FIRST_ASSUM (ASSUME_TAC o (MATCH_MP (REAL_FIELD `!x. ~(x = &0) ==&gt; !a. x * -- (&1 / x) * a = -- a`)))) 
</span><span class='line'>  THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[REAL_FIELD `--a + a = &0`] THEN ASM_SIMP_TAC[ARITH_RULE `~(x + 1 = 0)`]);;</span></code></pre></td></tr></table></div></figure>

<p>
I will explain this proof in detail in the section <a href="#proc">A Procedural Proof</a> below. For now, the important thing to note here is simply this: <em>Presented in this way, the procedural proof is completely unintelligible.</em> To make sense of procedural proofs, they have to be run interactively. I will walk you through such an interactive run of this proof below and try to explain what is going on in the process. The gist of it is this: Procedural proofs like this one consist of a sequence of proof tactics. Tactics are essentially functions like <code>REWRITE_TAC</code> that are written in OCaml and that produce a part of the proof as their output. They may take pre-proved theorems like <code>FUN_EQ_THM</code> as their arguments.
</p>

<p>
This way of writing proofs is opposite to the way humans write informal proofs. Take for example an equational proof, i.e., a proof done by rewriting a term step by step to show an equality. Humans would write down the intermediate expressions obtained during the process. In the procedural style, you write down the <em>rule</em> you apply to move from one expression to the next.
</p>

<p>
While in some ways, this procedural style of <em>carrying out</em> a proof may in fact be closer to how humans think about proofs, this procedural notation has huge drawbacks when it comes to <em>communicating</em> proofs. To me, the most important drawback is that <em>the meaning of the proof is hidden almost entirely within the library of tactics and theorems</em> that it is built upon. Without constantly referring to a dictionary of all these <code>ALL_CAPS_SYMBOLS</code> it impossible to read or write these proofs at all. This is problematic insofar as it adds an additional layer of complexity to the problem of reading or writing a proof: You not only have to know the subject matter, you also have to bind yourself to a particular &#8220;API&#8221;. This not only makes proofs less human readable, it also makes procedural proofs stored in this fashion <a href="http://vimeo.com/22669718">&#8220;bit-rot at an alarming rate&#8221;</a>.
</p>

<p>
Of course, the procedural style also has its advantages, most importantly the way it lends itself to automation of proof methods. However, as I stated in the beginning, my primary concern is the translation of everyday informal mathematical articles into a formal language. Which brings us to the declarative proof style.
</p>

<p>
The declarative version of the proof that I came up with is the following:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let GF_RECIP_EXPLICIT_FORM = thm `;
</span><span class='line'>  !(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)
</span><span class='line'>  proof
</span><span class='line'>    let f be num-&gt;real;
</span><span class='line'>    assume ~(f 0 = &0) [1];
</span><span class='line'>    !n. sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0)
</span><span class='line'>    proof
</span><span class='line'>      sum (0..0) (\k. f k * recip f (0 - k)) = f 0 * recip f (0 - 0) by NUMSEG_SING,SUM_SING;
</span><span class='line'>        .= f 0 * recip f 0;
</span><span class='line'>        .= f 0 * &1 / f 0 by recip;
</span><span class='line'>        .= f 0 / f 0;
</span><span class='line'>        .= &1 by REAL_DIV_REFL,1;
</span><span class='line'>        .= (if 0 = 0 then &1 else &0) [2];
</span><span class='line'>      !n. sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0)
</span><span class='line'>          ==&gt; sum (0..SUC n) (\k. f k * recip f (SUC n - k)) = (if SUC n = 0 then &1 else &0) [3]
</span><span class='line'>      proof
</span><span class='line'>        let n be num;
</span><span class='line'>        assume sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0);
</span><span class='line'>        !x. ~(x = &0) ==&gt; !a. x * -- (&1 / x) * a = -- a [4];
</span><span class='line'>        sum (0..SUC n) (\k. f k * recip f (SUC n - k)) = (\k. f k * recip f (SUC n - k)) 0 + sum (0 + 1..SUC n) (\k. f k * recip f (SUC n - k)) by SUM_CLAUSES_LEFT,LE_0;
</span><span class='line'>          .= (f 0 * recip f (SUC n)) + sum (1..SUC n) (\k. f k * recip f (SUC n - k)) by ADD_0,SUB_0,ADD_AC; 
</span><span class='line'>          .= (f 0 * recip f (n + 1)) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k));
</span><span class='line'>          .= (f 0 * -- (&1/(f 0)) * sum (1..(n + 1)) (\k. (f k) * recip f ((n + 1) - k))) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k)) by recip;
</span><span class='line'>          .= -- sum (1..(n + 1)) (\k. (f k) * recip f ((n + 1) - k)) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k)) by 1,4;
</span><span class='line'>          .= &0;
</span><span class='line'>          .= (if SUC n = 0 then &1 else &0);
</span><span class='line'>      qed;
</span><span class='line'>    qed by INDUCT_TAC from 2,3;
</span><span class='line'>    (\n. sum (0..n) (\k. f k * recip f (n - k))) = (\n. (if n = 0 then &1 else &0)) [5] by FUN_EQ_THM;
</span><span class='line'>  qed by gf_reciprocal,gf_times,gf_one,1 from 5;
</span><span class='line'>`;;</span></code></pre></td></tr></table></div></figure>

<p>
To my eye, this looks wonderful! This is an entirely formal proof, that 
<ul>
<li>
is very close to the informal version,
</li>
<li>
is not that much longer than the informal version,
</li>
<li>
is human readable,
</li>
<li>
uses very few references to an external &#8220;dictionary&#8221; or &#8220;API&#8221; (not all steps have to be justified!),
</li>
<li>
and all external references refer to theorems and not to tactics.
</li>
</ul>
On top of that, I had a much, <em>much</em> easier time writing this proof than writing the procedural version.
</p>

<p>
Of course there are still many aspects that can be improved. First of all, while this ASCII syntax is quite readable (much more readable than LaTeX anyway), the ability to edit a fully typeset version of the proof would be a pleasant convenience. I will definitely look into creating a <a href="http://blog.felixbreuer.net/2012/03/11/qute.html">custom transformer</a> for <a href="http://www.inkcode.net/qute">Qute</a> for this syntax.
</p>

<p>
More importantly, some steps in this proof seem unnecessarily small. For example, when calculating <code>sum (0..0) (\k. f k * recip f (0 - k))</code>, it would be great to go directly to <code>f 0 * recip f 0</code> without using <code>f 0 * recip f (0 - 0)</code> as a stepping stone. In a similar vein, I would like to avoid stating trivial lemmas like <code>!x. ~(x = &0) ==> !a. x * -- (&1 / x) * a = -- a</code> explicitly, since in the line where it is used, it is easy to infer from context what lemma is needed here. Finally, I think it is very important to reduce API dependencies even further and so I would like to drop explicit references to such &#8220;trivial&#8221; library theorems as <code>ADD_0</code> or <code>ADD_AC</code>.
</p>

<p>
More details about the declarative proof system and the construction of this proof make up the last part of this post.
</p>

<p>
On the whole, I am <em>extremely</em> impressed with the state of current formal proof systems. While a lot remains to be done until everyday mathematicians not specialized in formal proof can routinely produce formal versions of their papers, this dream appears to be almost within reach.
</p>

<p>
After this summary, I am now going to get my hands dirty and explain all of this in detail.
</p>

<h2><a name="hol"></a>Meeting HOL Light</h2>

<p>
The proof system I used for these experiments is <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/">HOL Light</a>. HOL stands for &#8220;higher order logic&#8221; which basically means classical mathematical logic with the additional feature that quantifiers can range over functions as well and not only over elements of the ground set. (In practice, working with formal higher order logic is not too different from the mix of &#8220;colloquial&#8221; classical logic and set theory that I, as a mathematician not specialized in logic, am used to working with.) Higher order logic is one of the standard foundations of mathematics used in the formal proof community and several major proof systems such as <a href="http://www.cl.cam.ac.uk/research/hvg/isabelle/">Isabelle/HOL</a>, <a href="http://hol.sourceforge.net/">HOL4</a>, <a href="http://www.lemma-one.com/ProofPower/index/index.html">ProofPower</a> and <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/">HOL Light</a> work with it.
</p>

<p>
In this post, I will not assume familiarity with HOL Light and I hope to keep things reasonably self-contained. Nonetheless, I want to recommend some references as starting points for further reading: <a href="http://www.cs.ru.nl/~freek/">Freek Wiedijk</a> has done some very helpful work comparing and contrasting the different provers out there, see for example the list of the <a href="http://www.cs.ru.nl/~freek/comparison/comparison.pdf">Seventeen Provers of the World</a> which he compiled. To get started with HOL Light, I recommend the great <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/tutorial_220.pdf">HOL Light Tutorial</a> by <a href="http://www.cl.cam.ac.uk/~jrh13/">John Harrison</a>. When doing a proof, it is useful to have the <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/holchart.pdf">quick reference</a> at hand.
</p>

<p>
Installing HOL Light is non-trivial. First, you need to have a working installation of <a href="http://caml.inria.fr/ocaml/index.en.html">OCaml</a>. Second, you will need <a href="http://pauillac.inria.fr/~ddr/camlp5/">Camlp5</a>, which has to be compiled with the <code>-strict</code> configuration option. This is often not the case for camlp5 packages that ship with major Linux distributions. Third, you need to fetch HOL Light from its SVN repository and compile it. I will not walk through these steps in detail, but I can recommend a <a href="https://bitbucket.org/akrauss/hol-light-workbench/src/6223418e08a3/setup">script</a> by Alexander Krauss that does these things for you (and that you can read if you need instructions on how to do this by hand).
</p>

<p>
After everything is installed, you run OCaml from the HOL Light source directory and then, from the OCaml toplevel, start HOL Light with the command
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>#use "hol.ml";;</span></code></pre></td></tr></table></div></figure>
HOL Light will need about a minute to start and will generate lots of output in the process.
</p>

<p>In the rest of this section, I will give a <em>very</em> short summary of the basics of HOL Light. As an introduction to HOL Light, this whirlwind tour is of course woefully inadequate. It is mainly intended as a brief orientation for readers unfamiliar with HOL who do not want to read the <a href="http://www.cl.cam.ac.uk/~jrh13/hol-light/tutorial_220.pdf">tutorial</a> first. Either way, I hope that these brief notes will help in making sense of the exercise that this post is about.</p>

<ul>
<li style="margin-top:1em;">
Proofs in HOL Light are typically developed interactively at the OCaml toplevel.
</li>
<li style="margin-top:1em;">
In HOL Light, mathematical expressions in higher order logic are enclosed in backquotes. These expressions have the OCaml type <code>term</code>. For example, if you enter <code>`1 + 1 = 2`</code> at the OCaml toplevel (followed by two semicolons and return) you will see:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># `1 + 1 = 2`;;
</span><span class='line'>val it : term = `1 + 1 = 2`</span></code></pre></td></tr></table></div></figure>
</li>
<li style="margin-top:1em;">
The HOL Light syntax for higher order logic is straightforward. For example the principle of induction on the natural numbers
\[
\forall P: P(0) \wedge \left( \forall n: P(n) \Rightarrow P(S(n)) \right) \Rightarrow (\forall n. P(n))
\]
would be written as
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>!P. P 0 /\ (!n. P n ==&gt; P (SUC n)) ==&gt; (!n. P n)</span></code></pre></td></tr></table></div></figure>
where <code>SUC</code> is a predefined constant, $\forall$ is written as <code>!</code> and $\wedge$ is written as <code>/\</code>. Here is the notation for some other useful symbols: $\exists$ is written as <code>?</code>, $\vee$ is written as <code>\/</code>, $\neg$ is written as <code>~</code> and $\Leftrightarrow$ is written as <code><=></code>. Lambda expressions are written using <code>\</code>, e.g., $\lambda x. x + 1$ is written as <code>\x. x + 1</code>.
</li>
<li style="margin-top:1em;">
Higher order logic in HOL Light is typed. As long as HOL Light can figure out the types on its own, you don&#8217;t need to specify them. If you want to give type information explicitly, you can use the colon. For example, here is the principle of induction on lists:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>!P:(A)list-&gt;bool. P [] /\ (!h t. P t ==&gt; P (CONS h t)) ==&gt; !l. P l</span></code></pre></td></tr></table></div></figure>
</li>
<li style="margin-top:1em;">
Theorems in HOL Light are objects of type <code>thm</code>. The only way to produce an object of type theorem in HOL Light is to <em>prove</em> that theorem.
</li>
<li style="margin-top:1em;">
Inference rules are special OCaml functions that produce theorems. They encapsulate proof methods. For example <code>ARITH_RULE</code> is a function of type <code>term->thm</code> that uses linear arithmetic methods to prove statements about natural numbers. For example we can produce the theorem $\vdash 1 + 1 = 2$ by
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># ARITH_RULE `1 + 1 = 2`;;
</span><span class='line'>val it : thm = |- 1 + 1 = 2</span></code></pre></td></tr></table></div></figure>
or we can produce the theorem $x > 0 \vdash x \geq 1$ by
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># UNDISCH (ARITH_RULE `x &gt; 0 ==&gt; x &gt;= 1`);;
</span><span class='line'>val it : thm = x &gt; 0 |- x &gt;= 1</span></code></pre></td></tr></table></div></figure>
where <code>UNDISCH</code> takes a theorem of the form $\vdash p \Rightarrow q$ and produces the theorem $p \vdash q$.
</li>
<li style="margin-top:1em;">
A <code>goal</code> captures a claim of the form $p_1,\ldots,p_n\vdash q$ that we are currently trying to prove but have not proved yet. In the HOL Light documentation, the distinction is made clear using the <code>?-</code> notation, e.g., the <em>goal</em> that $x > 0 \vdash x \geq 1$ might be written as <code>x > 0 ?- x >= 1</code>. On the OCaml toplevel (a stack of goals containing) this goal would be printed as:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`x &gt; 0`]
</span><span class='line'>
</span><span class='line'>`x &gt;= 1`</span></code></pre></td></tr></table></div></figure>
where the expression in square brackets represents the assumption of that goal.
</li>
<li style="margin-top:1em;">
A <code>tactic</code> is a function that (essentially) takes a goal and produces a list of subgoals, such that a proof of all subgoals produces a proof of the original goal. This allows backward proofs. These are the typical way of working with HOL Light.
</li>
<li style="margin-top:1em;">An example. Suppose we want to prove $x\not=0 \Rightarrow 1 \leq x$ using the lemma $0 < x \Rightarrow 1 \leq x$. We store the lemma in an OCaml variable.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># let lemma = ARITH_RULE `0 &lt; x ==&gt; 1 &lt;= x`;;
</span><span class='line'>val lemma : thm = |- 0 &lt; x ==&gt; 1 &lt;= x</span></code></pre></td></tr></table></div></figure>
Then we set up our goal with the function <code>g</code>.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># g `~(x=0) ==&gt; 1 &lt;= x`;;                   
</span><span class='line'>Warning: Free variables in goal: x
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>`~(x = 0) ==&gt; 1 &lt;= x`</span></code></pre></td></tr></table></div></figure>
Next we apply the tactic <code>DISCH_TAC</code> using the function <code>e</code>. This reduces the goal $\vdash x\not=0 \Rightarrow 1 \leq x$ to $x\not=0 \vdash 0 \Rightarrow 1$.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e DISCH_TAC;; 
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(x = 0)`]
</span><span class='line'>
</span><span class='line'>`1 &lt;= x`</span></code></pre></td></tr></table></div></figure>
Now we apply our lemma to &#8220;simplify&#8221; the conclusion of our goal, using <code>MATCH_MP_TAC</code> which is of type <code>thm->tactic</code>. <code>MATCH_MP_TAC</code> uses the theorem $\vdash p \Rightarrow q$ to reduce the goal $\vdash q$ to $\vdash p$, making instantiations as necessary.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(MATCH_MP_TAC(lemma));;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(x = 0)`]
</span><span class='line'>
</span><span class='line'>`0 &lt; x`</span></code></pre></td></tr></table></div></figure>
What is now left to prove is the content of the theorem <code>LT_NZ</code> in the library.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># LT_NZ;;
</span><span class='line'>val it : thm = |- !n. 0 &lt; n &lt;=&gt; ~(n = 0)</span></code></pre></td></tr></table></div></figure>
We make use of this theorem via <code>ASM_REWRITE_TAC</code> of type <code>thm list -> tactic</code>, which rewrites goals by the list of (equational) theorems it is passed, taking assumptions into account.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(ASM_REWRITE_TAC[LT_NZ]);;
</span><span class='line'>val it : goalstack = No subgoals</span></code></pre></td></tr></table></div></figure>
The statement that there are no subgoal left, means that the proof is complete. We can get the theorem we just proved using <code>top_thm</code>.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># top_thm();;
</span><span class='line'>val it : thm = |- ~(x = 0) ==&gt; 1 &lt;= x</span></code></pre></td></tr></table></div></figure>
(Note that this example is non-sensical insofar as we could have used <code>ARITH_RULE</code> to solve our goal immediately.)
</li>
<li>
If you make a mistake during one of these goalstack-style proofs, you can use <code>b</code> to back up one step, by calling <code>b();;</code>.
</li>
</ul>

<p>
After this minimal introduction to HOL Light, we can now turn to formalizing the above proof.
</p>

<h2><a name="defs"></a>Formal Definitions</h2>

<p>
Before we can start with the proof proper, however, we need to make a couple of definitions.
</p>

<p>
For the purposes of this exercise a formal power series or generating function will be simply a map $f:\mathbb{N}\rar\mathbb{R}$. Of course you could also view $f$ as a sequence of real numbers or, classically, as the sequence of coefficients of a power series. Addition of formal power series is defined componentwise, i.e., $(f+g)(n)=f(n)+g(n)$, which in HOL Light looks as follows:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gf_plus = new_definition `gf_plus = \(f:num-&gt;real) (g:num-&gt;real) (n:num). (f n) + (g n) :real`;;</span></code></pre></td></tr></table></div></figure>
This simply means that <code>gf_plus</code> is a function that takes two generating functions and returns the generating function that is the componentwise sum of the arguments. 
</p>

<p>
The product of two generating functions is defined via the Cauchy product rule
\[
  (f\cdot g)(n) = \sum_{k=0}^n f(k)\cdot g(n-k).
\]
This looks much more natural when phrased in terms of formal series and this is the reason why formal power series are traditionally written in power series notation:
\[
  \sum_{n\geq 0}a_nx^n \cdot \sum_{n\geq 0} b_n x^n = \sum_{n\geq0} \left(\sum_{k=0}^n a_k b_{n-k}\right) x^n.
\]
Personally, I think of this &#8220;product&#8221; more as a &#8220;Minkowski sum&#8221;, but that will be the subject of another blog post. The HOL Light version of this definition is straightforward:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gf_times = new_definition `gf_times = \(f:num-&gt;real) (g:num-&gt;real) (n:num). (sum (0 .. n) (\k. (f k)*(g (n-k)))) :real`;;</span></code></pre></td></tr></table></div></figure>
</p>

<p>
Next, we define a constant <code>gf_one</code> which represents the formal power series $1$, i.e., the function $f$ with $f(0)=1$ and $f(n)=0$ for all other $n$.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gf_one = new_definition `gf_one = \(n:num). if n = 0 then &1 else &0`;;</span></code></pre></td></tr></table></div></figure>
</p>

<p>
Now, it is straightforward to define a binary relation <code>gf_reciprocal</code> that specifies when a generating function $g$ is the reciprocal of a generating function $f$, that is, $f\cdot g = 1$.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gf_reciprocal = new_definition `gf_reciprocal = \(f:num-&gt;real) (g:num-&gt;real). gf_times f g = gf_one`;;</span></code></pre></td></tr></table></div></figure>
</p>

<p>
Finally, the theorem we will prove contains a recursive formula for the reciprocal of a generating function $f$, namely:
\begin{eqnarray*}
b_0 & = & \frac{1}{a_0} \cr
b_n & = & -\frac{1}{a_0}\sum_{k = 1}^n a_k b_{n-k} \; \forall n\geq 1
\end{eqnarray*}
We will use the shorthand <code>recip f</code> to denote the function defined by this recursive formula.
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let recip = define `recip f (0:num) =  ((&1:real)/(f 0) :real) /\  recip f (n+1) = -- (&1/(f 0)) * sum (1..(n+1)) (\k. (f k) * recip f ((n + 1) - k))`;;</span></code></pre></td></tr></table></div></figure>
</p>

<p>
Note that these definitions all return theorems. In addition they have the side effect of modifying the OCaml variable <code>the_definitions</code>, see <code>fusion.ml</code>. This has the drawback that you cannot change existing definitions within a running HOL Light session. You will have to restart HOL Light to change definitions. (If you want to learn more about definitions and state in HOL, you may want to look at <a href="http://www.lemma-one.com/papers/hcddr.pdf">these</a> <a href="http://arxiv.org/abs/1103.3322v1">papers</a>.)
</p>


<h2><a name="proc"></a>A Procedural Proof</h2>

<p>
The theorem that we want to prove says that if $f(0)\not= 0$ then $\text{recip}(f)$, as defined in the previous section, is a reciprocal of $f$. In HOL this statement reads simply as follows.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>!(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)</span></code></pre></td></tr></table></div></figure>

<p>
Note that <code>0</code> refers to the natural number $0$, whereas <code>&0</code> refers to the real number $0$ - which are distinct in HOL. Real number literals always have to be prefixed with <code>&</code> in HOL. The type annotations given above are not essential. We could also write simply <code>!f. ~(f 0 = &0) ==> gf_reciprocal f (recip f)</code>.
</p>

<p>
In this section, we will go through the procedural proof given in the summary at the beginning step by step, and take a look at the goalstack at each point. If you want to expand other proofs in a similar fashion, you may want to take a look at the tool <a href="http://www.proof-technologies.com/tactician/index.html">Tactician</a>.
</p>

<p>
We start out by pushing the theorem we want to prove onto the goalstack.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># g `!(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)`;;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>`!f. ~(f 0 = &0) ==&gt; gf_reciprocal f (recip f)`</span></code></pre></td></tr></table></div></figure>

<p>
Next, we eliminate the universal quantifier and the implication, turning $f(0) \not = 0$ into an assumption, and we expand the definitions. 
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(GEN_TAC);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>`~(f 0 = &0) ==&gt; gf_reciprocal f (recip f)`
</span><span class='line'>
</span><span class='line'># e(DISCH_TAC);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`gf_reciprocal f (recip f)`
</span><span class='line'>
</span><span class='line'>#  e(REWRITE_TAC[gf_reciprocal;gf_times;gf_one]);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`(\n. sum (0..n) (\k. f k * recip f (n - k))) =
</span><span class='line'> (\n. if n = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
We have to show that two functions are equal. This boils down to showing that their values are equal for all arguments. This is the content of <code>FUN_EQ_THM</code>, which we apply using <code>REWRITE_TAC</code>.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(REWRITE_TAC[FUN_EQ_THM]);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`!x. sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
Now we start working at the heart of the problem. Just as in the informal proof, we are going to use induction, even though a more elementary case analysis would work as well. To use induction we apply <code>INDUCT_TAC</code> which leaves us with two subgoals: The base of the induction and the induction step.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(INDUCT_TAC);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 2 subgoals (2 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>
</span><span class='line'>`sum (0..SUC x) (\k. f k * recip f (SUC x - k)) =
</span><span class='line'> (if SUC x = 0 then &1 else &0)`
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`sum (0..0) (\k. f k * recip f (0 - k)) = (if 0 = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
We start working on the base of the induction, i.e., the second subgoal. All we simplify the equality we have to prove, by evaluating the <code>if .. then .. else ..</code> and using the fact that the sum over an interval that contains just $0$ can be obtained by evaluating the expression we sum over at $0$. This latter fact follows from the lemmas <code>NUMSEG_SING</code> and <code>SUM_SING</code>. 
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(ASM_SIMP_TAC[NUMSEG_SING;SUM_SING]);;
</span><span class='line'>val it : goalstack = 1 subgoal (2 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * recip f (0 - 0) = &1`</span></code></pre></td></tr></table></div></figure>

<p>
The next couple of steps are about calculating with numbers and we use a couple of different methods for doing so. <code>NUM_REDUCE_CONV</code> is a so-called conversion, that can be used to simplify expressions as part of a bigger expression, and conversions can be turned into tactics using <code>CONV_TAC</code>. <code>NUM_REDUCE_CONV</code> evaluates expressions over natural numbers and this allows us to reduce $0-0$ to $0$, without knowing the name of a lemma in the HOL library that says so. Afterward, we expand <code>recip</code> according to its definition.  
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(CONV_TAC NUM_REDUCE_CONV);;
</span><span class='line'>val it : goalstack = 1 subgoal (2 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * recip f 0 = &1`
</span><span class='line'>
</span><span class='line'># e(REWRITE_TAC[recip]);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (2 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * &1 / f 0 = &1`</span></code></pre></td></tr></table></div></figure>

<p>
Next, we want to go from $f(0)\cdot \frac{1}{f(0)}$ to $\frac{f(0)}{f(0)}$. Again we don&#8217;t know the exact name of a lemma in the library that allows us to get there. However, the library does contain a general purpose inference rule <code>REAL_ARTIH</code> that can prove certain identities of real numbers automatically. We use this to prove the lemma we need on the fly. After this, all that is left to show is that $\frac{f(0)}{f(0)}=1$ under the assumption that $f(0)\not=0$. The appropriate lemma in the library is <code>REAL_DIV_REFL</code>. To apply it, we use <code>ASM_SIMP_TAC</code> which uses not only the theorem it is passed as argument, but also takes into account the available assumptions. This, then, completes our proof of the base of the induction, and we continue to the next goal on the stack: the induction step.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(SIMP_TAC[REAL_ARITH `x * &1 / x = x / x`]);;
</span><span class='line'>val it : goalstack = 1 subgoal (2 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 / f 0 = &1`
</span><span class='line'>
</span><span class='line'># e(ASM_SIMP_TAC[REAL_DIV_REFL]);;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>
</span><span class='line'>`sum (0..SUC x) (\k. f k * recip f (SUC x - k)) =
</span><span class='line'> (if SUC x = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
The first thing that we want to do here is to split off the first summand of the sum. The theorem in the library that says we can split off the first term in a sum is <code>SUM_CLAUSES_LEFT</code>.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># SUM_CLAUSES_LEFT;;
</span><span class='line'>val it : thm = |- !f m n. m &lt;= n ==&gt; sum (m..n) f = f m + sum (m + 1..n) f</span></code></pre></td></tr></table></div></figure>

<p>
We want to use this theorem for $f=\lambda k. f(k)\cdot \text{recip}(f,x-k)$, $m=0$ and $n=n$. We can achieve these specializations as follows. Here <code>LE_0</code> is the theorem $\forall n. 0 \leq n$ and <code>SPEC_ALL LE_0</code> is simply the theorem $0 \leq n$. Note that $n$ refers to a natural number here.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># let sum_lemma = (SPEC `(\k. f k * recip f (x - k))` SUM_CLAUSES_LEFT);;
</span><span class='line'>val sum_lemma : thm =
</span><span class='line'>  |- !m n.
</span><span class='line'>         m &lt;= n
</span><span class='line'>         ==&gt; sum (m..n) (\k. f k * recip f (x - k)) =
</span><span class='line'>             (\k. f k * recip f (x - k)) m +
</span><span class='line'>             sum (m + 1..n) (\k. f k * recip f (x - k))
</span><span class='line'># let split_sum_lemma = MATCH_MP sum_lemma (SPEC_ALL LE_0);;
</span><span class='line'>val split_sum_lemma : thm =
</span><span class='line'>  |- sum (0..n) (\k. f k * recip f (x - k)) =
</span><span class='line'>     (\k. f k * recip f (x - k)) 0 +
</span><span class='line'>     sum (0 + 1..n) (\k. f k * recip f (x - k))</span></code></pre></td></tr></table></div></figure>

<p>
We use our <code>split_sum_lemma</code> to split the sum in question. After some simplifications, the first occurrence of $\text{recip}$ in the expression is in the exact form we need in order to be able to apply the recursive definition of $\text{recip}$.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(REWRITE_TAC[split_sum_lemma]);;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * recip f (SUC x - 0) +
</span><span class='line'> sum (0 + 1..SUC x) (\k. f k * recip f (SUC x - k)) =
</span><span class='line'> (if SUC x = 0 then &1 else &0)`
</span><span class='line'>
</span><span class='line'># e(REWRITE_TAC[SUB_0;ADD_0;ADD_AC;ADD1]);;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * recip f (x + 1) + sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) =
</span><span class='line'> (if x + 1 = 0 then &1 else &0)`
</span><span class='line'>
</span><span class='line'># e(REWRITE_TAC[recip]);;
</span><span class='line'>
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>
</span><span class='line'>`f 0 * --(&1 / f 0) * sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) +
</span><span class='line'> sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) =
</span><span class='line'> (if x + 1 = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
Now we want to cancel the two occurrences of $f(0)$ in the numerator and the denominator. Standard facilities for working with expressions of real numbers, such as <code>REAL_RAT_REDUCE_CONV</code>, do not suffice here, as we have to take the assumption that $f(0)\not=0$ into account. However, the lemma that we need in this situation can be proved automatically by <code>REAL_FIELD</code>.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>#  let calc_lemma = (REAL_FIELD `!x. ~(x = &0) ==&gt; !a. x * -- (&1 / x) * a = -- a`);;
</span><span class='line'>2 basis elements and 0 critical pairs
</span><span class='line'>3 basis elements and 1 critical pairs
</span><span class='line'>3 basis elements and 0 critical pairs
</span><span class='line'>val calc_lemma : thm = |- !x. ~(x = &0) ==&gt; (!a. x * --(&1 / x) * a = --a)</span></code></pre></td></tr></table></div></figure>

<p>
We need to specialize this lemma to make use of it. The expression <code>FIRST_ASSUM (ASSUME_TAC o (MATCH_MP calc_lemma))</code> is idiomatic for this purpose. <code>FIRST_ASSUM tac</code> tries to apply the tactic <code>tac</code> to each assumption in turn, until it finds one on which <code>tac</code> succeeds. In our case <code>ASSUME_TAC o (MATCH_MP calc_lemma)</code> succeeds immediately on the first assumption. <code>MATCH_MP calc_lemma</code> applied to the assumption <code>~(f 0 = &0)</code> makes the substitution $x=f(0)$ in <code>calc_lemma</code> and produces the theorem <code>!a. f 0 * --(&1 / f 0) * a = --a</code>. This is then added as an assumption to our goal by <code>ASSUME_TAC</code>. Afterward, <code>ASM_REWRITE_TAC</code> is able to perform the simplification we intended.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(FIRST_ASSUM (ASSUME_TAC o (MATCH_MP calc_lemma)));;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>  2 [`!a. f 0 * --(&1 / f 0) * a = --a`]
</span><span class='line'>
</span><span class='line'>`f 0 * --(&1 / f 0) * sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) +
</span><span class='line'> sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) =
</span><span class='line'> (if x + 1 = 0 then &1 else &0)`
</span><span class='line'>
</span><span class='line'># e(ASM_REWRITE_TAC[]);;
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>  2 [`!a. f 0 * --(&1 / f 0) * a = --a`]
</span><span class='line'>
</span><span class='line'>`--sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) +
</span><span class='line'> sum (1..x + 1) (\k. f k * recip f ((x + 1) - k)) =
</span><span class='line'> (if x + 1 = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
For the last simplification we again create the necessary theorem on the fly, without looking it up in the library.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(SIMP_TAC[REAL_FIELD `--a + a = &0`]);;
</span><span class='line'>1 basis elements and 0 critical pairs
</span><span class='line'>val it : goalstack = 1 subgoal (1 total)
</span><span class='line'>
</span><span class='line'>  0 [`~(f 0 = &0)`]
</span><span class='line'>  1 [`sum (0..x) (\k. f k * recip f (x - k)) = (if x = 0 then &1 else &0)`]
</span><span class='line'>  2 [`!a. f 0 * --(&1 / f 0) * a = --a`]
</span><span class='line'>
</span><span class='line'>`&0 = (if x + 1 = 0 then &1 else &0)`</span></code></pre></td></tr></table></div></figure>

<p>
The last thing we need to do is to show that the right-hand side of this equality is $0$, using the fact that $x+1\not=0$ for any natural number $x$. The proof is then complete and we can retrieve the theorem we just proved using <code>top_thm</code>.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># e(ASM_SIMP_TAC[ARITH_RULE `~(x + 1 = 0)`]);;
</span><span class='line'>val it : goalstack = No subgoals
</span><span class='line'>
</span><span class='line'># top_thm();;
</span><span class='line'>val it : thm = |- !f. ~(f 0 = &0) ==&gt; gf_reciprocal f (recip f)</span></code></pre></td></tr></table></div></figure>

<p>
As we can see, running the procedural proof interactively is crucial to understanding what the proof does. However, working through this exercise, I have often found it excruciatingly hard to perform even simple manipulations of the goalstack in the way I intended. My understanding of HOL&#8217;s library of theorems and tactics has to improve considerably, before I can become effective at this. Fortunately, working with declarative proofs was much easier for me.
</p>


<h2><a name="miz"></a>Mizar in HOL: miz3</h2>

<p>
The <a href="http://mizar.org/">Mizar</a> system pioneered declarative proof languages, and has a lasting influence on declarative proof languages in other systems, such as the <a href="http://isabelle.in.tum.de/Isar/">Isar</a> language that is part of <a href="http://www.cl.cam.ac.uk/research/hvg/Isabelle/">Isabelle</a> or the various variants of Mizar implementations for the HOL family of provers. The latest incarnation of Mizar for HOL Light is <a href="http://www.cs.ru.nl/~freek/miz3/miz3.pdf">miz3</a> by Freek Wiedijk.
</p>

<p>
As you can see from the declarative version of the proof given in the introduction, Mizar-style proofs are largely self-explanatory. Of course some elements still require explanation, but I will not go through them in detail here. Instead I want to refer you directly to Freek&#8217;s <a href="http://www.cs.ru.nl/~freek/miz3/miz3.pdf">paper</a>. Instead, I will use this section to give some tips for installing and using miz3. These tips refer to the version of miz3 available at the time of publication of this post (miz3 releases do not appear to be numbered).
</p>

<ul>
<li>
You can get miz3 from <a href="http://www.cs.ru.nl/~freek/miz3/miz3.tar.gz">here</a>. To use miz3, all you need to do is to extract <code>miz3.ml</code> from the archive and place it in your HOL Light source directory.
</li>
<li>
miz3 comes with a Vim interface. This interface is very lightweight and its use is not required: You can always paste miz3 code into your OCaml toplevel. But these notes are mainly about using miz3 via Vim. To install the Vim interface, you need to 
<ul>
<li>
place the two executables <code>miz3</code> and <code>miz3f</code> from the <code>bin/</code> subdirectory of the miz3 distribution on your path, and
</li>
<li>
add <code>source /path/to/exrc</code> to your <code>.vimrc</code>, where the path points to the file <code>exrc</code> from the miz3 distribution.
</li>
</ul>
</li>
<li>
To use miz3, you need to start the OCaml toplevel using the command <code>ocaml unix.cma</code>. On the toplevel, first run <code>#use "hol.ml";;</code> and then <code>#use "miz3.ml";;</code>. This automatically starts the miz3 server and you can begin using Vim.
</li>
<li>
In Vim, you can press Ctrl-C RET to send paragraphs of code (delimited by blank lines) to the OCaml toplevel. Error reports are then displayed <em>right in the Vim buffer</em>. However, <em>some errors are not</em>. So you should always keep an eye on your toplevel!
</li>
<li>
You should keep the paragraphs you send to miz3 minimal: Separate your miz3 proofs and your <code>(* OCaml comments *)</code> with a blank line. Do the same for definitions and proofs. Otherwise miz3 may throw errors that only appear on the toplevel.
</li>
<li>
<code>GOAL_TAC</code> is another very useful tool to know about in a declarative proof. If you want to know, what exact goal you have to prove at any given step of you declarative proof, you can add <code>by GOAL_TAC</code> to the end of the line. After the declarative proof has been processed by miz3 you can inspect the goal at that point by running <code>p();;</code> at the toplevel. This works no matter if you proof has been successful or not. As <code>GOAL_TAC</code> is a tactic, it is very flexible and can be used in procedural proofs or as part of a more complicated tactic as well.
</li>
</ul>

<p>
After these introductory comments, we can now go on to the declarative version of the proof. 
</p>

<h2><a name="decl"></a>A Declarative Proof</h2>

<p>
Using a vanilla installation of HOL Light and miz3, a declarative version of the proof might look like this.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let GF_RECIP_EXPLICIT_FORM = thm `;
</span><span class='line'>  !(f:num-&gt;real). ~(f (0:num) = (&0:real)) ==&gt; gf_reciprocal f (recip f)
</span><span class='line'>  proof
</span><span class='line'>    let f be num-&gt;real;
</span><span class='line'>    assume ~(f 0 = &0) [1];
</span><span class='line'>    !n. sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0)
</span><span class='line'>    proof
</span><span class='line'>      sum (0..0) (\k. f k * recip f (0 - k)) = f 0 * recip f (0 - 0) by NUMSEG_SING,SUM_SING;
</span><span class='line'>        .= f 0 * recip f 0;
</span><span class='line'>        .= f 0 * &1 / f 0 by recip;
</span><span class='line'>        .= f 0 / f 0;
</span><span class='line'>        .= &1 by REAL_DIV_REFL,1;
</span><span class='line'>        .= (if 0 = 0 then &1 else &0) [2];
</span><span class='line'>      !n. sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0)
</span><span class='line'>          ==&gt; sum (0..SUC n) (\k. f k * recip f (SUC n - k)) = (if SUC n = 0 then &1 else &0) [3]
</span><span class='line'>      proof
</span><span class='line'>        let n be num;
</span><span class='line'>        assume sum (0..n) (\k. f k * recip f (n - k)) = (if n = 0 then &1 else &0);
</span><span class='line'>        !x. ~(x = &0) ==&gt; !a. x * -- (&1 / x) * a = -- a [4] by REAL_FIELD;
</span><span class='line'>        sum (0..SUC n) (\k. f k * recip f (SUC n - k)) = (\k. f k * recip f (SUC n - k)) 0 + sum (0 + 1..SUC n) (\k. f k * recip f (SUC n - k)) by SUM_CLAUSES_LEFT,LE_0;
</span><span class='line'>          .= (f 0 * recip f (SUC n)) + sum (1..SUC n) (\k. f k * recip f (SUC n - k)) by ADD_0,SUB_0,ADD_AC; 
</span><span class='line'>          .= (f 0 * recip f (n + 1)) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k));
</span><span class='line'>          .= (f 0 * -- (&1/(f 0)) * sum (1..(n + 1)) (\k. (f k) * recip f ((n + 1) - k))) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k)) by recip;
</span><span class='line'>          .= -- sum (1..(n + 1)) (\k. (f k) * recip f ((n + 1) - k)) + sum (1..(n + 1)) (\k. f k * recip f ((n + 1) - k)) by 1,4;
</span><span class='line'>          .= &0;
</span><span class='line'>          .= (if SUC n = 0 then &1 else &0);
</span><span class='line'>      qed;
</span><span class='line'>    qed by INDUCT_TAC from 2,3;
</span><span class='line'>    (\n. sum (0..n) (\k. f k * recip f (n - k))) = (\n. (if n = 0 then &1 else &0)) [5] by REWRITE_TAC,FUN_EQ_THM;
</span><span class='line'>  qed by REWRITE_TAC,gf_reciprocal,gf_times,gf_one,1 from 5;
</span><span class='line'>`;;</span></code></pre></td></tr></table></div></figure>

<p>
Note that this version differs slightly from the declarative proof given at the beginning. The difference is that this version uses additional references to the HOL library, making explicit use of the tactics <code>REAL_FIELD</code> and <code>REWRITE_TAC</code>. The proof given in the introduction is a bit less verbose and it is tactic-free, i.e., it only references theorems and not tactics in the library. 
</p>

<p>
Why do I care about a proof being tactic-free? After all, the availability of proof tactics and the corresponding opportunities for automation are a great strength of procedural provers such as HOL Light? Well, on the one hand this exercise is about translating human-written proofs and not about automated reasoning. On the other hand, theorems used in <code>by</code> clauses can be stated in higher order logic and can thus be easily included in a <a href="http://www.gilith.com/research/opentheory/">prover-independent library</a>. Tactics, however, depend critically on the prover they were written for and are therefore less portable. I will write another post in the near future on why I think prover independence is so important.
</p>


<h2><a name="hacking"></a>Making Declarative Proofs more Self-Contained</h2>

<p>
In this section we will see how to tweak miz3 in order to eliminate the tactics <code>REWRITE_TAC</code> and <code>REAL_FIELD</code> from the above declarative proof.
</p>

<p>
First, we have to examine a bit more closely how miz3 proves each step in a declarative proof:
<ul>
<li>
If the <code>by</code> clause contains only theorems and no tactics (or if it is even empty altogether), then miz3 uses the tactic specified in the variable <code>default_prover</code> to prove this step. 
</li>
<li>
If the <code>by</code> clause contains a tactic, that tactic is used for the proof and the default prover is ignored.
</li>
</ul>
</p>

<p>
The standard default prover in miz3 is <code>HOL_BY</code>, which in turn was inspired by the prover contained in the original Mizar. <code>HOL_BY</code> resides in the file <code>Examples/holby.ml</code> in the HOL Light source directory (<em>not</em> the miz3 source directory). It is set as the default prover of miz3 at the very top of <code>miz3.ml</code>.
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let default_prover = ref ("HOL_BY", CONV_TAC o HOL_BY);;</span></code></pre></td></tr></table></div></figure>

<p>
<code>HOL_BY</code> is of type <code>thm list -> term -> thm</code> whence <code>CONV_TAC o HOL_BY</code> is of type <code>thm list -> tactic</code>, which is the type expected of a default prover.
</p>

<p>
We now turn to the task of eliminating the explicit reference to <code>REAL_FIELD</code> from the proof. The idea is to improve <code>HOL_BY</code> so that the default prover tries <code>REAL_FIELD</code> automatically. <code>REAL_FIELD</code> is an inference rule. So in order to find a suitable place for integrating <code>REAL_FIELD</code> into <code>HOL_BY</code>, we look for other inference rules in the <code>HOL_BY</code> source. Right at the beginning of the definition of the function <code>HOL_BY</code> itself, we find a bunch of conversions and inference rules. So we just include <code>REAL_FIELD</code> right after <code>REAL_ARITH</code>, like this:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let HOL_BY =
</span><span class='line'>  let BETASET_CONV =
</span><span class='line'>    TOP_DEPTH_CONV GEN_BETA_CONV THENC REWRITE_CONV[IN_ELIM_THM]
</span><span class='line'>  and BUILTIN_CONV tm =
</span><span class='line'>    try EQT_ELIM(NUM_REDUCE_CONV tm) with Failure _ -&gt;
</span><span class='line'>    try EQT_ELIM(REAL_RAT_REDUCE_CONV tm) with Failure _ -&gt;
</span><span class='line'>    try ARITH_RULE tm with Failure _ -&gt;
</span><span class='line'>    try REAL_ARITH tm with Failure _ -&gt;
</span><span class='line'>    try REAL_FIELD tm with Failure _ -&gt;
</span><span class='line'>    failwith "BUILTIN_CONV" in
</span><span class='line'>  fun ths tm -&gt;
</span><span class='line'>    ... etc. ...</span></code></pre></td></tr></table></div></figure>

<p>
And indeed, with this addition, we can remove <code>REAL_FIELD</code> from our declarative proof (after reloading <code>miz3.ml</code>).
</p>

<p>
Eliminating <code>REWRITE_TAC</code> from our proof turns out to be a bit more subtle. If we remove the explicit occurrences of <code>REWRITE_TAC</code> from the proof, we get an inference timeout. Does this imply that <code>REWRITE_TAC</code> can do something that <code>HOL_BY</code> cannot? No. Even if we replace <code>REWRITE_TAC</code> with <code>ALL_TAC</code>, the proof will succeed, even though <code>ALL_TAC</code> is the tactic that does nothing. The answer to this riddle lies in the code that miz3 wraps around the tactics it is given. This code we find in the function <code>tactic_of_by</code> in <code>miz3.ml</code>.
</p>

<p>
In <code>tactic_of_by</code> we find the block:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>   (try
</span><span class='line'>      0,((FILTER_ASSUMS (fun _,(x,_) -&gt; x &lt;&gt; "=") THEN
</span><span class='line'>        FILTER_ASSUMS
</span><span class='line'>         (fun n,(x,_) -&gt;
</span><span class='line'>            mem x labs or n &lt; hor or (n = 0 & mem "-" labs) or full_asl) THEN
</span><span class='line'>        MAP_ASSUMS (fun l,th -&gt; l,PURE_REWRITE_RULE sets th) THEN
</span><span class='line'>        MIZAR_NEXT' (PURE_REWRITE_TAC sets) THEN
</span><span class='line'>       (fun (asl',w' as g') -&gt;
</span><span class='line'>          let key = name,(map concl thms,map concl thms'),w' in
</span><span class='line'>          try
</span><span class='line'>            if grow then failwith "apply";
</span><span class='line'>            let e,th = apply (!just_cache) key in
</span><span class='line'>            if e = 0 then (ACCEPT_TAC th THEN NO_TAC) g' else
</span><span class='line'>            if e = 2 then raise Timeout else failwith "cached by"
</span><span class='line'>          with
</span><span class='line'>          | Failure "apply" -&gt;
</span><span class='line'>              try
</span><span class='line'>                let (_,_,just as gs) =
</span><span class='line'>                 ((fun g'' -&gt;
</span><span class='line'>                    let gs' = TIMED_TAC (!timeout) (tac thms) g'' in
</span><span class='line'>                    if grow then raise (Grown (steps_of_goals g gs'))
</span><span class='line'>                            else gs') THEN
</span><span class='line'>                  REPEAT (fun (asl'',_ as g'') -&gt;
</span><span class='line'>                    if subset asl'' asl' then NO_TAC g''
</span><span class='line'>                    else FIRST_ASSUM (UNDISCH_TAC o concl) g'') THEN
</span><span class='line'>                  TRY (FIRST (map ACCEPT_TAC thms'')) THEN
</span><span class='line'>                  REWRITE_TAC thms'' THEN NO_TAC) g' in
</span><span class='line'>                let th = just null_inst [] in
</span><span class='line'>                just_cache := (key |-&gt; (0,th)) !just_cache;
</span><span class='line'>                gs
</span><span class='line'>              with
</span><span class='line'>              | Grown _ as x -&gt; raise x
</span><span class='line'>              | x -&gt; if name &lt;&gt; "GOAL_TAC" then just_cache :=
</span><span class='line'>                    (key |-&gt; ((if x = Timeout then 2 else 1),TRUTH))
</span><span class='line'>                      !just_cache;
</span><span class='line'>                  raise x
</span><span class='line'>        )) g)</span></code></pre></td></tr></table></div></figure>

<p>
And the crucial piece in here is the line:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let gs' = TIMED_TAC (!timeout) (tac thms) g'' in</span></code></pre></td></tr></table></div></figure>

<p>
Here <code>tac</code> refers to either the tactic that was found in the <code>by</code> clause or the default prover. <code>TIMED_TAC</code> tries the tactic it is passed for a fixed amount of time. If the tactic does not succeed in the specified interval, a <code>Timeout</code> exception is raised and <em>the tactics that follow are never even tried.</em> As a consequence a long-running tactic such as <code>HOL_BY</code> may achieve less than a instantaneous tactic such as <code>ALL_TAC</code>, because the exception thrown by the former prevents the last few tactics in <code>tactic_of_by</code> from being called. A workaround, therefore, is to modify the default prover so that <code>HOL_BY</code> is tried for a fixed amount of time strictly less than the timeout. After that <code>HOL_BY</code> is aborted <em>without</em> raising an exception and the subsequent tactics given in <code>tactic_of_by</code> are still executed.
<p>

<p>
To implement this workaround, we add the following definition to then end of <code>miz3.ml</code> right before the definition of <code>reset_miz3</code>:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let TIMEOUT_HOL_BY = fun ths g -&gt; try TIMED_TAC 1 (CONV_TAC (HOL_BY ths)) g with Timeout -&gt; ALL_TAC g;;</span></code></pre></td></tr></table></div></figure>

<p>
This defines a new tactic <code>TIMEOUT_HOL_BY</code> that tries to run <code>HOL_BY</code> and aborts it silently after 1 second. Next, we set the timeout after which tactics are killed and an exception is raised to 10 seconds (so that this timeout does not interfere with <code>TIMEOUT_HOL_BY</code>) and set the default prover accordingly to <code>TIMEOUT_HOL_BY</code>, by modifying <code>reset_miz3</code> as follows:
</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>let reset_miz3 h =
</span><span class='line'>  horizon := h;
</span><span class='line'>  timeout := 10;
</span><span class='line'>  default_prover := ("HOL_BY", TIMEOUT_HOL_BY);
</span><span class='line'>  sketch_mode := false;
</span><span class='line'>  just_cache := undefined;
</span><span class='line'>  by_item_cache := undefined;
</span><span class='line'>  current_goalstack := [];
</span><span class='line'>  server_up();;</span></code></pre></td></tr></table></div></figure>

<p>
After this, we reload <code>miz3.ml</code> and then run <code>reset_miz3 !horizon;;</code> on the toplevel. Our miz3 can now tackle the tactic-free declarative proof given at the beginning of this post!
</p>

<p>
As I already wrote at the end of the summary, I am very impressed. With current provers it is possible to write proofs that are at the same time formal, human-readable and reasonably short and self-contained. On top of that, further improvements seem to be within reach.
</p>

<p>
For me, the biggest pleasant surprise was that a declarative proof in miz3 requires relatively few explicit justifications (<code>by</code> clauses) in each step. I think this is very important, as this reduces the volume of the dictionary that a user has to learn to get started, it decreases the danger of bit-rot and it increases portability. I will write more on these issues in a future blog post.
</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="formal"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="proof"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="software"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[OMeta in Qute - a first experiment]]></title>
    <link href="http://blog.felixbreuer.net/2012/03/11/qute.html"/>
    <updated>2012-03-11T22:41:47-07:00</updated>
    <id>http://blog.felixbreuer.net/2012/03/11/qute</id>
    <content type="html"><![CDATA[<p>It has been quiet around <a href="http://www.inkcode.net/qute">Qute</a>, my <a href="http://blog.felixbreuer.net/2011/06/30/qute.html">experimental editor project</a>, for quite some time since I <a href="http://blog.felixbreuer.net/2011/11/05/qute.html">announced</a> a rewrite of the code. Well, to be honest, the rewrite has not started yet. But I did get around to do some experimenting with the feature I am most excited about: The support for <strong>user-defined custom markup languages</strong> within Qute.</p>

<p>I will write more about the rationale behind this feature when it is more polished. Right now, I just want to give you a little heads-up on the latest rough-around-the-edges feature in <strong>Qute 0.4.1</strong>.</p>

<p>To define a custom markup language, you include an <a href="http://www.tinlizzie.org/ometa/">OMeta</a> grammar right inside your document. Such a grammar might look like this.</p>

<p><img src="http://blog.felixbreuer.net/files/2012-03-11-ometa-1.png" alt="An OMeta grammar in Qute" /></p>

<p>You can then tell Qute that any paragraph in your document is written in the custom language you just defined. Then Qute will transform that paragraph according to the rules specified in the grammar. In this example, we calculate the number 42 by way of OMeta.</p>

<p><img src="http://blog.felixbreuer.net/files/2012-03-11-ometa-2.png" alt="Using the custom language in Qute" /></p>

<p>Qute 0.4.1 even supports some rudimentary error reporting.</p>

<p><img src="http://blog.felixbreuer.net/files/2012-03-11-ometa-3.png" alt="An OMeta parse error in Qute" /></p>

<p>If you want to try this out for yourself, grab a copy of Qute 0.4.1 from <a href="http://www.inkcode.net/qute">here</a>.</p>

<p>The next milestone is to make this do something interesting. For example, an implementation of Markdown in OMeta would allow the user to easily extend Markdown to suit his or her needs. This is something that I have been missing sorely while writing mathematics with Qute.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="qute"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="software"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="writing"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Feldenkrais' Spontaneous Action and Laozi's Wuwei]]></title>
    <link href="http://blog.felixbreuer.net/2012/03/03/feldenkrais.html"/>
    <updated>2012-03-03T23:58:13-08:00</updated>
    <id>http://blog.felixbreuer.net/2012/03/03/feldenkrais</id>
    <content type="html"><![CDATA[<p>It has been out for a while already, but now I finally get around to announcing it here: my first venture into philosophy.</p>

<p>Mosh&eacute; Feldenkrais&#8217; work and Laozi&#8217;s classic, the <em>Daode Jing</em>, have both had a big effect on me and I have always been struck by how alike in spirit these (at first glance) very different philosophies are. In the summer of 2010, I heard a great talk by <a href="http://www.hkbu.edu.hk/~ppp/">Steve Palmquist</a> about parallels between the <em>Daode Jing</em> and Kant&#8217;s philosophy and this experience gave me the confidence to sit down and work out my own ideas on the relationship between Feldenkrais and Laozi.</p>

<p>The result is an article that has just been published by the <a href="http://www.daoiststudies.org/dao/content/journal-daoist-studies-vol-5"><em>Journal of Daoist Studies</em></a>. You can</p>

<blockquote><p>download a PDF of my article <a href="http://www.felixbreuer.net/feldenkrais.pdf">right here</a></p></blockquote>

<p>or you can purchase an ebook or a printed copy of the entire journal from <a href="http://www.lulu.com/product/ebook/journal-of-daoist-studies-vol-5/18860141">Lulu</a>.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="article"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="philosophy"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Not only beyond Journals, not only beyond Papers. Beyond Theorems.]]></title>
    <link href="http://blog.felixbreuer.net/2012/02/27/beyondtheorems.html"/>
    <updated>2012-02-27T02:45:11-08:00</updated>
    <id>http://blog.felixbreuer.net/2012/02/27/beyondtheorems</id>
    <content type="html"><![CDATA[<p>The mathematical community is discussing how we can leave the journal publishing model behind us. However, putting journals online, making them open access or even leaving them behind us entirely will not solve the challenges the mathematical sciences face in the next couple of decades. A couple of weeks ago, Peter Krautzberger <a href="http://boolesrings.org/krautzberger/2012/01/29/a-comment-on-tim-gowerss-blog/">captured this point of view</a> with the simple and beautiful <a href="http://boolesrings.org/krautzberger/2011/12/16/the-recent-publishing-debate-the-imus-blog-continues/">slogan</a>:</p>

<blockquote><p>Not beyond Journals, beyond Papers.</p></blockquote>

<p>I agree! And I would like to go one step further. We have to go beyond journals. We have to go beyond papers. And we have to go beyond that which we, as mathematicians, hold dearest:</p>

<blockquote><p>We have to go beyond theorems!</p></blockquote>

<p>In this post, I want to make an argument why, from my point of view. This is going to be a long post, but I will try not to rant too much.</p>

<h2>The number of new results per year is increasing</h2>

<p>The number of mathematical articles - and theorems! - published each year has increased dramatically in the last decades. To give you just one piece of evidence, here is a graph of the number of <em>new</em> research articles entered in the Zentralblatt MATH index <em>each year</em>. This figure is taken from Bernd Wegner&#8217;s article in the <a href="http://www.ems-ph.org/journals/newsletter/pdf/2011-06-80.pdf">June 2011 newsletter</a> of the European Mathematical Society.</p>

<p><img src="http://blog.felixbreuer.net/files/2012-02-26-graph.png" alt="ZMATH publication by year" /></p>

<p>This trend will continue. The human population on earth is increasing and (on average) becoming more prosperous. So, more people will pursue an academic career and more people will become research mathematicians. And, because new theorems are the currency in which mathematicians currently measure research activity, this means that the number of new (!) theorems proven each year will continue to increase dramatically - unless we change our way of thinking about research.</p>

<h2>This increase is a loss for everyone</h2>

<p>There are roughly 100,000 mathematical articles on the Zentralblatt index that have been published in 2010. One hundred thousand articles, of which the majority contain (supposedly) <em>new</em> results. I&#8217;d go so far as to say that most mathematicians cannot read and properly digest more than 100 articles per year. (For me personally, the number is certainly lower than that.)</p>

<blockquote><p>This means that most mathematicians cannot even make use of 0.1% of the new results published <em>each year</em>.</p></blockquote>

<p>This must have at least one of the following two consequences. In my opinion, it has both.</p>

<blockquote><p>Mathematical research is becoming more and more <em>specific</em>.</p></blockquote>

<p>Mathematicians have a great talent for inventing ever more particular fields and sub-fields and sub-sub-fields in which we can discover ever more new theorems. If this strategy is successful, then these theorems are truly new and they have never come up in another area before. The flip side of the coin is of course that the majority of these very particular theorems will simply not be relevant for most mathematicians (and they will be utterly irrelevant for the rest of the world). A favorite objection to this argument is that, a couple of decades down the road, these results will <em>become</em> relevant in other fields and that results from today will be made use of then. But how is this supposed to happen if mathematicians can only read less than 0.1% of what is published <em>this</em> year? It is much more likely that mathematicians who, 20 years later, arrive at an equivalent problem in another field will simply solve it again on their own. Which brings us to the other consequence.</p>

<blockquote><p>Mathematical research is becoming more and more <em>redundant</em>.</p></blockquote>

<p>Independent rediscoveries of theorems happen all the time. They may happen more or less simultaneously. Or they may happen a couple of years apart. Or they may happen in entirely different fields, in which case it may take a while for people to notice that these results are, in fact, equivalent. Whatever form these redundancies take, their number is going to increase.</p>

<p>One can make the argument, that this is no problem at all. Science <em>is</em> redundant. So if all a rediscovery achieves is to make an old result popular in a different time or a different area, then so be it! But this clear eyed view of the world goes against the grain of our current self-image as mathematicians, where only original (never-seen-before) theorems count.</p>

<p>Also, redundancy becomes a real problem in conjunction with increasing specialization. What is the point of doing foundational research in a narrow area of specialization today, if the people who may need this stuff twenty years down the road have no means of discovering it? The only insurance against this type of disaster is to focus on advertising our small corner of mathematics, in the hope that somebody will remember it when the time comes. But again, our mathematical community is not built on this socio-dynamic view of research.</p>

<p>In the end, both trends, increasing specialization and increasing redundance, have the same effect:</p>

<blockquote><p>Mathematical research is becoming increasingly <em>irrelevant</em>.</p></blockquote>

<p>Note that I am <em>not</em> saying that <em>mathematics</em> is becoming increasingly irrelevant! There will always be seminal theorems that have a far reaching impact on both mathematics and the real world. But <em>the work of the average research mathematician</em> is going to become increasingly irrelevant.</p>

<p>Unless we finally stop to believe that the only valid form of &#8220;research&#8221; in mathematics is proving new theorems.</p>

<h2>Beyond theorems</h2>

<p>I have tried to argue above that the business of churning out as many new theorems as possible is not in the best interest of both mathematicians and mathematics. The two causes that I see as central in this regard are the following.</p>

<ul>
<li>We as a community view only new theorems as research. (Thus we create incentives to produce an unnecessarily large inflation of theorems.)</li>
<li>Our current methods of discovering theorems do not scale with the increase in theorem production.</li>
</ul>


<p>Thus the best way out of this situation is to acknowledge other forms of mathematical activity as research, not only the proving of new theorems. In particular, activities that help in the discovery of mathematical ideas should be promoted. Here are a couple of suggestions:</p>

<p><strong>Communicating mathematics.</strong> This includes all forms of communication, by means of talks, videos, games and of course writing in blog posts, web forums (such as mathoverflow), survey articles and books. This should also include all levels of writing, from expository work for students to references for experts. Finally, this should also include all audiences, from the interested public, to scientists outside mathematics, to mathematicians in other fields and finally specialists in your area. All of these forms of communicating mathematics are widely recognized in the mathematical community. But they are not recognized <em>as research</em>. I argue that mathematicians should get credit <em>as researchers</em> for communicating mathematics, because a larger part of every mathematician&#8217;s work will have to be about communication if we are to cope with the present inflation of new results. And we should make it possible that <em>researchers</em> specialize in these social activities, which will only be possible if we give them proper recognition.</p>

<p><strong>Collaborative theorem proving.</strong> Instead of everyone trying to get their little theorem published, why do we not try to find new ways of working on the big open questions collaboratively? The polymath projects are very valuable efforts in this regard, but they are only a small first step. As someone on the sidelines of these projects, it appeared to me that in the end, only a relatively small number of people were able to actually contribute to any given polymath project. We have to find ways to make large projects like this asynchronous and distributed. That means, we have to find ways how people can contribute half-baked ideas to research projects, how people who might find them useful can discover them and how to give credit for half-baked ideas in the mathematical community. How to solve these problems is wide open, from my point of view.</p>

<p>The two topics of communicating mathematics and &#8220;crowd sourcing&#8221; proofs have been widely dicussed in the current debate about mathematical publishing. Now on to two points that have received less attention, as far as I know.</p>

<p><strong>Implementing mathematical software.</strong> To make mathematical methods discoverable (and useful), it is of tremendous value to have them implemented in software. This applies to algorithms and methods for visualization as well as to such mundane tasks as the development of decent user interfaces. While these may be engineering tasks in many cases, we should recognize them as research, because they are crucial to the advancement of mathematics! Moreover turning all the useful algorithms available in the literature into usable software is a <em>huge</em> endeavour - it just won&#8217;t happen without the proper incentives.</p>

<p><strong>Formalizing mathematics.</strong> In my opinion, formalizing mathematics is the single one most important thing that needs to happen if we want mathematics to scale. With &#8220;formalizing mathematics&#8221; I mean a huge process that includes all of the following.</p>

<ul>
<li>The development of the languages and tools necessary to make the formalization of mathematical definitions, theorems and proofs feasible for the average mathematician.</li>
<li>This will have to go hand in hand with the development of automatic proof systems that can automatically &#8220;fill in the gaps&#8221; present in any research article.</li>
<li>The creation of an infrastructure that allows formal mathematical articles to be shared and discovered across different proof systems and formal mathematical languages.</li>
<li>And, finally, the formalization of (almost) all of mathematics.</li>
</ul>


<p>It goes without saying that this is more than enough work for generations (plural!) of mathematicians. We still have a long way to go in all of the four areas indicated by the four bullet points above. And even though work is going on in all of these areas, this work is not as widely known as it should. <a href="http://www.cs.ru.nl/~freek/">Freek Wiedijk</a> was kind enough to give me a brief tour last fall, and I plan to blog about this in the near future.</p>

<p>Here is why I think the project of formalizing mathematics is crucial. We, as humans, cannot cope with the sheer quantity of mathematical output that is going to be produced in the 21st century. So we have to teach computers how to discover theorems for us that are relevant for the questions we are interested in. Otherwise, the work of most mathematicians will disappear into obscurity faster than anyone can be comfortable with.</p>

<p>Communicating mathematics, collaborative theorem proving, implementing mathematical software and formalizing mathematics are of course all closely interrelated. Why should we not dream of composite electronic resources that are accessible and understandable by all kinds of different readers, that we work on collaboratively and that combine expository texts with detailed explanations and usable software with formalized mathematics? This dream is certainly not new and it is shared by many. How should this brave new world of mathematics look like in detail and how do we build it? The process of exploring these questions will be interesting indeed. My point here is that to get there we need to give up the belief that theorem proving is what mathematical research is all about.</p>

<h2>The self-image of the mathematician</h2>

<p>No matter what happens, proving mathematical theorems is going to become less relevant. If we succeed in changing they way mathematical research works, other activities will become more important. If we do not, the theorems most mathematicians prove will, generally, be redundant and overspecialized. So:</p>

<blockquote><p>Theorems will become less relevant.</p></blockquote>

<p>The social and psychological impact of this simple observation is huge. The self-image of the modern mathematician is built entirely on proofs and theorems. We, as mathematicians, grow up on stories of great &#8220;heros&#8221; who became &#8220;immortal&#8221; by proving all these great theorems we learn about. Naturally, we aspire to do as they did and so we seek to wrest these eternal truths from the world of pure, abstract ideas that we conquer using nothing but our &#8220;beautiful mind&#8221;.</p>

<p>Of course I am being ridiculous here, I exaggerate. But our identity as mathematicians is based on the stories we tell each other about other mathematicians - and those stories revolve around theorems and proofs. Often the only thing we know about a mathematician is what theorem they proved and we set up Millenium Prizes to celebrate the act of attaching a particular mathematician&#8217;s name to a particular theorem.</p>

<p>The association of &#8220;being a mathematician&#8221; with &#8220;proving a new theorem&#8221; is so tight that I have serious doubts about whether we as a community will accept other mathematical activities as research anytime soon. To do so would call into question what a mathematician is at a fundamental level. But this is precisely what we have to do.</p>

<h2>Conclusion</h2>

<p>The current model of doing mathematics is in need of reform. The fundamental issues with the current model cannot be resolved just by placing mathematical journals on a different economic and organizational basis. The core of the problem is our fixation as a community on theorems and proofs. As these notions are tied so closely to our self-image as mathematicians, finding a new model of doing mathematics is going to be a long and arduous process. But we have to do it, if we want our work to be relevant in a couple of decades.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="opinion"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Ehrhart f*-coefficients of polytopal complexes are non-negative integers]]></title>
    <link href="http://blog.felixbreuer.net/2012/02/19/fstar.html"/>
    <updated>2012-02-19T21:41:52-08:00</updated>
    <id>http://blog.felixbreuer.net/2012/02/19/fstar</id>
    <content type="html"><![CDATA[<p>One week ago, my most recent math paper <a href="http://arxiv.org/abs/1202.2652">appeared on the arXiv</a> and now I finally get around to blogging about it.</p>
<p>The \(f^*\)- and \(h^*\)-coefficents of a polynomial \(p(k)\) are simply the coefficients of \(p(k)\) with respect to certain binomial bases of the space of polynomials. If \(p\) is of degree \(d\), then they are given by \[p(k)=\sum_{i=0}^d f^*_i {k-1 \choose i} =\sum_{i=0}^d h^*_i {k+d-i \choose d}.\]</p>
<p>Where do these definitions come from? The motivation is Ehrhart theory. Given a set \(X\subset\mathbb{R}^d\), the Ehrhart function \(L_X\) of \(X\) is given by \[L_X(k)=\#\mathbb{Z}^d\cap k\cdot X,\] for \(1\leq k \in \mathbb{Z}\), that is, \(L_X(k)\) counts the number of integer points in the \(k\)-th dilate of \(X\).</p>
<p>Now, a famous theorem by Ehrhart states that if \(X\) is a polytope with integral vertices, then \(L_X\) is a polynomial. More precisely, there exists a polynomial that coincides with \(L_X\) at all positive integers and by abuse of notation, we will denote this polynomial by \(L_X\) as well.</p>
<p>After this preamble you may already have guessed it. The binomials in the expansion above are Ehrhart polynomials of particularly nice polytopes, namely half-open unimodular simplices. We denote by \(\Delta^d_i\) the \(d\)-dimensional standard simplex with \(i\)-open faces, i.e., \[\Delta^d_i = \{ x\in\mathbb{R}^{d+1} \;|\; x_0,\ldots,x_{i-1} > 0, x_i,\ldots x_d\geq 0 \sum_{i=0}^d x_i = 1 \} \]</p>
<p>and then it is not hard to check that \[L_{\Delta^d_i}(k) = {k+d-i \choose d}\] and in particular \[L_{\Delta^d_{d+1}}(k) = {k-1\choose d}.\] Thus:</p>
<ul>
<li>If \(P\) is a lattice polytope with a shellable unimodular triangulation \(K\), then \(h^*_i\) counts the number of \(d\)-dimensional simplices with \(i\) open faces in a shelling of \(K\).</li>
<li>If \(P\) is a lattice polytope with a unimodular triangulation \(K\), then \(f^*_i\) counts the number of \(i\)-dimensional faces in \(K\).</li>
</ul>
<p>In particular, if \(P\) is sufficiently nice, then both the \(f^*\)- and the \(h^*\)-coefficients are non-negative. The point of my article is to show that even if \(P\) is not nice and partitioning \(P\) into unimodular simplices does not work at all, the \(f^*\)-vector is <em>still</em> non-negative.</p>
<p><strong>Theorem.</strong> If \(P\) is a polytopal complex, then the \(f^*\)-coefficients of \(L_P\) are non-negative integers, even if \(P\) does not have a unimodular triangulation.</p>
<p>This becomes relevant when \(P\) is not-convex. As long as \(P\) is a polytope, its \(h^*\)-coefficients are non-negative by a famous theorem of Stanley. However, the \(h^*\)-coefficients of polytopal complexes may well be negative. For example, in <a href="http://arxiv.org/abs/1104.0483">recent work</a>, <a href="http://mat.univie.ac.at/~kubitzke/">Martina Kubitzke</a>, Aaron Dall and myself have shown that there exist coloring complexes of hypergraphs with negative \(h^*\)-coefficents.</p>
<p>In fact, we can take this theorem one step further and use it to <em>characterize</em> Ehrhart polynomials of what I call partial polytopal complexes. An integral partial polytopal complex is any set in \(\mathbb{R}^d\) that can be written as the disjoint union of relatively open polytopes with integral vertices.</p>
<p><strong>Theorem.</strong> A vector is the vector of \(f^*\)-coefficients of some integral partial polytopal complex if and only if it is integral and non-negative.</p>
<p>Behind all of this lies a combinatorial interpretation of the \(f^*\)-coefficients in a (not necessarily unimodular) lattice simplex and a new way of partitioning the set of lattice points in a simplicial cone into discrete cones.</p>
<p>For more results, in particular about the rational case, and more details on all of this, please check out my article! It has the id <a href="http://arxiv.org/abs/1202.2652">arxiv: 1202.2652</a>.</p>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="article"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="research"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Using Intuitive Geometry - Lecture Summary]]></title>
    <link href="http://blog.felixbreuer.net/2011/12/30/lecture.html"/>
    <updated>2011-12-30T23:18:17-08:00</updated>
    <id>http://blog.felixbreuer.net/2011/12/30/lecture</id>
    <content type="html"><![CDATA[<a href="http://blog.felixbreuer.net/files/2011-lecture/summary.png"><img class="plain" src="http://blog.felixbreuer.net/files/2011-lecture/summary.png" style="margin-bottom: 2em; width: 930px"/></a>

<p>This fall semester, I taught the Math 890 course at San Francisco State University. It was the very first course that I taught all on my own. I am currently funded by the DFG, so I have no teaching obligation (in fact, I had to ask the DFG for permission to devote my time to something other than research). But when I was offered this opportunity, I leapt at the chance and volunteered to teach this course, even though, with two 75 minute classes each week, it was a significant amount of work. I wanted the experience, and, after all the years where I was responsible only for my own research portfolio, I was looking forward to taking on some <em>real</em> responsibility. Also, this was a topic course for graduate students, so that I could teach anything that I wanted. What a wonderful opportunity to experiment!</p>

<p>In this post, I will present the idea behind the course I gave, give an outline of the topics covered, provide all my slides and notes for the lecture as well as all the exercise problems, give a list of topics for the seminar, and review how the course, as a whole, went.</p>

<p><em>Note:</em> The material linked below is known to contain a number of typos. </p>

<h2>The Idea</h2>

<p>
I always wanted to try a different format of a course. With &#8220;format&#8221; I do not mean the methodology for teaching - experiments in that department are certainly called for, but I wanted to stick to the classical lecture + seminar format (because I actually enjoyed it as a student). What I wanted to experiment with was the content of my course.
</p>

<p>
Math courses, the way I experienced them at the FU Berlin, typically build a theory from the ground up, in a very detailed fashion. They emphasize rigor over intuition, and have a classical definition-theorem-proof structure. Courses of this &#8220;classic&#8221; format are certainly important, especially for teaching mathematical rigor, but here, I wanted to do things differently:
</p>

<ul>
<li>
The course was to cover a <b>large range of topics</b>, with the aim of showing their <b>interconnections</b>,
</li>
<li>
<b>intuition</b> was to be emphasized over rigor,
</li>
<li>
and it was to make extensive use of <b>visualization</b>.
</li>
</ul>

<p>In short, I wanted to give my students a grand tour of the mathematics that I find interesting. Adding courses of this type to the curriculum is important for a number of reasons. I do not want to go into too much detail on this, so here are just a few bulletpoints, in no particular order.</p>

<ul>
<li>For me personally, grand tours are simply more inspiring than develop-a-theory-from-the ground-up-lectures. I want to take a grand tour of the house, instead of spending my time laying bricks for the foundations!</li>
<li>Grand tours have more room to present applications of the covered material.</li>
<li>Pure mathematics especially are not measured only in terms the applications they have. The beauty, insight and perspective they have to offer are of direct value to us as human beings. However beauty, insight and perspective are tied primarily to the rough ideas and much less to the technical details. So let&#8217;s cover more beautiful ideas and less details!</li>
<li>Showing the connections between different fields make <em>all</em> of these fields more relevant to the audience!</li>
<li>First, I cannot remember a theorem unless I develop some kind of intuition for it. Second, I cannot prove similar theorems on my own, without having an intuitive idea why it should be true. Third, the intuitive idea is often all I remember off the top of my head after a couple of weeks have passed. So why not focus on teaching the intuition in the first place?</li>
<li>For me personally visualization is by far the best way to develop an intuition.</li>
</ul>

<h2>Outline</h2>

The topics that were covered in the lecture + seminar are show in the big mind map at the top of this page. As you can see, the variety of topics is very large. Each of the big headlines in the mindmap could easily make up an entire course on its own! All of these topics are interrelated. Yet, it is hard to come up with a single title for the course that includes them all. &#8220;Discrete Geometry&#8221;, certainly, is too generic and not entirely accurate. In the end, I decided to call the course:

<blockquote><b>Using Intuitive Geometry - Using Geometry Intuitively</b></blockquote>

I like this title, because it makes clear that I care more about methods and intuition, than about giving a comprehensive account of anything. For example, Game Theory is certainly no subset of Discrete Geometry, but methods from &#8220;intuitive geometry&#8221; do play a big role: The Minimax Theorem in Game Theory is both equivalent to the LP Duality Theorem and it is implied by Brouwer&#8217;s Fixed Point Theorem, which are both staples of intuitive geometry.

In hindsight, it occured to me that another fitting title would have been:

<blockquote><b>Adventures with Hyperplanes</b></blockquote>

Well, maybe next time. Here are the slides and notes from the tour I took this fall through all of these diverse topics:

<ul>
<li>Visualizing Numbers
(Gauss sum formula, lattice points in triangles, staircases, Dedekind sums)
<ul><li>Lecture 1 <a href="http://blog.felixbreuer.net/2011/08/23/visualising-numbers-part1.html">lecture notes</a></li>
<li>Lecture 2 <a href="http://blog.felixbreuer.net/2011/08/30/visualising-numbers-part2.html">lecture notes</a></li></ul></li>
<li>Polytopes
(H- and V-description, faces, permutahedron)
<ul><li>Lecture 3 + 4 <a href="http://blog.felixbreuer.net/files/2011-lecture/Polytopes-slides.pdf">slides</a></li></ul>
</li>
<li>Linear Programming (Fourier-Motzkin eliminiation, Farkas lemma, LP duality, simplex algorithm, combinatorial optimization) <ul><li>Lecture 5 <a href="http://blog.felixbreuer.net/files/2011-lecture/FourierMotzkin-slides.pdf">slides</a></li><li>Lecture 6 <a href="http://blog.felixbreuer.net/files/2011-lecture/Duality-slides.pdf">slides</a></li><li>Lecture 7 <a href="http://blog.felixbreuer.net/files/2011-lecture/Simplex-slides.pdf">slides</a></li></ul></li>
<li>Game Theory, Social Choice (minimax theorem, Nash equilibria, spatial voting, McKelvey&#8217;s theorem) <ul><li>Lecture 8 <a href="http://blog.felixbreuer.net/files/2011-lecture/Game-slides.pdf">slides</a></li><li>Lecture 9 <a href="http://blog.felixbreuer.net/2011/11/20/mckelvey.html">lecture notes</a>, <a href="http://blog.felixbreuer.net/files/2011-lecture/McKelvey-slides.pdf">slides</a></li></ul></li>
<li>Topological Combinatorics, Fair Division (Brouwer&#8217;s fixpoint theorem, Sperner lemma, ham sandwich splitting)<ul><li>Lecture 10 <a href="http://blog.felixbreuer.net/files/2011-lecture/Brouwer-slides.pdf">slides</a></li><li>Lecture 11+12 <a href="http://blog.felixbreuer.net/files/2011-lecture/FairDivision-slides.pdf">slides</a></li></ul></li>
<li>Ehrhart Theory, Lattice Points in Polyhedra (Ehrhart&#8217;s theorem, Ehrhart-Macdonald reciprocity, Stanley non-negativity, combinatorial applications)
<ul><li>Lecture 13+14 <a href="http://blog.felixbreuer.net/files/2011-lecture/Ehrhart-slides.pdf">slides</a></li><li>Lecture 15+16 <a href="http://blog.felixbreuer.net/files/2011-lecture/EhrhartApplications-slides.pdf">slides</a></li></ul></li>
<li>Generating Functions (formal power series as lattice point sets and vice versa, enumeration of lattice points using formal power series)<ul><li>Lecture 17+18 <a href="http://blog.felixbreuer.net/files/2011-lecture/GeneratingFunctions-slides.pdf">slides</a></li><li>Lecture 19 <a href="http://blog.felixbreuer.net/files/2011-lecture/GeneratingFunctionMethods-slides.pdf">slides</a></li></ul></li>
<li>Machine Learning (support vector machines, kernel trick, VC dimension)</li>
</ul>

<h2>Exercises</h2>

To go with these lectures, I made up these exercises, containing 2 to 5 problems each:

<ul>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise01.pdf">Exercise 1</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise02.pdf">Exercise 2</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise03.pdf">Exercise 3</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise04.pdf">Exercise 4</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise05.pdf">Exercise 5</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise06.pdf">Exercise 6</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise07.pdf">Exercise 7</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise08.pdf">Exercise 8</a></li>
<li><a href="http://blog.felixbreuer.net/files/2011-lecture/exercise09.pdf">Exercise 9</a></li>
</ul>

<h2>Seminar Talks</h2>

<p>After 10 weeks of lectures, we had 4 weeks of student talks. Some of the talks were in-depth talks on a particular subject, while others were brief introductions to large subject areas. These are the topics I suggested:</p>

<ul>
<li>The Mordell-Pommersheim Tetrahedron. (Source: <em>Computing the Continuous Discretely</em>. Beck, Robins. 2007. Chapter 8.)
</li>
<li>Power Indices and Spatial Power Indices (Source: <em>Power and Stability in Politics</em>. Straffin. In: <em>Handbook of Game Theory Volume 2</em>. Chapter 32. 1994.)
</li>
<li>LP and MIP Modelling Tricks (Source: <em>AIMMS Optimization Modelling.</em> Bisschop. 2011. <a href="http://www.aimms.com/aimms/download/manuals/aimms_modeling.pdf">link</a>)
</li>
<li>Interior Point Methods (Source: <em>The integer-point revolution in optimization: History, recent developments, and lasting consequences.</em> Wright. 2004. <a href="http://www.ams.org/journals/bull/2005-42-01/S0273-0979-04-01040-7/S0273-0979-04-01040-7.pdf">link</a>)
</li>
<li>The Borsuk-Ulam Theorem and Ham Sandwich Splitting (Source: <em>Using the Borsuk-Ulam Theorem</em>. Matousek. 2003. Chapters 2 and 3.)
</li>
<li>Integer Programming Methods (Source: <em>Theory of Linear and Integer Programming</em>. Schrijver. 1986. Chapters 23 and 24.)
</li>
<li>Order Polynomials (Source: <em>Combinatorial Reciprocity Theorems</em>. Beck. 2011. Chapter 6. <a href="http://math.sfsu.edu/beck/papers/crt.pdf">link</a>)
</li>
<li>P-Partitions (Source: <em>Combinatorial Reciprocity Theorems</em>. Beck. 2011. Chapter 7. <a href="http://math.sfsu.edu/beck/papers/crt.pdf">link</a>)
</li>
</ul>


<h2>How did it go?</h2>

<p>I am very happy with how the course turned out! This &#8220;grand tour&#8221; style of a course succeeded in engaging the students. From what I heard, my students not only learned something, but also took away a new perspective on many of the subjects I covered. One student even told me that they now had a much better understanding what the thesis they had been working on is about. Was will man mehr!</p>

<p>Nonetheless there are of course a number of things I would like to improve the next time I teach this course - which I would really like to do! Here is a list of notes that I would like to keep in mind for the next iteration.</p>

<h4>Exercises</h4>

<p>The exercises were what made this &#8220;intuitive tour&#8221; type of course work. Had my students not spent the time to accquaint themselves personally with the subject matter, I guess many parts of this course might have remained too vague. The great thing is, that my students did work through virtually all of the exercise problems, even though I did not have the resources to grade the correctness of their solutions. It would have been too easy to skip corners - but they didn&#8217;t! Thus, I really have to thank them for their initiative, curiosity and dilligence - <em>they</em> made this course work (even more than ususal)!</p>

<p>In hindsight, I think this large program is better suited to a course with three 75 minute sessions per week. Two sessions for lectures and one for talking about the exercise problems. Also, it would have been very valuable to provide individual corrections for the exercises and/or solutions of the exercises for the students to review on their own.</p>

<h4>Lecture Notes</h4>

<p>I wrote the script for my lectures as I went along. Given that the material was so diverse and scattered over so many sources and given that it was my ambition to present some material from an (AFAIK) original perspective, this was very work intensive. Originally, I had planned to use my blog to record detailed lecture notes, but this turned out to be infeasible. (Currently, it takes me at least four hours to write up notes for one 75-minute lecture in a form suitably self-contained for a blog post - even if I have prepared the material beforehand in slide form and given the lecture in front of class. Is that typical or somewhat slow?)
</p>

<p>The points mentioned so far (publish lecture notes, publish solutions for the exercises, provide individual corrections for the exercises) all boil down to putting in more work. And when I give this course the next time, I certainly want to prepare lecture notes and solutions beforehand and work together with a teaching assistant for grading! Here are some more thoughts, though, that take a different direction:</p>

<h4>Seminar</h4>

<p>Combining the lecture with a seminar was an excellent choice. For two reasons. First, it gave the students the opportunity to work on a subject in depth. This was especially important as the &#8220;intuitive tour&#8221; format (by necessity) left the students wanting more details. The seminar gives students the opportunity to pick one subject they find particularly appealing and dig into the details that were only hinted at in the lecture and in the exercises.</p>

<p>Second, the seminar was enjoyable not only for the students, but for me as well! During preparation, it was simply fun to get together and puzzle about a problem or figure out the best picture for illustrating a theorem. (Especially after I had spent hours on end with mainly one-way communication during the lecture.) On the whole, the talks were very good and got across all the important points. Some even went above and beyond the suggested material! Next time, I might be tempted to make the seminar a much bigger part of the course!</p>

<h4>Proofs</h4>

<p>What place do proofs have in this type of course? After the first two weeks of the course I become worried that my intuitive style of lecturing might be too vague for my audience. This worry was not fed by any actual observations during class, but rather by my rookie-lecturer-confidence wavering. So I decided to up the level of detail in the next few weeks and include more proofs and a greater level of formality. In retrospect, after talking with my students about it and judging from the their exercise solutions, I can say that this failed completely. This &#8220;proofy&#8221; part of the lecture was the part my students enjoyed the least and it was the part they had the least grasp of, judging by the exercises. (Of course, proper lecture notes would have helped their performance in the exercises, but I think this is not the main point here.)</p>

<p>I was reminded here of these great quotes by Victor Klee:</p>

<ul><li>&#8220;A good talk contains no proofs; a great talk contains no theorems.&#8221;</li><li>&#8220;Mathematical proofs should only be communicated in private and to consenting adults.&#8221;</li></ul>

<p>In any case, they have no place in this type of lecture! Intuitions for why a theorem should hold, rough proof sketches, all of these certainly belong in this type of lecture. But going the extra distance from an intutive proof sketch to an actual &#8220;formal&#8221; proof is not worth it - simply because any formalization is significantly harder to understand than the intuitive idea that gave rise to it. If your goal is to teach a theory, then teaching that formalization is part of what you want to communicate. If your goal is to show connections between different fields intuitively, then that formalization is only tangential to what you want to communicate. So, adding formalism just for the sake of communicating an intuitive idea is not going help - instead of clarifying the point it will obfuscate.</p>

<p>Of course this does not mean that proofs are irrelevant! On the contrary, if students are to learn how to use geometric intuition, then learning how to make intuitive ideas precise is crucial. However this is an <em>active</em> process. Students have to <em>do it themselves</em> when solving exercises or preparing seminar talks. My doing it at the whiteboard does not help anybody! More precisely: my doing it at the whiteboard helps only, if students have tried to do it by themselves beforehand.</p>

<p>I will not try to write down here all the mental notes I made for myself on how to present proof ideas if you do not want to make them 100% precise. (Maybe I will write another blog post about this.) I want to mention two things, however: First, when explaining an algorithm/constructive proof it is much more important to make the construction precise and illustrate it with an example than to prove its correctness. Second, always give a concise summary of the key point of a theorem or proof that you just explained. That way, even those members of your audience that you may have lost will have something concrete to remember.</p>

<h4>Drawing</h4>

<p>Of course, when talking about geometric intuition, drawing is the most important thing! Two shorts thoughts about this:</p>

<p>The most important aspect of many mathematical figures is <em>the way they are drawn</em> and not the final image. Thus it is very important to construct a figure slowly, step by step. No fancy visualization tool beats a good drawing on a whiteboard!</p>

<p>In this vein, I encouraged my students to draw the objects they were talking about, both in the exercises and in the seminar - and I got everybody to do it in the end! I was very happy about this, because, in my opinion, drawing is an essential skill for any mathematician!</p>


<h2>Conclusion</h2>

<p>It was a great experience teaching this course! I learned a lot, both in terms of hard skills and soft skills. I would love to teach this course a second time, and the next time I would like to experiment more with teaching methodology. Also, I would really like to write up this tour through some uses of intuitive geometry in book form and smooth out all the wrinkles along the way. But, maybe, the printed page (or static PDF document) is just not the right medium for this.</p>

<p>I think mathematics could benefit from more courses and texts of this &#8220;intuitive tour&#8221; type: overview material with a strong emphasis on intuition and visuals, accessible to advanced undergraduates but with enough depth to satisfy graduate students.</p>

<h2>Bibliography</h2>

Finally, here is a short informal summary of the literature I used for the preparation of this course.

<ul>
<li>Beck, <em>Combinatorial Reciprocity Theorems</em>.</li>
<li>Beck, Robins, <em>Computing the Continuous Discretely</em>.</li>
<li>Bisschop, <em>AIMMS Optimization Modelling</em>.</li>
<li>Breuer, Heymann, <em>Staircases in <script id="MathJax-Element-1" type="math/tex">\mathbb{Z}^2</script></em>, Integers.</li>
<li>de Longueville, <em>A Course in Topological Combinatorics</em>.</li>
<li>Gaiha, Gupta, <em>Adjacent Vertices on a Permutohedron</em>, SIAM Journal on Applied Mathematics.</li>
<li>Gr&ouml;tschel, <em>Lineare und Ganzzahlige Programmierung</em>.</li>
<li>Matousek, <em>Using the Borsuk-Ulam Theorem.</em></li>
<li>McKelvey, <em>Intransitivities in multidimensional voting models and some implications for agenda control</em>, Journal of Economic Theory.</li>
<li>McKelvey, <em>General Conditions for Global Intransitivities in Formal Voting Models</em>, Econometrica.</li>
<li>Raghavan, <em>Zero-sum two-person games</em>, Handbook of Game Theory, Vol 2.</li>
<li>Sch&ouml;lkopf, Smola, <em>Learning with Kernels</em>.</li>
<li>Schrijver, <em>Theory of Linear and Integer Programming</em>.</li>
<li>Straffin, <em>Power and stability in politics</em>, Handbook of Game Theory, Vol 2.</li>
<li>Wright, <em>The interior-point revolution in optimization: History, recent developments, and lasting consequences</em>, Bulletin of the American Mathematical Society.</li>
<li>Ziegler, <em>Lectures on Polytopes</em>.</li>
</ul>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="lecture"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="teaching"/>
    
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Geometry, the Majority Vote and the Power of Agenda Control]]></title>
    <link href="http://blog.felixbreuer.net/2011/11/20/mckelvey.html"/>
    <updated>2011-11-20T23:48:17-08:00</updated>
    <id>http://blog.felixbreuer.net/2011/11/20/mckelvey</id>
    <content type="html"><![CDATA[<p><em>These are notes for a talk I gave both in my course at SF State and at the <a href="http://blog.felixbreuer.net/2011/11/17/protest.html">teach-in</a> against police violence at UC Berkeley. The talk at the teach-in found its way on <a href="http://www.indybay.org/newsitems/2011/11/18/18700055.php">IndyMedia</a> and YouTube (Pt <a href="http://www.youtube.com/watch?v=SqhlP3BUQK8">1</a> <a href="http://www.youtube.com/watch?v=j8G4TIonCdc">2</a>).</em></p>

<p>In a democracy, <b>people are fighting all the time over control of the political agenda</b>. Media campaigns, protests and lobbying are all examples of people trying to shape the political discourse. They seek to get &#8220;the public&#8221; to discuss a topic they care about, they seek to shift the focus of the current political discussion towards the points they think are important or they may even want to throw up a smokescreen to divert the public from a topic they consider dangerous for them. This process is vital for a democracy to work. In fact, I want to present a mathematical argument that supports the following bold claim: <b>This process is more important for a democracy than voting!</b> And perhaps the most amazing thing about this observation is that this is a direct consequence of the <b>geometry of voting</b>.
</p>

<h2>Policies as points in space</h2>

<p><b>Political choices can often be represented by points in space.</b> By this I mean that often, all the different policies that can be adopted with regard to a given political issue can be represented by different points in space.</p>

<p>As an <b>example</b>, let us consider <b>budget</b> decisions. A state&#8217;s budget can be represented by three numbers: <ul><li>the state&#8217;s revenue (e.g. <b>taxes</b>)</li><li>the state&#8217;s expenditures (e.g. public <b>spending</b>)</li><li>the state&#8217;s <b>deficit</b></li></ul> In this way, we can view every possible budget decision as a point in three-dimensional space. However, these three values are not independent of each other. Instead they are related by</p> <p style="text-align:center; margin: 20px 20px 20px 20px;"> <b>deficit = spending - taxes</b>.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-budgethyperplane.png"><img style="float: right; width:400px; margin: 0px 0px 5px 20px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-budgethyperplane.png"/></a>

<p>This equation defines a <b>plane in three dimensional space</b>. All possible budgets lie in this hyperplane. To visualize how this looks consider the following three dimensional coordinate system. The axes represent spending, taxes and deficit. The budget hyperplane lies slanted in space. Its intersections with the three coordinate hyperplanes are shown as dashed lines. For example, the horizontal dashed line is the set of budgets with spending = 0. It is a diagonal in the plane spanned by the deficit and taxes axes. Similarly, the other two dashed lines are diagonals in the deficit/spending and spending/taxes coordinate hyperplanes.</p>

<p>As we have seen, the set of all budgets with spending = 0 forms a line in the plane of all possible budgets. Increasing or decreasing spending by, say, 1 dollar corresponds to translating this line in the plane. Taking all translates by $k$ dollars, we obatin a family of parallel lines. And if we repeat this for the lines given by taxes = 0 and deficit = 0, we obtain a <b>triangulation of the budget plane</b> as shown below.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-triangulation.png"><img style="float: left; width:400px; margin: 0px 20px 5px 0px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-triangulation.png"/></a>

<p>This picture shows a part of this triangular lattice. It allows us to visualize what happens if we change a given budget $b$. Say $b$ is given by a spending of 3 trillion dollars, tax revenues of 2 trillion dollars and a deficit of 1 trillion dollars and suppose we increase tax revenues by 1 dollar. This corresponds to moving from $b$ to the line given by 1 trillion and one dollar of tax revenues. However, we have to make a choice here. Do we use that one extra dollar to lower the deficit or increase spending? If we go &#8220;left&#8221; in the picture, we stay on a line where the deficit remains constant but we move from one &#8220;spending line&#8221; to the next thus increasing spending. On the other hand, if we go &#8220;right&#8221; we keep spending constant and decrease the deficit.</p>

<p>Now that we have a means to visualize how different budget decisions relate to each other, we can use that to visualize the current positions of various political actors in the US with regard to the federal budget.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-demrep.png"><img style="float: right; width:400px; margin: 0px 0px 5px 20px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-demrep.png"/></a>

<p>We place the 2011 federal budget in the center of our picture at the point labeled $b$. Next we draw the three lines through $b$ along which spending, taxes and deficit are constant, respectively. Both, the democrats and the republicans want to decrease the deficit. So if you asked a democrat or republican where their ideal 2012 budget would be, then they would tell you that it lies below the deficit line through $b$. Ideally, however, a <b>democrat</b> would like to decrease the deficit by increasing taxes, without decreasing spending. So, qualitatively, a democrat&#8217;s ideal policy would lie in the blue region. A <b>republican</b>, on the other hand, would want to reduce spending to finance the decrease in deficit without raising taxes. So a republican&#8217;s ideal policy would lie in the red region. There are other people, though, e.g., <b>Keynesian economists</b>, who think that lowering the deficit is not a priority at the moment. They think that it is much more important to stimulate the economy by lowering taxes and increasing spending, even if that means that the deficit has to increase even further. People in this comparatively small group might have an ideal budget somewhere in the green region.</p>

<p>We have now seen how to think geometrically about politics. Now we are going to apply this point of view to analyze the dynamics of the majority vote.</p>

<h2 style="clear:both;">Spatial Voting and the Power of Agenda Control</h2>

<p>So far, we have only visualized policies as points in space. Now we come to <b>McKelvey&#8217;s theorem</b>, the main result I want to tell you about. To be able to state this theorem, we need to formulate a model of voting, called spatial voting.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-spatialvoting.png"><img style="float: right; width:500px; margin: 0px 0px 5px 20px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-spatialvoting.png"/></a>

<p>As we discussed, every policy corresponds to a point in space. Now, spatial voting simply means the following. <ul><li>Voters are asked to decide between <b>two alternatives</b>, the status quo which we call $x$ and a proposed new policy $z$. Voters can vote for either of these two alternatives.</li><li>The alternative with the most votes wins, i.e., we are having a <b>majority vote</b>.</li><li>Every <b>voter</b> has an <b>ideal policy</b> in mind. So the voters can be represented by a set of points in space.</li><li>Finally, we make a very important assumption: <b>Every voter will vote for the alternative closest to his or her ideal policy!</b></li></ul></p>

<p>Consider as an example the following picture. The black points represent the ideal policies of all voters. The blue point labeled $x$ marks the status quo, while the red point labeled $z$ marks the proposed new policy. In this example, most voters are going to vote for $z$ as $z$ is closer to their ideal than $x$. As we are running a majority vote, this means that $z$ is going to be approved and will become the new policy.
</p>

<p>Now we can state McKelvey&#8217;s theorem.</p>

<div style="box-shadow: 0px 0px 5px #999; border: 1px solid gray; padding: 20px; margin-bottom: 2em; clear:both;">
<p><b>Theorem. (McKelvey 1976)</b> For every status quo $x$ and <em>every</em> other policy $z$ there exist policies $y_1,y_2,\ldots,y_k$ such that</p>

<p style="padding: 0px 40px 0px 40px">$x$ loses against $y_1$ which loses against $y_2$ which loses against $y_3$ &#8230; which loses against $y_{k-1}$ which loses against $y_k$ which loses against $z$</p>

<p style="margin:0px">in the majority vote.</p>
</div>

<p>What does this mean? Suppose there were someone with complete control of the agenda. This <b>agenda controller</b> would have absolute control over which new policies are proposed. Whenever the agenda controllers proposes a new policy, the voters would get to vote and the agenda controller would be bound by their decision according to the majority rule. This means that an agenda controller cannot decide anything. <b>All he can control is between which alternatives the voters get to choose.</b></p>

<p>So, suppose there is an aganda controller and the current status quo is $x$. Suppose further that the agenda controller wants voters to pass a new policy $z$ that he favors (but that everybody else may hate). McKelvey&#8217;s theorem now states that there are cleverly devised policies $y_1,\ldots,y_k$ such that the agenda controller can proceed as follows. First, he proposes $y_1$. The voters get to choose between $x$ and $y_1$ and they approve $y_1$ as the new policy because the majority of voters prefers $y_1$ to $x$. Now $y_1$ is the new status quo. Next, the agenda controller proposes $y_2$ and again, the voters prefer $y_2$ over $y_1$ so they are going to adopt $y_2$ as the new status quo of their own free will. The agenda controller continues in this fashion until the voters pass $y_k$ as their new policy. Then he makes his final move and proposes $z$, the policy that he likes but that everybody else hates. However, through his previous moves, he has managed to put the public in a position where the majority actually prefers $z$ to the current status quo $y_k$. And so they are going to approve of $z$ of their own free will.</p>

<p>In this way, <b>someone in control of the political agenda is in complete power, even if he is bound by the majority vote of the population.</b> This explains why, for example, freedom of speech and the right to protest are so important parts of democracy. Protest is a way of getting a certain item on the political agenda, trying to influence the direction that current policy should take. (See <a href="http://www.politico.com/blogs/bensmith/1111/Occupy_Wall_Street_is_winning.html">here</a> for a recent example.) Conversely, if there is a small elite who dictates the political topic of the day, then this elite will get its way, no matter if vote or not. So the morale of the story is this:</p>

<p style="margin: 20px 40px 20px 40px;"><b>Voting alone does not give the people any power! Just by voting, you can&#8217;t control anything. You also have to have a public discussion about political topics and this is what protest is about.</b></p>

<p>At this point, it is important to stress the difference between the provocative morale that I drew from the story and the statement of the original theorem. The theorem is provably true, but applies only to a very specific abstract model of a society. In reality, no one is in absolute control of the political agenda! And the theorem tells us that this is a very good thing!</p>

<p>So, while the theorem does not apply to western democracies such as the USA, it can still tell us something about the real world, by way of analogy, in just the same way that a good novel can reveal a truth about the world we live in. (See the Q&amp;A section for more about this.)</p>

<p>Now that we have both a formal as well as an intuitive feeling of what McKelvey&#8217;s theorem is saying, let us try to get an idea why the theorem should be true.</p>

<h2 style="clear:both;">The Idea behind McKelvey&#8217;s Theorem</h2>

<p>In this section, I want to give an idea how the sequence of policies $y_1,\ldots,y_k$ are constructed. If you want, this is a proof by example, but of course it is not a complete proof of the theorem. For a thorough proof I refer the interested reader to the literature cited at the end of the Q&amp;A section.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-circles.png"><img style="float: right; width:400px; margin: 0px 0px 5px 20px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-circles.png"/></a>

<p>We work with an example in 2 dimensions. There are three voters $v_1,v_2,v_3$ whose ideal policies are given by the three black points $p_1,p_2,p_3$ in the picture. We draw the lines through any pair of these three points. The status quo is given by the blue mark in the center of this triangle formed by the voters&#8217; ideals. So, intuitively, the current status quo $x$ seems like a pretty good compromise between the voters&#8217; preferences.</p> 

<p><b>Which policies defeat the status quo $x$ in a majority vote?</b> Remember that the three voters will vote for the alternative closest to their ideal policy. So, for each voter, we draw a circle around that voter&#8217;s ideal policy and we choose the radius of that circle such that the cirlcle passes through the status quo $x$. Let $C_1$ be the circle around voter $v_1$&#8217;s ideal policy $p_1$. $v_1$ will prefer any policy $y$ to $x$ that lies strictly inside the circle $C_1$!</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-reflection.png"><img style="float: left; width:300px; margin: 0px 20px 5px 0px; padding:5px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-reflection.png"/></a>

<p>
Consequently, the policies that will defeat $x$ lie in the intersection of any two of the circles shown in the picture. The area corresponding to the set of <b>policies that defeat $x$ are shaded green</b> in the picture. As you notice, the shaded area extends outside of the triangle spanned by the three ideal policies $p_1,p_2,p_3$. Let $L_1$ denote the line through $p_1$ and $p_2$. If we reflect $x$ at $L_1$, then we will obtain a point $x&#8217;$ at exactly the same distance to $p_1$ and $p_2$ as $x$. If we now move $x&#8217;$ inwards for a little bit, the resulting point $x&#8221;$ will lie strictly in the interior of both $C_1$ and $C_2$. Thus $x&#8221;$ will defeat $x$ in a majority vote, because both voters $v_1$ and $v_2$ will like $x&#8221;$ slightly bettern than $x$. Note, however, that for $v_3$ the new policy $x&#8221;$ is much worse than the status quo $x$. Since we are working with a majority vote, however, this is not taken into account.
</p>

<p>As it turns out, this construction always works! We summarize this observation as follows.</p>

<p style="margin: 20px 40px 20px 40px">For any policy $x$ and any line $L$ through two of the voters&#8217; ideal policies, the policy $x&#8221;$ obtained by first <b>reflecting</b> $x$ at $L$ and then moving the reflected point back towards $L$ a tiny bit, will always defeat $x$ in a majority vote. Typically, $x&#8221;$ will be &#8220;slightly better&#8221; than $x$ for two of the voters and much worse for the third voter.</p>

<p>This observation is the staples of the agenda controller&#8217;s strategy for manipulating the voters. Phrased provocatively, the agenda controller&#8217;s strategy is this:</p>

<p style="margin: 20px 40px 20px 40px"><b>Play off different groups of voters against each other! Offer a majority of voters marginal incentives to hurt a minority really bad!</b></p>

<p>So how can an agenda controller use this strategy to get voters to vote for his favorite policy? The following figure tells it all.</p>

<a href="http://blog.felixbreuer.net/files/2011-11-20-agendacontrol.png"><img style="float:right; width:600px; margin: 5px 0px 5px 20px; padding:20px 0px 2px 20px; border: 1px solid #999; box-shadow: 0px 0px 5px #aaa;" src="http://blog.felixbreuer.net/files/2011-11-20-agendacontrol.png"/></a>

<p>We start with a status quo $x$. This we reflect $x$ along the line $L_1$ through $p_1$ and $p_2$ by playing off voters $v_1$ and $v_2$ against voter $v_3$ to get to a new policy $y_1$. Next, we reflect $y_1$ along $L_3$ by playing off $p_1$ and $p_3$ against $p_2$ to get to $y_2$. Then, we reflect $y_2$ along $L_2$, by playing off $p_2$ and $p_3$ against $p_1$. We can keep going in this fashion as long as we like. Note that in each step we give two of our voters a tiny improvement (we move towards their ideal points by a tiny bit) while at the same time making the situation much worse for the third one (we move much further away from his ideal policy). In total, we make the situation worse in every step! So <b>if we continue this process long enough, everybody will be so unhappy with the current policy</b>  ($y_k$ will be so far away from all voters&#8217; ideal policies) <b>that everybody will be happy to agree to the policy $z$ that the agenda controller had in mind all along.</b></p>

<p>I find this proof striking for a number of reasons. First of all, even from this small example, you get a clear idea how the proof will proceed in the general case (even though you need a couple of technical tools like median hyperplanes). Second, for three voters, the proof requires only an elementary geometric construction that (I hope) does not scare off people who do not feel that comfortable around mathematics. Finally, and this is most remarkable, this proof gives clear instructions how someone who wants to manipulate public decision making should go about it: <b>Play off different groups of voters against each other! The fact that many political decisions are two or higher dimensional provides the necessary room to maneuver.</b></p>

<p>(In fact, I find it striking how similar the manipulative stragtegy suggested by the geometry of voting is to how many agents on the political stage actually behave. To manipulate public opinion, they try to reduce the public discussion on an issue to a one-dimensional problem. To a choice between two alternatives. They try to hide the fact that real world problems are higher-dimensional.)</p>

<h2 style="clear: both;">Conclusion</h2>

<p>I hope to have convinced you that there is merit in looking at politics from a geometric point of view. A natural consequence of this point of view is McKelvey&#8217;s theorem, which states that <b>an agenda controller can get voters to agree to anything the agenda controller wants of their own free will</b>. Fortunately, there are no perfect agenda controllers in real world democracies! But McKelvey&#8217;s theorem reminds us that we had better exercise the freedom we have to shape the political agenda. <b>Because without active political debate, the right to vote alone does not give the public any power at all.</b></p>

<h2 style="clear: both;">Q&amp;A</h2>

There are a great many things more to say about all this. Here are a few of them.

<h3>Budgets are more complicated than this!</h3>

<p>Of course a state&#8217;s budget is much more complex than the model I suggested above. There are many more parameters to take into account! The advantage of this model is that it captures the gist of the problem while still being low-dimensional enough so that we can draw something!</p>

<h3>There are some assumptions missing from McKelvey&#8217;s theorem!</h3>

<p>That is true. First of all, McKelvey&#8217;s theorem only works in dimensions two and up. If different policies all lie on a line, then McKelvey&#8217;s theorem fails. The same thing can happen in higher dimensions if the voters&#8217; individual preferences have a particular pattern. For example, if all voters have the exact same ideal, then agenda control won&#8217;t work. The technical assumption I omitted in the above statement, is that the median hyperplanes (whatever that is) of the the voters&#8217; ideal policies do not all intersect in a single point. However, this assumption is not critical for the following reason: By slightly perturbing the voters ideal policies we can always guarantee that this assumption is satisfied. Also, the theorem assumes that the set of policies is all of $\mathbb{R}^n$. This is not true in the budget example, as negative values for taxes or spending do not make sense (a negative deficit is fine, though). But generalizations of McKelvey&#8217;s theorem take care of this issue (see below). Finally, the theorem assumes an odd number of voters. McKelvey argues, however, that this makes no difference, as the agenda controller can decide to participate in the vote if and only if his vote is required to make the total number of votes odd.</p>

<p>It should also be mentioned that McKelvey&#8217;s theorem assumes that all voters use the Euclidean distance to measure which policies they prefer. However, this assumption is not essential as McKelvey showed in a subsequent paper. (See below.)</p>

<h3>What generalizations of McKelvey&#8217;s theorem are there?</h3>

<p>McKelvey generalized his theorem considerably in subsequent work. For example, he showed that if the set of policies is an arbitrary connected subset $X$ of $\mathbb{R}^n$ and each voter measures with his or her own, private notion of distance (which has to be continuous) then, still, the top cycle of the majority rule is going to be all of $X$ (i.e., agenda control works). He concludes, in his own words:</p>

<p>&#8220;Regardless of other voters&#8217; preferences, any one voter with complete information of the other voters&#8217; preferences, control of the agenda, and the ability to cast his own vote as he chooses can always construct majority paths to get anywhere in space.&#8221;</p>

<h3>Is protest really more important than voting?</h3>

<p>The provocative catchphrase that &#8220;protest is more important than voting&#8221; is meant in the following sense: A political system in which people do not shape the political agenda at all but only go to vote is not democratic. In this sense, active participation in the public political discourse is at least as important as going to vote. This is not to be construed as an excuse not to go voting, however!</p>

<h3>Is there a mathematical proof that influencing the political agenda is more important than voting?</h3>

<p>No. Mathematics makes statements about abstract models. McKelvey&#8217;s theorem makes a statement about a particular abstract model of a society in which the people do not influence the political agenda at all and behave in a predictable way. This statement is provably true. But &#8220;mathematics&#8221; makes no claim whatsoever about what this statement about an abstract model has to do with <em>reality</em>.</p>

<h3>How realistic is the model of society assumed in McKelvey&#8217;s theorem?</h3>

<p>First of all: I am not a political scientist, and I do not know of any empirical research on this subject. My personal opinion, however, is the following: Western democracies such as the USA do not fit the model of McKelvey&#8217;s theorem at all. In particular there are a number of important differences:
<ol><li>In practice, all actors on the political stage constantly strive to control the agenda! So McKelvey&#8217;s theorem does not apply to practical politics, but it offers an unconventional explanation why control of the agenda is so strongly contested.</li><li>The theorem assumes that the agenda controller has complete information about the preferences off all voters. This is not true in practice. However, never before was so much data about personal opinions readily available to anyone with an internet connection. So one could argue that western societies are converging on the condition required for McKelvey&#8217;s theorem to apply.</li><li>Voters oppinions change over time. The theorem assumes that opinions are constant. I would guess, though, that the theorem could be extended to account for changing opinions.</li><li>There are few voting processes where voters only decide to aprove or reject a single proposition. Presidential election in the US fit this description but are too closely tied to personality to admit a reasonable parameterization by points in space. In most other public elections, the voters have to decide between many alternatives, so spatial voting does not fit either. In process of passing a bill in congress fits the model accurately, however there voters are constantly trying to control the agenda. Ballot propositions also fit the model, but again, voters have direct influence on the available propositions through the initiative system.</li><li>As mentioned above, the theorem makes a couple of additional technical assumptions. However, I do not think that these are essential, especially with regard to McKelvey generalizations of his theorem.</li><li>There is one technical assumption that deserves special mention: continuity. I do not think that it is that much of a constraint to assume that voters preferences are continuous. Rather, I think it is a significant departure from reality to assume that the space of all policies is a continuum in the first place. For a budget, this is simply false: Two budgets cannot differ infinitessimally - they can only differ by cents.</li></ol>
So, while McKelvey&#8217;s theorem does <em>not</em> prove anything about real world democracies, I think it still provides insight on how democracies work.
</p>

<h3>There is no policy that cannot be defeated by any other policy in a majority vote, right? </h3>

<p>Exactly! But instead of looking for a policy that cannot be defeated, we can go for the policy that is least likely to be defeated! This is the policy for which the shaded green area in circle picture above is smallest. As it turns out this so-called &#8220;strong point&#8221; of the majority game lies roughly in the center of all voters&#8217; ideal points. More precisely, it is given by a convex combination of the voters&#8217; preferences, where the weights of the convex combination are given by spatial power indices of the voters. This means that centrist voters have more influence on the strong point than extremist voters. (Owen and Shapley 1989)</p>

<h3>Where can I read more on this?</h3>

<p>I recommend the excellent article by P.D. Straffin Jr. in the Handbook of Game Theory and Richard McKelvey&#8217;s original articles on the subject.</p>

<ol><li>Straffin, P. D. J. (1994). Power and stability in politics. Handbook of Game Theory with Economic Applications Volume 2 (Vol. 2, pp. 1127-1151). Elsevier.</li><li>McKelvey, R. D. (1979). General Conditions for Global Intransitivities in Formal Voting Models. Econometrica, 47(5), 1085-1112.</li><li>McKelvey, R. D. (1976). Intransitivities in multidimensional voting models and some implications for agenda control. Journal of Economic Theory, 12, 472-482.</li></ol>
]]></content>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="lecture"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="math"/>
    
      <category scheme="http://blog.felixbreuer.net/blog/categories" term="policy"/>
    
  </entry>
  
</feed>
