N , , + > > D f f D D , N F > > M M M m + B m f m F + B , dip F > F + B f f + > + B N N B dip + dot > dab
On occasions, we'll call f outside of F. Notably, f(x) = (0, x), f(0, x) = (x, x), and
f(x, y) = (y, x + y)
, dip F >
dip F dips the first coordinate of the argument vector, while > returns the remaining coordinates. Thus, , maps (v1, ..., vn) to (|v1 - 1|, ..., vn).
In particular, , maps (x) to (|x - 1|), so we can use it instead of dip for singleton vectors.
M and m
M M m + B m f m F + B
m is always meant to be called on a pair. It simply combines a few functions we've seen before. Recall that B behaves differently if x ≤ y and if not.
We have m(x, y) = (x, y - x) if x ≤ y but m(x, y) = (x, (x - y) % 2) otherwise.
M is always meant to be called on a pair, whose first coordinate will be non-zero. M attempts to recursively call itself on the result of m. Since m doesn't change the first coordinate of its argument, we only need to examine the second one.
On the second line, B(m(f(x, y))) = B(m(y, x + y)) = B(y, x). After + takes the sum, we get x - y if x ≥ y, but (y - x) % 2 otherwise.
If y = qx, M(x, y) = M(x, qx) will successively call M(x, (q - 1)x), M(x, (q - 2)x), ..., M(x, x), M(x, 0). At the end, M(x, 0) attempts to recursively call itself, which surrenders. The return value is (x, 0), concatenated with all singletons returned by the second line. Since the second line maps (x, x) to 0, the result of M(x, y) will match the pattern (x, 0, 0, ...).
If y = qx + r, with 0 < r < x, we'll proceed in similar fashion, eventually reaching M(x, x + r), then M(x, r).
If r = 1 and x is even, m(x, r) = (x, (x - r) % 2) = (x, 1), and the recursive call to M surrenders. In the previous call, the second line mapped (x, x + r) to (x + r - x) % 2 = 1, so the result of M(x, y) will match the pattern (x, 1, 1, ...).
If r = 1 and x is odd, m(x, r) = (x, (x - r) % 2) = (x, 0), and the recursive call to M succeeds.
Likewise, if r > 1, then m(x, r) = (x, (x - r) % 2) ≤ (x, 1) < (x, r), and the recursive call to M succeeds.
In both cases, the second line will be evaluated for the last time with argument (x, t). Since we have t < r < x, the outcome is the non-zero vector (x - t), so the result of M(x, y) will match the pattern (x, ?, x - t, ...).
Thus, the third element of the vector returned by M(x, y) will be 0 if and only if x is a divisor of y.
[TIO-jf0gja4y]: https://tio.run/##JYy9CoQwEITrnaeYPjYn2KYIwS6@gxICFiGCvv/enMfAMj8fW0cdt7ttnKTAKGU2NmRY5gQt69sWFFhhhwUmdhGy65sgrJ4XlSL@leb2M1EHSV@wwRJFIQgeD7TU/XD3efl8AQ "Dodos – Try It Online" "Dodos – Try It Online" [DOS]: https://github.com/DennisMitchell/dodos#divide-or-surrender "DennisMitchell/dodos: Dodos Only Divide Or Surrender"