scieee AI-readable full text Open interactive document viewer

Algorithmic geometry with infinite time computation

Tobar Nicolau, Adrián

Abstract

In this project we do an algorithmic study of problems from computational geometry with countably infinite input, especially countable sets in R^n. To do so, we use the infinite time Blum-Shub-Smale (ITBSS) machine, which is capable to extend computations to infinite time. We present this framework, explained with several algorithms, some results on the ITBSS Machine, and a storage system capable of encoding, editing and extracting sequences of real numbers. We study different geometric problems, giving algorithmic solutions to several of them. The accumulation points problem in R^2 is presented and solved for countable sets with finitely many accumulation points. Also, the convex hull problem is studied. We show how to compute the closure of the convex hull of countable bounded sets in R^n. The non-crossing perfect matching problem with infinite input is addressed as well.

Full text

Universitat Polit`ecnica de Catalunya Facultat de Matem`atiques i Estad´ıstica Master in Advanced Mathematics and Mathematical Engineering Master’s thesis Algorithmic geometry with infinite time computation Adrian Tobar Nicolau Supervised by Clemens Huemer and Moritz Mueller June, 2020 Thanks to the people fighting COVID-19. Abstract In this project we do an algorithmic study of problems from computational geometry with countably infinite input, especially countable sets in Rn. To do so, we use the infinite time Blum-Shub-Smale (ITBSS) machine, which is capable to extend computations to infinite time. We present this framework, explained with several algorithms, some results on the ITBSS Machine, and a storage system capable of encoding, editing and extracting sequences of real numbers. We study different geometric problems, giving algorithmic solutions to several of them. The accumulation points problem in R2is presented and solved for countable sets with finitely many accumulation points. Also, the convex hull problem is studied. We show how to compute the closure of the convex hull of countable bounded sets in Rn. The non-crossing perfect matching problem with infinite input is addressed as well. Keywords Algorithms, Infinite Computation, Infinite input, Infinite Time, Computational Geometry, Blum-Shub- Smale, Accumulation point, Convex Hull, Matching 1 Contents 1 Introduction 4 2 Ordinals 8 3 Computational model 14 3.1 BSS machine ......................................... 14 3.2 ITBSS machine ........................................ 16 3.3 Some results on the ITBSS machine ............................. 18 3.4 Observations and basic algorithms .............................. 19 3.5 How the machine stores data ................................. 20 3.6 Inputs and technical details .................................. 26 3.7 Scroll through a list ...................................... 27 4 Accumulation points 29 5 Convex Hull 37 5.1 Convex hull computation ................................... 38 6 Matchings 42 6.1 Stable Marriage ........................................ 44 7 Conclusions 48 8 Bibliography 49 A Density of rationals 51 B Auxiliar algorithms 53 2 List of Algorithms 1 Absolut value of a real number ................................. 16 2 Computation of π2 6....................................... 17 3 Value of πusing the Leibniz formula .............................. 19 4 Code of a real .......................................... 22 5 Real of a code .......................................... 22 6 Extract one code ........................................ 24 7 Extract one digit ........................................ 24 8 Alter a code ........................................... 24 9 Modify a digit .......................................... 26 10 Supremum of a countable bounded set ............................ 27 11 Inverse of the Cantor pairing function used in Proposition 3.22 ................ 28 12 Mass center of a set in R2................................... 31 13 Removing an accumulation point ................................ 32 14 Deciding if a segment Lhas an accumulation point of X................... 33 15 Finding the accumulation points of Xon a segment L.................... 34 16 Compute the finite number of accumulation points of a bounded set ............ 35 17 Compute the finite number of accumulation points of a set ................. 35 18 Decide if x∈CH(X)⊆Rn................................... 38 19 Decide if x∈CH(X)⊂Rnwith intCH(X)6=∅........................ 38 20 Compute closure of convex hull as a countable intersection of rational halfspaces . . . . . . 40 21 Well order ............................................ 46 22 Infinite Stable Marriage Algorithm ............................... 47 23 Exponentiation ......................................... 53 24 Floor function .......................................... 53 25 Number of integer-digits of a number ............................. 54 26 Binary expansion of a natural number as a natural number .................. 54 27 Square root of a non-negative real number .......................... 54 3 Infinite algorithmic geometry 1. Introduction The objective of this project is doing computational geometry with infinite input size, in particular countable infinite subsets of Rn. In computational geometry diverse problems on point sets are studied, being convex hull calculation a well-known example. The convex hull problem studies how to find the smallest convex set containing a particular finite set, see Figure 1. This problem has been widely studied since the 1970s [21] and several optimal algorithms have been discovered, see for instance [4,5]. In this project, we present the convex hull problem and other geometrical problems for point sets which are infinite countable. Figure 1: Convex hull, in gray, of a finite set of points in R2. To do computational geometry with infinite sets a framework is needed. The classical computational models, such as Turing machines [22], Random acces machines [6] and Blum-Shub-Smale machines [15] are not suitable to be such framework, since their computations are limited to only finitely many steps. The model used in this project is the Infinite-Time-Blum-Shub-Smale (ITBSS) machine, an extension of the BSS machine with the capacity to extend the computation to infinitely many steps. In this project we study three main geometric problems: accumulation points, convex hull and matchings. Accumulation points, as limit points of a set in Rn, are a proper problem of infinite input computation. The accumulation points problem that we study is how to find the accumulation points of a set in Rn. The main difficulty that emerges from this problem is that the accumulation points of a set do not have to be elements in the set, otherwise an easy computation could check for each point in the set if it is an accumulation point and give the solution. From this difficulty it is necessary to study the relative position of the elements in the set to determine where the accumulation points are. We prove that in the ITBSS model, the accumulation point problem can be solved for point sets with a finite number of accumulation points. The convex hull problem for infinite sets of points presents several difficulties. In general, it is not possible to report all the points on the boundary of the convex hull. Consider, for example, a closed ball in R2. To overpass this limitation we use a countable family of halfplanes, with common intersection the solution set, as a method to report the closure of the convex hull. Since this method is limited to closed sets, we give a partial solution to the convex hull problem showing that the ITBSS machine can solve the convex hull problem for the closure of convex hulls of countable sets. As the third studied geometric problem, we present diverse matching problems. A non-crossing perfect matching between two disjoint point sets is a bijection between the two sets, such that segments which connect paired points do not intersect, see Figure 2. We show several counterexamples to the existence of a non-crossing perfect matching, and of related non-crossing matchings. We end with a positive result in a non-geometric problem: stable matchings. As originally defined in 4 Figure 2: Non-crossing perfect matching between two finite sets with colors red and blue respectively. [9], the stable matching problems consists in finding a correspondence between two sets such that certain preferences are satisfied. We present the stable matching for infinite sets as done in [3] and prove that the stable matching problem can be solved by a ITBSS machine as long as certain conditions on the preferences are satisfied. Computational geometry with infinite input has certain differences with finite computational geometry. Starting with the convex hull, the solution for finite instances of this problem is always a convex polyhedron, not like for the infinite instances where, for example, the set of rational points, in R2, inside the open ball with center (0, 0) and radius 1 has convex hull a disk. The accumulation points problems is in radical difference with the finite computation since this problem does not have a finite counterpart. The noncrossing perfect matching problem for the point sets of infinite size does not always have a solution, not like in the finite case, where under the assumption of general position, i.e., there are no three points aligned, the existence of a solution is guaranteed. More differences appear when studying other problems, or when trying to adapt elementary tools from finite computation to the infinite case. For example, finite sets of points can be sorted and a least element can be identified. This cannot be done for most infinite sets. Consider, for example, the set of rational points in the interval (0, 1) where no least element exists. In general, in infinite computational geometry some properties, that are assumed in the finite case, do not hold. A minimum distance among the points of a set does not have to exist. An input can be unbounded. An input set can have accumulation points, and the set of accumulation points can be uncountable. For these reasons during this project several restrictions are imposed to the input sets to guarantee that the algorithms work properly. For these and many other reasons, the finite computational model and the infinite one are substantially different, and are interesting as independent fields of study. The problems commented so far are only a very small subset of all the geometric problems that can be studied for infinite inputs. Problems such as the existence of minimal spanning tree [12], or the stucture of Voronoi diagrams [23] have also been studied for infinite sets. With all commented before, we see that computational geometry with infinite input size can be a fertile ground for many studies on several different problems not only extending the finite ones but also unique questions that emerge from the infinity of the input. The organization of this projects can be divided in two main parts:(i) the model of computation,(ii) the study of problems. Section 2gives an introduction to ordinal numbers which are necessary for a full understanding of the model. The main operations and properties of ordinals are presented, showing the well known relation between ordinals and well-ordered sets. Section 3presents the Blum-Shub-Smale machine model and its generallization to the Infinite Time Blum-Shub-Smale machine [15]. This presentation shows several examples of computations and some of their properties. It ends with a discussion of the capacity 5 Infinite algorithmic geometry Proof. The proof is done by induction over β. For β= 0 we have α+ 0 = α⊕0 equal to α. Similarly, α+ 1 = α⊕1 also holds since the function f(γ)=(γ, 0) for γ < α and f(α) = (1, 1) is an isomorphism. Let β=γ+ 1, we know by induction hypothesis that β⊕γ=β+γ. Now, (α+β) + 1 = (α⊕β)⊕1 also holds by induction hypothesis. When β= supγ<β γis a limit ordinal we know that for each γthere is an isomorphism fγ:α+γ→α⊕γ. From Lemma 2.18 we know that if γ < γ0< β then fγ⊆f0 γ. Then fβ=Sγ∈βfγis a function with domain [ γ∈β α+γ=α+β. Its range is [ γ∈β α×{0}∪(γ×{1}) = (α×{0})∪[ γ∈β (γ×{1}) = (α×{0})∪ ([ γ∈β γ)×{1}  = (α×{0})∪(β×{1}) =α⊕β. And Sγ∈βα⊕γis exactly α⊕β. From construction, fis an isomorphism from α+βto α⊕β. Definition 2.23. Let α,β∈Ord>0, then α⊗βis the unique ordinal isomorphic to the well-order <on α×βdefined as (γ,η)<(γ0,η0)∈α×βif and only if η < η0, or η=η0and γ < γ0. Proposition 2.24. The operation ⊗is well defined. Proof. From the definition of <clearly for any two elements a,bof α×βwe have a<bor a>bor a=b and a≮a. The transitivity, i.e., a<band b<cimplies a<c, is a straightforward case analysis. We only have to prove that each non-empty set has a least element. Let Xbe a non-empty subset of α×βand let ξ= min{η∈β|(γ,η)∈X}and θ= min{η∈α|(γ,η)∈X∧γ=ξ}, both elements exists because {η∈β|(γ,η)∈X}and {η∈α|(γ,η)∈X∧γ=ξ}are non-empty subsets of βand αrespectively. Observe that (θ,ξ)∈Xand for all (γ,η)∈Xwe have ξ≤ηand θ≤γ. We conclude that (θ,ξ) is the least element of X. Now from Theorem 2.19 there exists a unique ordinal isomorphic to the well-ordered set (α×β,<). 12 Lemma 2.25. The equality α⊗(β+ 1) = (α⊗β)⊕αholds for any α,β∈Ord. Proof. We have that α⊗(β+ 1) is isomorphic to α×(β+ 1) with total order <of Definition 2.23 and (α⊗β)⊕αis isomorphic to ((α×β)×{0})∪(α×{1}) where α×βhas total order <0of Definition 2.23 and, the whole set, total order <00 of Definition 2.20. Consider the function F:α×(β+ 1) →((α×β)×{0})∪(α×{1}) F(x,y) = (((x,y), 0) if x∈αand y∈β, (x, 1) if x∈αand y=β. Fis order preserving and bijective. It implies that both ordered sets are isomorphic and we conclude that α⊗(β+ 1) = (α⊗β)⊕α. Proposition 2.26. For any α,β∈Ord the equalities α⊗β=α·βholds. Proof. As shown in Proposition 2.24 relation <from Definition 2.23 is a well-order. The proof is done by induction over β. For β= 1 we have α⊗1 = α·1 = α. For the general case α·(β+ 1) = (α·β) + α = (α⊗β) + α = (α⊗β)⊕α =α⊗(β+ 1). Where the second equality holds by induction hypothesis, the third from Proposition 2.22 and the last from Lemma 2.25. When βis a limit ordinal the argument is analogous to the one given for ⊕. Corollary 2.27. The operations +, ·and ⊕,⊗are, respectively, equal. To end we present the notion of limit which will be useful in the definition of our model of computation. Definition 2.28. Let α∈Ord a limit ordinal and r:α→Ra function. We say that zis the limit at α, and write lim ξ→αr(ξ) = z if and only if for any real  > 0 exists an ordinal γ∈αsuch that for all ordinal η≥γthe inequality |r(η)−z|<  holds. The limit of vectors is defined component-wise. Proposition 2.29. Let g :α→R, if f :R→Ris continuous at z, and limξ→αg(ξ) = z, then f( lim ξ→αg(ξ)) = f(z) = lim ξ→αf(g(ξ)). Proof. The first equality is trivial. Let us prove f(z) = limξ→αf(g(ξ)). Let  > 0, from continuity of f there exists δ > 0 such that |f(y)−f(z)|<  if |y−z|< δ. Let y=g(ξ). Then, if |g(ξ)−z|< δ we have |f(g(ξ)) −f(z)|< . Since limξ→αg(ξ) = zthere exists γ∈Ord such that |g(ξ)−z|< δ if ξ≥γ. We conclude that for any  > 0 there exists γsuch that |f(g(ξ)) −f(z)|<  if ξ≥γ. 13 Infinite algorithmic geometry 3. Computational model The main goal of this text is to explore algorithms for geometric problems with input of infinite size. To do so, an adequate model of computation must be chosen. The typical models of computation cannot be considered since their finiteness in time and capacity make them not powerful enough. This discards the classical Turing machines [22] and the Blum-Shub-Smale machines [1]. Among the diverse options, the ones that hold similarities with the classical ones are their infinite extensions, namely, the Infinite Time Turing Machine which have been presented and studied by Joel David Hamkins and Andy Lewis in [11] and the Infinite Time Blum-Shub-Smale (ITBSS) machine presented and studied by Peter Koepke and Benjamin Seyfferth in [15]. Both models present a natural extension of the finite computation to a transfinite computation able to carry on much more complicated tasks. Nonetheless, both models present some limitation in their capacity to manage infinite size inputs. The ITBSS machine model was chosen for this project, given the relative simplicity to present the programs as a combination of IF and EDIT commands. In the following sections the capacity and limitations of the ITBSS machine model are shown, all with focus in the construction of algorithms to solve the infinite extension of well known problems of finite algorithmic geometry and some problems unique for the infinite case, in particular, the calculation of accumulation points. 3.1 BSS machine To explain the final model that will be used we present first the Blum-Shub-Smale (BSS) machine model, originally presented in [1]. We start with an intuitive explanation of the BSS machine which will be later formalized. A BSS machine needs: an indexed finite list of commands of the form IF(f,`,k), EDIT(f) or HALT, a finite lists of real numbers called input (i0, ..., in−1) and a finite set of registers R= (R0,R1, ..., Rn−1). The machine works as follows. Set the value of the registers to R= (i0, ..., in−1). Execute the command with index 0. If the instruction is EDIT(f) set the values of the registers R=f(R) and execute the next command in the list. If the command is IF(f,`,k) check the condition f(R)≤0, if it is satisfied, the command with index `is executed next, the instruction kis executed otherwise. This process is continued until a HALT instruction is executed, after that the machine stops. This process is called “computation”. The computation is formalised in the following definitions. Definition 3.1. A function f:Rn→Rmis rational if it is a fraction of polynomials on each coordinate. Definition 3.2. A command is an instruction of the form EDIT(f), IF(g,`,k) or HALT where f:Rn→Rn is a rational function, g:Rn→Ris a rational function and `,kare natural numbers. A BSS program is a finite list of commands, each one with a distinct natural number associated with it, called index. Definition 3.3. We define: •R(t) := the value of the registers after step t. •I(t) := the command executing after step t. 14 Now we are able to define computation. Definition 3.4. Let P be a BSS program. The BSS machine computation by P on some input (i0, ..., in−1)∈ Rnis defined as the sequence (Ct)t<L= (R(t), I(t))t<Lwith (R(t), I(t)) ∈(Rn×N) for all t<L, where: •L∈Nor L=∞. •R(0) = (i0, .., in−1) and I(0) = 0. •EDIT(f) commands always have a function fwith image in Rn. •(EDIT) If t<Land I(t) = ilet EDIT(f) be the command of Pwith index i. Then, R(t+ 1) = f(R(t)) and I(t+ 1) = i+ 1. •IF(f,`,k) commands always have a function fwith image in R. •(IF) If t<Land I(t) = i, let IF(f,`,k) be the command of P with index i. Then R(t+ 1) = R(t) and if f(R(t)) ≤0, then I(t+ 1) = `; otherwise I(t+ 1) = k. •(HALT) If t<Land I(t) = i, let HALT be the command of P with index i. Then there exists no t0 such that t<t0<L. Definition 3.5. If an execution of P with some input does not create a computation,i.e, some division by zero occurs or the input is not valid or the registers do not converge, we say that the computation diverges. Remark 3.6. We assume that the denominator of the rational functions of EDIT commands do not vanish in any evaluation during the computation. Therefore f(R(t)) is well-defined in the EDIT command. In general, the computation of a program has the objective of extracting some particular information (factorization of a natural number, ordered list, convex hull,...). This information is called output. Definition 3.7. The output of a computation is the value of the register R0. Example 3.8. Consider the simple program P that computes the absolute value with indexed commands 0) IF(R0, 1, 2) 1) EDIT(f(R) = −R) 2) HALT The computation of P with input −5, first sets the registers R= (−5), goes to the command 0) and checks −5≤0. Since it is satisfied it runs the command 1). The register is updated to R= (5). Finally the HALT command 2) is executed and the process stops. As a sequence (R(t), I(t))t<L: 0: ((−5), 0) 1: ((−5), 1) 2: ((5), 2) Program P with input xcan be expressed with pseudocode, see Algorithm 1, where Return indicates which register is the output. 15 Infinite algorithmic geometry Algorithm 1: Absolut value of a real number Input: x∈R Output: |x|. 1Set R= (x); 2if R0≤0then 3R0=−R0; 4Return R0; 3.2 ITBSS machine We present the Infinite time Blum-Shub-Smale (ITBSS) machine, which will be the one that carries all computations during the rest of the text. The main reference is [15] where it was originally presented. The ITBSS machine needs the same as a BSS machine, i.e., an indexed finite list of commands of the form IF(f,`,k), EDIT(f) or HALT, a finite list of real numbers called input (i0, ..., in−1) and a finite set of registers R= (R0,R1, ..., Rn−1). The ITBSS machine is an extension of the BSS machine, where the number of steps that can be performed can be transfinite. The ITBSS machine works, for each finite step in the same way as a BSS machine. The main differences appears when an infinite number of steps are performed, in this case the value of the register is updated to a limit value. This limit value is determined by the infinitely many values that are taken before. This limit process is formally presented in the following definition. Definition 3.9. Let P be a BSS program. The infinite time BSS machine (ITBBS) computation by P on some input (i0, ..., in−1)∈Rnis defined as the transfinite sequence (Ct)t∈θ= (R(t), I(t))t∈θwith (R(t), I(t)) ∈(Rn×N) for all t∈θ, where: •θ∈Ord or θ= Ord. •R(0) = (i0, ..., in−1) and I(0) = 0. •EDIT(f) commands always have a function fwith image in Rn. •(EDIT) If t< θ and I(t) = i, let EDIT(f) be the command of Pwith index i. Then, R(t+ 1) = f(R(t)) and I(t+ 1) = i+ 1. •IF(f,`,k) commands always have a function fwith image in R. •(IF) If t< θ and I(t) = i, let IF(f,`,k) be the command of P with index i. Then R(t+ 1) = R(t) and if f(R(t)) ≤0 then I(t+ 1) = `; otherwise I(t+ 1) = k. •(HALT) If t< θ and I(t) = i, let HALT be the command of P with index i. Then there exists no t0 such that t<t0< θ. •If t< θ is a limit ordinal and y= lims→tR(s), then R(t) = yand I(t) = lim infs→tI(s). •If θ < Ord, then θ=γ+ 1 is a successor ordinal and I(γ) calls a HALT command. Remark 3.10. Observe how we are accessing the limit case assuming the existence of a limit in the values of R(s) as stends to a limit value. This limit clearly does not have to exist, in that case the computation fails. 16 Example 3.11. Let P be the program with indexed commands 0) EDIT(R0+R2 1,R1 R1+1) 1) IF(R1, 2, 0) 2) HALT and registers R= (0, 1). The execution will set R= (0, 1). The first command will be carried on updating R= (1, 1 2). The IF instruction will send us to command 0) for any finite step. Notice how the values of the registers will be updated to (Pt n=1 1 n2,1 n+1). The machine will update the values of the registers to the limit values, obtaining (P∞ n=1 1 n2, 0). From Definition 3.9, the next step that will be carried on will be the lim infs→ωI(s) = 0. In this command the registers will remain unchanged. Finally the condition of the IF command 1) will be satisfied and the computation will stop after executing the HALT command. As a sequence, the computation is given by (R(t), I(t)) = t X n=1 1 n2,1 t+ 1!,tmod 2!for t∈ω. (R(ω+i), I(ω+i)) = (π2 6, 0), ifor i∈ {0, 1, 2}. The program can be presented with pseudocode as Algorithm 2. Algorithm 2: Computation of π2 6 Input: No input. Output: π2 6. 1Set R= (0, 1); 2R0=R0+R2 1; 3R1=R1 R1+1 ; 4while R1>0do 5R0=R0+R2 1; 6R1=R1 R1+1; 7Return R0; Remark 3.12. Example 3.11 shows how a while loop is made. We execute a list of ordered EDIT commands and use an IF instruction to repeat them if the condition is not satisfied. 17 Infinite algorithmic geometry 3.3 Some results on the ITBSS machine Here we present some of the main results presented in [15]. Definition 3.13. Let α < θ be a limit ordinal and (Ct)t<θ an ITBSS computation by some program P. We say that a command in the computation is carried cofinally often below αif for any β < α there exists γsuch that β≤γ < α and the command has been executed at time γ. Lemma 3.14. [15] Let (Ct)t<θ be an ITBM computation by some program P and let α < θ be a limit ordinal. Then the first command in the computation that alters the register contents after time αhas not been carried out cofinally often below α. Proof. Suppose otherwise. Let c=EDIT(f) a command which is called cofinally often below α. Suppose that chas been called at some time β > α and for all α < γ < β the register content has not been changed. Since fis locally continuous (it is a rational function) we have: R(β+ 1) = f(R(β)) =f(R(α)) =f( lim t→αR(t)) = lim t→α,I(t)=iφ(R(t)) = lim t→α,I(t)=iR(t+ 1) =R(α). A contradiction. Theorem 3.15. [15] Let P be a program with k EDIT commands. Then, for any computation (Ct)t<θ according to P, the register stabilize before ωk+1, i.e., the values of the registers do not change any more. Proof. The proof is done by induction on k. If k= 0, all commands are IF or HALT instructions. That implies that the values of the registers Rdo not change. As the program is executed, the IF commands can do two things: halt the program or execute a new IF command. If the machine halts, it will be after a finite number of steps. If it does not halt after b+ 1 steps, where bis the number of IF commands, at least one IF instruction has been visited twice which implies that the program has fallen in a loop. Assume true for k. Let P be a program with k+ 1 EDIT commands. Suppose that the register does not stabilize before ωk+2. Let cbe the first EDIT command that changes the register after ωk+2, As we have seen in Lemma 3.14,cdoes not change the registers cofinally often below ωk+2. Let αbe the supremum of the times below ωk+2 that cwas executed non trivially (the values of the registers changed). (Ct)α<t<θ is the computation of Pchanging cfor a trivial IF(0, i,i), where i is the index of cplus one, with input R(α). By induction, the registers of this computation stabilized in ωk+1 steps. Since α+ωk+1 < ωk+2, the original computation stabilized before ωk+2. Since the argument used before is independent of the input, we have the following result. Theorem 3.16. [15] Every ITBM computation halts before ωω-many steps or the execution diverges. 18 3.4 Observations and basic algorithms In this section we show several examples of simple algorithms that will be used in the following chapters. Remark 3.17. When the value of the registers is set as R= (R0,R1, ...) the dots indicate that a finite number of registers are added to execute secondary computations. Computing a limit: From the definition of the computation in Definition 3.9 it is enough to update a register Rat each step tto values that tend to a limit value to obtain the desired result. This process can be seen in the following example. Example 3.18. How to compute πusing the Leibniz formula. Since P∞ k=0 (−1)k 2k+1 =π 4we can explicitly compute the sum. See Algorithm 3for the pseudocode. Algorithm 3: Value of πusing the Leibniz formula Input: No input. Output: π. 1Set R= (1, 1, −1); 2while R1>0do 3R0=R0+R2 R1+2 (store the partial sum); 4R2=−R2 R1( store (−1)k); 5R1=R1 1+R1(store 1 k); 6R2=R2R1(store (−1)k k); 7R0= 4R0; 8Return R0; The program is given by the list of commands 0) IF(R1, 3, 1) 1) EDIT R=R0+R2 R1+2,R1 1+R1,R2 R1 2) EDIT (R= (R0,R1,R2R1)) 3) IF(R1, 4, 0) 4) EDIT (R0= 4R0) 5) HALT At each step the different registers store the necessary information to carry the computation, in this case R(t) = t X k=0 (−1)k 2k+ 1,1 t+ 1,(−1)t+1 t+ 1 !. Once the computation halts the value of the first register will be the complete computation of the Leibniz formula. 19 Infinite algorithmic geometry Remark 3.19. As we slowly increase the complexity of the algorithms we see that the presentation of a program as a list of commands increases. From now on, only the pseudocode representation will be used to keep the programs understandable. Example 3.18 shows the limitation of the model that needs convergence in each register. In general, this limitation can be circumvented forcing a convergence to a constant or 0 using a denominator that tends to infinity. 3.5 How the machine stores data This section presents how the data can be stored inside the machine. Our objective is storing a countable list of reals inside one register. This codification must allow us to recover each value. We will use the Cantor pairing function to store families (ri)i∈Nof real numbers inside one register of the machine. This will be done using subsets of digits of the decimals of a real number to store infinitely many codes, each one coding a real number. We present the Cantor pairing function. The results are taken from [2]. Definition 3.20. The Cantor pairing function π:N×N→Nis defined as π(x,y) = 1 2(x+y)(x+y+ 1) + y. Proposition 3.21. The Cantor pairing function is a bijection. Proof. To see injectivity we first prove that x+y<x0+y0implies π(x,y)< π(x0,y0). Given k=m+n with kfixed, the maximum value of the function π(m,n) is π(0, k) = 1 2(k)(k+ 1) + kand the minimum value π(k, 0) = 1 2(k)(k+ 1). If k0≥k+ 1, then π(k0, 0) ≥1 2(k+ 1)(k+ 1) + k+ 1 > π(0, k). Now assume that π(m,n) = π(m0,n0) then n+m=n0+m0by above, and hence π(m,n)−π(m0,n0) = n−n0= 0, which implies n=n0and m=m0. To see surjectivity let z∈Nand tk=1 2(k)(k+ 1) be the largest value not bigger than zwith k∈N. Let m=z−tkand n=k−m. Then π(n,m) = z. Proposition 3.22. The inverse of the Cantor pairing function is given by π−1(z) = z−w2+w 2,−z+w2+ 3w 2, where w =j√8z+1−1 2k. The proof is omitted since it can be done by case analysis. By definition our machine model takes finite tuples of real numbers as inputs, but we are actually interested in countably infinite sets of real numbers as inputs. To simulate such inputs we code a family (ri)i∈Nof real numbers by a single real rin such a way that an ITBSS machine can compute the map (r,i)7→ ri. There are many ways to achieve this and the particular choice is a matter of no consequence for the rest of this thesis. 20 For completeness we now detail such a coding. It is based on a coding of reals rby “digit sequences” d∈ {0, ..., 9}N. Formally, such a sequence is a function d:N7→ {0, ..., 9}, also written as a family (di)i∈N, or, more informally, spelled out as d0d1d2.... Definition 3.23. We say that d∈ {0, ... , 9}Nis a digit code if and only if there is a positive natural number nsuch that dn= 2 and dm∈ {0, 1}for all m<n. The real rcoded by dis r= (−1)d0 k X j=1 10k−j+1dn+j+∞ X i=n+k+1 10n+k−idi where k:= Pn−1 i=1 2n−i−1di. In other words, a code dis a bit followed by a non-empty bit-string sfollowed by 2, followed by a sequence of digits.The first bit determines the sign, the sequence of digits determines the real with ”.” at place k, where k∈Nis the natural number with binary expansion s(allowing leading 0s). It is clear that that every digit code d codes exactly one real. Furthermore, it is clear that every real has a digit code, in fact, for every real rthere are infinitely many digit codes d∈ {0, ... , 9}Nsuch that d codes r. For example, the digit sequences 01210000... 0029999... 0000000299999... 01209999... all code the real 1. Conversely, every d∈ {0, ..., 9}Nhas a ”real code” <d>:= ∞ X i=0 10−(i+1)di∈(0, 1). Proposition 3.24. There is an ITBSS computation of a program P with input r ∈Rthat returns as output <d>for some digit code d of r. Further there is a ITBSS computation of a program P with input <d> for some digit code d of some real r with output r. Remark 3.25. In Algorithm 4, when the binary expansion of R3is done, the output is a natural number which coincides digit to digit with the binary representation R3as a natural number in base 2. Proof. The proof of Proposition 3.24 is done showing an algorithm that can do each process. How to compute <d>given r, see Algorithm 4. Following the steps of the algorithm we see: •Steps 1,2,3,4: It is checked if R0is negative or not. R0is set to its absolute value and R4is fixed to 1 in the case R0was negative. •Steps 5,6,7: We have R0=r1r2...rk.rk+1... a non-negative real . The register R1is updated to (R0·10−R3+ 2)/10 where R3=k. After Step 7 register R3equals 0.2r1r2... 21 Infinite algorithmic geometry Proof. Algorithm 11 implements the inverse function used in Proposition 3.22. Algorithm 11: Inverse of the Cantor pairing function used in Proposition 3.22 Input: A natural number n. Output: π−1(z). 1Set R= (n, 0, 0, 0); 2R3=j√8z+1−1 2k(Algorithms 24 and 27); 3R1=R0−R2 3+R3 2; 4R2=−R0+R2 3+3R3 2; 5R0= (R1,R2) (Definition 3.31); 6Return R0; Since π−1(z) is a bijection between Nand N2we can use it recursively to make a bijection from Nto Nkfor any knatural greater than 1. We present that bijection in the following definition. Definition 3.34. We define the functions Bk(z) : N→Nkfor naturals k≥2 as. Bk(z) = (π−1(z) if k= 2, Bk(z) = (x1, ..., xk−2,π−1(xk−1)) if k≥3, where (x1, ..., xk−1) = Bk−1(z). Proposition 3.35. The functions Bkare bijective for all naturals k ≥2. Proof. The proof is inductive. The case k= 2 is satisfied for being the preimage of π(z), a bijective function. Assume Bkbijective for k<n. Clearly, for all (m1, ..., mn−1)∈Nn−1there exists a unique (t1, ..., tn)∈Nnsuch that ti=mifor i∈ {1, ..., n−2}and π−1(mn−1)=(tn−1,tn). Since Bnis the composition of Bn−1and the unique correspondence stated before, it is bijective. These functions can be easily computed using k−1 times Algorithm 11. Additionally, we can make an exhaustive partial function from Nto Qk. Definition 3.36. We define the partial functions Qk:N→Qkfor all naturals k≥2 as Qk(z) = x1 x2 ,x3 x4 , ..., x2k−1 x2kwhen x2i6= 0 for all i∈ {1, ..., k}, where (x1, ..., x2k) = B2k(z). Proposition 3.37. The partial functions Qkare exhaustive. Proof. Since B2kis bijective, for any x1 x2,x3 x4, ..., x2k−1 x2k∈Qkthere exits some z∈Nsuch that B2k(z) = (x1, ..., x2k). These partial functions can be easily implemented and used to visit all points in Qn. 28 4. Accumulation points Now that the framework has been established, we apply it to geometric problems with infinite countable input. We start with accumulation points. The traditional models of computation can not work with accumulation points since for their appearance we need an infinite set of points. Definition 4.1. A point xis an accumulation point of the set X⊆Rnif ∀ > 0∃y∈X−{x}such that d(x,y)< , where d(x,y) is the Euclidean distance between xand y. Proposition 4.2. A point x is an accumulation point of a set X ⊂Rnif and only if inf{d(x,y)|y∈X−{x}} = 0. Proof. ⇒) Assume that inf{d(x,y)|y∈X−{x}} =k>0. Using the definition of accumulation point, with 0<  < k, we know that exists y∈Xsuch that d(x,y)<k, a contradiction. ⇐) Assume that xis not an accumulation point. That implies that there exists  > 0 such that no point yin Xsatisfies d(x,y)< . Then it is clear that inf{d(x,y)|y∈X−{x}} ≥ . Next, we introduce some technical results. Theorem 4.3. (Bolzano-Weierstrass Theorem in Rn) Let {ai}i∈Nbe a bounded sequence of points in the set X = [a1,b1]× ···×[an,bn]with a1, ..., an,b1, ..., bn∈R. Then, there exists a subsequence that converges to a point in X. The proof is not complicated but technical and long. See [8]. Proposition 4.4. If an infinite set X ⊂Rnis bounded, it has at least one accumulation point. Proof. Let {ai}i∈Nbe a sequence of points of Xwithout repetitions. From Theorem 4.3 the sequence has a subsequence {bi}i∈Nthat converges. From the definition of limit, limn→∞ bnis an accumulation point of X. From now on, we present several definitions and concepts in R2. Most of the concepts can be easily adapted to Rnbut, since the final results will concern R2, we only define them for the planar case. Definition 4.5. The mass center of a set {(xi,yi)}i∈Nof R2is defined as lim n→∞ n−1 X i=0 xi n, n−1 X i=0 yi n!. Lemma 4.6. The mass center of a bounded set of R2always exists. 29 Infinite algorithmic geometry Proof. Since the set is bounded, there exists c= sup{xi}<∞and d= inf{xi}>−∞. From these bounds we obtain d= lim n→∞ n−1 X i=0 d n≤lim n→∞ n−1 X i=0 xi n≤lim n→∞ n−1 X i=0 c n=c. We can assume that all coordinates are positive, otherwise we can make a translation of the points to the first quadrant. Given that all the entries are positive, the series converge. The same argument holds for the second coordinate of the points. Proposition 4.7. The mass center of a bounded and countable set of points with exactly one accumulation point is the accumulation point. Proof. Let (x,y) be the accumulation point and (a,b) the mass center of the given set {(xi,yi)}i∈N. The following argument applies to each coordinate of the points. Suppose that a<x. Then lim n→∞ n−1 X i=0 xi n=a. Let c=a+x 2. Since the limit exists, we can express it as the sum lim n→∞ n−1 X i=0 xi n= lim n→∞ X xj≤c xj n+X xi>c,i<n xi n , where the first sum is the sum of points with x-coordinate smaller than or equal to c. This set must be finite because otherwise the ball B(xj,c) would have infinitely many points, and Proposition 4.4 would imply the existence of another accumulation point. The second sum is the sum of the rest of the points, an infinite set. Since both series converge, lim n→∞ n−1 X i=0 xi n= lim n→∞ X xj≤c xj n + lim n→∞ X xi>c,i<n xi n  =0 + lim n→∞ X xi>c,i<n xi n  ≥lim n→∞ X xi>c,i<n c n  =c, which is a contradiction. An analogue argument works for a>x. Algorithm 12 shows how to compute the mass center of a countable set Xin R2. Definition 4.8. We define “removing” an accumulation point xfrom a set Xas finding a subset Yof X such that •xis not an accumulation point of Y. 30 Algorithm 12: Mass center of a set in R2 Input: A countable set X⊂R2. Output: Mass center of X. 1Set R= (X,X(0), 1, ...); 2while R2>0do 3R1=R1 R2+1 +X(1 R2)R2 R2+1 (sum from 0 to n-1; It is a sum of points in R2, see Definition 3.31); 4R2=R2 R2+1; 5Return R1; •If z6=xis an accumulation point of X, it is also an accumulation point of Y. We say that Yremoves xfrom X. Definition 4.9. The open ball of center x and radius r,B(x,r) is defined as the set B(x,r) = {z|d(x,z)<r}. Given a set Xwith a finite number of accumulation points, Algorithm 13 shows how to remove an accumulation point x. See Figure 3. Figure 3: The balls B(x,1 2n), B(x,1 2n+1 ) separate the neighbours of the accumulation point xinto regions. There exists a natural number n0such that for all n>n0, the region B(c,1 2n−1)\B(x,1 2n) contains only a finite number of point of X. Proposition 4.10. Algorithm 13 outputs a valid solution. Proof. To see that this algorithm works it is enough to see that the output R5contains all accumulation points of Xexcept x. First observe that the while loop of Step 2 checks for each element of Xif it lies between the two balls. If the number of points that satisfy the condition is infinite, the value of the register R2will converge to 0. If R2= 0, the register R4is updated to a new value. This process will update R4until the balls with radius 1 21/R2,1 21/R2+1 have finitely many elements in between for all natural n≥1 R3. This will eventually happen because otherwise, we would have infinitely disjoint bounded regions with infinitely many points inside, which would imply the existence of infinitely many accumulation points. In this process R1is used 31 Infinite algorithmic geometry Algorithm 13: Removing an accumulation point Input: A countable set X⊂R2with finitely many accumulation points, and an accumulation point xof X. Output: A set Ythat removes xfrom X. 1Set R= (X, 1, 1, 1, 1, E, ...) (E is an empty list as defined in subsection 3.6); 2while R3>0do 3while R1>0do 4if X(1 R1)∈B(x,1 21/R3)\B(x,1 21/R3+1 )then 5R2=R2 R2+1 6R1=R1 R1+1 7if R2≤0then 8R4=R3 R3+1 9R3=R3 R3+1; 10 R2= 1; 11 R1= 1; 12 while R1>0do 13 if X(1 R1−1) /∈B(x,1 21/R4)then 14 E(1 R2−1) = X(1 R1−1); 15 R1=R1 R1+1; 16 R2=R2 R2+1; 17 else 18 R1=R1 R1+1; 19 Return R5; 32 to go through all points of Xto check if they lie between the balls. And R3is used to go through all values of Nto study all the possible radius of the balls. When R4stabilizes to a value n, the ball B=B(x, 1/2n) contains xand all points zin Xsuch that d(x,z)<1/2n. From here it is clear that for all z∈X\B,d(x,z)≥1 2n, which implies that xis not an accumulation point of X\B. Steps 12 to 16 store in R5the set X\B. The register R1is used to go through all the elements of Xand R2to go through all the elements of E. To end, all the accumulation points of Xdifferent from xare in X\B. Suppose that z6=xis an accumulation point in Xbut it is not in X\B. Then for all  > 0 exists b∈Bsuch that d(z,b)< , a contradiction with the value of n. Algorithm 14 shows a simple criterion, based in Proposition 4.2 to decide if a segment contains an accumulation point of a set X. Algorithm 14: Deciding if a segment Lhas an accumulation point of X Input: A set Xand a segment Lwith at most finite number of points in common. Output: Yes/No answer. 1Set R= (X,L, 1, 1, 1); 2while R3>0do 3R4=d(L,X(1 R3−1)) (use the point-segment distance formula of R2); 4if 0<R4<R5then 5R5=R4 6R3=R3 R3+1; 7if R5≤0then 8Return Yes; 9else 10 Return No; We present now Algorithm 15. In this case we state the algorithm in words without the detailed operations on registers, though it is possible to explicitly give the ITBSS program. Remark 4.11. In Algorithm 15 we need that the segment and Xdo not have more than finitely many points in common, otherwise an accumulation point of Xcould be the limit of points in Land we would not detect it. From now on, we assume that the sets Xstudied have at most finitely many points aligned. Proposition 4.12. Algorithm 15 is correct. Proof. Since we check if Lhas accumulation points of X, we can assure that the sequence {si}, defined in the algorithm, is computed, and that at least one accumulation point in Lexists. By construction the values of the sequence {si}get closer to Las itends to infinity. Now, since ya= lim n→∞inf i≥ny(si) there exists an infinite subsequence {ai}in {si}such that limi→∞ y(ai) = ya. By construction, the xcoordinates tend to the x-coordinate of L. We conclude that limi→∞ ai∈Land it is an accumulation point of X. Since this process always finds one accumulation point, removing the point found and repeating the process will eventually complete the search. 33 Infinite algorithmic geometry Algorithm 15: Finding the accumulation points of Xon a segment L Input: A set X⊂R2with finitely many accumulation points , and a vertical segment L. Output: Accumulation points of Xin L. 1Use Algorithm 14 to check if Xhas accumulation points on L. If the answer is negative return the empty set. Otherwise continue. 2Check if the extremal points of the segment are accumulation points. If an accumulation point is found, remove it using Algorithm 13. 3Store {ri}, a sequence containing all points with y-coordinate between the extremal values of the segment not in L. To do this, check for each element of Xif it satisfies this condition on the y-coordinate. If it does, add it to the sequence; do not otherwise. From this set take a subset {si}as follows: Pick the initial value s1=r1. Then search the first riin the sequence such that d(L,ri)<1 2d(L,s1), this point is s2. Repeat until step ω. Compute ya= lim n→∞inf i≥ny(si) where y(s) is the y-coordinate of point s(use the method of Algorithm 10). Check if the point on the segment with y-coordinate yais an accumulation point. If it is, remove it to obtain a subset Y. Check if Lhas an accumulation point of Y; if it does, repeat Step 3, processing with Y. Otherwise return all the accumulation points found. Remark 4.13. Some remarks on the proof and the Algorithm 15. •In this case the algorithm was a exposed in text to facilitate the comprehension. •In the condition d(L,si)<1 2d(L,si−1) the 1 2is necessary to assure that the points tend to L. Any 0<<1 could be used instead. •The sequence {si}does not have to converge to a value. For example the sequence could be an alternation of {(1 n, 1)}n∈N>0and {(1 n, 2)}n∈N>0. •Using the inferior limit does not guarantee us that the accumulation points will be found in ascending order, the order of appearance depends on how the sequence {si}is created. It could always choose elements from a subsequence that tends to an accumulation point which is not the lowest, nor the highest. 34 Algorithm 16: Compute the finite number of accumulation points of a bounded set Input: A bounded set X⊂R2with finitely many accumulation points. Output: Accumulation points of X. 1Check for each n∈Nif Xis contained in the square [−n,n]2until a natural mis found such that Xis contained in [−m,m]2(Check for each point in Xif it lies inside the square). 2Check, using Algorithm 15, if the vertical sides of [−m,m]2contain accumulation points and use the process of Algorithm 13 to remove them. 3Let Rbe the list containing only the square [−m,m]2. 4For a generic rectangle T= [a,b]×[c,d] in R: •Remove Tfrom R. •Check if there are infinitely many points of Xinside T(Method of algorithm 13). If there are, –Check if the vertical segments from (a,c) to (a,d) and (b,c) to (b,d) have accumulation points. If they have, remove them. –For the rectangles T1= [a, (a+b)/2] ×[c,d] and T2= [(a+b)/2, b]×[c,d], check if there are infinitely many points inside each one. If some has, add it to R. Take a square in Rand repeat the process until Ris empty. Return the accumulation points found. Now, we are finally able to compute the accumulation points of a given bounded set X. Proposition 4.14. Algorithm 16 is correct. Proof. Simply observe that if an accumulation point lies in the interior of a region, there must be infinitely many points inside it. At each step the vertical segments will be closer to the x-coordinate of the accumulation point until the values converge to a line that contains the accumulation point. With a simple trick, Algorithm 17 can be adapted to work for unbounded sets. Algorithm 17: Compute the finite number of accumulation points of a set Input: A set X⊂R2with finitely many accumulation points. Output: Accumulation points of X. 1Apply Algorithm 16 to the points of Xinside the square [−1, 1]2. 2Remove the points of Xinside the square [−1, 1]2(Create a new sequence with the elements of X outside the square). 3Apply the complex transformation f(z) = 1 zto the points of Xoutside the square and apply Algorithm 16. Once the accumulation points are found, to all the solution points different from (0, 0), apply again the complex transformation 1 z(change each element for each complex transformation). 4Return the accumulation points found. Remark 4.15. In Algorithm 17, the point (0,0) is removed because it will never be an accumulation point after the transformation 1 zis done. Observe that the tranformation 1 zsends big module numbers to small 35 Infinite algorithmic geometry module numbers, and if the point (0, 0) appears it is because the supremum of the modules tends to infinity. Remark 4.16. Sadly, Algorithm 16 cannot be extended to a countable amount of accumulation points because the process to remove accumulation points needs the existence of a minimum distance among them. Nonetheless, if a set Xhas a countable amount of accumulation points and if there exists a non-zero minimum distance among them, then Algorithm 16 can be adapted to work, by simply dividing the space into squares of the form [a,a+ 1] ×[b,b+ 1] with a,b∈Z, and applying Algorithm 16 to each square. 36 5. Convex Hull Calculation of convex hull is a very studied field in finite and infinite geometry. Here, we present some results and algorithms for the infinite case using well known facts about them. A good reference is [17]. Definition 5.1. A set Xis convex if ∀x,y∈X⊆Rn,∀t∈[0, 1] tx + (1 −t)y∈X. Definition 5.2. The convex hull of X,CH(X) is the intersection of all convex sets containing X. Definition 5.3. We define an hyperplane H(~ c,d) , with ~ c∈Rnand d∈Ras H(~ c,d) = {x∈Rn|x·~ c=d}. If ~ c∈Qnand d∈Qwe say it is a rational hyperplane. Definition 5.4. Given non-empty sets X1,X2of Rn. The hyperplane H(~ c,d) separates X1and X2if sup x∈X1 (x·~ c)≤d≤inf x∈X2 (x·~ c). If the inequality is strict, we say that H(~ c,d) strongly separates X1and X2. Theorem 5.5. (Strong Separating Hyperplane Theorem) Let K and C be disjoint and non-empty convex subsets of Rn. Suppose K is compact and C is closed. Then there exists an hyperplane H(~ p,d)that strongly separates K and C. Proof. This fact is well known. A proof can be found in [16]. Here we present a result that motivates the use of closed halfspaces. Proposition 5.6. Let C be the family of convex sets that contain X and H be the family of closed halfspaces that contain X, then the following equality holds: \c c∈C =CH(X) = \h h∈H , (1) where the overline denotes the closure of the set. Proof. The first equality holds immediately by the definition of convex hull. Tc c∈C⊂Th h∈H : Clearly H⊂Cand that implies \c c∈C⊂\h h∈H , now, that implies that \c c∈C⊂\h h∈H , but, since H is a family of closed sets the intersection is a closed set. We conclude \c c∈C⊂\h h∈H =\h h∈H . 37 Infinite algorithmic geometry p r s Figure 6: Example 6.8. 6.1 Stable Marriage The stable marriage problem consists in two finite lists B={b1,b2, ..., bn},G={g1,g2, ..., gm}where each b∈Bhas a list of preference for the elements of G. Respectively each g∈Ghas a list of prefence for the elements of B. Formally this preference is stated as a binary relation <where a<a0implies that ais prefered over a0. This has been historically stated as a list of boys Band a list of girls Gwhere the preference indicates which boy/girl prefers to marry. Given an injection (or marriage) M:B→G, b and g are matched if M(b) = g. A marriage is unstable if there exists a pair (b,g)∈B×Gsuch that they are not matched but bprefers g over their matched partner and g also prefers bover its matched partner. Such a pair is called blocking pair. A marriage is stable if it is not unstable. This problem was presented and solved by Gale and Shapley in [9]. First we formalize the definitions. Definition 6.10. Let B,Gbe sets such that for each b∈Bthere exists a well-order <on G, for each g∈Gthere exists a well-order <0on Band let M:G→Bbe a matching. Let g,g0∈Gwith respective orders <g,<g0on B and b,b0∈Bwith respective orders <b,<b0on G. •We say that gprefers bover b0if b<b0. •We say that g and b are matched if M(g) = b. •We say that b and g are a blocking pair if they are not matched and prefer each other over their matched partner of M. We state the infinite stable marriage problem as follows, see [3]. Definition 6.11. A stable marriage problem instance is a tuple hB,G,{<i}bi∈B,{<j}gj∈Gisuch that •B= (bi)i∈Nand G= (gj)j∈Nare sequences. •For each i∈Nthe ordered set (G,<i) is isomorphic to ω. 44 •For each j∈Nthe ordered set (B,<j) is isomorphic to ω. Remark 6.12. Each <i,<jencodes the preference of each element. If bx<jbythen gjprefers bxover by. Since (G,<i), (B,<j) are isomorphic to ωthey are well-orders, which implies that we always have a least element for any non-empty subset. Definition 6.13. Let hB,G,{<i}bi∈B,{<j}gj∈Gibe a stable marriage problem instance. M:B→G(or M:G→B) is a stable matching if there is no blocking pair (b,g)∈B×G. Now we state the result presented in [3]. Theorem 6.14. ([3]) Let hB,G,{<i}bi∈B,{<j}gj∈Gibe an instance of the stable marriage problem. Then there is a stable (R,B)-matching or a stable (B,R)-matching. Proof. The proof is constructive. Start matching b0with the first girl of his preference <0(i.e., least element of (G,<0)). This girl exists because <iis a well-order. Note that we could as well start matching g0with the first boy of her preference. At the end of step s assume we have a matching Ms={(b0,gσ(0)), ...(bs−1,gσ(s−1)}. We consider now the element bwith least index in Bthat is not matched. We check for the least element g∈(G,<s) such that gis not matched or prefers bover the current matched partner. If gis not matched then we match b and gand start step s+ 1 with b0the element with least index in Bthat is not matched. If gwas matched to some b00, we update Msremoving (b00,g) and adding (b,g). Now we do again the procedure (round) stated before with b00 (we are still in the same step). Notice that after a finite number of rounds we will match some bwith some unmatched g. But in each such change some of the gchanges its partner to a preferred one; this can happen only a finite number of times for each gand thus only for a finite number of rounds in total. It can be seen from induction that, at each step one new girl is matched and that she will remain matched at the end of each following step (this is done in the original proof in [9]). In particular, at each step the girls that change partner will do it only to partners that are higher in their preference. Since there are finitely many partners with higher preference than the first one, for each girl gthere exists a finite step tgafter which gdoes not change partner. Then we will have M={(bi,gτ(i))|(bi,gτ(i))∈Msfor all steps after some finite step tgτ(i)}. Let us prove that Mis a stable matching. First we prove injectivity. It is enough to see that if g(or b) is inside some pair in Mno other pair can have g( or b). Let (b,g)∈Mbe the pair that contains bwith lowest tg. The element bwill never be considered after step tgin the procedure since bis already paired and will not be unpaired. That implies that no (b,g0) can be added. Then (b,g) is the only pair that contains bin M. Let (b,g) the pair that contains gwith lowest tg. After step tgno b0will be considered such that b0<b, which implies that no pair (b0,g) will be added. Since in both cases the pair has the lowest tgno pair containing bor g, respectively, can be in M. If some b0∈Bis not matched, let bbe the least of all unmatched elements of B. Then there are infinitely many steps where bwas left unmatched. But if bhas been left unmatched infinitely many times it must have checked all girls in their preference and checked if they were unmatched or matched with a lower preference b00. That implies that all girls are matched. Then Mis a (B,G)-matching or a (G,B)-matching. Now we prove the stability of M. Suppose that (b,g)∈B×Gis a blocking pair, i.e., contradicts the stability of M. Then, from the argument used before, if bis not matched, it must have checked at some 45 Infinite algorithmic geometry step if gwas unmatched or if she preferred her current match. If the match (b,g) was in Msafter that step, then some other b0must have checked gand removed this matching from Mindicating that b0<b with <the preference of g. Alternatively if bis matched with some g0two things can happen. If g0<g with <the preference of b, then (b,g) is not a blocking pair. And if g<g0, then g must have been checked before g0. Since it is not matched with bit must be matched with a b0such that b0<b, with < being the preference of g. In conclusion, Mis a stable matching. Remark 6.15. Note that not all the elements of Bmust be matched to obtain a solution. The solution is not always a perfect stable matching. From this result we can extract an algorithm to compute stable matchings. The following Algorithm 21 will be used as a sub-routine. Algorithm 21: Well order Input: A well-order <and two natural numbers n,m Output: Yes/No to the question n<m 1Set R= (<,n,m, 0, ...) 2R3= decimal digit of <at position π(n,m) (Algorithm 7); 3if R3≤0then 4Return Yes; 5else 6Return No; Corollary 6.16. Let I =hB,G,{<i}bi∈B,{<j}gj∈Gibe an instance of the stable marriage problem. Then there is an ITBSS computation that finds a stable matching of I. Proof. The proofs follows from Algorithm 22. This algorithm will reproduce the procedure of the proof of Theorem 6.14 identifying Band Gwith N. The output will be a positive real number with the decimal digit at position π(n,m) 1 if nand mare matched, and 0 otherwise. Remark 6.17. In Algorithm 22, the value bshould be used carefully to avoid a divergence in the register. To do so use the trick of storing 1 b+1, instead. This has been eliminated from the code to make it more understandable. Remark 6.18. A stronger result is presented in [3] where a stable matching exists when the ordered sets (G,<i), (B,<j) are isomorphic to some ordinal, not necessarily ω. Hence, using a similar algorithm as the one given in the proof of Theorem 6.14 it could be possible to extend Corollary 6.16 under some reasonable conditions. This limitation should guarantee that the limitations shown in Theorem 3.16 are not broken. 46 Algorithm 22: Infinite Stable Marriage Algorithm Input: Two real numbers that code the families (<i)i∈Nand (<j)i∈N(Definition 3.30 6)) Output: A (B,G) or (G,B)-matching 1Set b= 0 (we identify Band Gwith N); 2Set GM = 0 (the decimal digit nis 1 if gnis matched); 3Set BM = 0 (the decimal digit nis 1 if bnis matched); 4Set M= 0 (the decimal digit π(n,m) = 1 if bnand gmare matched); 5Search the least element g∈(G,<b) that is not matched or prefers bover their actual partner b0 (i.e. b<gb0; use Algorithm 21).; 6if g was not matched then 7Set the decimal digit π(b,g) of Mequal to 1; 8Set the decimal digit bof BM equal to 1; 9Set the decimal digit gof BM equal to 1; 10 Set bto the first decimal position in GM with digit 0. (Next unmatched b; see Remark 6.17).; 11 else 12 Set the decimal digit π(b,g) of Mequal to 1; 13 Set the decimal digit π(b0,g) of Mequal to 0; 14 Set the decimal digit bof BM equal to 1; 15 Set the decimal digit gof BM equal to 1; 16 Set b=b0(see Remark 6.17); 17 if GM 6= 0.1111... and BM 6= 0.1111... then 18 Go to Step 5; 19 else 20 Return M; 47 Infinite algorithmic geometry 7. Conclusions This project had two main objectives: (i) present a framework to explore the capacity of study and solvability of problems with infinite input and (ii) present algorithms inside that framework that can solve some problems. This study has focused on classical geometrical problems and the new questions that emerge from the infiniteness of the input. In Section 2an introduction to ordinal numbers and their basic operations has been made. This allows the understanding of infinite ordered sets which are fundamental for an effective algorithmic approach. In Section 3we have presented the structure of the whole framework. A presentation of the ITBSS machines has been done presenting definitions of program and computation. Several approachable examples of computation were shown. Some known properties of the model have been presented. Finally, a discussion on the capacity of the machine was made, showing codification and decodification algorithms. Section 4studied a proper problem of infinite inputs, the accumulation points problem. We have analysed accumulation points, presenting the mass center of a countable set and how it relates to the accumulation points. This study concluded with the presentation and proof of new algorithms to find and identify accumulation points on the real plane. These results are limited to finite sets of accumulation points, an interesting questions could be how to approach more general sets of accumulation points, or how to decide if the number of accumulation points is finite. Section 5studied the classical problem of convex hull computation of a set of points. Several known properties were stated, rational hyperplanes were presented and with the combination of diverse new algorithms a final program to compute closure of convex hulls was presented. Section 6, which focuses on matching problems, showed some differences between the finite and infinite instance of some matching problems. It ends with the presentation of a result in [3] proving the capacity to make a stable matching under reasonable conditions on the input. The nature of this project leaves many open questions. The extension of many other geometric problems to the infinite model could represent an interesting topic in several future projects. The study of Voronoi diagrams in sets with accumulation points, linear programming, and many more. Another interesting question is how to further adapt the model to handle the inputs. The main questions that emerge from the topics studied in this thesis are about generalizations of the search of accumulation points, a promising method is using subdivisions of the space and progressively refine them. The use of subdivision also presents an interesting question in how to handle the information created by algorithms. In the particular case of convex hull, the use of rational hyperplanes allowed us to store them inside only one register using the methods presented in Section 3. The matching problem presents many questions. When does a non-crossing perfect matching exist? And a (B,R)-matching? All questions represent an interesting continuation of this project. Another interesting line of research would be to study the complexity classes of these algorithms. There are two main options. The number of steps, which is upper bounded by Theorem 3.16, could be a natural extension to the classical classes. On the other hand, an interesting approach would be the one derived from analytic set theory. In the Descriptive set theory there exists a hierarchy of sets, which classifies the sets depending in how ”complicated” they are. This approach can be seen in [3] (Corollary 2.3). For more information [14] and [18] are good references. All together we have presented a different framework to confront countable infinite input problems and several results concerning the different topics studied. 48 8. Bibliography References [1] Lenore Blum, M. Shub, and Steve Smale. “On a Theory of Computation and Complexity over the Real Numbers: NP-Completeness, Recursive Functions and Universal Machines.” In: Bull. Amer. Math. Soc. 21 (July 1989), pp. 1–46. doi:10.1090/S0273-0979-1989-15750-9. [2] G. Cantor. “Ein Beitrag zur Mannigfaltigkeitslehre.” In: Journal f¨ur die reine und angewandte Mathematik 84 (1877), pp. 242–258. url:http://eudml.org/doc/148353. [3] Douglas Cenzer and Jeffrey B. Remmel. “Proof-theoretic strength of the stable marriage theorem and other problems”. In: Reverse Mathematics 2001. Ed. by Stephen G.Editor Simpson. Lecture Notes in Logic. Cambridge University Press, 2005, 67–103. doi:10.1017/9781316755846.005. [4] T. M. Chan. “Optimal output-sensitive convex hull algorithms in two and three dimensions”. In: Discrete & Computational Geometry 16.4 (1996), pp. 361–368. doi:10.1007/bf02712873.url: https://doi.org/10.1007%2Fbf02712873. [5] Bernard Chazelle. “An optimal convex hull algorithm in any fixed dimension”. In: Discrete & Computational Geometry 10.4 (1993), pp. 377–409. doi:10.1007/bf02573985.url:https://doi. org/10.1007%2Fbf02573985. [6] Stephen A. Cook and Robert A. Reckhow. “Time bounded random access machines”. In: Journal of Computer and System Sciences 7.4 (1973), pp. 354–375. doi:10.1016/s0022-0000(73)80029-7. url:https://doi.org/10.1016%2Fs0022-0000%2873%2980029-7. [7] Oscar Cunningham. A better representation for real numbers.https://oscarcunningham.com/ 494/a-better-representation-for-real-numbers/. [8] Patrick Fitzpatrick. Advanced calculus. Belmont, CA: Thomson Brooks/Cole, 2006. isbn: 9780534376031. [9] D. Gale and L. S. Shapley. “College Admissions and the Stability of Marriage”. In: The American Mathematical Monthly 69.1 (1962), pp. 9–15. issn: 00029890, 19300972. url:http : / / www . jstor.org/stable/2312726. [10] Derek Goldrei. Classic set theory : a guided independent study. Chapman & Hall, 1996. isbn: 978- 0412606106. [11] Joel David Hamkins and Andy Lewis. “Infinite Time Turing machines”. In: Journal of Symbolic Logic 65.2 (2000), 567–604. doi:10.2307/2586556. [12] A. O. Ivanov and A. A. Tuzhilin. Minimal Spanning Trees on Infinite Sets. 2014. arXiv: 1403.3831 [math.MG].url:https://arxiv.org/abs/0811.1525. [13] Thomas Jech. Set theory. Berlin New York: Springer, 2003. isbn: 978-3-540-44761-0. [14] Alexander Kechris. Classical Descriptive Set Theory. New York, NY: Springer New York, 1995. isbn: 978-1-4612-4190-4. [15] Peter Koepke and Benjamin Seyfferth. “Towards a Theory of Infinite Time Blum-Shub-Smale Machines”. In: How the World Computes. Ed. by S. Barry Cooper, Anuj Dawar, and Benedikt L¨owe. Berlin, Heidelberg: Springer Berlin Heidelberg, 2012, pp. 405–415. isbn: 978-3-642-30870-3. [16] I. E. Leonard. Geometry of Convex Sets. City: Wiley, 2015. isbn: 978-1119022664. 49 Infinite algorithmic geometry [17] Valeriu Soltan. Lectures on convex sets. World Scientific, 2015. isbn: 978-9814656689. [18] S. M. Srivastava. A course on Borel sets. New York: Springer, 1998. isbn: 978-0-387-22767-2. [19] Josef Stoer. Convexity and Optimization in Finite Dimensions I. Berlin, Heidelberg: Springer Berlin Heidelberg, 1970. isbn: 978-3-642-46216-0. [20] William Terrell. A passage to modern analysis. American Mathematical Society, 2019. isbn: 978-1- 4704-5135-6. [21] Godfried T Toussaint. “A historical note on convex hull finding algorithms”. In: Pattern Recognition Letters 3.1 (1985), pp. 21–28. doi:10.1016/0167-8655(85)90038-8.url:https://doi.org/ 10.1016%2F0167-8655%2885%2990038-8. [22] A. M. Turing. “On Computable Numbers, with an Application to the Entscheidungsproblem”. In: Proceedings of the London Mathematical Society s2-42.1 (Jan. 1937), pp. 230–265. issn: 0024- 6115. doi:10.1112/plms/s2-42.1.230. eprint: https://academic.oup.com/plms/articlepdf/s2-42/1/230/4317544/s2-42-1-230.pdf.url:https://doi.org/10.1112/plms/s2- 42.1.230. [23] Ina Voigt. Voronoi cells of discrete point sets. 2008. arXiv: 0811.1525 [math.CO]. [24] Willie Wong. Continuity of the infinitum.https://williewong.wordpress.com/2011/11/01/ continuity-of-the-infimum/. [25] G¨unter M. Ziegler. Lectures on Polytopes : Updated Seventh Printing of the First Edition. New York, NY: Springer New York, 1995. isbn: 978-1-4613-8431-1. 50 A. Density of rationals A good understanding of Rnand Qnis assumed from the reader, nonetheless, since the density of rationals is used in several proofs, this section states some basic properties derived from the Arquimedean property. The main reference is [20]. Definition A.1 ([20]).(The Archimedean property) For any real x>0 exists n∈N>0such that 0<1 n<x. Proposition A.2 ([20]).For any real a, the interval (a,a+ 1] contain an integer. Proof. Assume a>0 and let S={n∈N|n>a}, the Archimedean property implies that there is t∈N such that 1 t<1 awhich implies t>a. Then Sis non-empty. Now consider the minimum element m of S. If m>a+ 1, then m−1>aand m−1∈Swhich contradicts minimality of m. We conclude a<m≤a+ 1. The rationals Q, seen as a subset of reals R, are dense in the following sense. Proposition A.3 ([20]).(Density of rationals in R) For any a,b∈Rwith a <b there is a rational q such that a <q<b. Proof. The Archimedean property applied to b−a>0 implies the existence of n∈Nsuch that 0<1 n<b−a which implies na + 1 <nb . From Proposition A.2 there exists an integer min (na,na + 1]. All together na <m≤na + 1 <nb which proves that m n, rational, lies between aand b. Theorem A.4. (Density of rationals in Rn) For any a ∈Rnand r ∈R>0the open ball B(a,r)contains a rational q ∈Qn. Proof. The proof is inductive. Case n= 1: it corresponds to Proposition A.3. Assume the statement holds for n−1. Let B=B(a,r) be a ball in Rn. The points inside the ball are points in Rn−1×R. The projection, π1:Rn−1×R→Rn−1 (x,y)→x is an open function, i.e., sends open sets to open sets. Let B16=∅be the image π1(B). Since B1is open, there exists r1>0 such that B(π1(a), r1)⊂B1. From induction hypothesis, there exists a rational point q1∈Qn−1B(π1(a), r1). Let P=π−1 1(q1)∩B.P is an open set because π1is continuous. We consider now the projection π2:Rn−1×R→R (x,y)→y 51 Infinite algorithmic geometry Let P2=π2(P). From being an open function P2is an open set. Using the case n= 1 we know that there exists a rational element in P2, call it q2. Now let P2=π−1 2(q2)∩P. Since the projection functions do not alter the values of the entries, all the elements in P2are in Qn. Now P2is non-empty because q2 was chosen from the set π2(P). 52 B. Auxiliar algorithms Many algorithms are used in different proofs during the text. For completeness, several are shown here. Remark B.1. When the value of the registers is set as R= (R0,R1, ...) the dots indicate that a finite number of registers are added to execute secondary computations. Algorithm 23: Exponentiation Input: (x,z)∈R×Z\{(0, 0)}. Output: xz. 1Set R= (x,z, 1, 1); 2if R1<0then 3R2=−1; 4R1=−R1; 5while R1>0do 6R3=R0·R3; 7R1=R1−1; 8if R2<0then 9Return 1 R3; 10 else 11 Return R3; Algorithm 24: Floor function Input: x∈R. Output: bxc. 1Set R= (x, 0, 1); 2if R0<0then 3R2=−1; 4R0=−R0 5while R1<R0do 6R1=R1+ 1 7if R1== R0then 8Return R1·R2 9else if R2<0then 10 Return −R1 11 else 12 Return R1−1 53