<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>João Ferreira &#187; proofs</title>
	<atom:link href="http://www.joaoff.com/tag/proofs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joaoff.com</link>
	<description>Programming, Algorithms, and Mathematics</description>
	<lastBuildDate>Wed, 09 Jun 2010 10:41:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Probabilities in Proofreading</title>
		<link>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/</link>
		<comments>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:04:36 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Computing Science]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[calculational]]></category>
		<category><![CDATA[polya]]></category>
		<category><![CDATA[probabilities]]></category>
		<category><![CDATA[probability]]></category>
		<category><![CDATA[proof]]></category>
		<category><![CDATA[proofreading]]></category>
		<category><![CDATA[proofs]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=267</guid>
		<description><![CDATA[Suppose you write a program and you send the source code to two of your friends, and . Your two friends read the code and when they finish, A errors are detected by , B errors are detected by , and C errors are detected by both. So, in total, A+B-C errors are detected and [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you write a program and you send the source code to two of your friends, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />. Your two friends read the code and when they finish, <em>A</em> errors are detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" />, <em>B</em> errors are detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />, and <em>C</em> errors are detected by both. So, in total, <em>A+B-C</em> errors are detected and can now be eliminated. We wish to <em>estimate</em> the number of errors that remain unnoticed and uncorrected.</p>
<p>The original version of this problem concerns manuscripts and proofreaders, instead of source code and programmers. It was posed and solved by George Polya and published in 1976 on <a href="http://www.maa.org/pubs/monthly.html" title="The American Mathematical Monthly Journal">The American Mathematical Monthly</a> under the name of <em>Probabilities in Proofreading</em>. Because the problem is interesting and Polya&#8217;s solution is short and elegant, I have decided to record and share it. Also, since code sharing and reading is a frequent activity in the software development world, estimating the desired value can be helpful for some readers of this blog.</p>
<h3>Estimating the number of unnoticed errors</h3>
<p>Let <em>E</em> be the number of all errors, noticed and unnoticed, in the source code. Our goal is to estimate the value of <em>E-(A+B-C)</em>. Let <em>p</em> be the probability that friend <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> notices any given error and <em>q</em> the analogous probability for friend <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />. The expected number of errors that may be detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/8cc3bbe573866e221e7058d5c94f4d29.png' title="LaTeX Formula" alt="LaTeX Formula" /> and by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" /> is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7056be452630dd69988efc1014cb132a.png' title="LaTeX Formula" alt="LaTeX Formula" />. Assuming that these probabilities are independent, the expected number of errors that may be mutually detected by both friends is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/11091e85ba69d9e4f9df5448109fab45.png' title="LaTeX Formula" alt="LaTeX Formula" />.</p>
<p>Because we are interested in an <em>estimate</em>, we can safely assume that the expected numbers are approximately equal to the number of errors detected, that is, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/f6b99c84e75877cc3b7a90c154ac13d5.png' title="LaTeX Formula" alt="LaTeX Formula" />, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7f97b9bcffe46f8d265985d6c19c88c7.png' title="LaTeX Formula" alt="LaTeX Formula" />, and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/2c4ca7fc8699851220220bd5da2ff535.png' title="LaTeX Formula" alt="LaTeX Formula" />. (We use the notation <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/39336a2ffd276833bc2af414ed460bfa.png' title="LaTeX Formula" alt="LaTeX Formula" /> to denote that two numbers are approximately equal.)</p>
<p>We now have all the ingredients to conclude the solution. Recall that our goal is to estimate the value of <em>E-(A+B-C)</em>. We calculate:</p>
<p><img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d5bab5f3311a1d1c63abbb8274ac53ac.png' title="LaTeX Formula" alt="LaTeX Formula" /></p>
<p>This is the desired estimate!</p>
<p style="margin-top: 10px;"><strong>Related Articles:</strong></p><ul><li><a href="http://www.joaoff.com/2008/05/09/multiples-in-the-fibonacci-series/" rel="bookmark">Multiples in the Fibonacci series</a></li><li><a href="http://www.joaoff.com/2008/02/11/direct-proofs/" rel="bookmark">Calculational proofs are usually direct</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Calculational proofs are usually direct</title>
		<link>http://www.joaoff.com/2008/02/11/direct-proofs/</link>
		<comments>http://www.joaoff.com/2008/02/11/direct-proofs/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 00:02:03 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[calculational]]></category>
		<category><![CDATA[irrationality]]></category>
		<category><![CDATA[proofs]]></category>

		<guid isPermaLink="false">http://www.joaoferreira.org/2008/02/11/direct-proofs/</guid>
		<description><![CDATA[jd2718 asked in his blog if anyone knew a direct proof of the irrationality of &#160;&#160;. In this post I present a proof that, even if some don&#8217;t consider it direct, is a nice example of the effectiveness of calculational proof. But first, there are two concepts that need to be clarified: direct proof and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jd2718.wordpress.com/2008/02/06/is-there-a-direct-proof/" title="Is there a direct proof for the irrationality of sqrt(2)?">jd2718 asked in his blog</a> if anyone knew a direct proof of the irrationality of <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/e3ffc1186774b36e03fbf02a80b794db.png' title="LaTeX Formula" alt="LaTeX Formula" />&nbsp;&nbsp;. In this post I present a proof that, even if some don&#8217;t consider it direct, is a nice example of the effectiveness of calculational proof. But first, there are two concepts that need to be clarified: <em>direct proof</em> and <em>irrational number</em>.</p>
<h2>Direct proofs</h2>
<p>The concept of direct proof can vary slightly from person to person. For instance, <a href="http://en.wikipedia.org/wiki/Direct_proof" title="Definition of Direct Proof in Wikipedia">Wikipedia defines it as</a>:</p>
<blockquote><p>In mathematics and logic, a direct proof is a way of showing the truth or falsehood of a given statement by a straightforward combination of established facts, usually existing lemmas and theorems, without making any further assumptions.</p></blockquote>
<p>Alternatively, in <a href="http://zimmer.csufresno.edu/~larryc/proofs/proofs.direct.html" title="Definition of Direct Proof at Larry Cusick's website">Larry W. Cusick&#8217;s website we can read</a>:</p>
<blockquote><p>
A direct poof [<i>sic</i>] should be thought of as a flow of implications beginning with &#8220;P&#8221; and ending with &#8220;Q&#8221;.</p>
<p>P -> &#8230; -> Q</p>
<p>Most proofs are (and should be) direct proofs. Always try direct proof first, unless you have a good reason not to.
</p></blockquote>
<p>I consider the wording &#8216;<i>without making any further assumptions</i>&#8216; in the first definition ambiguous and I don&#8217;t understand why the second definition only applies to implications. But anyway, with these definitions in mind, a direct proof for the irrationality of <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/71486f265f83bc1e3d2b6f67704bcc23.png' title="LaTeX Formula" alt="LaTeX Formula" /> can be something like:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/548fc40d95576c3a28bbccd7978041ec.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<p>Or, alternatively, we can also use a proof of the following shape:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7bea98f144c5cf871381e339a7da2770.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<h2>Irrational numbers</h2>
<p>An irrational number is a real number that can&#8217;t be expressed as a simple fraction. Therefore, the number <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/71486f265f83bc1e3d2b6f67704bcc23.png' title="LaTeX Formula" alt="LaTeX Formula" /> is irrational because for all integers m and n, with n non-negative, we have that:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/f7b8eba2e56a090a2b1d238a148123f4.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<h2>A direct proof for the irrationality of <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/71486f265f83bc1e3d2b6f67704bcc23.png' title="LaTeX Formula" alt="LaTeX Formula" /></h2>
<p>Now that we have clarified the concepts above, we prove that <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/71486f265f83bc1e3d2b6f67704bcc23.png' title="LaTeX Formula" alt="LaTeX Formula" /> is irrational. For all integers m and n, with n non-negative, we have:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d18ae2dd07478a1d23daf198f99b64e7.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<p>Note that, unlike traditional proofs, we don&#8217;t assume that m and n are co-prime, nor that <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/71486f265f83bc1e3d2b6f67704bcc23.png' title="LaTeX Formula" alt="LaTeX Formula" /> is a rational. We essentially derive the boolean value of the expression <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/f1924c6abc6e88eeb2dc5618df8219b0.png' title="LaTeX Formula" alt="LaTeX Formula" /></p>
<p>If you have any suggestions or corrections, please leave a comment. I&#8217;d be more than happy to hear from you.</p>
<p>Note: I learnt the contrapositive of this proof from Roland Backhouse (page 38, <a href="http://www.amazon.co.uk/Program-Construction-Calculating-Implementations-Specifications/dp/0470848820/ref=pd_bbs_sr_1?ie=UTF8&#038;s=gateway&#038;qid=1202602020&#038;sr=8-1" title="Program Construction -- Calculating Implementations from Specifications">Program Construction &#8212; Calculating Implementations from Specifications</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2008/02/11/direct-proofs/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
