Construction and properties of pairing functions

[13/77%]
Show
LaTeX

The lattice points in the closed first quadrant are enumerable. I.e. there exist functions f(x,y)f(x,y) defined for ordered pairs of non-negative integers x,yx,y that combine the following two properties:

?
(1)

The values assumed by f(x,y)f(x,y) form the set of numbers 1,2,3,4,5,…1,2,3,4,5,\ldots.

(2)

The function f(x,y)f(x,y) takes different values at distinct points; i.e. if x,y,x′,y′x,y,x',y' are integers, x≥0x\geq 0, y≥0y\geq 0, x′≥0x'\geq 0, y′≥0y'\geq 0, (x−x′)2+(y−y′)2>0(x-x')^2+(y-y')^2>0, then f(x,y)≠f(x′,y′)f(x,y)\neq f(x',y').

There even exist rational entire functions f(x,y)f(x,y) that enumerate the lattice points, i.e. that have the properties (1) (2). An example is the function

f(x,y)=12(x2+2xy+y2+3x+y+2)=(x+y+12)+x+1 f(x,y) = \tfrac 12(x^2+2xy+y^2+3x+y+2) = \binom {x+y+1}{2}+x+1

and the function arising from it by interchanging xx and yy [the lattice points are counted successively on the line segments

x+y=0,x+y=1,x+y=2,…,x≥0,y≥0. x+y=0, \quad x+y=1, \quad x+y=2, \quad \ldots , \quad x\geq 0, \quad y\geq 0 .

Let f(x,y)f(x,y) be a rational entire function of degree mm

f(x,y)=φ0(x,y)+φ1(x,y)+⋯+φm(x,y), f(x,y) = \varphi _0(x,y)+\varphi _1(x,y)+\cdots +\varphi _m(x,y) ,

where φμ(x,y)\varphi_\mu (x,y) denotes a rational entire homogeneous function of degree μ\mu. If f(x,y)f(x,y) enumerates the lattice points, then clearly φm(x,y)≥0\varphi_m(x,y)\geq 0 for x≥0x\geq 0, y≥0y\geq 0. If φm(x,y)>0\varphi_m(x,y)>0 for x≥0x\geq 0, y≥0y\geq 0, x+y>0x+y>0 and f(x,y)f(x,y) enumerates the lattice points, then the degree of f(x,y)f(x,y) is

m=2. m=2 .

[The number of lattice points contained inside the contour line f(x,y)=const.f(x,y)=\text{const.} is related to the enclosed area.]]

Suppose that all pairs (x,y)(x, y) of natural numbers are ordered by increasing sum x+yx+y, and pairs with the same sum are ordered by increasing coordinate xx. This order looks as follows:

(0,0),(0,1),(1,0),(0,2),(1,1),(2,0),……,(0,x+y),(1,x+y−1),…,(x,y),…,(x+y,0),… \begin{aligned} (0,0),(0,1),(1,0),(0,2) & ,(1,1),(2,0), \ldots \\ & \ldots ,(0, x+y),(1, x+y-1), \ldots ,(x, y), \ldots ,(x+y, 0), \ldots \end{aligned}

Let ⟨x,y⟩\langle x, y\rangle be the number of the pair (x,y)(x, y) in this order (we take the pair (0,0)(0,0) to have number 0). Then the function ⟨⋅,⋅⟩\langle \cdot ,\cdot \rangle enumerates all pairs of natural numbers bijectively.

?
(a)

Prove that ⟨x,y⟩=(x+y)(x+y+1)2+x\langle x, y\rangle =\frac{(x+y)(x+y+1)}{2}+x.

(b)

Find the inverse functions ⟩1\left\rangle_{1}\right. and ⟩2\left\rangle_{2}\right. such that the equalities ⟨⟨x,y⟩⟩1=x,⟨⟨x,y⟩⟩2=y\langle \langle x, y\rangle \rangle_{1}=x,\langle \langle x, y\rangle \rangle_{2}=y hold, and hence ⟨⟨z⟩1,⟨z⟩2⟩=z\left\langle \langle z\rangle_{1},\langle z\rangle_{2}\right\rangle =z.

(c)

