16 lines
64 KiB
JSON

{
"hash": "f1d1f6321eb69b507eacbbdbfb621264",
"result": {
"engine": "jupyter",
"markdown": "---\ntitle: \"Numbering Numbers, Part 2: Ordering Obliquely\"\ndescription: |\n How do we construct an irrational number from rational ones?\nformat:\n html:\n html-math-method: katex\ndate: \"2023-12-31\"\ndate-modified: \"2025-07-29\"\ncategories:\n - haskell\n - diagonal argument\n---\n\n\n\nThis post assumes you have read the [previous one](./1), which discusses the creation of sequences\n containing every integer, every binary fraction, and in fact, every fraction.\nFrom the fractions, we also could enumerate quadratic irrational numbers using the *question-mark function*.\n\n\nOther Irrationals\n-----------------\n\nBecause rationals -- and even some irrationals -- can be enumerated, we might imagine\n that it would be nice to enumerate *all* irrational numbers.\nUnfortunately, we're not very lucky this time.\n\nLet's start by making what we mean by \"number\" more concrete\nWe've already been exposed to infinite expansions, like 1/3 in binary (and conveniently, also decimal).\nIn discussing the question mark function, I mentioned the utility of repeating expansions as a means of\n accessing quadratic rationals in the Stern-Brocot tree.\nA general sequence need not repeat, so we can choose to treat these extra \"infinite expansions\" as numbers.\nProving that a rational number must have a repeating expansion is difficult, but if we accept this premise,\n then the new non-repeating expansions are our irrationals.\nFor example, $2 - \\varphi \\approx 0.381966...$, which we encountered last time, is such a number.\n\nDoing this introduces a number of headaches, the least of which is that of\n the definition of arithmetic on such quantities.\nHowever, we need only be concerned with the contents of these sequences to show why\n we can't list out all irrationals.\n\n\n### Diagonalization\n\nWe can narrow our focus to the interval between 0 and 1, since the numbers outside this interval\n are their reciprocals.\nNow (if we agree to use base ten), \"all numbers between 0 and 1\" as we've defined them begin with \"0.\",\n followed by an infinite sequence of digits 0-9.\nSuppose that we have an enumeration of every infinite sequence on this list -- no sequence is left out.\n[Cantor's diagonal argument](https://en.wikipedia.org/wiki/Cantor%27s_diagonal_argument) shows that\n a new sequence can be found by taking the sequence on the diagonal\n and changing each individual digit to another one.\nThe new sequence differs in at least one place from every element on the list,\n so the new sequence cannot be on the list.\nTherefore, such an enumeration cannot exist.\n\nThis is illustrated for binary sequences in this diagram:\n\n<!-- TODO: better wikimedia imports -->\n<div class=\"quarto-figure quarto-figure-center\">\n <figure class=\"figure\">\n <a title=\"Jochen Burghardt, CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons\" href=\"https://commons.wikimedia.org/wiki/File:Diagonal_argument_01_svg.svg\">\n <img width=\"256\" alt=\"Diagonal argument\" style=\"background-color:white !important; border-radius: 5px\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Diagonal_argument_01_svg.svg/256px-Diagonal_argument_01_svg.svg.png\">\n </a>\n\n <figcaption>\n Source: Jochen Burghardt, via Wikimedia Commons\n </figcaption>\n </figure>\n</div>\n\nIt's fairly common to show this argument without much further elaboration,\n but there are a few problems with doing so:\n\n- We're using infinite sequences of digits, not numbers.\n - Equality between sequences is defined by having all elements coincide.\n- We assume we have an enumeration of sequences to which the argument applies.\n The contents of the enumeration are a mystery.\n- We have no idea which sequences are rational numbers, or if we'd construct one\n by applying the diagonal argument.\n\n\n### Equality\n\nThe purpose of the diagonal argument is to produce a new sequence which was not previously enumerated.\nThe sequence is different in all positions, but what we actually want is equality with respect to the base.\nIn base ten, we have the peculiar identity that\n [$0.\\overline{9} = 1$](https://en.wikipedia.org/wiki/0.999...).\nThis means that if the diagonal argument (applied to base ten sequences) constructs a new sequence\n with the digit 9 repeating forever, it might be equivalent to a sequence which was already in the list:\n\n::: {#cd4d8b5b .cell .plain execution_count=2}\n``` {.haskell .cell-code code-fold=\"true\"}\ndiagData = rowsOmega [\n [1, 2, 3, 4, 5, 6],\n [9, 2, 4, 8, 3, 7],\n [2, 2, 8, 2, 2, 2],\n [2, 3, 9, 3, 9, 9],\n [9, 4, 9, 4, 9, 4],\n [8, 1, 2, 5, 7, 9]\n ]\n [2, 3, 9, 4, 0, 0]\n\nrenderTable (displayDiagRows [Omega, RN 3]\n (numberColumn <> diagBox' 5 <> ellipsisColumn)) diagData\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n<table class=\"\">\n <thead>\n <tr>\n <th>\n Sequence\n </th>\n <th>\n 0\n </th>\n <th>\n 1\n </th>\n <th>\n 2\n </th>\n <th>\n 3\n </th>\n <th>\n 4\n </th>\n <th>\n 5\n </th>\n <th>\n ...\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 2\n </td>\n <td>\n 3\n </td>\n <td>\n 4\n </td>\n <td>\n 5\n </td>\n <td>\n 6\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 1\n </td>\n <td>\n 9\n </td>\n <td>\n <span style=\"color: red\">\n 2\n </span>\n </td>\n <td>\n 4\n </td>\n <td>\n 8\n </td>\n <td>\n 3\n </td>\n <td>\n 7\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 2\n </td>\n <td>\n 2\n </td>\n <td>\n 2\n </td>\n <td>\n <span style=\"color: red\">\n 8\n </span>\n </td>\n <td>\n 2\n </td>\n <td>\n 2\n </td>\n <td>\n 2\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n <span style=\"color: green\">\n 3\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 2\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 3\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 9\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 3\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 9\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 9\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n ...\n </span>\n </td>\n </tr>\n <tr>\n <td>\n 4\n </td>\n <td>\n 9\n </td>\n <td>\n 4\n </td>\n <td>\n 9\n </td>\n <td>\n 4\n </td>\n <td>\n <span style=\"color: red\">\n 9\n </span>\n </td>\n <td>\n 4\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 5\n </td>\n <td>\n 8\n </td>\n <td>\n 1\n </td>\n <td>\n 2\n </td>\n <td>\n 5\n </td>\n <td>\n 7\n </td>\n <td>\n <span style=\"color: red\">\n 9\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n <span style=\"color: green\">\n ω\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 2\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 3\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 9\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 4\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n ...\n </span>\n </td>\n </tr>\n </tbody>\n</table>\n```\n\nA case in which the diagonal argument could construct a number already on the list.\n:::\n:::\n\n\nIn the above table, sequence 3 is assumed to continue with 9's forever.\nThe new sequence ω comes from taking the red digits along the diagonal and mapping each digit\n to the next one (mod ten).\nIn the enumeration given, the diagonal continues with 9's forever, so we end up with 0's forever in ω.\n\n\n### Picking a Sequence and Ensuring Rationals\n\n\"No problem, just pick another enumeration,\" you might say.\nIndeed, the example given relies on a simple function and an enumeration\n to which it is particularly ill-suited.\n\nInstead, let's focus on something we *can* do.\nInstead of assuming we have all irrational numbers listed out already, let's start smaller.\nAs of last post, we already have several ways to enumerate all rational numbers between 0 and 1.\nWe can take this enumeration and convert each rational number to positional expansions in a base.\nThen after applying the diagonal argument, the resulting quantity *should* be an irrational number.\n\nFor convenience, we'll use binary expansions of rationals as our sequences.\nThat way, to get a unique sequence on the diagonal, we only have to worry\n about changing \"0\"s to \"1\"s (and vice versa).\nSince we have less flexibility in our digits, it also relieves us from some of the responsibility\n of finding a \"good\" function, like in the decimal case.\nHowever, it's still possible the argument constructs a number already equal to something on the list.\n\n\nInto Silicon\n------------\n\nBefore going any further, let's write a function for applying the diagonal argument to\n a list of binary sequences.\nThis can be implemented in Haskell fairly easily:\n\n::: {#9ef6e535 .cell execution_count=3}\n``` {.haskell .cell-code}\ndiagonalize :: [[Int]] -> [Int]\n -- pair each sequence with its index\ndiagonalize xs = let sequences = zip [0..] xs in\n -- read out the red diagonal\n let diagonal = map (\\(n, s_n) -> s_n !! n) sequences in\n -- map 0 to 1 and vice versa\n map (1 -) diagonal\n-- or in point-free form\n-- diagonalize = map (\\(x,y) -> 1 - (y !! x)) . zip [0..]\n```\n:::\n\n\nNothing about this function is specific to \"binary sequences\", since `Int` contains values\n other than `1` and `0`.\nIt's just more intuitive to work with them instead of \"`True`\" and \"`False`\"\n (since `Bool` actually does have 2 values).\nYou can replace `(1 -)` with `not` to get a similar function for the type `Bool`.\n\nWe also need a function to get a rational number's binary expansion.\nThis is simple if you recall how to do long division.\nWe try to divide the numerator by the denominator, \"emit\" the quotient as part of the result list,\n then continue with the remainder (and the denominator is unchanged).\nIt's not *quite* that simple, since we also need to \"bring down\" more zeroes.\nIn binary, we can add more zeroes to an expansion by just multiplying by 2.\n\n::: {#b118a7a3 .cell layout-ncol='2' execution_count=4}\n``` {.haskell .cell-code}\nbinDiv :: Int -> Int -> [Int]\n-- Divide n by d; q becomes part of the result list\n-- The rest of the list comes from doubling the remainder and keeping d fixed\nbinDiv n d = let (q,r) = n `divMod` d in q:binDiv (2*r) d\n\nx = take 10 $ binDiv 1 3\ny = take 10 $ binDiv 1 5\n\nputStrLn $ \"x = 1 / 3 = 0.\" ++ (tail x >>= show) ++ \"...\"\nputStrLn $ \"y = 1 / 5 = 0.\" ++ (tail y >>= show) ++ \"...\"\n```\n\n::: {.cell-output .cell-output-display}\n```\nx = 1 / 3 = 0.010101010...\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\ny = 1 / 5 = 0.001100110...\n```\n:::\n:::\n\n\nThis function gives us the leading 0 (actually the integer part of the quotient of `n` by `d`),\n but we can peel it off by applying `tail`.\n\nSince we intend to interpret these sequences as binary numbers, we might as well also\n convert this into a form we recognize as a number.\nAll we need to do is take a weighted sum of each sequence by its binary place value.\n\n::: {#ac159fb9 .cell execution_count=5}\n``` {.haskell .cell-code}\nfromBinSeq :: Int -> [Int] -> Double\n -- Construct a list of place values starting with 1/2\nfromBinSeq p = let placeValues = (tail $ iterate (/2) 1) in\n -- Convert the sequence to a type that can multiply with\n -- the place values, then weight, truncate, and sum.\n sum . take p . zipWith (*) placeValues . map fromIntegral\n\noneFifth = fromBinSeq 64 $ tail $ binDiv 1 5\n\nprint oneFifth\n```\n\n::: {.cell-output .cell-output-display}\n```\n0.2\n```\n:::\n:::\n\n\nThe precision `p` here is mostly useless, since we intend to take this to as far as `Double` will go.\n`p` = 100 will do for most sequences, since it's rare that we'll encounter more than a few zeroes\n at the beginning of a sequence.\n\n\nSome Enumerations\n-----------------\n\nNow, for the sake of argument, let's look at an enumeration that fails.\nUsing the tree of binary fractions from the last post, we use a breadth-first search to create\n a list of terminating binary expansions.\n\n![\n Tree of binary fractions, as the tree of terminating binary expansions. <br>\n We perform a BFS on the left subtree to obtain the values between 0 and 1.\n](../1/binary_expansion_tree.png)\n\n::: {#593d4d8d .cell execution_count=6}\n``` {.haskell .cell-code}\n-- Data class for a labelled sequence\ndata LabelledSeq a b = LS a [b] deriving Functor\n-- Create a labelled binary sequence by dividing n into d and tagging it with \"n/d\"\nbinSeqLabelled (n, d) = LS (show n ++ \"/\" ++ show d) (tail $ binDiv n d)\n-- Build a new diagonalize function to work over labelled sequences\nlsify diagonalize = diagonalize . map (\\(LS _ y) -> y)\n\n-- Extract the left subtree (i.e., the first child subtree)\nbadDiag diagonalizeLS = let (Node _ (tree:__)) = binFracTree in\n diagonalizeLS $ map binSeqLabelled $ bfs tree\n```\n:::\n\n\n::: {#4cc08e74 .cell .plain execution_count=7}\n``` {.haskell .cell-code code-fold=\"true\"}\n-- Helper functions for drawing tables\nbuildDiagTable m = (rowsOmegaLabelled \"Fraction\" . take m . map (\\(LS s y) -> (s, y))) <*> lsify diagonalize\nrenderDiagTable diagf n = renderTable\n (displayDiagRows []\n (numberColumn <> labelColumn \"Fraction\" <> diagBox' (n - 1) <> ellipsisColumn)) $\n diagf (buildDiagTable n)\n\nrenderDiagTable badDiag 8\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n<table class=\"\">\n <thead>\n <tr>\n <th>\n Sequence\n </th>\n <th>\n Fraction\n </th>\n <th>\n 0\n </th>\n <th>\n 1\n </th>\n <th>\n 2\n </th>\n <th>\n 3\n </th>\n <th>\n 4\n </th>\n <th>\n 5\n </th>\n <th>\n 6\n </th>\n <th>\n 7\n </th>\n <th>\n ...\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n 0\n </td>\n <td>\n 1/2\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 1\n </td>\n <td>\n 1/4\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 2\n </td>\n <td>\n 3/4\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 3\n </td>\n <td>\n 1/8\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 4\n </td>\n <td>\n 3/8\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 5\n </td>\n <td>\n 5/8\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 6\n </td>\n <td>\n 7/8\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 7\n </td>\n <td>\n 1/16\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ...\n </td>\n <td>\n \n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ω\n </td>\n <td>\n \n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n </tbody>\n</table>\n```\n:::\n:::\n\n\nComputing the diagonal sequence, it quickly becomes apparent that we're going\n to keep getting \"0\"s along the diagonal.\nThis is because we're effectively just counting in binary some number of digits to the right.\nThe length of a binary expansion grows logarithmically, but going down the diagonal is a linear process.\nIn other words, we can't count fast enough by just adding 1 (or adding any number, really).\n\nEven worse than this, we get a sequence which is equal to sequence 1 as a binary expansion.\nWe can't even rely on the diagonal argument to give us a new number that *isn't* equal\n to a binary fraction.\n\n\n### Stern-Brocot Diagonal\n\nThe Stern-Brocot tree contains more than just binary fractions, so we're bound to encounter more than\n \"0\" forever when running along the diagonal.\nAgain, looking at the left subtree, we can read off fractions between 0 and 1.\n\n![\n Stern-Brocot tree\n](../1/stern-brocot_tree.png)\n\nWe end up with the following enumeration:\n\n::: {#f3be84d7 .cell .plain execution_count=8}\n``` {.haskell .cell-code}\n-- Extract the left subtree (i.e., the first child subtree)\nsbDiag diagonalizeLS = let (Node _ (tree:__)) = sternBrocot in\n diagonalizeLS $ map binSeqLabelled $ bfs tree\n\nrenderDiagTable sbDiag 8\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n<table class=\"\">\n <thead>\n <tr>\n <th>\n Sequence\n </th>\n <th>\n Fraction\n </th>\n <th>\n 0\n </th>\n <th>\n 1\n </th>\n <th>\n 2\n </th>\n <th>\n 3\n </th>\n <th>\n 4\n </th>\n <th>\n 5\n </th>\n <th>\n 6\n </th>\n <th>\n 7\n </th>\n <th>\n ...\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n 0\n </td>\n <td>\n 1/2\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 1\n </td>\n <td>\n 1/3\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 2\n </td>\n <td>\n 2/3\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 3\n </td>\n <td>\n 1/4\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 4\n </td>\n <td>\n 2/5\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 5\n </td>\n <td>\n 3/5\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 6\n </td>\n <td>\n 3/4\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 7\n </td>\n <td>\n 1/5\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ...\n </td>\n <td>\n \n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ω\n </td>\n <td>\n \n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n </tbody>\n</table>\n```\n:::\n:::\n\n\nWhen expressed as a decimal, the new sequence corresponds to the value 0.12059395276... .\nDually, its continued fraction expansion begins \\[0; 8,3,2,2,1,2,12, ...\\].\nWhile the number is (almost) certainly irrational, I have no idea whether it is algebraic or transcendental.\n\n\n### Pairs, without repeats\n\nWe have a second, similar enumeration given by `allRationalsMap` in the previous post.\nWe'll need to filter out the numbers greater than 1 from this sequence, but that's not too difficult\n since we're already filtering out repeats.\n\n::: {#ab797911 .cell .plain execution_count=9}\n``` {.haskell .cell-code}\n-- Only focus on the rationals whose denominator is bigger\narDiag diagonalizeLS = let rationals01 = filter (uncurry (<)) allRationals in\n diagonalizeLS $ map binSeqLabelled rationals01\n\nrenderDiagTable arDiag 8\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n<table class=\"\">\n <thead>\n <tr>\n <th>\n Sequence\n </th>\n <th>\n Fraction\n </th>\n <th>\n 0\n </th>\n <th>\n 1\n </th>\n <th>\n 2\n </th>\n <th>\n 3\n </th>\n <th>\n 4\n </th>\n <th>\n 5\n </th>\n <th>\n 6\n </th>\n <th>\n 7\n </th>\n <th>\n ...\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n 0\n </td>\n <td>\n 1/2\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 1\n </td>\n <td>\n 1/3\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 2\n </td>\n <td>\n 1/4\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 3\n </td>\n <td>\n 2/3\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 4\n </td>\n <td>\n 1/5\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 5\n </td>\n <td>\n 1/6\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 6\n </td>\n <td>\n 2/5\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 7\n </td>\n <td>\n 3/4\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ...\n </td>\n <td>\n \n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ω\n </td>\n <td>\n \n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n </tbody>\n</table>\n```\n:::\n:::\n\n\nThis new sequence has a decimal expansion equivalent to 0.24005574958...\n (continued fraction expansion begins \\[0; 4, 6, 28, 1, 1, 5, 1, ...\\]).\nAgain, this is probably irrational, since WolframAlpha has no idea on whether a closed form exists.\n\n\nThe Diagonal Transform\n----------------------\n\nWhy stop with just one?\nThis new number can just be tacked onto the beginning of the list.\nThen, we re-apply the diagonal argument to obtain a new number.\nAnd so on ad infinitum.\n\n::: {#5ab3d034 .cell execution_count=10}\n``` {.haskell .cell-code}\ntransform :: [[Int]] -> [[Int]]\n-- Emit the new diagonal sequence, then recurse with the new sequence\n-- prepended to the original enumeration\ntransform xs = let ds = diagonalize xs in ds:transform (ds:xs)\n```\n:::\n\n\n::: {#4dfd6c42 .cell .plain execution_count=11}\n``` {.haskell .cell-code code-fold=\"true\"}\ntransformLS :: [LabelledSeq String Int] -> [LabelledSeq String Int]\n-- Emit the new diagonal sequence, then recurse with the new sequence\n-- prepended to the original enumeration\ntransformLS xs = let ds = lsify diagonalize xs in LS \"\" ds:transformLS (LS \"\" ds:xs)\n\n-- Prepend and append ellipses, then join the reversed transform sequence to the original\nbuildTransformTable labelName m xs = DR Ellipsis [] []:table where\n table = concat [reverse prepended, mainTable, [DR Ellipsis [] []]]\n xs' = transformLS xs\n prepended = take m $ zipWith (\\(LS l x) n -> DR (RN $ -n) [] x) xs' [1..]\n mainTable = zipWith (\\(LS l x) n -> DR (RN n) [(labelName, l)] x) xs [0..]\n\n-- Render certain diagonals and rows in the same way\ndisplayTransformRows ns = renderCells (stringCell . showCell) $ ns >>= formatDiag where\n formatDiag (n, f) = [\n markDiagonal n (f . show),\n markRows [RN $ n-1] (f . showCell)\n ]\n\n-- Render diagonal 0 (row -1) as red and diagonal -1 (row -2) as green\nrenderTransformTable n = renderTable\n (displayTransformRows [(0, redCell), (-1, greenCell)]\n (numberColumn <> labelColumn \"Fraction\" <> diagBox' (n - 1) <> ellipsisColumn)) .\n buildTransformTable \"Fraction\" 2\n\nrenderTransformTable 8 $ take 8 $ sbDiag id\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n<table class=\"\">\n <thead>\n <tr>\n <th>\n Sequence\n </th>\n <th>\n Fraction\n </th>\n <th>\n 0\n </th>\n <th>\n 1\n </th>\n <th>\n 2\n </th>\n <th>\n 3\n </th>\n <th>\n 4\n </th>\n <th>\n 5\n </th>\n <th>\n 6\n </th>\n <th>\n 7\n </th>\n <th>\n ...\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n ...\n </td>\n <td>\n \n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n <span style=\"color: green\">\n -2\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n \n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n ...\n </span>\n </td>\n </tr>\n <tr>\n <td>\n <span style=\"color: red\">\n -1\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n \n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: red\">\n ...\n </span>\n </td>\n </tr>\n <tr>\n <td>\n 0\n </td>\n <td>\n 1/2\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 1\n </td>\n <td>\n 1/3\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 2\n </td>\n <td>\n 2/3\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 3\n </td>\n <td>\n 1/4\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 4\n </td>\n <td>\n 2/5\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 1\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 5\n </td>\n <td>\n 3/5\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n 1\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 6\n </td>\n <td>\n 3/4\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n <span style=\"color: red\">\n 0\n </span>\n </td>\n <td>\n <span style=\"color: green\">\n 0\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n 7\n </td>\n <td>\n 1/5\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n 1\n </td>\n <td>\n 0\n </td>\n <td>\n 0\n </td>\n <td>\n 1\n </td>\n <td>\n <span style=\"color: red\">\n 1\n </span>\n </td>\n <td>\n ...\n </td>\n </tr>\n <tr>\n <td>\n ...\n </td>\n <td>\n \n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n <td>\n ...\n </td>\n </tr>\n </tbody>\n</table>\n```\n\nUsing the Stern-Brocot enumeration ~~because I like it better~~\n:::\n:::\n\n\nFor completeness's sake, the decimal expansions of the first few numbers which pop are as follows:\n\n::: {#29cbe414 .cell execution_count=12}\n``` {.haskell .cell-code}\nsbDiagSeq = let (Node _ (tree:__)) = sternBrocot in\n transform $ map (tail . uncurry binDiv) $ bfs tree\n\nmapM_ print $ take 10 $ map (fromBinSeq 100) sbDiagSeq\n```\n\n::: {.cell-output .cell-output-display}\n```\n0.12059395276295479\n0.9839683315741587\n0.39401828609177836\n0.7474914867558182\n3.876798422930419e-2\n0.7802097209903278\n0.3215249242021624\n0.6795283379777878\n0.1938245109955674\n0.947203605609322\n```\n:::\n:::\n\n\nDoes this list out \"all\" irrational numbers? Not even close.\nIn fact, this just gives us a bijection between the original enumeration\n and a new one containing our irrationals.\n\nThe new numbers we get also depend heavily on the order of the original sequence.\nThis is obvious just by looking at the first entry produced by our two good enumerations.\nPerhaps if we permuted the enumeration of rationals in all possible ways, we would end up listing\n all irrational numbers, but we'd also run through\n [all ways of ordering the natural numbers](https://en.wikipedia.org/wiki/Baire_space_%28set_theory%29).\n\nThe fact that \"bad\" enumerations exist tells us that it's not even guaranteed that we don't collide\n with any rationals.\nI conjecture that the good enumerations won't do so, since we shouldn't ever encounter\n an infinite sequence of \"0\"s or \"1\"s, and a sequence should eventually differ\n in at least one position from one already listed.\n\n\n### Almost Involution\n\nSince the function has the same input and output type, you may wonder what happens when\n it's applied multiple times.\nPerhaps it is possible that since `\\x -> 1 - x` is an involution, so too is this new function.\nAlas, experimentation proves us wrong.\n\n::: {#aacbae40 .cell layout-ncol='2' execution_count=13}\n``` {.haskell .cell-code}\nsbDiagSeq2 = transform sbDiagSeq\n\nmapM_ print $ take 10 $ map (fromBinSeq 100) sbDiagSeq2\n-- Guesses\nmapM_ putStrLn [ \"1/2\", \"1/3\", \"11/12\", \"1/8\", \"57/80\", \"23/80\",\n \"55/64\", \"3/40\", \"???, possibly 613/896\", \"249/512\" ]\n```\n\n::: {.cell-output .cell-output-display}\n```\n0.5\n0.3333333333333333\n0.9166666666666666\n0.125\n0.7124999999999999\n0.2875\n0.859375\n7.5e-2\n0.6841517857142857\n0.486328125\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\n1/2\n1/3\n11/12\n1/8\n57/80\n23/80\n55/64\n3/40\n???, possibly 613/896\n249/512\n```\n:::\n:::\n\n\nThe fraction forms of the above numbers are my best guesses.\nEither way, it only matches for the first two terms before going off the rails.\n\nEven stranger than this distorted reflection is the fact that going through the mirror again\n doesn't take us anywhere new:\n\n::: {#bd14098b .cell execution_count=14}\n``` {.haskell .cell-code}\nsbDiagSeq3 = transform sbDiagSeq2\n\nsquaresAgree n xs ys = let takeSquare zs = take n $ map (take n) zs in\n takeSquare xs == takeSquare ys\n\nmapM_ print $ take 10 $ map (fromBinSeq 100) sbDiagSeq3\n-- First and third iterates agree\nprint $ squaresAgree 100 sbDiagSeq sbDiagSeq3\n```\n\n::: {.cell-output .cell-output-display}\n```\n0.12059395276295479\n0.9839683315741587\n0.39401828609177836\n0.7474914867558182\n3.876798422930419e-2\n0.7802097209903278\n0.3215249242021624\n0.6795283379777878\n0.1938245109955674\n0.947203605609322\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nTrue\n```\n:::\n:::\n\n\nIn other words, applying the transform thrice is the same as applying the transform once.\nNot that this has been shown rigorously in the least -- it's only been tested in a 100x100 square.\n\nRegardless, this semi-involutory behavior is strange and nontrivial.\nAnd it's not limited to this enumeration.\nFor example, the filtered `allRationalsMap` iterations shows:\n\n::: {#68ed7f9a .cell layout='[[1,1],[1]]' execution_count=15}\n``` {.haskell .cell-code}\narDiagSeq = let rationals01 = filter (uncurry (<)) allRationals in\n transform $ map (tail . uncurry binDiv) rationals01\n\n\n-- What goes in isn't what comes out\nmapM_ print $ take 10 $ map (fromBinSeq 100) $ transform arDiagSeq\n-- Guesses\nmapM_ putStrLn [\"1/2\", \"1/3\", \"3/4\", \"1/6\", \"7/10\", \"5/12\", \"139/160\", \"13/128\", \"???, possibly 949/1792\", \"633/1280\"]\n-- First and third iterates agree\nprint $ squaresAgree 100 arDiagSeq (transform $ transform arDiagSeq)\n```\n\n::: {.cell-output .cell-output-display}\n```\n0.5\n0.3333333333333333\n0.75\n0.16666666666666666\n0.7\n0.41666666666666663\n0.8687499999999999\n0.1015625\n0.5295758928571428\n0.49453125\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\n1/2\n1/3\n3/4\n1/6\n7/10\n5/12\n139/160\n13/128\n???, possibly 949/1792\n633/1280\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nTrue\n```\n:::\n:::\n\n\nMeanwhile, the bad enumeration just gives more binary fractions, but it still doesn't mean\n double-transforming returns the original diagonal.\n\n::: {#45b09da2 .cell layout='[[1,1],[1,1],[1]]' execution_count=16}\n``` {.haskell .cell-code}\nbfDiagSeq = let (Node _ (tree:__)) = binFracTree in\n transform $ map (tail . uncurry binDiv) $ bfs tree\n\n(putStrLn \"First diagonal transform: \" >>) $\n mapM_ print $ take 10 $ map (fromBinSeq 100) bfDiagSeq\n-- Guesses\nmapM_ putStrLn [\"Guesses\", \"1/4\", \"1/1\", \"1/2\", \"5/8\", \"1/16\", \"25/32\", \"25/64\", \"81/128\", \"49/256\", \"417/512\"]\n\n-- What goes in isn't what comes out\n(putStrLn \"Second diagonal transform: \" >>) $\n mapM_ print $ take 10 $ map (fromBinSeq 100) $ transform bfDiagSeq\n-- Guesses\nmapM_ putStrLn [\"Guesses\", \"1/2\", \"1/4\", \"3/4\", \"1/8\", \"11/16\", \"15/32\", \"55/64\", \"15/128\", \"143/256\", \"223/512\"]\n\n-- First and third iterates agree\nprint $ squaresAgree 100 bfDiagSeq (transform $ transform bfDiagSeq)\n```\n\n::: {.cell-output .cell-output-display}\n```\nFirst diagonal transform: \n0.25\n1.0\n0.5\n0.625\n6.25e-2\n0.78125\n0.390625\n0.6328125\n0.19140625\n0.814453125\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nGuesses\n1/4\n1/1\n1/2\n5/8\n1/16\n25/32\n25/64\n81/128\n49/256\n417/512\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nSecond diagonal transform: \n0.5\n0.25\n0.75\n0.125\n0.6875\n0.46875\n0.859375\n0.1171875\n0.55859375\n0.435546875\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nGuesses\n1/2\n1/4\n3/4\n1/8\n11/16\n15/32\n55/64\n15/128\n143/256\n223/512\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```\nTrue\n```\n:::\n:::\n\n\nWhat does it mean that the initial enumeration comes back as a completely different one?\nSince the new one is \"stable\" with respect to applying the diagonal transform twice,\n are the results somehow preferable or significant?\n\n\nClosing\n-------\n\nThese questions, and others I have about the products of this process, I unfortunately have no answer for.\nI was mostly troubled by how rare it is to find people applying the diagonal argument\n to something to anything other than random sequences.\n\nRandom sequences, either by choice or by algorithm (if you can even call them random at that point),\n are really only good to show *how* to apply the diagonal argument.\nWithout knowing *what* the argument is applied to, it's useless for constructive arguments.\nIt also still remains to be proven that your new sequences are sufficient for the purpose\n (since I've only shown a case in which it fails).\n\n(Recycled) diagrams made in Geogebra.\n<!-- Downloadable Haskell code, including things from the previous post available [here](). -->\n\n",
"supporting": [
"index_files"
],
"filters": [],
"includes": {
"include-in-header": [
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\" integrity=\"sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==\" crossorigin=\"anonymous\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\" integrity=\"sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==\" crossorigin=\"anonymous\" data-relocate-top=\"true\"></script>\n<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>\n"
]
}
}
}