You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lec_04_code_and_data.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -337,11 +337,11 @@ Similarly, every circuit $C$ of at most $s$ gates can be represented by a string
337
337
Since we can represent programs as strings, we can also think of a program as an input to a function.
338
338
In particular, for every natural number $s,n,m>0$ we define the function $EVAL_{s,n,m}:\{0,1\}^{S(s)+n} \rightarrow \{0,1\}^m$ as follows:
339
339
$$
340
-
EVAL_{s,n,m}(px) = \begin{cases} P(x) & \text{$p\in \{0,1\}^{S(s)}$ represents a size-$s$ program $P$ with $n$ inputs and $m$ outputs} \\ 0^m & \text{otherwise} \end{cases} \label{evalcirceq}
340
+
EVAL_{s,n,m}(px) = \begin{cases} P(x) & \text{$p\in \{0,1\}^{|S(s)|}$ represents a size-$s$ program $P$ with $n$ inputs and $m$ outputs} \\ 0^m & \text{otherwise} \end{cases} \label{evalcirceq}
341
341
$$
342
342
where $S(s)$ is defined as in [lengthstringrepreseq](){.eqref} and we use the concrete representation scheme described in [representprogramsec](){.ref}.
343
343
344
-
That is, $EVAL_{s,n,m}$ takes as input the concatenation of two strings: a string $p\in \{0,1\}^{S(s)}$ and a string $x\in \{0,1\}^n$.
344
+
That is, $EVAL_{s,n,m}$ takes as input the concatenation of two strings: a string $p\in \{0,1\}^{|S(s)|}$ and a string $x\in \{0,1\}^n$.
345
345
If $p$ is a string that represents a list of triples $L$ such that $(n,m,L)$ is a list-of-tuples representation of a size-$s$ NAND-CIRC program $P$, then $EVAL_{s,n,m}(px)$ is equal to the evaluation $P(x)$ of the program $P$ on the input $x$.
346
346
Otherwise, $EVAL_{s,n,m}(px)$ equals $0^m$ (this case is not very important: you can simply think of $0^m$ as some "junk value" that indicates an error).
Let $\Sigma=\{ a,b,c,d,0,1,2,3,4,5,6,7,8,9 \}$ and $F:\Sigma^* \rightarrow \{0,1\}$ be the function such that $F(x)$ outputs $1$ iff $x$ consists of one or more of the letters $a$-$d$ followed by a sequence of one or more digits (without a leading zero).
527
527
Then $F$ is a regular function, since $F=\Phi_e$ where
If we wanted to verify, for example, that $\Phi_e(abc12078)=1$, we can do so by noticing that the expression $(a|b|c|d)$ matches the string $a$, $(a|b|c|d)^*$ matches $bc$, $(0|1|2|3|4|5|6|7|8|9)$ matches the string $1$, and the expression $(0|1|2|3|4|5|6|7|8|9)^*$ matches the string $2078$. Each one of those boils down to a simpler expression. For example, the expression $(a|b|c|d)^*$ matches the string $bc$ because both of the one-character strings $b$ and $c$ are matched by the expression $a|b|c|d$.
531
+
If we wanted to verify, for example, that $\Phi_e(abc12078)=1$, we can do so by noticing that the expression $(a|b|c|d)$ matches the string $a$, $(a|b|c|d)^*$ matches $bc$, $(1|2|3|4|5|6|7|8|9)$ matches the string $1$, and the expression $(0|1|2|3|4|5|6|7|8|9)^*$ matches the string $2078$. Each one of those boils down to a simpler expression. For example, the expression $(a|b|c|d)^*$ matches the string $bc$ because both of the one-character strings $b$ and $c$ are matched by the expression $a|b|c|d$.
532
532
:::
533
533
534
534
Regular expression can be defined over any finite alphabet $\Sigma$, but as usual, we will mostly focus our attention on the _binary case_, where $\Sigma = \{0,1\}$.
@@ -684,7 +684,7 @@ INPUT: Regular expression $e$ over $\Sigma^*$, $x\in \Sigma^n$ where $n\in\N$
Copy file name to clipboardexpand all lines: lec_06_loops.md
+8-10
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,7 @@ Let $PAL$ (for _palindromes_) be the function that on input $x\in \{0,1\}^*$, ou
115
115
116
116
We now show a Turing machine $M$ that computes $PAL$. To specify $M$ we need to specify __(i)__ $M$'s tape alphabet $\Sigma$ which should contain at least the symbols $0$,$1$, $\triangleright$ and $\varnothing$, and __(ii)__ $M$'s _transition function_ which determines what action $M$ takes when it reads a given symbol while it is in a particular state.
117
117
118
-
In our case, $M$ will use the alphabet $\{ 0,1,\triangleright, \varnothing, \times \}$ and will have $k=13$ states. Though the states are simply numbers between $0$ and $k-1$, we will give them the following labels for convenience:
118
+
In our case, $M$ will use the alphabet $\{ 0,1,\triangleright, \varnothing, \times \}$ and will have $k=11$ states. Though the states are simply numbers between $0$ and $k-1$, we will give them the following labels for convenience:
119
119
120
120
```table
121
121
---
@@ -131,13 +131,11 @@ State, Label
131
131
3,`LOOK_FOR_0`
132
132
4,`LOOK_FOR_1`
133
133
5,`RETURN`
134
-
6,`REJECT`
135
-
7,`ACCEPT`
136
-
8,`OUTPUT_0`
137
-
9,`OUTPUT_1`
138
-
10,`0_AND_BLANK`
139
-
11,`1_AND_BLANK`
140
-
12,`BLANK_AND_STOP`
134
+
6,`OUTPUT_0`
135
+
7,`OUTPUT_1`
136
+
8,`0_AND_BLANK`
137
+
9,`1_AND_BLANK`
138
+
10,`BLANK_AND_STOP`
141
139
```
142
140
143
141
@@ -156,7 +154,7 @@ We describe the operation of our Turing machine $M$ in words:
156
154
157
155
* The `OUTPUT_`$b$ states mean that $M$ will eventually output the value $b$. In both the `OUTPUT_0` and `OUTPUT_1` states, $M$ goes left until it hits $\triangleright$. Once it does so, it makes a right step, and changes to the `1_AND_BLANK` or `0_AND_BLANK` states respectively. In the latter states, $M$ writes the corresponding value, moves right and changes to the `BLANK_AND_STOP` state, in which it writes $\varnothing$ to the tape and halts.
158
156
159
-
The above description can be turned into a table describing for each one of the $13\cdot 5$ combination of state and symbol, what the Turing machine will do when it is in that state and it reads that symbol. This table is known as the _transition function_ of the Turing machine.
157
+
The above description can be turned into a table describing for each one of the $11\cdot 5$ combination of state and symbol, what the Turing machine will do when it is in that state and it reads that symbol. This table is known as the _transition function_ of the Turing machine.
160
158
161
159
162
160
### Turing machines: a formal definition
@@ -181,7 +179,7 @@ For every $x\in \{0,1\}^*$, the _output_ of $M$ on input $x$, denoted by $M(x)$,
181
179
* We then repeat the following process:
182
180
183
181
1. Let $(s',\sigma',D) = \delta_M(s,T[i])$.
184
-
2. Set $s \rightarrow s'$, $T[i] \rightarrow \sigma'$.
182
+
2. Set $s \leftarrow s'$, $T[i] \leftarrow \sigma'$.
185
183
3. If $D=\mathsf{R}$ then set $i \rightarrow i+1$, if $D=\mathsf{L}$ then set $i \rightarrow \max\{i-1,0\}$. (If $D = \mathsf{S}$ then we keep $i$ the same.)
Copy file name to clipboardexpand all lines: lec_07_other_models.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1003,7 +1003,7 @@ It's λ's all the way down!
1003
1003
1004
1004
::: { .pause }
1005
1005
This is a good point to pause and think how you would implement these operations yourself. For example, start by thinking how you could implement $MAP$ using $REDUCE$, and then $REDUCE$ using $RECURSE$ combined with $0,1,IF,PAIR,HEAD,TAIL,NIL,ISEMPTY$.
1006
-
You can also $PAIR$, $HEAD$ and $TAIL$ based on $0,1,IF$.
1006
+
You can also implement $PAIR$, $HEAD$ and $TAIL$ based on $0,1,IF$.
1007
1007
The most challenging part is to implement $RECURSE$ using only the operations of the pure λ calculus.
0 commit comments