Show that all these functions are general recursive.

Show that the function F(x)F(x) from Problem 281 on page 381 is general recursive. Hint. First show that the function g(x)=⟨F(x),F(x+1)⟩g(x)=\langle F(x), F(x+1)\rangle is general recursive.

?

Suppose that all pairs (x,y)(x, y) of natural numbers are ordered by increasing sum x+yx+y, and pairs with the same sum — by increasing coordinate xx. This order looks like this:

(0,0),(0,1),(1,0),(0,2),(1,1),(2,0),……,(0,x+y),(1,x+y−1),…,(x,y),…,(x+y,0),… \begin{aligned} & (0,0),(0,1),(1,0),(0,2),(1,1),(2,0), \ldots \\ & \quad \ldots ,(0, x+y),(1, x+y-1), \ldots ,(x, y), \ldots ,(x+y, 0), \ldots \end{aligned}

Let ⟨x,y⟩\langle x, y\rangle be the number of the pair (x,y)(x, y) in this order (we take the pair (0,0) to have number 0). Then the function ⟨,⟩\langle ,\rangle numbers all pairs of natural numbers in a one-to-one fashion.

?
(a)

Prove that ⟨x,y⟩=(x+y)(x+y+1)2+x\langle x, y\rangle =\frac{(x+y)(x+y+1)}{2}+x.

(b)

Find the inverse functions ⟨⟩1\langle \rangle_{1} and ⟨⟩2\langle \rangle_{2} such that the equalities ⟨⟨x,y⟩⟩1=x,⟨⟨x,y⟩⟩2=y\langle \langle x, y\rangle \rangle_{1}=x,\langle \langle x, y\rangle \rangle_{2}=y hold, and consequently ⟨⟨z⟩1,⟨z⟩2⟩=z\langle \langle z\rangle_{1},\langle z\rangle_{2}\rangle =z.

(c)

Show that all these functions are general recursive.

Another function that allows one to number pairs of natural numbers looks like this: c(x,y)=2x(2y+1)−1c(x, y)=2^{x}(2 y+1)-1. Prove that cc itself and the inverse functions c1c_{1} and c2c_{2} to it (that is, c1(c(x,y))=xc_{1}(c(x, y))=x and c2(c(x,y))=yc_{2}(c(x, y))=y) are general recursive. ⊛\circledast

?

Given a one-to-one numbering of pairs kk (for example, from Problems 578 or 580), one can inductively number ordered nn-tuples of arbitrary length:

K()=0K(x1,…,xn,xn+1)=k(k(k1(K(x1,…,xn)),xn+1),n+1) \begin{aligned} K() & =0 \\ K\left(x_{1}, \ldots , x_{n}, x_{n+1}\right) & =k\left(k\left(k_{1}\left(K\left(x_{1}, \ldots , x_{n}\right)\right), x_{n+1}\right), n+1\right) \end{aligned}
?
(a)

Prove that the function KK is one-to-one.

(b)

Prove that the functions K(n)(x1,…,xn)K^{(n)}\left(x_{1}, \ldots , x_{n}\right) are general recursive.

(c)

Prove that the inverse function K′K^{\prime } to KK is also general recursive: ⊛\circledast

