SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\{E P (x _ {1}, \dots , x _ {d - 1}, y) \mid y \in S \}.
$$
Since  $d > 2$ , we have
$$
\chi_ {d - 1, S} ^ {(3)} (\mathbf {x}) = \left(\chi_ {d - 1, S} ^ {(2)} (\mathbf {x}), \{\{\left(\chi_ {d - 1, S} ^ {(2)} (\mathbf {x} [ y / 1 ]), \ldots , \chi_ {d - 1, S} ^ {(2)} (\mathbf {x} [ y / k ])\right) \mid y \in S \} \}\right).
$$
For every  $y \in S$ , knowing  $\chi_{d-1,S}^{(2)}(\mathbf{x})$  and  $\left(\chi_{d-1,S}^{(2)}(\mathbf{x}[y/1]), \ldots, \chi_{d-1,S}^{(2)}(\mathbf{x}[y/k])\right)$ , we have to compute  $EP(x_1, \ldots, x_{d-1}, y)$ , that is, the distance matrix of  $(b, x_1, \ldots, x_{d-1}, y)$  and the distance profiles of the tuples
$$
(b, x _ {2}, \dots , x _ {d - 1}, y), \dots , (x _ {1}, \dots , x _ {d - 2}, b, y), (x _ {1}, \dots , x _ {d - 1}, b).
$$
Distance profiles can be computed by Lemma A.2. The distances amongst elements of  $\{x_{1},\ldots ,x_{d - 1},y\}$  can be computed by definition from  $\chi_{d - 1,S}^{(0)}(\mathbf{x})$  and  $\left(\chi_{d - 1,S}^{(0)}(\mathbf{x}[y / 1]),\dots ,\chi_{d - 1,S}^{(0)}(\mathbf{x}[y / k])\right)$ . Distances to  $b$  from these points can be computed by Lemma A.1 from  $\chi_{d - 1,S}^{(1)}(\mathbf{x})$  and  $\left(\chi_{d - 1,S}^{(1)}(\mathbf{x}[y / 1]),\dots ,\chi_{d - 1,S}^{(1)}(\mathbf{x}[y / k])\right)$ .
Now that we have the enhanced profiles, we have to select one for which  $(x_{1},\ldots ,x_{d})$  satisfies the cone condition. We first observe that, knowing  $EP(x_{1},\ldots ,x_{d})$ , we can reconstruct  $(b,x_{1},\ldots ,x_{d})$  up to an isometry by Lemma 4.3 (because inside  $EP(x_{1},\ldots ,x_{d})$  we are given the distance matrix of  $(b,x_{1},\ldots ,x_{d})$ ). This means that from  $EP(x_{1},\ldots ,x_{d})$  we can compute any function of  $b,x_{1},\ldots ,x_{d}$  which is invariant under isometries. In particular, we can compute AffineDim  $(b,x_{1},\ldots ,x_{d})$ . We will refer to AffineDim  $(b,x_{1},\ldots ,x_{d})$  as the dimension of the corresponding enhanced profile.
We show that AffineDim(S) is equal to the maximal dimension of an enhanced profile. Indeed, first notice that AffineDim(S) = AffineDim(\{b\}  $\cup S$ ) because  $b$  is a convex combination of points of  $S$ . In turn, AffineDim(\{b\}  $\cup S$ ) is equal to the maximal  $k$  for which one can choose  $k$  points  $x_{1},\ldots ,x_{k}\in S$  such that  $x_{1} - b,\ldots ,x_{k} - b$  are linearly independent. Obviously,  $k$  is bounded by the dimension of the space. Hence, there will be an enhanced profile with the same maximal dimension  $k$ .
If AffineDim  $(S) < d$ , any enhanced profile with maximal dimension satisfies the initialization requirement, and we are done. Assume therefore that AffineDim  $(S) = d$ . Our task is to output some  $EP(x_{1},\ldots ,x_{d})$  such that
1. AffineDim  $(b, x_1, \ldots, x_d) = d$ , and
2. there is no  $x\in S$  such that  $x - b$  belongs to the interior of  $\operatorname {Cone}(x_1 - b,\ldots ,x_d - b)$
For that, among all  $d$ -dimensional enhanced profiles, we output one which minimizes the solid angle at the origin, defined as
$$
\operatorname {A n g l e} \left(x _ {1} - b, \dots , x _ {d} - b\right) = \frac {1}{d} \operatorname {V o l} \{x \in \operatorname {C o n e} \left(x _ {1} - b, \dots , x _ {d} - b\right): \| x \| \leq 1 \} \tag {3}
$$
(the solid angle is invariant under isometries, and hence can be computed from  $EP(x_{1},\ldots ,x_{d})$ ).
We have to show that for all  $x \in S$  we have that  $x - b$  lies outside the interior of  $\operatorname{Cone}(x_1 - b, \ldots, x_d - b)$ . To prove this, we need an extra lemma. We will say that a cone  $C$  is simple if  $C = \operatorname{Cone}(u_1, \ldots, u_d)$ , for some linearly independent  $u_1, \ldots, u_d$ . Observe that if  $C = \operatorname{Cone}(u_1, \ldots, u_d)$  is a simple cone, then the interior of  $C$  is the set
$$
i n t (C) = \left\{\lambda_ {1} u _ {1} + \dots + \lambda_ {d} u _ {d} \mid \lambda_ {1}, \dots , \lambda_ {d} \in (0, + \infty) \right\}.
$$
Note also that the boundary of  $C$  consists of  $d$  faces
$$
F _ {i} = C \cap \operatorname {L i n e a r S p a n} \left(u _ {1}, \dots , u _ {i - 1}, u _ {i + 1}, \dots , u _ {d}\right), \quad i = 1, \dots , d.
$$
Lemma A.3. Let  $C = \mathrm{Cone}(\mathbf{u})\subseteq \mathbb{R}^d$  for  $\mathbf{u} = (u_{1},\dots ,u_{d})$  be a simple cone and let  $y$  belong to the interior of  $C$ . Then  $\mathrm{Cone}(\mathbf{u}[y / 1])$  is a simple cone and  $\mathrm{Angle}(\mathbf{u}[y / 1]) < \mathrm{Angle}(\mathbf{u})$ .
Proof. Since  $y$  belongs to the interior of  $\operatorname{Cone}(\mathbf{u})$ , we have that
$$
y = \lambda_ {1} u _ {1} + \dots + \lambda_ {d} u _ {d},
$$
for some  $\lambda_1 > 0, \dots, \lambda_d > 0$ . The fact that  $\lambda_1 > 0$  implies that  $y, u_2, \ldots, u_d$  are linearly independent, and hence  $\operatorname{Cone}(\mathbf{u}[y/1])$  is a simple cone. Since  $y \in \operatorname{Cone}(\mathbf{u})$ , we have that  $\operatorname{Cone}(\mathbf{u}[y/1]) \subseteq \operatorname{Cone}(\mathbf{u})$ . Thus, to show that  $\operatorname{Angle}(\mathbf{u}[y/1]) < \operatorname{Angle}(\mathbf{u})$ , it suffices to show that the volume of
$$
\{x \in \operatorname {C o n e} (\mathbf {u}): \| x \| \leq 1 \} \setminus \{x \in \operatorname {C o n e} (\mathbf {u} [ y / 1 ]): \| x \| \leq 1 \}
$$
is positive. We claim that for any point  $x = \mu_1 u_1 + \ldots + \mu_d u_d \in \mathrm{Cone}(\mathbf{u}[y/1])$  we have  $\mu_1 > 0 \Rightarrow \mu_2 / \mu_1 \geq \lambda_2 / \lambda_1$ . This is because  $x$  can be written as a non-negative linear combination of  $y, u_2, \ldots, u_d$ . Since  $\mu_1 > 0$ , the coefficient in front of  $y$  in this linear combination must be positive. Now, if the coefficient in front of  $u_2$  is 0, then the ratio between  $\mu_2$  and  $\mu_1$  is exactly as the ratio between  $\lambda_2$  and  $\lambda_1$ , and if the coefficient before  $u_2$  is positive,  $\mu_2$  can only increase.
This means that no point of the form
$$
x = \mu_ {1} u _ {1} + \dots + \mu_ {d} u _ {d}, \quad 0 <   \mu_ {1}, \mu_ {2} / \mu_ {1} <   \lambda_ {2} / \lambda_ {1} \tag {4}
$$
belongs to  $\operatorname{Cone}(\mathbf{u}[y/1])$ . It remains to show that the set of points that satisfy (4) and lie in  $\{x \in \operatorname{Cone}(\mathbf{u}) : \| x \| \leq 1\}$  has positive volume.
Indeed, for any  $\varepsilon > 0$  and  $\delta > 0$ , consider a  $d$ -dimensional parallelepiped:
$$
P = \left\{\mu_ {1} x _ {1} + \dots + \mu_ {d} x _ {d} \mid \mu_ {1} \in [ \varepsilon / 2, \varepsilon ], \mu_ {2}, \dots , \mu_ {d} \in [ \delta / 2, \delta ] \right\}.
$$
Regardless of  $\varepsilon$  and  $\delta$ , we have that  $P$  is a subset of  $\operatorname{Cone}(\mathbf{u})$  and its volume is positive. For all sufficiently small  $\varepsilon, \delta$ , we have that  $P$  is a subset of the unit ball  $\{x \in \mathbb{R}^d \mid \|x\| \leq 1\}$ . In turn, by choosing  $\varepsilon$  to be sufficiently big compared to  $\delta$ , we ensure that all points of  $P$  satisfy (4).
Now we can finish the proof of Proposition 4.2. Let  $\mathbf{x} \in S^d$  minimize  $\mathrm{Angle}(x_1 - b, \ldots, x_d - b)$  amongst  $\mathbf{x} \in S^d$  such that AffineDim  $(b, x_1, \ldots, x_d) = d$ . Assume that  $\mathbf{x}$  does not satisfy the cone condition, and let  $x \in S$  be such that  $x - b \in Int(\mathrm{Cone}(x_1 - b, \ldots, x_d - b))$  holds. Then, by Lemma A.3,  $\mathrm{Angle}(x - b, x_2 - b, \ldots, x_d - b)$  is strictly smaller than  $\mathrm{Angle}(x_1 - b, x_2 - b, \ldots, x_d - b)$ . As  $\mathrm{Cone}(x - b, x_2 - b, \ldots, x_d - b)$  is a simple cone,  $x - b, x_2 - b, \ldots, x_d - b$  are linearly independent, and thus AffineDim  $(b, x, x_2, \ldots, x_d) = d$ , contradicting the minimality hypothesis on  $\mathbf{x}$ , as desired.
A.2 Proofs for Reconstruction
Proof of Lemma 4.4. We claim that for every  $i = 2, \ldots, m$  we have  $\langle a - x_1, x_i - x_1 \rangle = \langle b - x_1, x_i - x_1 \rangle$ . This is because  $a - x_1$  and  $b - x_1$  have the same distance to  $x_i - x_1$  (which is equal to  $d(a, x_i) = d(b, x_i)$ ) and, moreover, the norms of  $a - x_1$  and  $b - x_1$  coincide (and are equal to  $d(a, x_1) = d(b, x_1)$ ). Hence, both  $a - x_1$  and  $b - x_1$  are solutions to the following linear system of equations:
$$
\langle x, x _ {i} - x _ {1} \rangle = \langle a - x _ {1}, x _ {i} - x _ {1} \rangle , \quad i = 2, \dots , m.
$$
This system has at most 1 solution over  $x \in \operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$ . Moreover,  $a - x_1$  and  $b - x_1$  are both from LinearSpan  $(x_2 - x_1, \ldots, x_m - x_1)$  because  $a, b \in \operatorname{AffineSpan}(x_1, \ldots, x_m)$ . Hence,  $a - x_1 = b - x_1$ , and  $a = b$ .
Proof of Proposition 4.5. Let  $P_{i} = \operatorname{AffineSpan}(z_{1},\ldots ,z_{i - 1},0,z_{i + 1},\ldots ,z_{d})$ . As the following lemma shows, knowing the distances from  $s\in T$  to  $z_{1},\dots ,z_{i - 1},0,z_{i + 1},z_{d}$ , we can determine the position of  $s$  uniquely up to the reflection through  $P_{i}$ .
Lemma A.4 (The Symmetric Lemma). Let  $x_1, \ldots, x_m \in \mathbb{R}^d$  be such that AffineSpan  $(x_1, \ldots, x_m)$  has dimension  $d - 1$ . Assume that  $a, b \in \mathbb{R}^d$  are such that  $d(a, x_i) = d(b, x_i)$  for all  $i = 1, \ldots, m$ . Then either  $a = b$  or  $a$  and  $b$  are symmetric w.r.t. AffineSpan  $(x_1, \ldots, x_m)$ .
Proof. As in the proof of Lemma 4.4, we have that  $\langle a - x_1, x_i - x_1 \rangle = \langle b - x_1, x_i - x_1 \rangle$  for every  $i = 2, \ldots, m$ . Consider orthogonal projections of  $a - x_1$  and  $b - x_1$  to  $\operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$ . Both these projections are solutions to the system
This system has at most one solution over  $x \in \operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$ . Hence, projections of  $a - x_1$  and  $b - x_1$  coincide. We also have that  $\| a - x_1 \| = \| b - x_1 \|$ , which implies that  $a - x_1$  and  $b - x_1$  have the same distance to  $\operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$ . Since the dimension of  $\operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$  is  $d - 1$ , we get that either  $a - x_1 = b - x_1$  or they can be obtained from each other by the reflection through  $\operatorname{LinearSpan}(x_2 - x_1, \ldots, x_m - x_1)$ . After translating everything by  $x_1$ , we obtain the claim of the lemma.
In fact, if  $s$  belongs to  $P_{i}$ , then there is just one possibility for  $s$ . Thus, we can restore all the points in  $T$  that belong to the union  $\bigcup_{i=1}^{d} P_{i}$ . Let us remove these points from  $T$  and update distance profiles by deleting the tuples of distances that correspond to the points that we have removed.
From now on, we may assume that  $T$  is disjoint from  $\bigcup_{i=1}^{d} P_i$ . Hence,  $T$  is also disjoint from the boundary of  $C = \operatorname{Cone}(x_1, \ldots, x_d)$ , not only from its interior (every face of this cone lies on  $P_i$  for some  $i$ ).
For  $x \in \mathbb{R}^d$ , we define  $\rho(x) = \min_{i=1,\dots,d} \mathrm{dist}(x, P_i)$ . Since  $T$  is disjoint from  $\bigcup_{i=1}^{d} P_i$ , we have that  $\rho(s) > 0$  for every  $s \in T$ . Moreover, from, say, the distance profile of  $(0, z_2, \ldots, z_d)$ , we can compute some  $\varepsilon > 0$  such that  $\rho(s) \geq \varepsilon$  for all  $s \in T$ . Indeed, recall that from the distance profile of  $(0, z_2, \ldots, z_d)$ , we get at most 2 potential positions for each point of  $T$ . This gives us a finite set  $T'$  (at most 2 times larger than  $T$ ) which is a superset of  $T$ . Moreover, as  $T$  is disjoint from  $\bigcup_{i=1}^{d} P_i$ , we have that  $T' \setminus \bigcup_{i=1}^{d} P_i \supseteq T$ . Thus, we can define  $\varepsilon$  as the minimum of  $\rho(x)$  over  $T' \setminus \bigcup_{i=1}^{d} P_i \supseteq T$ .
We conclude that  $T$  is disjoint from
$$
A _ {0} = C \cup \{x \in \mathbb {R} ^ {d} \mid \rho (x) <   \varepsilon \}
$$
(moreover, the set  $A_0$  is known to us).
Our reconstruction procedure starts as follows. We go through all distance profiles, and through all tuples of distances in them. Each tuple gives 2 candidates for a point in  $T$  (that can be obtained from each other by the reflection through  $P_i$ ). If one of the candidates lies in  $A_0$ , we know that we should take the other candidate. In this way, we may possibly uniquely determine some points in  $T$ . If so, we remove them from  $T$  and update our distance profiles.
Which points of  $T$  will be found in this way? Those that, for some  $i$ , fall into  $A_0$  under the reflection through  $P_i$ . Indeed, these are precisely the points that give 2 candidates (when we go through the  $i$ th distance profile) one of which is in  $A_0$ . In other words, we will determine all the points that lie in  $\bigcup_{i=1}^{d} \operatorname{Refl}_i(A_0)$ , where  $\operatorname{Refl}_i$  denotes the reflection through  $P_i$ . After we remove these points, we know that the remaining  $T$  is disjoint from  $A_1 = A_0 \cup \bigcup_{i=1}^{d} \operatorname{Refl}_i(A_0)$ .
We then continue in exactly the same way, but with  $A_{1}$  instead of  $A_0$ , and then with  $A_{2} = A_{1}\cup \bigcup_{i = 1}^{d}\operatorname{Refl}_{i}(A_{1})$ , and so on. It remains to show that all the points of  $T$  will be recovered in this way. In other words, we have to argue that each point of  $T$  belongs to some  $A_{i}$ , where
$$
A _ {0} = C \cup \{x \in \mathbb {R} ^ {d} \mid \rho (x) <   \varepsilon \}, \quad A _ {i + 1} = A _ {i} \cup \bigcup_ {i = 1} ^ {d} \operatorname {R e f l} _ {i} (A _ {i}).
$$
We will show this not only for points in  $T$  but for all points in  $\mathbb{R}^d$ . Equivalently, we have to show that for every  $x \in \mathbb{R}^d$  there exists a finite sequence of reflections  $\tau_1, \ldots, \tau_k \in \{\mathrm{Refl}_1, \ldots, \mathrm{Refl}_d\}$  which brings  $x$  inside  $A_0$ , that is,  $\tau_k \circ \ldots \circ \tau_1(x) \in A_0$ .
We construct this sequence of reflections as follows. Let  $x$  be outside  $A_0$ . In particular,  $x$  is outside the cone  $C = \operatorname{Cone}(z_1, \ldots, z_d)$ . Then there exists a face of this cone such that  $C$  is from one side of this face and  $x$  is from the other side. Assume that this face belongs to the hyperplane  $P_i$ . We then reflect  $x$  through  $P_i$ , and repeat this operation until we get inside  $A_0$ . We next show that the above process stops within a finite number of steps. For that, we introduce the quantity  $\gamma(x) = \langle x, z_1 \rangle + \ldots + \langle x, z_d \rangle$ . We claim that with each step,  $\gamma(x)$  increases by at least  $c \cdot \varepsilon$ , where
$$
c = 2\min_{1\leq i\leq d}\mathsf{dist}(z_{i},P_{i}).
$$
Note that  $c > 0$  because, for every  $i = 1, \dots, d$ , we have that  $z_i \notin P_i$ , by the linear independency of  $z_1, \dots, z_d$ . Also observe that  $\gamma(x) \leq |x| \sum_{i} |z_i|$  and reflections across the subspaces  $P_i$  do not change  $|x|$ . Hence,  $\gamma(x)$  cannot increase infinitely many times by some fixed positive amount.
It remains to show that  $\gamma(x)$  increases by at least  $c \cdot \varepsilon$  at each step, as claimed. Note that reflection of  $x$  across some  $P_i$  does not change the scalar product of  $x$  with those vectors among  $z_1, \ldots, z_d$  that belong to  $P_i$ . The only scalar product that changes is  $\langle x, z_i \rangle$ , and the only direction which contributes to the change is the one orthogonal to  $P_i$ . Before the reflection, the contribution of this direction to the scalar product was  $-d(x, P_i) \cdot d(z_i, P_i)$  (remember that  $x$  and  $z_i$  were from different sides of  $P_i$  because  $z_i \in C$ ). After the reflection, the contribution is the same, but with a positive sign. Thus, the scalar product increases by  $2d(x, P_i) \cdot d(z_i, P_i)$ . Now, we have  $d(z_i, P_i) \geq c/2$  by definition of  $c$  and  $d(x, P_i) \geq \varepsilon$  if  $x$  is not yet in  $A_0$ .
B Proofs for Theorem 5.1
Proof of Theorem 5.1. From  $\chi_{d,S}^{(1)}(\mathbf{s})$ , we can determine the tuple  $\mathbf{s} = (s_1, \ldots, s_d)$  up to an isometry, since  $\chi_{d,S}^{(1)}(\mathbf{s})$  gives us  $\chi_{d,S}^{(0)}(\mathbf{s})$ , which is the distance matrix of  $\mathbf{s}$ . In order to determine  $S$ , we consider two cases:
Case 1: For all  $\mathbf{s} \in S^d$  it holds AffineDim  $(\mathbf{s}) < d - 1$ . Then take  $\chi_{d,S}^{(1)}(\mathbf{s})$  with maximal AffineDim  $(\mathbf{s})$ , and fix locations of points from  $\mathbf{s}$  compatible with the distance specification, according to Lemma 4.3. All points of  $S$  belong to AffineSpan  $(\mathbf{s})$ , otherwise we could increase AffineDim  $(\mathbf{s})$ . Indeed, since AffineDim  $(\mathbf{s}) < d - 1$ , we could throw away one of the points from the tuple without decreasing the dimension and replace it with a point outside AffineSpan  $(\mathbf{s})$ . We now can reconstruct the rest of  $S$  uniquely up to an isometry. Indeed, in  $\chi_{d,S}^{(1)}(\mathbf{s})$  we are given the multiset of  $d$ -tuples of distances to  $\mathbf{s} = (s_1, \ldots, s_d)$  from the points of  $S$ , and it remains to use Lemma 4.4.
Case 2: There are tuples with AffineSpan(s) =  $d - 1$ . We first observe that from the multiset  $\{\{\chi_{d,S}^{(0)}(\mathbf{s}) \mid \mathbf{s} \in S^d\}\}$  we can compute the pairwise sum of distances between the points in  $S$ , i.e.,
$$
D _ {S} = \sum_ {x \in S} \sum_ {y \in S} d (x, y).
$$
Indeed, from  $\chi_{d,S}^{(0)}((s_1,\ldots ,s_d))$ , we determine  $d(s_{1},s_{2})$ . Hence, we can compute the sum:
$$
\sum_ {(s _ {1}, \ldots , s _ {d}) \in S ^ {d}} d (s _ {1}, s _ {2}) = D _ {S} \cdot | S | ^ {d - 2}.
$$
In our reconstruction of  $S$ , we go through all  $\chi_{d,S}^{(1)}(\mathbf{s})$  with AffineDim  $(\mathbf{s}) = d - 1$ . For each of them, we fix positions of the points of the tuple  $\mathbf{s}$  in any way that agrees with the distance matrix of this tuple. As before,  $\chi_{d,S}^{(1)}(\mathbf{s})$  gives us the multiset of  $d$ -tuples of distances to  $\mathbf{s}$  from the points of  $S$ . We call "candidates for  $S$  given  $\mathbf{s}$ " the set of point clouds  $S'$  which have one point associated with each such  $d$ -tuple of distances, and realizing these distances to points in  $\mathbf{s}$ . We aim to find  $\mathbf{s}$  for which, exactly one of these candidates can be isometric to  $S$ . We start with the following lemma:
Lemma B.1. For any finite set  $S \subseteq \mathbb{R}^d$  with AffineDim(S)  $\geq d - 1$  there exist  $x_1, \ldots, x_d \in S$  with AffineDim  $(x_1, \ldots, x_d) = d - 1$  such that all points of  $S$  belong to the same half-space with respect to the hyperplane AffineSpan  $(x_1, \ldots, x_d)$ .
Proof. The general idea of the proof is the following. If AffineDim  $(S) = d - 1$  then the extreme points of the convex hull of  $S$  contain an affinely independent set of cardinality  $d$ , which then gives the desired s. The half-space condition in the lemma is automatically verified in this case. If AffineDim  $(S) = d$  then to find s we can proceed by moving a  $(d - 1)$ -plane from infinity towards  $S$  until it touches  $S$  in at least one point, then iteratively we rotate the plane around the subspace containing the already touched points of  $S$ , until a new point in  $S$  prohibits to continue that rotation. We stop within at most  $d$  iterations, when no further rotation is allowed, in which case the plane has an affinely independent subset in common with  $S$ .
Formally, we need to find a hyperplane  $H$  such that, first, all points of  $S$  belong to the same half-space w.r.t.  $H$ , and second, AffineDim  $(H \cap S) = d - 1$ .
To start, we need to find a hyperplane  $H$  such that, first, all points of  $S$  belong to the same half-space w.r.t.  $H$ , and second,  $H \cap S \neq \emptyset$ . For instance, take any non-zero vector  $\alpha \in \mathbb{R}^d$ , consider  $m = \max_{x \in S} \langle \alpha, x \rangle$  and define  $H$  by the equation  $\langle \alpha, x \rangle = m$ . Now, take any  $x_1 \in H \cap S$ . After translating  $S$  by  $-x_1$ , we may assume that  $x_1 = 0$ .
Now, among all hyperplanes  $H$  that contain  $x_{1} = 0$  and satisfy the condition that all points of  $S$  lie in the same half-space w.r.t.  $H$ , we take one that contains most points of  $S$ . We claim that AffineDim  $(H \cap S) = d - 1$  for this  $H$ . Assume for contradiction that AffineDim  $(H \cap S) < d - 1$ . Define  $U = \operatorname{AffineSpan}(H \cap S)$ . Since  $H \cap S$  contains  $x_{1} = 0$ , we have that  $U \subseteq H$  is a linear subspace, and its dimension is less than  $d - 1$ . Hence, since AffineDim  $(S) \geq d - 1$ , there exists  $x_{2} \in S \setminus U$ . Note that  $x_{2} \notin H$  because otherwise  $x_{2}$  belongs to  $H \cap S \subseteq U$ .
Let  $\alpha$  be the normal vector to  $H$ . Since all points of  $S$  lie in the same half-space w.r.t.  $H$ , w.l.o.g. we may assume that  $\langle \alpha, s \rangle \geq 0$  for all  $s \in S$ . In particular,  $\langle \alpha, x_2 \rangle > 0$  because  $x_2 \notin H$ .
Let  $U^{\perp}$  denote the orthogonal complement to  $U$ . Since  $\alpha$  is the normal vector to  $H \supseteq U$ , we have that  $\alpha \in U^{\perp}$ . We need to find some  $\beta \in U^{\perp}$  which is not a multiple of  $\alpha$  but satisfies  $\langle \beta, x_2 \rangle > 0$ . Indeed, the dimension of  $U$  is at most  $d - 2$ , and hence the dimension of  $U^{\perp}$  is at least 2. Now, since  $\langle \alpha, x_2 \rangle > 0$ , we can take any  $\beta \in U^{\perp}$  which is sufficiently close to  $\alpha$ .
For any  $\lambda \geq 0$ , let  $H_{\lambda}$  be the hyperplane, defined by  $\langle \alpha - \lambda \beta, x \rangle = 0$  (this is a hyperplane and not the whole space because  $\beta$  is not a multiple of  $\alpha$ ). We claim that for some  $\lambda > 0$ , we have that  $H_{\lambda}$  has more points of  $S$  than  $H$  while still all points of  $S$  lie in the same half-space w.r.t.  $H_{\lambda}$ . This would be a contradiction.
Indeed, define  $S_{\beta} = \{s \in S \mid \langle s, \beta \rangle > 0\}$ . Note that  $S_{\beta}$ , by definition of  $\beta$ , contains  $x_{2}$  and hence is non-empty. Moreover,  $S_{\beta}$  is disjoint from  $H \cap S$ . This is because  $H \cap S \subseteq U$  and  $\beta \in U^{\perp}$ .
$$
\lambda = \min  _ {s \in S _ {\beta}} \frac {\langle \alpha , s \rangle}{\langle \beta , s \rangle}
$$
First,  $H_{\lambda} \supseteq U \supseteq H \cap S$  because  $\alpha - \lambda \beta \in U^{\perp}$ . Moreover,  $H_{\lambda}$  contains at least one point of  $S$  which is not in  $H$ . Namely, it  $H_{\lambda}$  contains any  $s \in S_{\beta}$ , establishing the minimum in the definition of  $\lambda$  (and recall that  $S_{\beta}$  is disjoint from  $H \cap S$ ). Indeed, for this  $s$  we have  $\lambda = \frac{\langle \alpha, s \rangle}{\langle \beta, s \rangle}$ . Hence,  $\langle \alpha, s \rangle - \lambda \langle \beta, s \rangle = 0 = \langle \alpha - \lambda b, s \rangle \Rightarrow s \in H_{\lambda}$ .
It remains to show that all points of  $S$  lie in the same half-space w.r.t.  $H_{\lambda}$ . More specifically, we will show that  $\langle \alpha - \lambda \beta, s \rangle \geq 0$  for all  $s \in S$ . First, assume that  $\langle s, \beta \rangle = 0$ . Then  $\langle \alpha - \lambda \beta, s \rangle = \langle \alpha, s \rangle \geq 0$  because all points of  $S$  lie in the "non-negative" half-space w.r.t.  $\alpha$ . Second, assume that  $\langle s, \beta \rangle > 0$ . Then  $s \in S_{\beta}$ . Hence, by definition of  $\lambda$ , we have  $\lambda \leq \frac{\langle \alpha, s \rangle}{\langle \beta, s \rangle}$ . This means that  $\langle \alpha - \lambda \beta, s \rangle = \langle \alpha, s \rangle - \lambda \langle \beta, s \rangle \geq 0$ , as required.
Next, consider the following simple geometric observation: