Math 2.0

Computer science Definition

Register machine

Builds on Natural numbersGeneral recursive function

Definition

Let k≥1k \ge 1. A register machine (counter machine) with registers R1,…,RkR_1, \dots, R_k is a finite sequence I1,…,ImI_1, \dots, I_m of instructions of the following three kinds, where 1≤i≤k1 \le i \le k and 1≤j,l≤m1 \le j, l \le m.

  1. INC(i,j)\mathrm{INC}(i, j): add 11 to RiR_i and go to instruction jj.
  2. DEC(i,j,l)\mathrm{DEC}(i, j, l): if Ri=0R_i = 0, go to instruction ll; otherwise subtract 11 from RiR_i and go to instruction jj.
  3. HALT\mathrm{HALT}: stop.

A configuration is a pair (p,r)(p, r) of an instruction number pp and a vector r∈ℕkr \in \N^k of register contents. Here ℕ\N is the set of natural numbers. A run starts at instruction 11 and performs the instructions in turn until it reaches HALT\mathrm{HALT}, if ever. The machine computes the partial function f ⁣:ℕn⇀ℕf \colon \N^n \rightharpoonup \N, for n<kn < k, that takes (x1,…,xn)(x_1, \dots, x_n) to the final content of R1R_1. Here the run starts with Ri+1=xiR_{i+1} = x_i for i≤ni \le n and all other registers 00, and f(x)f(x) is undefined when the run does not halt.

Remarks

Example: the program I1=DEC(3,2,3)I_1 = \mathrm{DEC}(3, 2, 3), I2=INC(1,1)I_2 = \mathrm{INC}(1, 1), I3=DEC(2,4,5)I_3 = \mathrm{DEC}(2, 4, 5), I4=INC(1,3)I_4 = \mathrm{INC}(1, 3), I5=HALTI_5 = \mathrm{HALT} computes f(x1,x2)=x1+x2f(x_1, x_2) = x_1 + x_2. Instructions 11 and 22 move the x2x_2 units of R3R_3 into R1R_1. Then instructions 33 and 44 move the x1x_1 units of R2R_2 into R1R_1, and the run halts with R1=x1+x2R_1 = x_1 + x_2. Non-example: an instruction that sets RiR_i to Ri⋅RjR_i \cdot R_j in one step is not allowed, since only the three kinds above exist. Multiplication must be programmed as repeated addition. The functions computed by register machines are exactly the partial recursive functions. Two registers already suffice for universality, when inputs and outputs are suitably encoded, for example as 2x2^x. Other register machine models allow more instructions, such as copying or indirect addressing.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Natural numbers object
  2. Primitive recursive function concept
  3. General recursive function definition
  4. Register machine definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Register_machine
About this page
TagBSPVYC28BY
URIm2://BSPVYC28BY
Kinddefinition
WritingW0 stub
MSC68Q04, 03D10
DefinesRegister machine
UsesNatural numbers, General recursive function
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.