<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Computing Theory | Kun WANG</title><link>https://kunwang.info/tags/computing-theory/</link><atom:link href="https://kunwang.info/tags/computing-theory/index.xml" rel="self" type="application/rss+xml"/><description>Computing Theory</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Wed, 06 May 2020 00:00:00 +0000</lastBuildDate><image><url>https://kunwang.info/media/icon_hu_23dc6ba021a93541.png</url><title>Computing Theory</title><link>https://kunwang.info/tags/computing-theory/</link></image><item><title>How to Make Infinite to be Finite</title><link>https://kunwang.info/posts/2020-05-08-from-infinite-to-finite/2020-05-08-from-infinite-to-finite/</link><pubDate>Wed, 06 May 2020 00:00:00 +0000</pubDate><guid>https://kunwang.info/posts/2020-05-08-from-infinite-to-finite/2020-05-08-from-infinite-to-finite/</guid><description>&lt;p&gt;As I read the wiki entry on
, some problems come to my mind.&lt;/p&gt;
&lt;h2 id="take-finite-out-of-infinite"&gt;Take Finite out of Infinite&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;what is left after I take a finite subset out of an infinite set?&lt;/strong&gt;
Consider the
. If room 1 is out of services, then we can move the guest currently in room 1 to room 2, the guest currently in room 2 to room 3, and so on, moving every guest from his current room $n$ to room $n+1$. After this, room 1 is not needed. By repeating this procedure, it is possible to cancel any finite number of rooms which are out of services. The answer to the problem is, when we take a finite subset out of an infinite set, the remaining set is still infinite.&lt;/p&gt;
&lt;h2 id="take-infinite-out-of-infinite"&gt;Take Infinite out of Infinite&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;what is left after I take an infinite subset out of an infinite set?&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id="case-1"&gt;Case 1&lt;/h3&gt;
&lt;p&gt;Take the
as an example. If all rooms of odd number are out of services, then we can first assume only room 1 is not availabe, the guest currently in room 1 is moved to room 2, guest in room 2 to room 3, and so on, moving every guest from his current room $n$ to room $n+1$. After this, room 1 is not needed. By repeating this procedure, it is possible to cancel all odd rooms. In this
case, the answer to the problem is, when we take an infinite subset (set of odd numbers) out of an infinite set, the remaining set is still infinite.&lt;/p&gt;
&lt;h3 id="case-2"&gt;Case 2&lt;/h3&gt;
&lt;p&gt;Take the set of natural numbers as example. We simply make the infinite subset $A$ be
$ A = \{x \in N | x \neq 1 \}$.
It&amp;rsquo;s easy to see that A is infinite, and the complement set of $A$ over $N$ is of size 1. In this case, the answer to the problem is, when we take an infinite subset (set of $A$) out of an infinite set, the remaining set is finite.&lt;/p&gt;
&lt;p&gt;Here is what confused me most. The cardinality of &lt;em&gt;set of odd numbers&lt;/em&gt; and set $A$ are both &lt;em&gt;Aleph-null&lt;/em&gt;, why their complements over $N$ are different? Currently, I make myself convinced that the problem occurs due to the ambiguity of &lt;em&gt;complement over N&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Turing Machine Simulator</title><link>https://kunwang.info/posts/2020-05-06-turing-machine-simulator/</link><pubDate>Wed, 06 May 2020 00:00:00 +0000</pubDate><guid>https://kunwang.info/posts/2020-05-06-turing-machine-simulator/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;I developed a Turing machine simulator when I was a teaching assistant for the course &amp;ldquo;Introduction to Models of Computation&amp;rdquo;.
You can find the project in
.
It is based on a nice Java Turing machine simulator from
with necessary
updates. Feel free to fork, modify it.&lt;/p&gt;
&lt;p&gt;The syntax of Turing machine is totally from the book of
&amp;ldquo;&lt;em&gt;Introduction to Models of Computation&lt;/em&gt;&amp;rdquo; by professor Fangmin Song, which you can buy from
.&lt;/p&gt;
&lt;h2 id="description"&gt;Description&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;bin&lt;/code&gt;: Contains the compiled .class files. The &amp;ldquo;images&amp;rdquo; sub-directory is very important as it stores the required images for the simulator. In the next update, I will try to move it out of the &amp;ldquo;bin&amp;rdquo; directory.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;files&lt;/code&gt;: Contains the program description for specific operations. Examples include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Adder.tur&lt;/strong&gt;: a program for adding two non-negative integers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;copyString.tur&lt;/strong&gt;: a program for copy a string of &lt;em&gt;11&amp;hellip;11&lt;/em&gt;s.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In these two files, I gave a detail description of the requirements for writing a program that can be accepted by the simulator.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;src&lt;/code&gt;: Source files of the simulator.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;All of the above three directories are required for running the simulator.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;introduction.pptx&lt;/code&gt;: Actually, the Turing machine simulator is a project for the third assignment of the course &lt;strong&gt;Software Architecture&lt;/strong&gt;. &lt;code&gt;introduction.pptx&lt;/code&gt; is my presentation on the course, which introduces basic ideas of the project, and the design patterns that have been applied.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;TMSimulator.7z&lt;/code&gt;: The packed runnable jar, with necessary config files.&lt;/p&gt;
&lt;h2 id="how-to-use"&gt;How to Use&lt;/h2&gt;
&lt;p&gt;There are two different ways to setup the simulator.&lt;/p&gt;
&lt;h3 id="method-1-running-the-jar-file"&gt;Method 1: Running the jar file&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Download the repository.&lt;/li&gt;
&lt;li&gt;Unpack &lt;code&gt;TMSimulator.7z&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;run.bat&lt;/code&gt; batch file.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Warnning!&lt;/strong&gt; The &lt;code&gt;files&lt;/code&gt; and &lt;code&gt;TMSimulator.jar&lt;/code&gt; must be in the same directory with &lt;code&gt;run.bat&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="method-2-importing-the-project-into-eclipse"&gt;Method 2: Importing the project into eclipse&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Download the repository.&lt;/li&gt;
&lt;li&gt;Import into eclipse.&lt;/li&gt;
&lt;li&gt;Run it!&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="known-problems"&gt;Known problems&lt;/h2&gt;
&lt;h3 id="problem-1"&gt;Problem 1&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Problem Description:&lt;/strong&gt; When exporting the project as a runnable jar (TMSimulator.jar is exported in this way), images cannot be load, as the jar cannot find the images.&lt;br&gt;
&lt;strong&gt;Current Solution:&lt;/strong&gt; This problem happens because the exporting system hasn&amp;rsquo;t add the necessary files in &lt;code&gt;bin/images&lt;/code&gt; into the jar file. There are two solutions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Modify the code to add the files.&lt;/li&gt;
&lt;li&gt;Add the &lt;code&gt;images&lt;/code&gt; directory into the jar file manually.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Due to my laziness, I take the latter one. It deserves better solution.&lt;/p&gt;
&lt;h3 id="problem-2"&gt;Problem 2&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Problem Description:&lt;/strong&gt; The input and output have been restricted into binary values, which are required by the simulator yet are not that human friendly.&lt;br&gt;
&lt;strong&gt;Possible Solution:&lt;/strong&gt; One encode module to translate the input decimal integers into corresponding bianry values, then feeding them into the simulator. One decode module to translate the output bianry value into corresponding decimal integer, then displaying out.&lt;/p&gt;
&lt;h2 id="more-on-the-simulator"&gt;More on the Simulator&lt;/h2&gt;
&lt;p&gt;If you have any ideas on the project, please feel free to let me know. You can try following ways to keep us in touch.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Comment on this post. This is highly recommended.&lt;/li&gt;
&lt;li&gt;Fork the project, and push the new version to me.&lt;/li&gt;
&lt;li&gt;Email me.&lt;/li&gt;
&lt;/ol&gt;</description></item></channel></rss>