Script for visualising the back-and-forth method.
Go to file
wan-may 424e8a9129 readme 2023-10-07 17:40:19 -03:00
enumeration.lua Big commit, basic functionality + plotting. 2023-10-07 11:52:55 -03:00
enumerations.lua Fix infinite loop bug, add FFI enum test, add moving camera 2023-10-07 16:38:00 -03:00
main.lua readme 2023-10-07 17:40:19 -03:00
readme.md readme 2023-10-07 17:40:19 -03:00
sequence.lua Big commit, basic functionality + plotting. 2023-10-07 11:52:55 -03:00
twintree.lua Fix infinite loop bug, add FFI enum test, add moving camera 2023-10-07 16:38:00 -03:00

readme.md

This is a little LOVE script for plotting correspondences between dense countable ordered sets. To use: download LOVE2D, then run LOVE in the directory where this repo is saved.

Any two countable dense total orders are order isomorphic. Using only this structure it is possible to explicitly construct an increasing bijection between these two orders.

This implements the standard procedure for doing this in general, the "back-and-forth" method. Pass a function that generates an infinite sequence to the enumerator wrapper ( require 'enumeration' ), then pass the resulting enumerators to twintree.build ( require 'twintree' ).

twintree.build takes a number as its first argument, and the pair of enumerators as its following two arguments. This number is the number of pairs of points in the support of the function (i.e., it's a partial function, only some large but finite number of points will be computed and plotted. The rest will be displayed by linear interpolation.).

twintree.build returns two values, each is a binary tree. twintree.flat does a simultaneous inorder traversal of both trees, then interlaces the entries in a large, reused, 1-indexed Lua table that can be passed to love.graphics.line. Supposing the trees are traversed like { x_1, x_2, x_3, ... x_n } and { y_1, y_2, y_3, ..., y_n }, then the resulting table will be { x_1, y_1, x_2, y_2, x_3, y_3, ..., y_n }.