<?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>phimuemue</title>
	<atom:link href="http://phimuemue.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://phimuemue.com</link>
	<description></description>
	<lastBuildDate>Sun, 13 Nov 2011 17:28:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Vim LatexSuite missing features</title>
		<link>http://phimuemue.com/?p=293</link>
		<comments>http://phimuemue.com/?p=293#comments</comments>
		<pubDate>Mon, 10 Oct 2011 13:06:09 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[table of contents]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=293</guid>
		<description><![CDATA[Since Emacs needs quite an amount of time to start, I decided to give vim a try and am quite happy with it. However, I missed a feature that I appreciated since I came to know it in AucTeX: Showing and browsing the table of contents. So, I implemented a basic table of contents myself. [...]]]></description>
				<content:encoded><![CDATA[<p>Since Emacs needs quite an amount of time to start, I decided to give vim a try and am quite happy with it. However, I missed a feature that I appreciated since I came to know it in AucTeX: Showing and browsing the table of contents. So, I implemented a basic table of contents myself.<br />
<span id="more-293"></span><br />
You can simply copy this to your plugins folder (usually <code>~/.vim/plugin</code>), and then call <code>:TOC</code> from within an opened tex-file. Moreover, this script enables automatic recognition of custom commands.</p>
<p>For both provided features, the whole document is scanned for sectioning commands and for <code>newcommand</code>-commands.</p>
<script src="http://gist.github.com/1275260.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=293</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An interesting bijection</title>
		<link>http://phimuemue.com/?p=273</link>
		<comments>http://phimuemue.com/?p=273#comments</comments>
		<pubDate>Sun, 11 Sep 2011 08:27:15 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=273</guid>
		<description><![CDATA[I came across the following identity recently: . This can be proved in various ways. Here, I will describe a &#8220;combinatorial proof&#8221;. First of all, we note the following: is the number of pairs of subsets , such that . Moreover, is the number of possibilities to choose items out of set containing items. This [...]]]></description>
				<content:encoded><![CDATA[<p>I came across the following identity recently: <img src='http://s.wordpress.com/latex.php?latex=%5Csum_%7Bi%3D0%7D%5En%20%5Cbinom%7Bn%7D%7Bi%7D%5E2%20%3D%20%5Cbinom%7B2n%7D%7Bn%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\sum_{i=0}^n \binom{n}{i}^2 = \binom{2n}{n}' title='\sum_{i=0}^n \binom{n}{i}^2 = \binom{2n}{n}' class='latex' />. This can be proved in various ways. Here, I will describe a &#8220;combinatorial proof&#8221;.<br />
<span id="more-273"></span><br />
First of all, we note the following: <img src='http://s.wordpress.com/latex.php?latex=%5Cbinom%7Bn%7D%7Bi%7D%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\binom{n}{i}^2' title='\binom{n}{i}^2' class='latex' /> is the number of pairs of subsets <img src='http://s.wordpress.com/latex.php?latex=%28S%2C%20T%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(S, T)' title='(S, T)' class='latex' />, such that <img src='http://s.wordpress.com/latex.php?latex=S%2CT%5Csubseteq%20%5C%7B1%2C2%2C3%2C%5Cdots%2Cn%20%5C%7D%2C%20%7CS%7C%20%3D%20%7CT%7C%20%3D%20i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='S,T\subseteq \{1,2,3,\dots,n \}, |S| = |T| = i' title='S,T\subseteq \{1,2,3,\dots,n \}, |S| = |T| = i' class='latex' />. Moreover, <img src='http://s.wordpress.com/latex.php?latex=%5Cbinom%7B2n%7D%7Bn%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\binom{2n}{n}' title='\binom{2n}{n}' class='latex' /> is the number of possibilities to choose <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> items out of set containing <img src='http://s.wordpress.com/latex.php?latex=2n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2n' title='2n' class='latex' /> items. This means, there must be a bijection from the pairs of subsets <img src='http://s.wordpress.com/latex.php?latex=%28S%2CT%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(S,T)' title='(S,T)' class='latex' /> (as described before) and the subsets of cardinality <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> of a set containing <img src='http://s.wordpress.com/latex.php?latex=2n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2n' title='2n' class='latex' /> elements.</p>
<p>To construct such a solution, we first note the following: <img src='http://s.wordpress.com/latex.php?latex=%5Cbinom%7Bn%7D%7Bi%7D%20%3D%20%5Cbinom%7Bn%7D%7Bn-i%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\binom{n}{i} = \binom{n}{n-i}' title='\binom{n}{i} = \binom{n}{n-i}' class='latex' />, a very basic identity of binomial coefficients. This means <img src='http://s.wordpress.com/latex.php?latex=%5Cbinom%7Bn%7D%7Bi%7D%5E2%20%3D%20%5Cbinom%7Bn%7D%7Bi%7D%20%5Cbinom%7Bn%7D%7Bn-i%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\binom{n}{i}^2 = \binom{n}{i} \binom{n}{n-i}' title='\binom{n}{i}^2 = \binom{n}{i} \binom{n}{n-i}' class='latex' />. However, this corresponds to the number of possible pairs of sets <img src='http://s.wordpress.com/latex.php?latex=%28S%27%2C%20T%27%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(S&#039;, T&#039;)' title='(S&#039;, T&#039;)' class='latex' /> with <img src='http://s.wordpress.com/latex.php?latex=S%27%2C%20T%27%5Csubseteq%20%5C%7B1%2C2%2C3%2C%5Cdots%2Cn%20%5C%7D%2C%20%7CS%27%7C%3Di%2C%20%7CT%27%7C%3Dn-i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='S&#039;, T&#039;\subseteq \{1,2,3,\dots,n \}, |S&#039;|=i, |T&#039;|=n-i' title='S&#039;, T&#039;\subseteq \{1,2,3,\dots,n \}, |S&#039;|=i, |T&#039;|=n-i' class='latex' />. For convenience we can simply say <img src='http://s.wordpress.com/latex.php?latex=T%27%3D%5C%7B1%2C2%2C3%2C%5Cdots%20n%5C%7D%5Csetminus%20T&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T&#039;=\{1,2,3,\dots n\}\setminus T' title='T&#039;=\{1,2,3,\dots n\}\setminus T' class='latex' />.</p>
<p>Now we desribe the process of choosing <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> elements from the <img src='http://s.wordpress.com/latex.php?latex=2n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2n' title='2n' class='latex' />-element set <img src='http://s.wordpress.com/latex.php?latex=%5C%7B%201%2C2%2C3%2C%5Cdots%20%2Cn%2C%20%5Coverline%7B1%7D%2C%20%5Coverline%7B2%7D%2C%20%5Coverline%7B3%7D%2C%5Cdots%2C%5Coverline%7Bn%7D%20%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\{ 1,2,3,\dots ,n, \overline{1}, \overline{2}, \overline{3},\dots,\overline{n} \}' title='\{ 1,2,3,\dots ,n, \overline{1}, \overline{2}, \overline{3},\dots,\overline{n} \}' class='latex' />. The obvious way is to choose simply <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> elements. This results in <img src='http://s.wordpress.com/latex.php?latex=%5Cbinom%7B2n%7D%7Bn%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\binom{2n}{n}' title='\binom{2n}{n}' class='latex' /> possibilities.</p>
<p>The other way to choose <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> elements would be as follows: We partition our set into two sets (namely <img src='http://s.wordpress.com/latex.php?latex=A%3D%20%5C%7B1%2C2%2C3%2C%5Cdots%2Cn%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A= \{1,2,3,\dots,n\}' title='A= \{1,2,3,\dots,n\}' class='latex' /> and <img src='http://s.wordpress.com/latex.php?latex=%5Coverline%7BA%7D%20%3D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5C%7B%5Coverline%7B1%7D%2C%5Coverline%7B2%7D%2C%5Coverline%7B3%7D%2C%5Cdots%2C%5Coverline%7Bn%7D%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\overline{A} =                 \{\overline{1},\overline{2},\overline{3},\dots,\overline{n}\}' title='\overline{A} =                 \{\overline{1},\overline{2},\overline{3},\dots,\overline{n}\}' class='latex' />. Then, in the first step we pick <img src='http://s.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> elements from the set <img src='http://s.wordpress.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A' title='A' class='latex' /> (<img src='http://s.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> random between 0 and <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />). Since we are allowed to take <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> elements in total, we pick <img src='http://s.wordpress.com/latex.php?latex=n-i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n-i' title='n-i' class='latex' /> elements from the set <img src='http://s.wordpress.com/latex.php?latex=A%27&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A&#039;' title='A&#039;' class='latex' />. This means, we picked <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> elements in total. In the first step, we can pick <img src='http://s.wordpress.com/latex.php?latex=i%3D0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i=0' title='i=0' class='latex' /> or <img src='http://s.wordpress.com/latex.php?latex=i%3D1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i=1' title='i=1' class='latex' /> or <img src='http://s.wordpress.com/latex.php?latex=i%3D2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i=2' title='i=2' class='latex' /> or &#8230; or <img src='http://s.wordpress.com/latex.php?latex=i%3Dn&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i=n' title='i=n' class='latex' /> elements. Thus, in total we have <img src='http://s.wordpress.com/latex.php?latex=%5Csum_%7Bi%3D0%7D%5En%20%5Cbinom%7Bn%7D%7Bi%7D%5Cbinom%7Bn%7D%7Bn-i%7D%3D%5Csum_%7Bi%3D0%7D%5En%5Cbinom%7Bn%7D%7Bi%7D%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\sum_{i=0}^n \binom{n}{i}\binom{n}{n-i}=\sum_{i=0}^n\binom{n}{i}^2' title='\sum_{i=0}^n \binom{n}{i}\binom{n}{n-i}=\sum_{i=0}^n\binom{n}{i}^2' class='latex' /> possibilities.</p>
<p>So, if we want to construct a bijection, we simply take all elements coming from <img src='http://s.wordpress.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A' title='A' class='latex' /> and put them into <img src='http://s.wordpress.com/latex.php?latex=S&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='S' title='S' class='latex' /> and all elements coming from <img src='http://s.wordpress.com/latex.php?latex=%5Coverline%7BA%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\overline{A}' title='\overline{A}' class='latex' /> and generate the complement set to obtain <img src='http://s.wordpress.com/latex.php?latex=T&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T' title='T' class='latex' /> for the pair <img src='http://s.wordpress.com/latex.php?latex=%28S%2C%20T%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(S, T)' title='(S, T)' class='latex' />.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=273</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Addendum: Encoding tuples with numbers</title>
		<link>http://phimuemue.com/?p=265</link>
		<comments>http://phimuemue.com/?p=265#comments</comments>
		<pubDate>Sun, 04 Sep 2011 12:29:47 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=265</guid>
		<description><![CDATA[I described how to encode tuples of natural numbers into natural numbers. Now, I wrote (hacked) a small piece in Haskell to try it in practice. So here it is: The functions encode and decode do most of the work. Note that this implementation includes also the number 0 (by accident, since computers usually index [...]]]></description>
				<content:encoded><![CDATA[<p>I described how to <a href="http://phimuemue.com/?p=208">encode tuples of natural numbers into natural numbers</a>. Now, I wrote (hacked) a small piece in Haskell to try it in practice.<br />
<span id="more-265"></span><br />
So here it is:<br />
<script src="http://gist.github.com/1192779.js"></script></p>
<p>The functions <code>encode</code> and <code>decode</code> do most of the work. Note that this implementation includes also the number 0 (by accident, since computers usually index lists starting with 0). However, as mentioned in the original post, it&#8217;s not a very practicable solution, since we have to deal with quite large numbers and factorize them.</p>
<p>The program can probably be sped up by explicitly stating the types of the functions and compiling the program. I omitted them because my compiler always complained about incompatible types (<code>[Int]</code> and <code>[Integer]</code>).</p>
<p>The program can be tested by simply calling <code>decode (encode [1,2,3,4,5])</code> or similar.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=265</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intermezzo: A brainf***-interpreter</title>
		<link>http://phimuemue.com/?p=257</link>
		<comments>http://phimuemue.com/?p=257#comments</comments>
		<pubDate>Thu, 04 Aug 2011 20:40:33 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=257</guid>
		<description><![CDATA[Here&#8217;s a 290-characters interpreter for the brainf*** programming language I wrote. It has to be compiled specifying some specialties: gcc -D"q(a,b)"="*c-a&#124;&#124;b;" -o pmmbf pmmbf.c and can be invoked as follows: ./pmmbf ",[-.]" 1000 The first argument specifies the brainf***-program to be run, the second argument determines the size of the tape.]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a 290-characters interpreter for the brainf*** programming language I wrote.<br />
<span id="more-257"></span><br />
<script src="http://gist.github.com/1126171.js"></script></p>
<p>It has to be compiled specifying some specialties:</p>
<p><code>gcc -D"q(a,b)"="*c-a||b;" -o pmmbf pmmbf.c</code></p>
<p>and can be invoked as follows:</p>
<p><code>./pmmbf ",[-.]" 1000</code></p>
<p>The first argument specifies the brainf***-program to be run, the second argument determines the size of the tape.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=257</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A nice property of primes</title>
		<link>http://phimuemue.com/?p=247</link>
		<comments>http://phimuemue.com/?p=247#comments</comments>
		<pubDate>Sun, 31 Jul 2011 09:58:02 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[combinatorics]]></category>
		<category><![CDATA[number theory]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=247</guid>
		<description><![CDATA[A while ago, a friend of mine told me that he once knew a number with the following property: &#8220;You can prepend any number before that number and will always obtain a prime number.&#8221; Of course, he was just kidding: Such a number can&#8217;t exist, because a number is divisible by 3 if and only [...]]]></description>
				<content:encoded><![CDATA[<p>A while ago, a friend of mine told me that he once knew a number with the following property: &#8220;You can prepend any number before that number and will always obtain a prime number.&#8221;</p>
<p>Of course, he was just kidding: Such a number can&#8217;t exist, because a number is divisible by 3 if and only if its digit sum is divisible by 3. So, it is no problem to find a number to prepend such the digit sum of the resulting number is divisible by 3. That implies that the resulting number is not a prime.</p>
<p>However, it&#8217;s possible to prove a similar theorem&#8230;<br />
<span id="more-247"></span><br />
We prove the following: For any number <img src='http://s.wordpress.com/latex.php?latex=m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m' title='m' class='latex' />, there is a number with <img src='http://s.wordpress.com/latex.php?latex=m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m' title='m' class='latex' /> digits, such there are infinitely many primes ending with this <img src='http://s.wordpress.com/latex.php?latex=m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m' title='m' class='latex' />-digit number.</p>
<p>To prove this, let us first consider the case <img src='http://s.wordpress.com/latex.php?latex=m%3D1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m=1' title='m=1' class='latex' />. This means, that we want to show that there is a number <img src='http://s.wordpress.com/latex.php?latex=n%20%5Cin%20%5Cleft%5C%7B%200%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%20%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' title='n \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' class='latex' /> such there are infinitely many primes ending in this number <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />.</p>
<p>It&#8217;s a well-known fact that there are infinitely many primes. Thus, due to the pigeonhole principle, there must be a number in <img src='http://s.wordpress.com/latex.php?latex=n%20%5Cin%20%5Cleft%5C%7B%200%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%20%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' title='n \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' class='latex' /> to occur infinitely many often. Thus, such a number exists.</p>
<p>Now, it&#8217;s no big step to generalize this to more digits: Assume we found our number <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> with the desired property. I.e. there are infinitely many primes ending with <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />. Now, we &#8220;cross out&#8221; all primes ending <em>not</em> in <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />. So, we are now only considering the infinitely many primes ending in <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /></p>
<p>But now, according to the pigeonhole principle, there must be a number <img src='http://s.wordpress.com/latex.php?latex=n%27%20%5Cin%20%5Cleft%5C%7B%200%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%20%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039; \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' title='n&#039; \in \left\{ 0,1,2,3,4,5,6,7,8,9 \right\}' class='latex' /> such that there are infinitely many primes whose next-to-last digit is <img src='http://s.wordpress.com/latex.php?latex=n%27&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039;' title='n&#039;' class='latex' />. That means, there are infinitely many primes ending in the digits <img src='http://s.wordpress.com/latex.php?latex=n%27%20n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039; n' title='n&#039; n' class='latex' />.</p>
<p>Now, we iterate the procedure: We cross out all primes not ending in <img src='http://s.wordpress.com/latex.php?latex=n%27%20n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039; n' title='n&#039; n' class='latex' />. This yields &#8211; again &#8211; infinitely many primes ending in <img src='http://s.wordpress.com/latex.php?latex=n%27%20n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039; n' title='n&#039; n' class='latex' />. So we can argument the same way as before: There must be &#8211; due to pigeonhole principle &#8211; a number $n&#8221;$ such that infinitely many primes end in <img src='http://s.wordpress.com/latex.php?latex=n%27%27%20n%27%20n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n&#039;&#039; n&#039; n' title='n&#039;&#039; n&#039; n' class='latex' />.</p>
<p>We can continue this procedure as long as we want &#8211; since there are infinitely many primes.</p>
<p>So, this means, there are arbitrarily large numbers <img src='http://s.wordpress.com/latex.php?latex=n_m%20n_%7Bm-1%7D%20n_%7Bm-2%7D%20%5Cdots%20n_2%20n_1%20n_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n_m n_{m-1} n_{m-2} \dots n_2 n_1 n_0' title='n_m n_{m-1} n_{m-2} \dots n_2 n_1 n_0' class='latex' /> (concatenated digits <img src='http://s.wordpress.com/latex.php?latex=n_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n_i' title='n_i' class='latex' />) such that there are infinitely many primes ending with exactly the digits <img src='http://s.wordpress.com/latex.php?latex=n_m%20n_%7Bm-1%7D%20n_%7Bm-2%7D%20%5Cdots%20n_2%20n_1%20n_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n_m n_{m-1} n_{m-2} \dots n_2 n_1 n_0' title='n_m n_{m-1} n_{m-2} \dots n_2 n_1 n_0' class='latex' />.</p>
<p>I like this proof because it is &#8211; once again &#8211; a proof of existence that does not explicitly construct a solution to the problem, but just shows that there is one.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=247</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A very nice proof of existence</title>
		<link>http://phimuemue.com/?p=233</link>
		<comments>http://phimuemue.com/?p=233#comments</comments>
		<pubDate>Fri, 15 Jul 2011 22:50:04 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[logic]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=233</guid>
		<description><![CDATA[We consider a propositional logic formula in conjunctive normal form, containing clauses, where each clause has exactly k (distinct) variables. We prove that this formula is satisfiable. First, we consider the following random experiment: We assign each occuring variable (in the whole formula) a value 1 or 0 generating a random assignment of values to [...]]]></description>
				<content:encoded><![CDATA[<p>We consider a propositional logic formula in <a href="http://en.wikipedia.org/wiki/Conjunctive_normal_form">conjunctive normal form</a>, containing <img src='http://s.wordpress.com/latex.php?latex=2%5Ek-1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2^k-1' title='2^k-1' class='latex' /> <a href="http://en.wikipedia.org/wiki/Clause_(logic)">clauses</a>, where each clause has exactly k (distinct) variables. </p>
<p>We prove that this formula is satisfiable.<br />
<span id="more-233"></span><br />
First, we consider the following random experiment: We assign each occuring variable (in the whole formula) a value 1 or 0 generating a random assignment of values to variables. Then, the probability that one specific clause is satisfied, is <img src='http://s.wordpress.com/latex.php?latex=1-%5Cdfrac%7B1%7D%7B2%5Ek%7D%20%3D%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1-\dfrac{1}{2^k} = \dfrac{2^k-1}{2^k}' title='1-\dfrac{1}{2^k} = \dfrac{2^k-1}{2^k}' class='latex' />. This is due to the fact that one single clause evaluates to false only for <em>one</em> single assignment of variables (the variables occuring in the clause).</p>
<p>So, we now introduce the following: For each clause <img src='http://s.wordpress.com/latex.php?latex=C_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C_i' title='C_i' class='latex' />, we introduce an indicator variable <img src='http://s.wordpress.com/latex.php?latex=I_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_i' title='I_i' class='latex' /> indicating whether the corresponding clause is satisfied or not (i.e. <img src='http://s.wordpress.com/latex.php?latex=I_i%3D1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_i=1' title='I_i=1' class='latex' /> iff <img src='http://s.wordpress.com/latex.php?latex=C_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C_i' title='C_i' class='latex' /> is satisfied by our randomly generated assignment). The above considerations yield <img src='http://s.wordpress.com/latex.php?latex=E%28I_i%29%3DP%28I_i%3D1%29%20%3D%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(I_i)=P(I_i=1) = \dfrac{2^k-1}{2^k}' title='E(I_i)=P(I_i=1) = \dfrac{2^k-1}{2^k}' class='latex' />, where <img src='http://s.wordpress.com/latex.php?latex=E%28I_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(I_i' title='E(I_i' class='latex' /> denotes the expected value of <img src='http://s.wordpress.com/latex.php?latex=I_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_i' title='I_i' class='latex' /> and <img src='http://s.wordpress.com/latex.php?latex=P%28A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P(A)' title='P(A)' class='latex' /> is the probability of event <img src='http://s.wordpress.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A' title='A' class='latex' />.</p>
<p>Moreover, we now define <img src='http://s.wordpress.com/latex.php?latex=X%3DI_1%20%2B%20I_2%20%2B%20%5Cdots%20%2B%20I_%7B2%5Ek-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X=I_1 + I_2 + \dots + I_{2^k-1}' title='X=I_1 + I_2 + \dots + I_{2^k-1}' class='latex' /> as the sum over all indication variables. This means, <img src='http://s.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' /> stands for the number of satisfied clauses. We compute the expected value <img src='http://s.wordpress.com/latex.php?latex=E%28X%29%20%3D%20E%28I_1%20%2B%20I_2%20%2B%20%5Cdots%20%2B%20I_%7B2%5Ek-1%7D%29%20%3D%20E%28I_1%29%20%2B%20E%28I_2%29%20%2B%20%5Cdots%20%2B%20E%28I_%7B2%5Ek-1%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(X) = E(I_1 + I_2 + \dots + I_{2^k-1}) = E(I_1) + E(I_2) + \dots + E(I_{2^k-1})' title='E(X) = E(I_1 + I_2 + \dots + I_{2^k-1}) = E(I_1) + E(I_2) + \dots + E(I_{2^k-1})' class='latex' /> (since the expected value is linear). This means, we can conclude <img src='http://s.wordpress.com/latex.php?latex=E%28X%29%20%3D%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D%20%2B%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D%20%2B%20%5Cdots%20%2B%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D%20%3D%20%282%5Ek-1%29%20%5Ccdot%20%5Cdfrac%7B2%5Ek-1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(X) = \dfrac{2^k-1}{2^k} + \dfrac{2^k-1}{2^k} + \dots + \dfrac{2^k-1}{2^k} = (2^k-1) \cdot \dfrac{2^k-1}{2^k}' title='E(X) = \dfrac{2^k-1}{2^k} + \dfrac{2^k-1}{2^k} + \dots + \dfrac{2^k-1}{2^k} = (2^k-1) \cdot \dfrac{2^k-1}{2^k}' class='latex' />. </p>
<p>This can be simplified to <img src='http://s.wordpress.com/latex.php?latex=E%28X%29%20%3D%202%5Ek%20-%202%20%2B%20%5Cdfrac%7B1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(X) = 2^k - 2 + \dfrac{1}{2^k}' title='E(X) = 2^k - 2 + \dfrac{1}{2^k}' class='latex' />. This means, in average, we have <img src='http://s.wordpress.com/latex.php?latex=2%5Ek%20-%202%20%2B%20%5Cdfrac%7B1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2^k - 2 + \dfrac{1}{2^k}' title='2^k - 2 + \dfrac{1}{2^k}' class='latex' /> clauses satisfied. Due to the principle of average, this means, that there must exist some assignment of variables such that the number of satisfied clauses <img src='http://s.wordpress.com/latex.php?latex=X%20%5Cgeq%202%5Ek%20-%202%20%2B%20%5Cdfrac%7B1%7D%7B2%5Ek%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X \geq 2^k - 2 + \dfrac{1}{2^k}' title='X \geq 2^k - 2 + \dfrac{1}{2^k}' class='latex' />.</p>
<p>But since <img src='http://s.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' /> must be a natural number, this can be restated so that we now know that there must exist an assignemt of variables such that <img src='http://s.wordpress.com/latex.php?latex=X%20%5Cgeq%202%5Ek%20-%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X \geq 2^k - 1' title='X \geq 2^k - 1' class='latex' />, which is the next natural number. But since <img src='http://s.wordpress.com/latex.php?latex=2%5Ek%20-%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2^k - 1' title='2^k - 1' class='latex' /> is exactly the number of clauses, we now know that all clauses are satisfied, and, thus, the whole formula is satisfied.</p>
<p>Thus, the formula is satisfiable.</p>
<p>I personally find this proof so nice because usually existence proofs involve some routine to construct an explicit solution which is then used as a proof of existence. However, this existence proof purely relies on the averaging principle, and proves the existence of a satisfying assignment without explicitly constructing it. Moreover, the proof uses the <a href="http://en.wikipedia.org/wiki/Probabilistic_method">probabilistic method</a>, which I consider a very elegant technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=233</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A little thougt about how to encode tuples of natural numbers with prime numbers</title>
		<link>http://phimuemue.com/?p=208</link>
		<comments>http://phimuemue.com/?p=208#comments</comments>
		<pubDate>Tue, 12 Jul 2011 09:13:32 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=208</guid>
		<description><![CDATA[I have always been interested in how to encode certain things into simple natural numbers. This post shows a way to encode sets and tuples of natural numbers, that I personally find quite nice. Let be the i-th prime (i.e. p(1)=2, p(2)=3, p(3)=5, and so on), let be the inverse of . Then, we can [...]]]></description>
				<content:encoded><![CDATA[<p>I have always been interested in how to encode certain things into simple natural numbers. This post shows a way to encode sets and tuples of natural numbers, that I personally find quite nice.<br />
<span id="more-208"></span><br />
Let <img src='http://s.wordpress.com/latex.php?latex=p%28i%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(i)' title='p(i)' class='latex' /> be the i-th prime (i.e. p(1)=2, p(2)=3, p(3)=5, and so on), let <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}' title='p^{-1}' class='latex' /> be the inverse of <img src='http://s.wordpress.com/latex.php?latex=p&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p' title='p' class='latex' />. Then, we can quite naturally encode a <em>finite set</em> <img src='http://s.wordpress.com/latex.php?latex=K%5Csubsetneq%20%5Cmathbb%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='K\subsetneq \mathbb{N}' title='K\subsetneq \mathbb{N}' class='latex' /> of natural numbers like the following (<img src='http://s.wordpress.com/latex.php?latex=c&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c' title='c' class='latex' /> is the coding function): <img src='http://s.wordpress.com/latex.php?latex=c%28K%29%3D%5Cprod_%7Bi%5Cin%20K%7D%20p%28i%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c(K)=\prod_{i\in K} p(i)' title='c(K)=\prod_{i\in K} p(i)' class='latex' />. I.e., we encode the elements of the set via prime factorization.</p>
<p>We can reconstruct the set <img src='http://s.wordpress.com/latex.php?latex=K&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='K' title='K' class='latex' /> from a number by taking it&#8217;s prime factorization and applying <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}' title='p^{-1}' class='latex' /> to each prime factor.</p>
<p>Note that the above does not preserve the order of the elements (multiplication is commutative), since we are considering sets. But what happens, if we want to encode ordered tuples this way?</p>
<p>So, let us now consider a tuple <img src='http://s.wordpress.com/latex.php?latex=T%3D%28t_1%2C%20t_2%2C%20%5Cdots%2C%20t_n%29%20%5Cin%20%5Cmathbb%7BN%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T=(t_1, t_2, \dots, t_n) \in \mathbb{N}^n' title='T=(t_1, t_2, \dots, t_n) \in \mathbb{N}^n' class='latex' />, that we want to encode into a number. For now, we exclude 0 from the natural numbers, but the idea can be easily extended to work with 0 as well.</p>
<p>For this, we can derive another encoding from the first. The problem is that &#8211; since multiplication is associative &#8211; we can not map the generated primes to the elements in <img src='http://s.wordpress.com/latex.php?latex=T&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T' title='T' class='latex' />, since we therefore must somehow know the position of the element.</p>
<p>We can circumvent this problem as follows: Starting with <img src='http://s.wordpress.com/latex.php?latex=t_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t_1' title='t_1' class='latex' />, we pick the prime <img src='http://s.wordpress.com/latex.php?latex=p%28t_1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_1)' title='p(t_1)' class='latex' />. We continue with <img src='http://s.wordpress.com/latex.php?latex=t_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t_2' title='t_2' class='latex' />, but we can not simply choose <img src='http://s.wordpress.com/latex.php?latex=p%28t_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_2)' title='p(t_2)' class='latex' />, since then <img src='http://s.wordpress.com/latex.php?latex=%28t_1%2C%20t_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(t_1, t_2)' title='(t_1, t_2)' class='latex' /> and <img src='http://s.wordpress.com/latex.php?latex=%28t_2%2C%20t_1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(t_2, t_1)' title='(t_2, t_1)' class='latex' /> would be mapped to the same number. </p>
<p>So, we do the following: For <img src='http://s.wordpress.com/latex.php?latex=t_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t_2' title='t_2' class='latex' />, we start counting primes at <img src='http://s.wordpress.com/latex.php?latex=p%28t_1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_1)' title='p(t_1)' class='latex' /> and thus, pick the number <img src='http://s.wordpress.com/latex.php?latex=p%28t_1%20%2B%20t_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_1 + t_2)' title='p(t_1 + t_2)' class='latex' />. Similarily, for <img src='http://s.wordpress.com/latex.php?latex=t_3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t_3' title='t_3' class='latex' /> we pick <img src='http://s.wordpress.com/latex.php?latex=p%28t_1%20%2B%20t_2%20%2B%20t_3%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_1 + t_2 + t_3)' title='p(t_1 + t_2 + t_3)' class='latex' />.</p>
<p>The rule: For <img src='http://s.wordpress.com/latex.php?latex=t_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t_i' title='t_i' class='latex' />, we choose <img src='http://s.wordpress.com/latex.php?latex=p%28t_1%20%2B%20t_2%20%2B%20%5Cdots%20%2B%20t_i%29%20%3D%20p%28%5Csum_%7Bj%3D1%7D%5Ei%20t_j%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(t_1 + t_2 + \dots + t_i) = p(\sum_{j=1}^i t_j)' title='p(t_1 + t_2 + \dots + t_i) = p(\sum_{j=1}^i t_j)' class='latex' />. Thus, we get the encoding function <img src='http://s.wordpress.com/latex.php?latex=c%28T%29%20%3D%20%5Cprod_%7Bi%3D1%7D%5En%20p%28%5Csum_%7Bj%3D1%7D%5Ei%20t_j%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c(T) = \prod_{i=1}^n p(\sum_{j=1}^i t_j)' title='c(T) = \prod_{i=1}^n p(\sum_{j=1}^i t_j)' class='latex' />.</p>
<p>That is, we ensure that the prime numbers are strictly increasing. If we want to reconstruct the tuple <img src='http://s.wordpress.com/latex.php?latex=T&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T' title='T' class='latex' /> given a number, we take the prime factorization, sort the prime numbers, and apply <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}' title='p^{-1}' class='latex' /> to each prime. Now, we compute the distances between two consecutive elements, and get the elements from the tuple.</p>
<h3>Example</h3>
<p>I don&#8217;t offer a proof, but an example to see how it&#8217;s done.</p>
<p>Take <img src='http://s.wordpress.com/latex.php?latex=T%3D%282%2C5%2C4%2C7%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='T=(2,5,4,7)' title='T=(2,5,4,7)' class='latex' />. To encode this, we have to compute <img src='http://s.wordpress.com/latex.php?latex=c%282%2C5%2C4%2C7%29%20%3D%20p%282%29%20%2A%20p%282%2B5%29%20%2A%20p%282%2B5%2B4%29%20%2A%20p%282%2B5%2B4%2B7%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c(2,5,4,7) = p(2) * p(2+5) * p(2+5+4) * p(2+5+4+7)' title='c(2,5,4,7) = p(2) * p(2+5) * p(2+5+4) * p(2+5+4+7)' class='latex' />, which can be evaulated to <img src='http://s.wordpress.com/latex.php?latex=p%282%29%20%2A%20p%287%29%20%2A%20p%2811%29%20%2A%20p%2818%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p(2) * p(7) * p(11) * p(18)' title='p(2) * p(7) * p(11) * p(18)' class='latex' />.</p>
<p>This yields <img src='http://s.wordpress.com/latex.php?latex=3%2A17%2A31%2A61%3D99603&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3*17*31*61=99603' title='3*17*31*61=99603' class='latex' />. So, we encode the tuple <img src='http://s.wordpress.com/latex.php?latex=%282%2C5%2C4%2C7%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(2,5,4,7)' title='(2,5,4,7)' class='latex' /> as 99603.</p>
<p>If we want to recompute the tuple from the given number 99603, we do the following: We prime-factorize: 99603 = 3 * 17 * 31 * 61. Thus, we know that the primes 3, 17, 31 and 61 were used. Now, we compute <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}' title='p^{-1}' class='latex' /> for each of them and get: <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D%283%29%3D2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}(3)=2' title='p^{-1}(3)=2' class='latex' />, <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D%2817%29%3D7&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}(17)=7' title='p^{-1}(17)=7' class='latex' />, <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D%2831%29%3D11&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}(31)=11' title='p^{-1}(31)=11' class='latex' />, <img src='http://s.wordpress.com/latex.php?latex=p%5E%7B-1%7D%2861%29%3D18&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='p^{-1}(61)=18' title='p^{-1}(61)=18' class='latex' />.</p>
<p>So, now we consider the numbers 2, 7, 11, 18. We now can conclude, that the first number must have been 2, the second number must have been 7-2=5, while the third number must have been 11-7=4 and the last number must have been 18-11=7. This yields the tuple (2,5,4,7).</p>
<h3>Remarks</h3>
<p>The presented encoding is (probably) of no practical relevance due to the following:</p>
<ul>
<li>The size of the prime numbers (not to speak about the product of them) grows rapidly. It is not possible to efficiently store numbers generated by tuples containing 100 elements</li>
<li>Decomposing a number into its prime factors seems to be rather computationally expensive. It is known to be in NP and coNP, but it is suspected to lie outside of P.
</ul>
<p>However, the presented encoding reveals a very nice result: It is clear that the above construction can be applied to any tuple of natural numbers and always yields a natural number. Moreover, we can factorize every natural number, and, thus, generate a tuple from every natural number. </p>
<p>We didn&#8217;t show this, but it is evident that no two sequences yield the same number. Simply assume that any two tuples would yield the same number: This would immediately imply that both tuples must have the same number of elements. But if the elements are distinct, this will directly lead to different primes and another resulting number.</p>
<p>So, this means, that each tuple has a natural number (greater that 1, since 1 is no prime), and each natural number corresponds to exactly one tuple. That means, that in essence, we have as many tuples as natural numbers, since we generated a bijection (aside from the number 1). Thus, the tuples of natural numbers are enumberable: We simply start counting 2, 3, 4, 5, 6, 7, &#8230; and compute the corresponding tuple for each number.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=208</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Messing with skolemization</title>
		<link>http://phimuemue.com/?p=199</link>
		<comments>http://phimuemue.com/?p=199#comments</comments>
		<pubDate>Mon, 04 Jul 2011 18:43:39 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[logic]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[skolemization]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=199</guid>
		<description><![CDATA[In predicate logic, skolemization is a central method to manipulate logic formulas. Since we had to do some homework on those formulas, and I always mixed up the parentheses, I decided to have it done by the computer. So, below you&#8217;ll find an implementation of skolemization in Haskell. It takes a formula specified in (admittedly [...]]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://en.wikipedia.org/wiki/Predicate_logic">predicate logic</a>, <a href="http://en.wikipedia.org/wiki/Skolem_normal_form">skolemization</a> is a central method to manipulate logic formulas. Since we had to do some homework on those formulas, and I always mixed up the parentheses, I decided to have it done by the computer.<br />
<span id="more-199"></span><br />
So, below you&#8217;ll find an implementation of skolemization in Haskell. It takes a formula specified in (admittedly clumsy) haskell data type syntax, and</p>
<ul>
<li>pushes negations as close to the predicates as possible</li>
<li>ensures that variable names are unique</li>
<li>brings quantifiers to front</li>
<li>eliminates existential quantifiers</li>
</ul>
<p>I can&#8217;t guarantee that it is working correctly, but at least for my example, it worked out quite well.<br />
<script src="http://gist.github.com/1063084.js"></script><br />
Note that this implementation is not optimal at all. There are several unelegant and inefficient passages, which is most due to the fact that I didn&#8217;t do very much in Haskell in the past. However, I always liked the way one can express and transform some kind of algebraic formulas in this programming language.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=199</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick and dirty unification algorithm</title>
		<link>http://phimuemue.com/?p=188</link>
		<comments>http://phimuemue.com/?p=188#comments</comments>
		<pubDate>Thu, 30 Jun 2011 13:30:34 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[logic]]></category>
		<category><![CDATA[misc]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=188</guid>
		<description><![CDATA[The following is a very simple unification algorithm in Haskell.]]></description>
				<content:encoded><![CDATA[<p>The following is a very simple unification algorithm in Haskell.<br />
<span id="more-188"></span><br />
<script src="http://gist.github.com/1056235.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=188</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A seemingly simple problem proven hard</title>
		<link>http://phimuemue.com/?p=180</link>
		<comments>http://phimuemue.com/?p=180#comments</comments>
		<pubDate>Thu, 21 Apr 2011 22:23:53 +0000</pubDate>
		<dc:creator>phimuemue</dc:creator>
				<category><![CDATA[complexity]]></category>

		<guid isPermaLink="false">http://phimuemue.com/?p=180</guid>
		<description><![CDATA[Consider the following problem: You are celebrating a festival and want to invite guests. The only problem is the following: You want to distribute all guests in a single row, but you can only place to guests next to each other if they get along with each other. The question is if there&#8217;s an efficient [...]]]></description>
				<content:encoded><![CDATA[<p>Consider the following problem: You are celebrating a festival and want to invite <img src='http://s.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> guests. The only problem is the following: You want to distribute all guests in a single row, but you can only place to guests next to each other if they get along with each other. The question is if there&#8217;s an efficient (meaning poly-time) algorithm computing such an order of guests.<br />
<span id="more-180"></span><br />
To put it in a nutshell: In general, there is probably (unless P=NP) no efficient procedure computing such a valid sequence of guests efficiently.</p>
<p>This can be quite naturally seen by reducing the NP-complete <a href="http://en.wikipedia.org/wiki/Hamiltonian_path">HAMILTON</a> to the given problem: Given any graph <img src='http://s.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='G' title='G' class='latex' />, we interpret its vertices as guests. We say that two guests get alogn with each other if there is an edge connecting the corresponding vertices. This is a quite natural tranformation of HAMILTON to our problem.</p>
<p>The rest is easy: We can easily show that the given problem is in NP, because we can check the correctness of a solution in polynomial time. Thus, the problem itself is NP-complete.</p>
<h2>Special cases might be solved efficiently</h2>
<p>Even if this problem can (probably) not be solved efficiently generally, we note the following: If we impose some restrictions onto the original problem (guests at a festival), we might be able to compute a solution efficiently. E.g. we can express guests as numbers and say that two guests get alogn with each other if their numbers are both even resp. odd. Then, we just have to check whether there are as many even as odd numbers and put them alternating (even-odd-even-odd-&#8230;) one after another. </p>
<p>Another example could be that two numbers (guests) get along, if their sum is less than a given maximum value. In this case, we can employ a greedy algorithm to construct an optimal solution.</p>
<p>So the question arises, why &#8211; in those cases &#8211; the reduction from HAMILTON isn&#8217;t working. It is simply the fact that not all graphs (i.e. not all HAMILTON problems) can be transformed into problem instances with the additionally imposed restrictions. For example, consider the even-odd case: A graph containing 3 vertices (guests) and no edges (i.e. no guest is compatible to any other guest) &#8211; this graph does <em>not</em> correspond to any valid problem instance with the restriction that two guests get along if their numbers are both even resp. odd.</p>
<p>In particular, when reducing problems, we have to ensure that <em>each</em> original problem has a corresponding case in the target problem description.</p>
]]></content:encoded>
			<wfw:commentRss>http://phimuemue.com/?feed=rss2&#038;p=180</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
