<?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; proof</title>
	<atom:link href="http://www.joaoff.com/tag/proof/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>A Calculational Proof of the Handshaking Lemma</title>
		<link>http://www.joaoff.com/2009/04/07/calculational-proof-handshaking-lemma/</link>
		<comments>http://www.joaoff.com/2009/04/07/calculational-proof-handshaking-lemma/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 21:11:55 +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[Methodology]]></category>
		<category><![CDATA[calculational]]></category>
		<category><![CDATA[goal-oriented]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[proof]]></category>
		<category><![CDATA[quantifiers]]></category>
		<category><![CDATA[vertex]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=86</guid>
		<description><![CDATA[In graph theory, the degree of a vertex A, d.A, is the number of edges incident with the vertex A, counting loops twice. So, considering graph 0 below, we have d.A=3, d.B=3, d.C=1, d.D=3, and d.E=2. A well-known property is that every undirected graph contains an even number of vertices with odd degree. The result [...]]]></description>
			<content:encoded><![CDATA[<p>In graph theory, the degree of a vertex <em>A</em>, <em>d.A</em>, is the number of edges incident with the vertex A, counting loops twice. So, considering graph 0 below, we have <em>d.A=3</em>, <em>d.B=3</em>, <em>d.C=1</em>, <em>d.D=3</em>, and <em>d.E=2</em>.</p>
<div id="attachment_90" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.joaoff.com/wp-content/uploads/2009/03/graph.png"><img class="size-medium wp-image-90" title="Figure 0: Example of an undirected graph with five nodes" src="http://www.joaoff.com/wp-content/uploads/2009/03/graph.png" alt="Example of an undirected graph with five nodes" width="300" height="229" /></a><p class="wp-caption-text">Graph 0: Example of an undirected graph with five nodes</p></div>
<p>A well-known property is that every undirected graph contains an even number of vertices with odd degree. The result first appeared in <a href="http://math.dartmouth.edu/~euler/docs/originals/E053.pdf">Euler&#8217;s 1736 paper</a> on the <a href="http://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberg">Seven Bridges of Königsberg</a> and is also known as <a href="http://en.wikipedia.org/wiki/Handshaking_lemma#Handshaking_lemma">the handshaking lemma</a> (that&#8217;s because another way of formulating the property is that the number of people that have shaken hands an odd number of times is even).</p>
<p>As we can easily verify, graph 0 satisfies this property. There are four vertices with odd degree (<em>A</em>,<em>B</em>,<em>C</em>, and <em>D</em>), and 4, of course, is an even number.</p>
<p>Although the proof of this property is simple, I have never seen it proved in a calculational and goal-oriented way. My aim with this post is to show you a development of a goal-oriented proof.<br />
<span id="more-86"></span><br />
Before we start, let me explain the notations that I use. I assume the existence of two predicates, <em>even</em> and <em>odd</em>, that test the parity of numbers. For example, <em>even.8</em> and <em>odd.3</em> are both <em>true</em>, and <em>even.5</em> and <em>odd.6</em> are both <em>false</em>. Also, I use the so-called Eindhoven notation for quantifiers; for example, to express the sum of all natural even numbers less than 50 I write <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/be3b25ccb6b37e8248904e21294b3ddf.png' title="LaTeX Formula" alt="LaTeX Formula" />, and instead of writing <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/11d37b46677a90b3273eef87d2744aca.png' title="LaTeX Formula" alt="LaTeX Formula" /> , I write <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d33282de72be9e825fe5b452d1d0a305.png' title="LaTeX Formula" alt="LaTeX Formula" />.</p>
<p>Now, the first step in any goal-oriented solution is to express the goal. In other words, what do we want to prove or calculate? Using the notation just described and assuming that <em>V</em> is the set of all vertices, our goal is to determine the value of the following expression:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/b3bb6964f72c90aa61c7427867a66568.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<p>Note that we are adding 1 (counting) for each node <em>a</em> in <em>V</em> with an odd degree. We then apply the predicate <em>even</em> to the result. If the result is <em>true</em>, there is an even number of vertices with odd degree; otherwise, there is an odd number. Our goal is thus to determine its value. (We know that it must evaluate to <em>false</em>, because the property is well-known. However, in general, when doing mathematics, we don&#8217;t know what is the final value; that is why goal-oriented and calculational proofs are important.)</p>
<p>We know that the predicate <em>even</em> distributes over addition, so we calculate:</p>
<p><img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/4e8aa954abd05c14d92756a7ac227f40.png' title="LaTeX Formula" alt="LaTeX Formula" /></p>
<p>This calculation shows that the parity of the number of vertices with odd degree is the same as the parity of the sum of all the degrees. But because each edge has two ends, the sum of all the degrees is simply twice the total number of edges. We thus have:</p>
<p><img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d52d70c3553e9e22ee975f34a594f8b6.png' title="LaTeX Formula" alt="LaTeX Formula" /></p>
<p>And so we can conclude that every undirected graph contains an even number of vertices with odd degree.</p>
<h2>What is wrong with conventional solutions?</h2>
<p>Conventional solutions for this problem are usually very similar to the following one, taken from the book &#8220;Ingenuity in Mathematics&#8221; (p. 8), by Ross Honsberger:</p>
<blockquote><p>
The proof in general is simple. We denote by T the total of all the local degrees:</p>
<p>(1) T = d(A) + d(B) + d(C) + &#8230; + d(K) .</p>
<p>In evaluating T we count the number of edges running into A, the number into B, etc., and add. Because each edge has two ends, T is simply twice the number of edges; hence T is even.</p>
<p>Now the values d(P) on the right-hand side of (1) which are even add up to a sub-total which is also even. The remaining values d(P) each of which is odd, must also add up to an even sub-total (since T is even). This shows that there is an even number of odd d(P)&#8217;s (it takes an even number of odd numbers to give an even sum). Thus there must be an even number of vertices with odd local degree.
</p></blockquote>
<p>There is nothing <em>seriously</em> wrong with this solution. It clearly shows why the property holds. However, it is, in my view, oriented to verification: it starts by introducing the total sum of all the local degrees, observing that its value is even; then it analyses that sum to conclude the property. My question is: how can we teach students to come with the total sum of all the local degrees? In general, how can we teach students to come with seemingly unrelated concepts that will be crucial in the development of their arguments? I don&#8217;t think we can.</p>
<p>On the other hand, if we look at the goal-oriented proof, we see that the goal is simple to express. Furthermore, with some training, most students would write it correctly and would be able to calculate that the parity of the number of vertices with odd degree is the same as the parity of the sum of all the degrees. And then (and only then) the introduction of the total sum of all the degrees would make sense. In a way, goal-oriented calculations are like that famous <a href="http://en.wikipedia.org/wiki/Breaking_the_Magician%27s_Code">masked magician that reveals magic&#8217;s biggest secrets</a>, for they reveal how the rabbit got into the hat.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2009/04/07/calculational-proof-handshaking-lemma/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multiples in the Fibonacci series</title>
		<link>http://www.joaoff.com/2008/05/09/multiples-in-the-fibonacci-series/</link>
		<comments>http://www.joaoff.com/2008/05/09/multiples-in-the-fibonacci-series/#comments</comments>
		<pubDate>Fri, 09 May 2008 16:18:30 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[calculational]]></category>
		<category><![CDATA[distributivity]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[proof]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=64</guid>
		<description><![CDATA[I found the following problem on K. Rustan M. Leino&#8217;s puzzles page: [Carroll Morgan told me this puzzle.] Prove that for any positive K, every Kth number in the Fibonacci sequence is a multiple of the Kth number in the Fibonacci sequence. More formally, for any natural number n, let F(n) denote Fibonacci number n. [...]]]></description>
			<content:encoded><![CDATA[<p>I found the following problem on <a href="http://research.microsoft.com/~leino/puzzles.html#Multiples%20in%20the%20Fibonacci%20series" title="K. Rustan M. Leino's puzzles page">K. Rustan M. Leino&#8217;s puzzles page</a>:</p>
<blockquote><p>
[Carroll Morgan told me this puzzle.]</p>
<p>Prove that for any positive K, every Kth number in the Fibonacci sequence is a multiple of the Kth number in the Fibonacci sequence.</p>
<p>More formally, for any natural number n, let F(n) denote Fibonacci number n. That is, F(0) = 0, F(1) = 1, and F(n+2) = F(n+1) + F(n).  Prove that for any positive K and natural n, F(n*K) is a multiple of F(K).
</p></blockquote>
<p>This problem caught my attention, because it looks like a good example for using a result that I have derived last year. My result gives a <a href="http://www.joaoff.com/publications/JFFs/JFF0" title="JFF0: Distributivity and the greatest common divisor">reasonable sufficient condition for showing that a function distributes over the greatest common divisor</a> and shows that the Fibonacci function satisfies the condition.</p>
<p>In fact, using the property that the Fibonacci function distributes over the greatest common divisor, we can solve this problem very easily. Using <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/5bd9fcfb08d175f1ee80d815885549fb.png' title="LaTeX Formula" alt="LaTeX Formula" /> to denote the Fibonacci number <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/55a049b8f161ae7cfeb0197d75aff967.png' title="LaTeX Formula" alt="LaTeX Formula" />, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/67f8900bb348ad7405c6997613c56dab.png' title="LaTeX Formula" alt="LaTeX Formula" /> to denote the greatest common divisor of <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/0e51a2dede42189d77627c4d742822c3.png' title="LaTeX Formula" alt="LaTeX Formula" /> and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/55a049b8f161ae7cfeb0197d75aff967.png' title="LaTeX Formula" alt="LaTeX Formula" />, and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/1df00dc7bb553d90756ea6002bd9fbb3.png' title="LaTeX Formula" alt="LaTeX Formula" /> to denote the division relation, a possible proof is:</p>
<div class="latex-margin">
<img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/ee86026bd72cb024a4ace884b6116f7f.png' title="LaTeX Formula" alt="LaTeX Formula" />
</div>
<p>The crucial step is clearly the one where we apply the distributivity property. Distributivity properties are very important, because they allow us to rewrite expressions in a way that prioritizes the function that has the most relevant properties. In the example above we could not simplify <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/76f243059e8bb3a9cacdc63b2f968769.png' title="LaTeX Formula" alt="LaTeX Formula" /> nor <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7b2ebadea81fc6279c1af91202d106e8.png' title="LaTeX Formula" alt="LaTeX Formula" />, but applying the distributivity property prioritised the <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/ce98e3d3fbb19473820b37950cb2ca99.png' title="LaTeX Formula" alt="LaTeX Formula" /> operator &#8212; and we know how to simplify <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d13fe68318d5bf8d74cc8c1d92cb7d03.png' title="LaTeX Formula" alt="LaTeX Formula" />. Furthermore, in practice, distributivity properties reduce to simple syntactic manipulations, thus reducing the introduction of error and simplifying the verification of our arguments.</p>
<p>(Now that I think about it, perhaps it would be a good idea to write a note on distributivity properties, summarizing their importance and their relation with symbol dynamics.)</p>
<p>If you have any corrections, questions, or alternative proofs, please leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2008/05/09/multiples-in-the-fibonacci-series/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
