F - Origami Warp 解説
by
Rice_tawara459
We will refer to something that is not reachable as “unreachable.” Additionally, for two points \(X\) and \(Y\), let \(XY\) denote the distance between \(X\) and \(Y\).
As a premise, the relationship “reachable” is considered an equivalence relation. Specifically, it satisfies the following properties:
- Reflexivity: \(P\) is reachable from \(P\).
- Symmetry: \(P\) is reachable from \(Q\) if and only if \(Q\) is reachable from \(P\).
- Transiticity: If \(Q\) is reachable form \(P\) and \(R\) is reachable from \(Q\), then \(R\) is reachable from \(R\).
The proof is as follows.
Proof
Since reflexivity is trivial, we will prove symmetry and transitivity.
Let us first confirm the following fact:
- Consider a sequence of lines \( (L_1, L_2, \ldots, L_n) \). When Alice is at \( X \), let \( X' \) be the destination reached by using \( L_1, \ldots, L_n \) in order. Similarly, when Alice is at \( Y \), let \( Y' \) be the destination reached by using \( L_1, \ldots, L_n \) in order. Then, \( XY = X'Y' \) holds.
This fact can be proved by mathematical induction on the number of operations. Using this fact, we proceed with the proof.
First, we prove symmetry. Assume \( Q \) is reachable from \( P \). Take any real number \( \varepsilon > 0 \). By the reachability of \( Q \) from \( P \), there exists a sequence of lines \( (L_1, \ldots, L_n) \) such that when Alice is at \( P \) and uses \( L_1, \ldots, L_n \) in order, the destination \( P' \) satisfies \( P'Q < \varepsilon \). Here, when Alice is at \( P' \) and uses \( L_n, L_{n-1}, \ldots, L_1 \) in order, her destination is \( P \). Given \( P'Q < \varepsilon \), let \( Q' \) be the destination when Alice starts at \( Q \) and uses \( L_n, L_{n-1}, \ldots, L_1 \) in order. Then \( P'Q = PQ' < \varepsilon \). Thus, \( P \) is reachable from \( Q \), proving symmetry.
Next, we prove transitivity. Assume \( Q \) is reachable from \( P \) and \( R \) is reachable from \( Q \). Take any real number \( \varepsilon > 0 \). By the reachability of \( Q \) from \( P \), there exists a sequence of lines \( (L_1, \ldots, L_n) \) such that when Alice is at \( P \) and uses \( L_1, \ldots, L_n \) in order, the destination \( P' \) satisfies \( P'Q < \frac{\varepsilon}{2} \). Similarly, by the reachability of \( R \) from \( Q \), there exists a sequence of lines \( (K_1, \ldots, K_m) \) such that when Alice is at \( Q \) and uses \( K_1, \ldots, K_m \) in order, the destination \( Q' \) satisfies \( Q'R < \frac{\varepsilon}{2} \). Since \( P'Q < \frac{\varepsilon}{2} \), when Alice is at \( P' \) and uses \( K_1, \ldots, K_m \) in order, the destination \( P'' \) satisfies
\( P''R \leq P''Q' + Q'R = P'Q + Q'R < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon. \)
Here, \( P'' \) is the destination Alice reaches when starting at \( P \) and using \( L_1, \ldots, L_n, K_1, \ldots, K_m \) in order. Therefore, \( P \) is reachable from \( R \), proving transitivity.
We define a good intersection as the intersection point \( O \) of two lines \( L_1 \) and \( L_2 \) such that the angle between \( L_1 \) and \( L_2 \) is not a multiple of \( \frac{\pi}{4} \). Additionally, we refer to \( L_1 \) and \( L_2 \) as the lines that constitute \( O \). Let us first observe the properties of these good intersections.
Properties of a Good Intersection
Suppose a good intersection \( O \) exists. Then, \( T \) is reachable from \( S \) by using the two lines that constitute \( O \) if and only if two points \( S \) and \( T \) lie on the same circle centered at \( O \).
Proof
We may assume \( O \) is the origin.
Let the angle of inclination of the first line be \( \alpha \) and that of the second line be \( \beta \). Let Alice’s current position be \( X \).
First, note that regardless of how the two lines are used, the value of \( OX \) does not change. Hence, if \( OS \neq OT \), that is, if \( S \) and \( T \) do not lie on the same circle centered at \( O \), it is impossible to reach \( T \) from \( S \).
Now, consider movement along the circle centered at \( O \) passing through \( S \). Denote the angular coordinate of \( X \) as \( x \), and examine how \( x \) changes due to movement. A movement by the first line results in \( x \mapsto 2\alpha - x \), and a movement by the second line results in \( x \mapsto 2\beta - x \). Thus, by using the first line followed by the second, \( x \mapsto x + 2(\beta - \alpha) \) is achieved. Similarly, by using the second line followed by the first, \( x \mapsto x - 2(\beta - \alpha) \) is achieved. Repeating this process allows movement to any point with angular coordinate \( x + 2n (\beta - \alpha) \mod 2\pi \), for any integer \( n \).
When \( \frac{\beta - \alpha}{\pi} \) is irrational, these reachable points densely “fill” the circle. This result can be shown using Diophantine approximation. (For reference: Wikipedia - Diophantine Approximation).
We now prove by contradiction that \( \frac{\beta - \alpha}{\pi} \) cannot be rational. Suppose \( \frac{\beta - \alpha}{\pi} \) is rational. In this problem, the lines are defined as those passing through two lattice points, and \( O \) is a good intersection, meaning \( \beta - \alpha = \pm\frac{\pi}{2} \) does not hold. Hence, \( \tan(\beta - \alpha) \) is rational. By a corollary of Niven’s theorem, if \( \tan(\beta - \alpha) \) is rational, \( \frac{\beta - \alpha}{\pi} \) can only be rational when \( \beta - \alpha = 0, \pm\frac{\pi}{4}, \pm\frac{3\pi}{4} \). (For reference: [Wikipedia - Niven’s Theorem](https://en.wikipedia.org/wiki/Niven’s_theorem)). However, these are all multiples of \( \frac{\pi}{4} \), which contradicts \( O \) being a good intersection. Therefore, \( \frac{\beta - \alpha}{\pi} \) must be irrational at a good intersection.
From the above, it follows that if two points \( S \) and \( T \) lie on the same circle centered at \( O \), \( T \) is reachable from \( S \).
From the above fact and the transitivity of reachability, we can conclude that allowing the operation of “moving continuously along the same circle centered at a good intersection” in addition to the operation of “moving to the position symmetric with respect to a line” does not change the result of whether a point is reachable.
Case: Two or More Good Intersections Exist
If there exists at least one line whose angle of inclination is not a multiple of \(\frac{\pi}{4}\), and at least one line that does not pass through the origin, then there are at least two good intersections. In this case, any two points are reachable.
Proof
Let the two good intersections be \(O_1\) and \(O_2\).
First, we will show that any point \(T\) is reachable from \(O_1\). Let \(d = O_1O_2\) and let Alice’s current position be represented by \(X\).
Initially, \(O_1X = 0\). From here, by moving along a circle centered at \(O_2\), we can achieve \(O_1X = 2d\). Next, by moving along a circle centered at \(O_1\), we can move \(X\) to the opposite side of \(O_2\) relative to \(O_1\). By repeating this process and moving along circles centered at \(O_2\), we can achieve \(O_1X = 4d\). By continuing this process, we can make \(O_1X\) arbitrarily large. Since the changes in distance can be made continuously, the value of \(O_1X\) can be set arbitrarily. Using this, we can set \(O_1X = O_1T\) and then move along a circle centered at \(O_1\) to reach \(T\). Thus, it is possible to reach \(T\) from \(O_1\).
For any two points \(S\) and \(T\), since both \(S\) and \(T\) are reachable from \(O_1\), it follows that \(S\) is reachable from \(T\) as well.
Case: Exactly One Good Intersection Exists
If there exists at least one line whose angle of inclination is not a multiple of \(\frac{\pi}{4}\), and all the lines pass through the origin, then there is exactly one good intersection at the origin, and there are no other intersections. In this case, only movements along the same circle centered at the origin are possible, and any other movement is impossible. Therefore, it suffices to check whether the distances from the origin to the two given points are equal.
Case: No Good Intersection Exists
If all the lines have angles of inclination that are multiples of \(\frac{\pi}{4}\), then there are no good intersections. In this case, if the starting point is a lattice point, the destination will always be a lattice point after a finite number of moves. Suppose \(P\) and \(Q\) are lattice points, and we assume that \(Q\) reachable from \(P\). In this case, there exists a point \(P'\) such that \(P'Q < \frac{1}{2}\), and it is possible to move from \(P\) to \(P'\) in a finite number of moves. However, since the points reachable from \(P\) in a finite number of moves are limited to lattice points, the only possible candidate for \(P'\) is \(Q\) itself. Thus, the condition “\(Q\) is reachable from \(P\)” implies that “Alice can move from \(P\) to \(Q\) in a finite number of moves.” The reverse is obviously true, so in cases where there are no good intersections, we only need to check whether movement is possible in a finite number of steps.
Let us confirm the solution to the following problem first:
Alice is on a number line. Points \(X_1, X_2, \dots, X_N\) on the number line are given. Alice can choose any of these points and move to a position symmetric to her current position relative to the chosen point. She can perform this operation as many times as she likes. Determine whether it is possible to move from a given point \(P\) to another point \(Q\).
This is essentially a one-dimensional version of the current problem, which is a well-known problem that can be solved as follows:
For \(N = 0\) or \(N = 1\), the solution is trivial. For \(N \geq 2\), consider the greatest common divisor (\(\gcd\)) of the distances between any two points (practically, it suffices to calculate \(\gcd(X_2 - X_1, X_3 - X_2, \dots, X_N - X_{N-1})\)). Let this value be \(g\). After moving \(P\) to a new position \(P'\) once, check if \(P \mod 2g\) and \(Q \mod 2g\) are equivalent, or if \(P' \mod 2g\) and \(Q \mod 2g\) are equivalent. If so, it is possible to move from \(P\) to \(Q\).
This solution shows that as long as \(X_1\) and \(g\) are determined, the possible destinations for Alice remain unchanged. Therefore, even if only two points \(X_1\) and \(X_1 + g\) are given, the result does not change. Similarly, the result remains unchanged if points \(X_1 + ng\) (\(n \in \mathbb{Z}\)) are provided.
With this solution in mind, let us return to the original problem.
When the angle of inclination of a line is \(\frac{n\pi}{4} \ (n=0,1,2,3)\), the value \(n\) is referred to as the direction of the line.
Case: No Lines with Directions \(1\) or \(3\)
In this case, vertical and horizontal movements are independent. Thus, the problem can be solved independently for each dimension as a one-dimensional problem.
Case: Lines with Directions \(1\) or \(3\) Exist
If all lines pass through the origin, the problem is straightforward to solve. We now consider the case where this is not true.
Let us confirm the following fact:
For two lines with directions \(0\) and \(1\) that intersect at a point \(O\), adding (or removing) a line with direction \(2\) that passes through \(O\) does not change the set of reachable points. The same holds for other directions.
Simple Proof
By sequentially using lines with directions \(1\), \(0\), and \(1\), movements along a line with direction \(2\) can be simulated. Therefore, adding (or removing) a line with direction \(2\) does not increase (or decrease) the set of reachable points.
Using this fact, for instance, if two lines with directions \(1\) and \(2\) intersect, we can add a line with direction \(0\) at their intersection point and remove the line with direction \(2\). This sequence of operations (without changing reachability) effectively transforms the line with direction \(2\) into one with direction \(0\). By repeatedly performing such conversions, additions, or deletions, we can create a configuration where the determination of reachability becomes simpler without changing the set of reachable points.
First, remove all lines with direction \(2\) except for the \(y\)-axis, and convert them into lines with direction \(0\) (since at least one line with direction \(1\) or \(3\) must exist, this is possible). Next, convert all lines with direction \(3\) into lines with direction \(1\). At this point, from the one-dimensional solution, we can assume that there are at most two lines with direction \(1\).
Add a line with direction \(0\) at the intersection of the lines with direction \(1\) and the \(y\)-axis. Take the \(\gcd\) of the intervals between any two lines with direction \(0\), and denote this value as \(g\) (since the line \(y=0\) exists, this is essentially the \(\gcd\) of the \(y\)-intercepts of the lines). Considering the one-dimensional solution, adding a line of the form \(y=ng\) (\(n \in \mathbb{Z}\)) will not change the set of reachable points. Additionally, adding lines of the form \(x=ng\) (\(n \in \mathbb{Z}\)) will also not change the set of reachable points (since we added lines of direction \(2\) at the intersection of the lines of direction \(1\) and direction \(0\)).
If there are two lines with direction \(1\), we change one of them to direction \(3\).
With this approach, we have changed the arrangement of the lines without altering the reachable points. The current set of edges in the plane consists of lines of the forms \(y=ng\), \(x=ng\) (\(n \in \mathbb{Z}\)), and at most one line of direction \(1\) and one line of direction \(3\). In this configuration, we can now determine the reachability.
First, let’s describe the decision method. At the start of the operation, we decide whether to use the lines with direction \(1\) and the lines with direction \(3\). There are \(2 \times 2 = 4\) possible combinations, and after performing the first move, we check if it’s possible to move using only lines with direction \(0\) and \(2\). The proof is as follows.
Proof
If it is determined to be reachable using the above method, it is clear that it is indeed reachable. Now, let’s show the reverse.
Suppose there is a sequence of operations to move from \(S\) to \(T\). In this sequence, there is a part where we perform operations using a line of direction \(0\) followed by a line of direction \(1\) (we call such an operation a \(0,1\) operation). Suppose that the intersection of these two lines is point \(O\). Since there exists a line of direction \(2\) passing through \(O\), we can use this line to change the \(0,1\) operation into a \(1,2\) operation. Similarly, we can perform the following transformations: - \(2,1\) becomes \(1,0\) - \(0,3\) becomes \(3,2\) - \(2,3\) becomes \(3,0\)
By repeating this transformation, we can bring all the operations with lines of direction \(1\) and \(3\) to the beginning of the operation sequence. Since the operations of lines with direction \(1\) and \(3\) are independent, and since there is at most one line of each direction, there is no need to perform the operation more than once for each direction. Therefore, we have shown that there exists a sequence of operations where we perform at most one operation with lines of direction \(1\) or \(3\), and the remaining operations are done with lines of direction \(0\) or \(2\). This proves that if it is possible to move from \(S\) to \(T\), it will be determined to be reachable by the above method.
Thus, we have shown that in this case, reachability can also be determined. In this explanation, we used a large number of lines to make the proof easier, but in the actual implementation, it is sufficient to only keep track of the value of \(g\). Moreover, there’s no need to transform the lines with direction \(1\) into lines with direction \(3\); we simply need to check the four possible cases based on whether to use the two lines with direction \(1\) initially.
投稿日時:
最終更新:
