Skip to content

Commit

Permalink
work on the coding section
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoss committed Jan 26, 2025
1 parent 7fd0769 commit fe26e9e
Show file tree
Hide file tree
Showing 26 changed files with 448 additions and 145 deletions.
Binary file modified _build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified _build/.doctrees/introOneSharp/functions.doctree
Binary file not shown.
Binary file modified _build/.doctrees/introOneSharp/haltDef.doctree
Binary file not shown.
Binary file modified _build/.doctrees/issues/coding.doctree
Binary file not shown.
Binary file modified _build/.doctrees/issues/problems.doctree
Binary file not shown.
32 changes: 18 additions & 14 deletions _build/html/_sources/introOneSharp/functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
},
"source": [
"\n",
"At this point we know what programs of ```111``` are and how they work.\n",
"At this point we know what programs of ```1#``` are and how they work.\n",
"We are interested not just in the programs themselves\n",
"but in *what* they compute. \n",
"\n",
"We call the set $\\{```1```,```#```\\}$ our *alphabet*, and we use the letter $A$ for it.\n",
"We call the set ```{1,#}``` our *alphabet*, and we use the letter $A$ for it.\n",
"\n",
"\n",
"We know that it is odd to call such a small set an \"alphabet\",\n",
Expand All @@ -40,7 +40,7 @@
"When used in situations like ours, the word \"alphabet\"\n",
"just means a set that you use to build words from. \n",
"\n",
"But if $\\{```1```,```#```\\}$ is our alphabet, what in\n",
"But if ```{1,#}``` is our alphabet, what in\n",
"the world are our words?!\n",
"\n",
"Answer:\n",
Expand All @@ -62,7 +62,7 @@
" \n",
"\n",
" \n",
"A *program* of $\\one\\hash$ is just a sequence of\n",
"A *program* of ```1#``` is just a sequence of\n",
"instructions, \n",
"run together to make a big word.\n",
"An instruction counts as a program, \n",
Expand Down Expand Up @@ -147,6 +147,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "ZhaXDhZfFra5"
Expand All @@ -158,10 +159,7 @@
" \n",
"For other programs $q$ there might be some programs $p$ for which $\\phifn_p$ is defined for some but not all input words. \n",
"\n",
"\n",
"\n",
"```{admonition} Definition\n",
":class: tip\n",
"```{prf:definition}\n",
"\n",
"Given words $x$ and $y$, we write\n",
"\n",
Expand Down Expand Up @@ -257,7 +255,8 @@
"\n",
"\n",
"```{prf:definition}\n",
"\\:class: tip\n",
":class: tip\n",
"\n",
"Every word $p$ gives us a function\n",
"called $\\phifn^n_p$ on $n$-tuples of words. \n",
"\n",
Expand Down Expand Up @@ -384,8 +383,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"```{admonition}\n",
"\n",
"```{prf:definition}\n",
"$$\n",
"\\phifn^0_p (\\ ) \\simeq y\n",
"$$\n",
Expand Down Expand Up @@ -448,9 +446,7 @@
"id": "ZkwdFYl1iXHH"
},
"source": [
"\n",
"```{admonition} Definition\n",
":class: tip\n",
"```{prf:definition} \n",
"For any set $A$, the *characteristic function of $A$* is the function $\\chi_A$ given by\n",
"\n",
"$$\n",
Expand Down Expand Up @@ -574,6 +570,14 @@
"Show that every computable set is computably enumerable. (As we shall see, the converse is false.) Show also that the family of computably enumerable sets is closed under intersection: if $A$ and $B$ are computably enumerable, so is $A\\cap B$.\n",
"```"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Equivalence of programs"
]
}
],
"metadata": {
Expand Down
6 changes: 3 additions & 3 deletions _build/html/_sources/introOneSharp/haltDef.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
"\n",
"```{admonition} Definition\n",
":class: tip\n",
"We (informally) say that a program $p$ *halts* on some inputs if at some point during the execution of $p$ on the inputs, the control transfers to right below the last instruction of $p$. In more detail, suppose that $p$ has n instructions. The formal definition is given below, after we discuss the remaining types of instructions.\n",
"We (informally) say that a program $p$ *halts* on some inputs if at some point during the execution of $p$ on those inputs, the control transfers to right below the last instruction of $p$. In more detail, suppose that $p$ has n instructions. The formal definition is given below, after we discuss the remaining types of instructions.\n",
"\n",
"In contrast, we say that p *halts improperly* if at some point during the execution of $p$, the control tranfers either to a point before the beginning of $p$ or to points more than one instruction beyond the last instruction of $p$.\n",
"```\n",
"\n",
"To see the difference, consider the following two programs: \n",
"```11###``` and ```1#111. Suppose we run them with some fixed but arbitrary word $x$ in R1.\n",
"```11###1#``` and ```1#11###```. Suppose we run them with some fixed but arbitrary word $x$ in R1.\n",
"\n",
"\n",
"The first says \"Go forward 2,\" and the second \"Add ```1``` to R1.\"\n",
"The first says \"Go forward 2,\" and the second \"Add ```1``` to R1, and then advance two instructions.\"\n",
"\n",
"The first halts, while the second halts improperly."
]
Expand Down
92 changes: 68 additions & 24 deletions _build/html/_sources/issues/coding.ipynb
Original file line number Diff line number Diff line change
@@ -1,39 +1,83 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPEru1e04O7x8TgD2z5Ig9K",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/lmoss/onesharp/blob/main/issues/coding.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# What is coding?"
],
"metadata": {
"id": "untDv95I9YWv"
}
},
"source": [
"# What is coding?"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"At this point, we have seen a bit about one particular model of computation, leading to the definition of a ```1#``` computable function. We also saw some mathematically natural algorithmic problems having to do with graphs, tiling, dominoes, and matricies. What we want to do at this point is to connect these two discussions.\n",
"We also want to say in a more formal way what it means for one or another algorithmic problem to be decidable or undecidable.\n",
"\n",
"\n",
"```{prf:definition}\n",
":label: structure\n",
"A *structure* is a tuyple \n",
"\n",
"$$ \n",
"\\mathcal{S} = (S,R_1, \\ldots, R_n, f_1, \\ldots, f_m)\n",
"$$\n",
"\n",
"where $S$ is a set, $R_1, \\ldots, R_n$ are relations on $S$, each of some finite number\n",
"$n_R\\geq 1$ of variables, and $f_1, \\ldots, f_m$ are functions on $S$, each of some finite number\n",
"$n_f \\geq 0$ of variables. Note that we allow $n_f = 0$, and in this case $f$ is called a *constant symbol*.\n",
"```\n",
"\n",
"This is the standard notion of a *first-order structure* from mathematical logic.\n",
"\n",
"The kinds of problems that interest us are where we are given a type of mathematical problem represented by a *structure* $S$, and a *target set* $T\\subseteq S$. We are interested to know whether a given $s\\in S$ belongs to $T$ or not. \n",
"\n",
"```{prf:definition}\n",
":label: coding\n",
"Given a structure $\\mathcal{S}$, a ```1#```-*encoding* of $\\mathcal{S}$ consists of \n",
"\n",
"1. A set $\\widehat{S} \\subset Words$ of ```1#```-words. $\\widehat{S}$ must be decidable.\n",
"\n",
"\n",
"2. A function $\\pi: S \\to \\widehat{S}$ called the *coding map*.\n",
"\n",
"3. For each relation $R\\subseteq S^n$ a relation $\\widehat{R}\\subseteq (\\widehat{S})^n$.\n",
"We require that \n",
"\n",
"$$ \n",
"R(s_1, \\ldots, s_n) \\mbox{ iff} \\widehat{R}(\\pi(s_1),\\ldots, \\pi(s_n)).\n",
"$$\n",
"```"
]
}
],
"metadata": {
"colab": {
"authorship_tag": "ABX9TyPEru1e04O7x8TgD2z5Ig9K",
"include_colab_link": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
]
}
},
"nbformat": 4,
"nbformat_minor": 0
}
16 changes: 9 additions & 7 deletions _build/html/_sources/issues/problems.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,28 @@
"source": []
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "1Dq_2wJ08VKG"
},
"source": [
"A *tile set* is a finite set of tiles. A *pointed* tile set is a tile set that comes with a special tile $t_0$ called the *start tile*. \n",
"A *tile set* is a finite set of tiles. A *pointed* tile set is a tile set that comes with a special tile $t_0$ called the *start tile*. \n",
"\n",
"The *first quadrant* is the set of squares shown below\n",
"<img src=\"https://github.com/lmoss/onesharp/blob/main/issues/pictures/pictures-02.png?raw=1\" width=\"100%\" height=\"100%\">\n",
"\n",
" \n",
" ```{admonition} Problems\n",
" :class: danger\n",
"\n",
"Given a tile set, is it possible to tile all of the squares in the first quadrant in such a way that tiles which share an edge must have the same color on that edge?\n",
"```\n",
"\n",
"Given a pointed tile set, is it possible to tile the first quadrant satisfying the same condition and also tile the corner of the quadrant with the start tile?\n",
"``` \n",
"\n",
"Going back to the example of a tile set shown above, the answer is Yes: since we have a tile with grey on all sides, we can just use it on every square of the quadrant. \n",
"<img src=\"https://github.com/lmoss/onesharp/blob/main/issues/pictures/pictures-55.png?raw=1\" width=\"100%\" height=\"100%\"> \n",
"\n",
"For example, here is a tile set:\n",
"<img src=\"https://github.com/lmoss/onesharp/blob/main/issues/pictures/pictures-02.png?raw=1\" width=\"100%\" height=\"100%\">\n",
"The first question has a trivial answer for this set: since we have a tile with grey on all sides, we can just use it on every square of the quadrant. Of course, this is a special feature of this example. \n",
"Of course, this is a special feature of this example. \n",
"\n",
"Continuing, we can turn our tile set above into a pointed tile set by selecting as $t_0$ any of the eight tiles. Let's choose the one marked in green below.\n",
"<img src=\"https://github.com/lmoss/onesharp/blob/main/issues/pictures/pictures-04.png?raw=1\" width=\"100%\" height=\"100%\">\n",
Expand Down
1 change: 1 addition & 0 deletions _build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@




<li class="toctree-l1"><a class="reference internal" href="introOneSharp/tidy.html">Tidy programs</a></li>

</ul>
Expand Down
1 change: 1 addition & 0 deletions _build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@




<li class="toctree-l1"><a class="reference internal" href="introOneSharp/tidy.html">Tidy programs</a></li>

</ul>
Expand Down
Loading

0 comments on commit fe26e9e

Please sign in to comment.