K′(K(x0,…,xn),m)={xm, for m⩽n,0, otherwise.  K^{\prime }\left(K\left(x_{0}, \ldots , x_{n}\right), m\right)= \begin{cases} x_{m}, & \text{ for } m \leqslant n, \\ 0, & \text{ otherwise. }\end{cases}

Yet another way of coding finite sequences of natural numbers uses binary notation: the sequence (n0,n1,…,nk)\left(n_{0}, n_{1}, \ldots , n_{k}\right) is coded by the binary number 1nk01nk−10…01n101n01^{n_{k}} 01^{n_{k-1}} 0 \ldots 01^{n_{1}} 01^{n_{0}} (sequences that arise from one another by adding or removing trailing zeros are not distinguished).

?
(a)

Find the codes of the sequences (2,3,0,1)(2,3,0,1) and (0,0,2,1,2)(0,0,2,1,2).

(b)

Determine of which sequences the numbers 169 and 19783 are codes.

(c)

Prove that the function k(x,y)k(x, y) is general recursive. Here xx is the code of a sequence, yy is the index of an element, and the value of the function equals that element. ⊛\circledast

Show that the following functions are pairing functions.

?
(a)

f1(n,m)=2n(2m+1)−1f_{1}(n, m)=2^{n}(2 m+1)-1.

(b)

f2(n,m)=max⁡(n,m)2+m+g(m,n)f_{2}(n, m)=\max (n, m)^{2}+m+g(m, n), where g(m,n)=ng(m, n)=n if m≥nm \geq n, and g(m,n)=0g(m, n)=0 if n>mn>m.

Let n1,n2,…,nkn_{1}, n_{2}, \ldots , n_{k} are kk nonnegative integers. Prove that if 1≤i1<i2<⋯<iℓ≤k1 \leq i_{1}< i_{2}<\cdots <i_{\ell } \leq k, then [ni1,ni2,…,niℓ]≤[n1,n2,…,nk]\left[n_{i_{1}}, n_{i_{2}}, \ldots , n_{i_{\ell }}\right] \leq \left[n_{1}, n_{2}, \ldots , n_{k}\right].

?

Show that the function π:N2→N\pi : \mathbf{N}^{2} \rightarrow \mathbf{N}, defined by

π(i,j)=(i+j)(i+j+1)2+j, \pi (i, j)=\frac{(i+j)(i+j+1)}{2}+j,

is a pairing function.

?

Suppose

?
(a)

Σ={1,2,…,8,9,X}\Sigma =\left\{ 1,2, \ldots , 8,9, X\right\} with the ordering 1≺2≺⋯≺8≺9≺X1 \prec 2 \prec \cdots \prec 8 \prec 9 \prec X.

(b)

Σ={0,1}\Sigma =\left\{ 0,1\right\} and 0≺10 \prec 1.

Investigate ι(n)\iota (n).

How can all partial recursive functions be obtained from one-place partial recursive functions and the functions cn(x1,…,xn)c^{n}(x_{1}, \ldots , x_{n})?

?

Prove that:

?
(a)

[x,y][x,y] is a bijection between N2\mathbb {N}^{2} and N\mathbb {N};

(b)

[x1,…,xn][x_{1}, \ldots , x_{n}] is a bijection between Nn\mathbb {N}^{n} and N\mathbb {N};

(c)

[[x]12,[x]22]=x[[x]_{1}^{2}, [x]_{2}^{2}] = x, [[x,y]]12=x[[x,y]]_{1}^{2} = x, [[x,y]]22=y[[x,y]]_{2}^{2} = y;

(d)

[[x]1n,…,[x]nn]=x[[x]_{1}^{n}, \ldots , [x]_{n}^{n}] = x, [[x1,…,xn]]in=xi[[x_{1}, \ldots , x_{n}]]_{i}^{n} = x_{i};

(e)

[x1,…,xm,xm+1,…,xn]=[[x1,…,xm],xm+1,…,xn][x_{1}, \ldots , x_{m}, x_{m+1}, \ldots , x_{n}] = [[x_{1}, \ldots , x_{m}], x_{m+1}, \ldots , x_{n}];

(f)

c(x0,c(x1,x2))=[c(x0,x1),x2]c(x_{0}, c(x_{1}, x_{2})) = [c(x_{0}, x_{1}), x_{2}].

References

[PóSz98] Pólya G., Szegő G. Problems and Theorems in Analysis. Springer, 1998.
[ДДК+21a] Дехтярь М.И., Дудаков С.М., Карлов Б.Н., Карлов М.И. Лекции по дискретной математике. 3-е изд., Тверской государственный университет, 2021.
[ДДК+21b] Дехтярь М.И., Дудаков С.М., Карлов М.И., Карлов Б.Н. Задачник по дискретной математике. 2-е изд., Тверской государственный университет, 2021.
[DuKo01] Du D., Ko K. Problem Solving in Automata, Languages, and Complexity. John Wiley & Sons, 2001.
[LaMa02] Lavrov I.A., Maksimova L.L. Задачи по теории множеств, математической логике и теории алгоритмов. 5-е изд., Физматлит, 2002.