{
  "index": "2014-B-6",
  "type": "ANA",
  "tag": [
    "ANA",
    "ALG",
    "NT"
  ],
  "difficulty": "",
  "question": "Let $f: [0,1] \\to \\mathbb{R}$ be a function for which there exists a constant $K>0$\nsuch that $\\left| f(x) - f(y) \\right| \\leq K \\left| x - y \\right|$ for all $x,y \\in [0,1]$.\nSuppose also that for each rational number $r \\in [0,1]$, there exist integers $a$ and $b$\nsuch that $f(r) = a + br$. Prove that there exist finitely many intervals $I_1, \\dots, I_n$\nsuch that $f$ is a linear function on each $I_i$ and $[0,1] = \\bigcup_{i=1}^n I_i$. \n\n\\end{itemize}\n\n\\end{document}",
  "solution": "Let us say that a linear function $g$ on an interval is \\emph{integral} if it has the form\n$g(x) = a + bx$ for some $a,b \\in \\ZZ$, and that a piecewise linear function is \\emph{integral} if on every interval where it is linear, it is also integral.\n\nFor each positive integer $n$, define the $n$-th \\emph{Farey sequence} $F_n$ as the sequence of rational numbers in $[0,1]$ with denominators at most $n$.\nIt is easily shown by induction on $n$ that any two consecutive elements $\\frac{r}{s}, \\frac{r'}{s'}$ of $F_n$, written in lowest terms, satisfy $\\gcd(s,s') = 1$, $s+s' > n$, and $r's - r s' = 1$. Namely, this is obvious for $n=1$ because $F_1 = \\frac{0}{1}, \\frac{1}{1}$. To deduce the claim for $F_n$ from the claim for $F_{n-1}$, let $\\frac{r}{s}, \\frac{r'}{s'}$ be consecutive elements of $F_{n-1}$. If $s+s' = n$, then for $m = r+r'$ we have $\\frac{r}{s} < \\frac{m}{n} < \\frac{r'}{s'}$ and the pairs $\\frac{r}{s},\\frac{m}{n}$ and $\\frac{m}{n}, \\frac{r'}{s'}$ \nsatisfy the desired conditions. Conversely, if $s+s' > n$, then we cannot have $\\frac{r}{s} < \\frac{m}{n} < \\frac{r'}{s'}$ for $a \\in \\ZZ$, as this yields the contradiction\n\\[\nn =(ms - nr)s' + (r'n - ms') \\geq s+s' > n;\n\\]\nhence $\\frac{r}{s}, \\frac{r'}{s'}$ remain consecutive in $F_n$. \n\nLet $f_n: [0,1] \\to \\RR$ be the piecewise linear function which agrees with $f$ at each element of $F_n$ and is linear between any two consecutive elements of $F_n$.\nBetween any two consecutive elements $\\frac{r}{s}, \\frac{r'}{s'}$ of $F_n$,\n$f_n$ coincides with some linear function $a+bx$. Since $s f(\\frac{r}{s}), s' f(\\frac{r'}{s'}) \\in \\ZZ$, we deduce first that\n\\[\nb = ss' (f(\\frac{r'}{s'}) - f(\\frac{r}{s}))\n\\]\nis an integer of absolute value at most $K$,\nand second that both $as = s f(\\frac{r}{s}) - br$ and $as' = s' f(\\frac{r'}{s'}) - br'$ are integral. It follows that $f_n$ is integral.\n\nWe now check that if $n > 2K$, then $f_n = f_{n-1}$. \nFor this, it suffices to check that for any consecutive elements $\\frac{r}{s}, \\frac{m}{n}, \\frac{r'}{s'}$ in $F_n$, the linear function $a_0 + b_0 x$ matching $f_{n-1}$ from $\\frac{r}{s}$ to $\\frac{r'}{s'}$ has the property that $f(\\frac{m}{n}) = a_0 + b_0 \\frac{m}{n}$. Define the integer $t = nf(\\frac{m}{n}) - a_0 n - b_0 m$. \nWe then compute that the slope of $f_n$ from $\\frac{r}{s}$ to $\\frac{m}{n}$ is $b_0+st$,\nwhile the slope of $f_n$ from $\\frac{m}{n}$ to $\\frac{r'}{s'}$ is at most $b_0 -s't$.\nIn order to have $\\left| b_0 + s t\\right|, \\left| b_0 - s' t\\right| \\leq K$, we must have\n$(s+s') \\left| t \\right| \\leq 2K$; since $s+s' = n > 2K$, this is only possible if $t=0$.\nHence $f_n = f_{n-1}$, as claimed.\n\nIt follows that for any $n > 2K$, we must have $f_n = f_{n+1} = \\cdots$. Since the condition on $f$ and $K$ implies that $f$ is continuous, we must also have $f_n = f$, completing the proof.\n\n\\noindent\n\\textbf{Remark:}\nThe condition on $f$ and $K$ is called \\emph{Lipschitz continuity}.\n\n\\noindent\n\\textbf{Remark:}\nAn alternate approach is to prove that for each $x  \\in [0,1)$, there exists $\\epsilon  \\in (0, 1-x)$ such that the restriction of $f$ to $[x, x+\\epsilon)$ is linear;\none may then deduce the claim using the compactness of $[0,1]$. In this approach, the role of the Farey sequence may also be played by the convergents of the continued fraction of $x$ (at least in the case where $x$ is irrational).\n\n\\noindent\n\\textbf{Remark:} This problem and solution are due to one of us (Kedlaya). Some related results can be proved with the Lipschitz continuity condition replaced by suitable convexity conditions.\n See for example: Kiran S. Kedlaya and Philip Tynan,\nDetecting integral polyhedral functions, \\textit{Confluentes Mathematici}\n\\textbf{1} (2009), 87--109.\nSuch results arise in the theory of $p$-adic differential equations; see for example:\nKiran S. Kedlaya and Liang Xiao, Differential modules on $p$-adic polyannuli, \\textit{J. Inst. Math. Jusssieu} \\textbf{9} (2010), 155--201 (errata, \\textit{ibid.}, 669--671).\n\n\\end{itemize}\n\\end{document}",
  "vars": [
    "f",
    "x",
    "y",
    "r",
    "a",
    "b",
    "g",
    "n",
    "F_n",
    "f_n",
    "s",
    "m",
    "t",
    "F_n-1",
    "f_n-1"
  ],
  "params": [
    "K"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "f": "mainfunction",
        "x": "inputvalue",
        "y": "comparisonvalue",
        "r": "rationalvalue",
        "a": "interceptconst",
        "b": "slopesymbol",
        "g": "helperfunction",
        "n": "levelindex",
        "F_n": "fareysequence",
        "f_n": "approxfunction",
        "s": "firstdenom",
        "m": "midnumerator",
        "t": "slopeadjust",
        "F_n-1": "previousfareyseq",
        "f_n-1": "previousapproxfunc",
        "K": "lipschitzbound"
      },
      "question": "Let $mainfunction: [0,1] \\to \\mathbb{R}$ be a function for which there exists a constant $lipschitzbound>0$\nsuch that $\\left| mainfunction(inputvalue) - mainfunction(comparisonvalue) \\right| \\leq lipschitzbound \\left| inputvalue - comparisonvalue \\right|$ for all $inputvalue,comparisonvalue \\in [0,1]$.\nSuppose also that for each rational number $rationalvalue \\in [0,1]$, there exist integers $interceptconst$ and $slopesymbol$\nsuch that $mainfunction(rationalvalue) = interceptconst + slopesymbol\\,rationalvalue$. Prove that there exist finitely many intervals $I_1, \\dots, I_{levelindex}$\nsuch that $mainfunction$ is a linear function on each $I_i$ and $[0,1] = \\bigcup_{i=1}^{levelindex} I_i$.",
      "solution": "Let us say that a linear function $helperfunction$ on an interval is \\emph{integral} if it has the form\n$helperfunction(inputvalue) = interceptconst + slopesymbol\\,inputvalue$ for some $interceptconst,slopesymbol \\in \\ZZ$, and that a piecewise linear function is \\emph{integral} if on every interval where it is linear, it is also integral.\n\nFor each positive integer $levelindex$, define the $levelindex$-th \\emph{Farey sequence} $fareysequence$ as the sequence of rational numbers in $[0,1]$ with denominators at most $levelindex$.\nIt is easily shown by induction on $levelindex$ that any two consecutive elements $\\frac{rationalvalue}{firstdenom}, \\frac{rationalvalue'}{firstdenom'}$ of $fareysequence$, written in lowest terms, satisfy $\\gcd(firstdenom,firstdenom') = 1$, $firstdenom+firstdenom' > levelindex$, and $rationalvalue'\\,firstdenom - rationalvalue\\,firstdenom' = 1$. Namely, this is obvious for $levelindex=1$ because $fareysequence_1 = \\frac{0}{1}, \\frac{1}{1}$. To deduce the claim for $fareysequence$ from the claim for $previousfareyseq$, let $\\frac{rationalvalue}{firstdenom}, \\frac{rationalvalue'}{firstdenom'}$ be consecutive elements of $previousfareyseq$. If $firstdenom+firstdenom' = levelindex$, then for $midnumerator = rationalvalue+rationalvalue'$ we have $\\frac{rationalvalue}{firstdenom} < \\frac{midnumerator}{levelindex} < \\frac{rationalvalue'}{firstdenom'}$ and the pairs $\\frac{rationalvalue}{firstdenom},\\frac{midnumerator}{levelindex}$ and $\\frac{midnumerator}{levelindex}, \\frac{rationalvalue'}{firstdenom'}$\nsatisfy the desired conditions. Conversely, if $firstdenom+firstdenom' > levelindex$, then we cannot have $\\frac{rationalvalue}{firstdenom} < \\frac{midnumerator}{levelindex} < \\frac{rationalvalue'}{firstdenom'}$ for $interceptconst \\in \\ZZ$, as this yields the contradiction\n\\[\nlevelindex =(midnumerator\\,firstdenom - levelindex\\,rationalvalue)firstdenom' + (rationalvalue'\\,levelindex - midnumerator\\,firstdenom') \\geq firstdenom+firstdenom' > levelindex;\n\\]\nhence $\\frac{rationalvalue}{firstdenom}, \\frac{rationalvalue'}{firstdenom'}$ remain consecutive in $fareysequence$.\n\nLet $approxfunction: [0,1] \\to \\RR$ be the piecewise linear function which agrees with $mainfunction$ at each element of $fareysequence$ and is linear between any two consecutive elements of $fareysequence$.\nBetween any two consecutive elements $\\frac{rationalvalue}{firstdenom}, \\frac{rationalvalue'}{firstdenom'}$ of $fareysequence$,\n$approxfunction$ coincides with some linear function $interceptconst+slopesymbol\\,inputvalue$. Since $firstdenom\\, mainfunction\\!\\left(\\frac{rationalvalue}{firstdenom}\\right), firstdenom'\\, mainfunction\\!\\left(\\frac{rationalvalue'}{firstdenom'}\\right) \\in \\ZZ$, we deduce first that\n\\[\nslopesymbol = firstdenom\\,firstdenom'\\!\\left( mainfunction\\!\\left(\\frac{rationalvalue'}{firstdenom'}\\right) - mainfunction\\!\\left(\\frac{rationalvalue}{firstdenom}\\right)\\right)\n\\]\nis an integer of absolute value at most $lipschitzbound$,\nand second that both $interceptconst\\,firstdenom = firstdenom\\, mainfunction\\!\\left(\\frac{rationalvalue}{firstdenom}\\right) - slopesymbol\\,rationalvalue$ and $interceptconst\\,firstdenom' = firstdenom'\\, mainfunction\\!\\left(\\frac{rationalvalue'}{firstdenom'}\\right) - slopesymbol\\, rationalvalue'$ are integral. It follows that $approxfunction$ is integral.\n\nWe now check that if $levelindex > 2\\,lipschitzbound$, then $approxfunction = previousapproxfunc$.\nFor this, it suffices to check that for any consecutive elements $\\frac{rationalvalue}{firstdenom}, \\frac{midnumerator}{levelindex}, \\frac{rationalvalue'}{firstdenom'}$ in $fareysequence$, the linear function $interceptconst_0 + slopesymbol_0\\,inputvalue$ matching $previousapproxfunc$ from $\\frac{rationalvalue}{firstdenom}$ to $\\frac{rationalvalue'}{firstdenom'}$ has the property that $mainfunction\\!\\left(\\frac{midnumerator}{levelindex}\\right) = interceptconst_0 + slopesymbol_0 \\frac{midnumerator}{levelindex}$. Define the integer $slopeadjust = levelindex\\, mainfunction\\!\\left(\\frac{midnumerator}{levelindex}\\right) - interceptconst_0\\, levelindex - slopesymbol_0\\, midnumerator$.\nWe then compute that the slope of $approxfunction$ from $\\frac{rationalvalue}{firstdenom}$ to $\\frac{midnumerator}{levelindex}$ is $slopesymbol_0+firstdenom\\, slopeadjust$,\nwhile the slope of $approxfunction$ from $\\frac{midnumerator}{levelindex}$ to $\\frac{rationalvalue'}{firstdenom'}$ is at most $slopesymbol_0 - firstdenom'\\, slopeadjust$.\nIn order to have $\\left| slopesymbol_0 + firstdenom\\, slopeadjust\\right|, \\left| slopesymbol_0 - firstdenom'\\, slopeadjust\\right| \\leq lipschitzbound$, we must have\n$(firstdenom+firstdenom') \\left| slopeadjust \\right| \\leq 2\\,lipschitzbound$; since $firstdenom+firstdenom' = levelindex > 2\\,lipschitzbound$, this is only possible if $slopeadjust=0$.\nHence $approxfunction = previousapproxfunc$, as claimed.\n\nIt follows that for any $levelindex > 2\\,lipschitzbound$, we must have $approxfunction = approxfunction_{levelindex+1} = \\cdots$. Since the condition on $mainfunction$ and $lipschitzbound$ implies that $mainfunction$ is continuous, we must also have $approxfunction = mainfunction$, completing the proof.\n\n\\noindent\n\\textbf{Remark:}\nThe condition on $mainfunction$ and $lipschitzbound$ is called \\emph{Lipschitz continuity}.\n\n\\noindent\n\\textbf{Remark:}\nAn alternate approach is to prove that for each $inputvalue  \\in [0,1)$, there exists $\\epsilon  \\in (0, 1-inputvalue)$ such that the restriction of $mainfunction$ to $[inputvalue, inputvalue+\\epsilon)$ is linear;\none may then deduce the claim using the compactness of $[0,1]$. In this approach, the role of the Farey sequence may also be played by the convergents of the continued fraction of $inputvalue$ (at least in the case where $inputvalue$ is irrational).\n\n\\noindent\n\\textbf{Remark:} This problem and solution are due to one of us (Kedlaya). Some related results can be proved with the Lipschitz continuity condition replaced by suitable convexity conditions.\n See for example: Kiran S. Kedlaya and Philip Tynan,\nDetecting integral polyhedral functions, \\textit{Confluentes Mathematici}\n\\textbf{1} (2009), 87--109.\nSuch results arise in the theory of $p$-adic differential equations; see for example:\nKiran S. Kedlaya and Liang Xiao, Differential modules on $p$-adic polyannuli, \\textit{J. Inst. Math. Jusssieu} \\textbf{9} (2010), 155--201 (errata, \\textit{ibid.}, 669--671)."
    },
    "descriptive_long_confusing": {
      "map": {
        "f": "buttercup",
        "x": "lavender",
        "y": "cinnamon",
        "r": "elephant",
        "a": "asteroid",
        "b": "pineapple",
        "g": "strawberry",
        "n": "hurricane",
        "F_n": "sunflower",
        "f_n": "raindrop",
        "s": "waterfall",
        "m": "butterfly",
        "t": "dandelion",
        "F_n-1": "sunflowerprev",
        "f_n-1": "raindropprev",
        "K": "lightning"
      },
      "question": "Let $buttercup: [0,1] \\to \\mathbb{R}$ be a function for which there exists a constant $lightning>0$ such that $\\left| buttercup(lavender) - buttercup(cinnamon) \\right| \\leq lightning \\left| lavender - cinnamon \\right|$ for all $lavender,cinnamon \\in [0,1]$. Suppose also that for each rational number $elephant \\in [0,1]$, there exist integers $asteroid$ and $pineapple$ such that $buttercup(elephant) = asteroid + pineapple\\,elephant$. Prove that there exist finitely many intervals $I_1, \\dots, I_{hurricane}$ such that $buttercup$ is a linear function on each $I_i$ and $[0,1] = \\bigcup_{i=1}^{hurricane} I_i$. \n\n\\end{itemize}\n\n\\end{document}",
      "solution": "Let us say that a linear function $strawberry$ on an interval is \\emph{integral} if it has the form $strawberry(lavender) = asteroid + pineapple\\,lavender$ for some $asteroid,pineapple \\in \\ZZ$, and that a piecewise linear function is \\emph{integral} if on every interval where it is linear, it is also integral.\n\nFor each positive integer $hurricane$, define the $hurricane$-th \\emph{Farey sequence} $sunflower_{hurricane}$ as the sequence of rational numbers in $[0,1]$ with denominators at most $hurricane$. It is easily shown by induction on $hurricane$ that any two consecutive elements $\\frac{elephant}{waterfall},\\frac{elephant'}{waterfall'}$ of $sunflower_{hurricane}$, written in lowest terms, satisfy $\\gcd(waterfall,waterfall') = 1$, $waterfall+waterfall' > hurricane$, and $elephant'\\,waterfall - elephant\\,waterfall' = 1$. Namely, this is obvious for $hurricane=1$ because $sunflower_1 = \\frac{0}{1},\\frac{1}{1}$. To deduce the claim for $sunflower_{hurricane}$ from the claim for sunflowerprev, let $\\frac{elephant}{waterfall},\\frac{elephant'}{waterfall'}$ be consecutive elements of sunflowerprev. If $waterfall+waterfall' = hurricane$, then for $butterfly = elephant+elephant'$ we have $\\frac{elephant}{waterfall} < \\frac{butterfly}{hurricane} < \\frac{elephant'}{waterfall'}$ and the pairs $\\frac{elephant}{waterfall},\\frac{butterfly}{hurricane}$ and $\\frac{butterfly}{hurricane},\\frac{elephant'}{waterfall'}$ satisfy the desired conditions. Conversely, if $waterfall+waterfall' > hurricane$, then we cannot have $\\frac{elephant}{waterfall} < \\frac{butterfly}{hurricane} < \\frac{elephant'}{waterfall'}$ for $asteroid \\in \\ZZ$, as this yields the contradiction\n\\[\nhurricane =(butterfly\\,waterfall - elephant\\,hurricane)\\,waterfall' + (elephant'\\,hurricane - butterfly\\,waterfall') \\geq waterfall+waterfall' > hurricane;\n\\]\nhence $\\frac{elephant}{waterfall},\\frac{elephant'}{waterfall'}$ remain consecutive in $sunflower_{hurricane}$.\n\nLet $raindrop: [0,1] \\to \\RR$ be the piecewise linear function which agrees with $buttercup$ at each element of $sunflower_{hurricane}$ and is linear between any two consecutive elements of $sunflower_{hurricane}$. Between any two consecutive elements $\\frac{elephant}{waterfall},\\frac{elephant'}{waterfall'}$ of $sunflower_{hurricane}$, $raindrop$ coincides with some linear function $asteroid+pineapple\\,lavender$. Since $waterfall\\,buttercup(\\frac{elephant}{waterfall}),\\,waterfall'\\,buttercup(\\frac{elephant'}{waterfall'}) \\in \\ZZ$, we deduce first that\n\\[\npineapple = waterfall\\,waterfall'\\bigl(buttercup(\\tfrac{elephant'}{waterfall'})-buttercup(\\tfrac{elephant}{waterfall})\\bigr)\n\\]\nis an integer of absolute value at most $lightning$, and second that both $asteroid\\,waterfall = waterfall\\,buttercup(\\frac{elephant}{waterfall}) - pineapple\\,elephant$ and $asteroid\\,waterfall' = waterfall'\\,buttercup(\\frac{elephant'}{waterfall'}) - pineapple\\,elephant'$ are integral. It follows that $raindrop$ is integral.\n\nWe now check that if $hurricane > 2lightning$, then $raindrop = raindropprev$. For this, it suffices to check that for any consecutive elements $\\frac{elephant}{waterfall},\\frac{butterfly}{hurricane},\\frac{elephant'}{waterfall'}$ in $sunflower_{hurricane}$, the linear function $asteroid_0 + pineapple_0\\,lavender$ matching raindropprev from $\\frac{elephant}{waterfall}$ to $\\frac{elephant'}{waterfall'}$ has the property that $buttercup(\\frac{butterfly}{hurricane}) = asteroid_0 + pineapple_0 \\frac{butterfly}{hurricane}$. Define the integer $dandelion = hurricane\\,buttercup(\\frac{butterfly}{hurricane}) - asteroid_0\\,hurricane - pineapple_0\\,butterfly$. We then compute that the slope of $raindrop$ from $\\frac{elephant}{waterfall}$ to $\\frac{butterfly}{hurricane}$ is $pineapple_0 + waterfall\\,dandelion$, while the slope of $raindrop$ from $\\frac{butterfly}{hurricane}$ to $\\frac{elephant'}{waterfall'}$ is at most $pineapple_0 - waterfall'\\,dandelion$. In order to have $\\left|pineapple_0 + waterfall\\,dandelion\\right|,\\left|pineapple_0 - waterfall'\\,dandelion\\right| \\leq lightning$, we must have $(waterfall+waterfall')\\,\\left|dandelion\\right| \\leq 2lightning$; since $waterfall+waterfall' = hurricane > 2lightning$, this is only possible if $dandelion=0$. Hence $raindrop = raindropprev$, as claimed.\n\nIt follows that for any $hurricane > 2lightning$, we must have $raindrop = raindrop_{hurricane+1} = \\cdots$. Since the condition on $buttercup$ and $lightning$ implies that $buttercup$ is continuous, we must also have $raindrop = buttercup$, completing the proof.\n\n\\noindent\\textbf{Remark:} The condition on $buttercup$ and $lightning$ is called \\emph{Lipschitz continuity}.\n\n\\noindent\\textbf{Remark:} An alternate approach is to prove that for each $lavender \\in [0,1)$, there exists $\\epsilon \\in (0, 1-lavender)$ such that the restriction of $buttercup$ to $[lavender,lavender+\\epsilon)$ is linear; one may then deduce the claim using the compactness of $[0,1]$. In this approach, the role of the Farey sequence may also be played by the convergents of the continued fraction of $lavender$ (at least in the case where $lavender$ is irrational).\n\n\\noindent\\textbf{Remark:} This problem and solution are due to one of us (Kedlaya). Some related results can be proved with the Lipschitz continuity condition replaced by suitable convexity conditions. See for example: Kiran S. Kedlaya and Philip Tynan, Detecting integral polyhedral functions, \\textit{Confluentes Mathematici} \\textbf{1} (2009), 87--109. Such results arise in the theory of $p$-adic differential equations; see for example: Kiran S. Kedlaya and Liang Xiao, Differential modules on $p$-adic polyannuli, \\textit{J. Inst. Math. Jusssieu} \\textbf{9} (2010), 155--201 (errata, \\textit{ibid.}, 669--671).\n\n\\end{itemize}\n\\end{document}"
    },
    "descriptive_long_misleading": {
      "map": {
        "f": "constantmap",
        "x": "fixedpoint",
        "y": "staticpoint",
        "r": "irrational",
        "a": "fractional",
        "b": "curvedcoef",
        "g": "nonlinear",
        "n": "infiniteidx",
        "F_n": "endlessfarey",
        "f_n": "fluidmap",
        "s": "numerator",
        "m": "irrationalidx",
        "t": "noninteger",
        "F_n-1": "prevfareyseq",
        "f_n-1": "fluidmapprev",
        "K": "unbounded"
      },
      "question": "Let $constantmap: [0,1] \\to \\mathbb{R}$ be a function for which there exists a constant $unbounded>0$ such that $\\left| constantmap(fixedpoint) - constantmap(staticpoint) \\right| \\leq unbounded \\left| fixedpoint - staticpoint \\right|$ for all $fixedpoint,staticpoint \\in [0,1]$. Suppose also that for each rational number $irrational \\in [0,1]$, there exist integers $fractional$ and $curvedcoef$ such that $constantmap(irrational) = fractional + curvedcoef \\,irrational$. Prove that there exist finitely many intervals $I_1, \\dots, I_{infiniteidx}$ such that $constantmap$ is a linear function on each $I_i$ and $[0,1] = \\bigcup_{i=1}^{infiniteidx} I_i$. ",
      "solution": "Let us say that a linear function $nonlinear$ on an interval is \\emph{integral} if it has the form $nonlinear(fixedpoint) = fractional + curvedcoef\\,fixedpoint$ for some $fractional,curvedcoef \\in \\ZZ$, and that a piecewise linear function is \\emph{integral} if on every interval where it is linear, it is also integral.\n\nFor each positive integer $infiniteidx$, define the $infiniteidx$-th \\emph{Farey sequence} $endlessfarey$ as the sequence of rational numbers in $[0,1]$ with denominators at most $infiniteidx$. It is easily shown by induction on $infiniteidx$ that any two consecutive elements $\\frac{irrational}{numerator}, \\frac{irrational'}{numerator'}$ of $endlessfarey$, written in lowest terms, satisfy $\\gcd(numerator,numerator') = 1$, $numerator+numerator' > infiniteidx$, and $irrational'\\,numerator - irrational\\,numerator' = 1$. Namely, this is obvious for $infiniteidx=1$ because $endlessfarey = \\frac{0}{1}, \\frac{1}{1}$. To deduce the claim for $endlessfarey$ from the claim for $endlessfarey_{infiniteidx-1}$, let $\\frac{irrational}{numerator}, \\frac{irrational'}{numerator'}$ be consecutive elements of $endlessfarey_{infiniteidx-1}$. If $numerator+numerator' = infiniteidx$, then for $irrationalidx = irrational+irrational'$ we have $\\frac{irrational}{numerator} < \\frac{irrationalidx}{infiniteidx} < \\frac{irrational'}{numerator'}$ and the pairs $\\frac{irrational}{numerator},\\frac{irrationalidx}{infiniteidx}$ and $\\frac{irrationalidx}{infiniteidx}, \\frac{irrational'}{numerator'}$ satisfy the desired conditions. Conversely, if $numerator+numerator' > infiniteidx$, then we cannot have $\\frac{irrational}{numerator} < \\frac{irrationalidx}{infiniteidx} < \\frac{irrational'}{numerator'}$ for $fractional \\in \\ZZ$, as this yields the contradiction\n\\[\ninfiniteidx =(irrationalidx\\,numerator - infiniteidx\\,irrational)numerator' + (irrational'\\,infiniteidx - irrationalidx\\,numerator') \\geq numerator+numerator' > infiniteidx;\n\\]\nhence $\\frac{irrational}{numerator}, \\frac{irrational'}{numerator'}$ remain consecutive in $endlessfarey$.\n\nLet $fluidmap: [0,1] \\to \\RR$ be the piecewise linear function which agrees with $constantmap$ at each element of $endlessfarey$ and is linear between any two consecutive elements of $endlessfarey$. Between any two consecutive elements $\\frac{irrational}{numerator}, \\frac{irrational'}{numerator'}$ of $endlessfarey$, $fluidmap$ coincides with some linear function $fractional+curvedcoef\\,fixedpoint$. Since $numerator\\,constantmap(\\frac{irrational}{numerator}),\\, numerator'\\,constantmap(\\frac{irrational'}{numerator'}) \\in \\ZZ$, we deduce first that\n\\[\ncurvedcoef = numerator\\,numerator'\\Bigl( constantmap\\!\\bigl(\\tfrac{irrational'}{numerator'}\\bigr) - constantmap\\!\\bigl(\\tfrac{irrational}{numerator}\\bigr) \\Bigr)\n\\]\nis an integer of absolute value at most $unbounded$, and second that both $fractional\\,numerator = numerator\\,constantmap(\\frac{irrational}{numerator}) - curvedcoef\\,irrational$ and $fractional\\,numerator' = numerator'\\,constantmap(\\frac{irrational'}{numerator'}) - curvedcoef\\,irrational'$ are integral. It follows that $fluidmap$ is integral.\n\nWe now check that if $infiniteidx > 2\\,unbounded$, then $fluidmap = fluidmap_{infiniteidx-1}$. For this, it suffices to check that for any consecutive elements $\\frac{irrational}{numerator}, \\frac{irrationalidx}{infiniteidx}, \\frac{irrational'}{numerator'}$ in $endlessfarey$, the linear function $fractional_0 + curvedcoef_0\\,fixedpoint$ matching $fluidmap_{infiniteidx-1}$ from $\\frac{irrational}{numerator}$ to $\\frac{irrational'}{numerator'}$ has the property that $constantmap(\\frac{irrationalidx}{infiniteidx}) = fractional_0 + curvedcoef_0 \\frac{irrationalidx}{infiniteidx}$. Define the integer $noninteger = infiniteidx\\,constantmap(\\frac{irrationalidx}{infiniteidx}) - fractional_0\\,infiniteidx - curvedcoef_0\\,irrationalidx$. We then compute that the slope of $fluidmap$ from $\\frac{irrational}{numerator}$ to $\\frac{irrationalidx}{infiniteidx}$ is $curvedcoef_0+numerator\\,noninteger$, while the slope of $fluidmap$ from $\\frac{irrationalidx}{infiniteidx}$ to $\\frac{irrational'}{numerator'}$ is at most $curvedcoef_0 - numerator'\\,noninteger$. In order to have $\\left| curvedcoef_0 + numerator\\,noninteger\\right|, \\left| curvedcoef_0 - numerator'\\,noninteger\\right| \\leq unbounded$, we must have $(numerator+numerator')\\,\\left| noninteger \\right| \\leq 2\\,unbounded$; since $numerator+numerator' = infiniteidx > 2\\,unbounded$, this is only possible if $noninteger=0$. Hence $fluidmap = fluidmap_{infiniteidx-1}$, as claimed.\n\nIt follows that for any $infiniteidx > 2\\,unbounded$, we must have $fluidmap = fluidmap_{infiniteidx+1} = \\cdots$. Since the condition on $constantmap$ and $unbounded$ implies that $constantmap$ is continuous, we must also have $fluidmap = constantmap$, completing the proof.\n\n\\noindent\\textbf{Remark:} The condition on $constantmap$ and $unbounded$ is called \\emph{Lipschitz continuity}.\n\n\\noindent\\textbf{Remark:} An alternate approach is to prove that for each $fixedpoint \\in [0,1)$, there exists $\\epsilon \\in (0, 1-fixedpoint)$ such that the restriction of $constantmap$ to $[fixedpoint, fixedpoint+\\epsilon)$ is linear; one may then deduce the claim using the compactness of $[0,1]$. In this approach, the role of the Farey sequence may also be played by the convergents of the continued fraction of $fixedpoint$ (at least in the case where $fixedpoint$ is irrational).\n\n\\noindent\\textbf{Remark:} This problem and solution are due to one of us (Kedlaya). Some related results can be proved with the Lipschitz continuity condition replaced by suitable convexity conditions. See for example: Kiran S. Kedlaya and Philip Tynan, Detecting integral polyhedral functions, \\textit{Confluentes Mathematici} \\textbf{1} (2009), 87--109. Such results arise in the theory of $p$-adic differential equations; see for example: Kiran S. Kedlaya and Liang Xiao, Differential modules on $p$-adic polyannuli, \\textit{J. Inst. Math. Jusssieu} \\textbf{9} (2010), 155--201 (errata, \\textit{ibid.}, 669--671)."
    },
    "garbled_string": {
      "map": {
        "f": "qzxwvtnp",
        "x": "hjgrksla",
        "y": "nrfqsmdk",
        "r": "vcxpldbe",
        "a": "eghmltcs",
        "b": "kjsdprua",
        "g": "wprtznvo",
        "n": "oyqtfmzn",
        "F_n": "blxdrqwi",
        "f_n": "mnhgtscv",
        "s": "zpefwrkd",
        "m": "dlyqaxno",
        "t": "rscvmkhu",
        "F_n-1": "cgfjltzb",
        "f_n-1": "nkwpsyer",
        "K": "slfdrqpo"
      },
      "question": "Let $qzxwvtnp: [0,1] \\to \\mathbb{R}$ be a function for which there exists a constant $slfdrqpo>0$\nsuch that $\\left| qzxwvtnp(hjgrksla) - qzxwvtnp(nrfqsmdk) \\right| \\leq slfdrqpo \\left| hjgrksla - nrfqsmdk \\right|$ for all $hjgrksla,nrfqsmdk \\in [0,1]$.\nSuppose also that for each rational number $vcxpldbe \\in [0,1]$, there exist integers $eghmltcs$ and $kjsdprua$\nsuch that $qzxwvtnp(vcxpldbe) = eghmltcs + kjsdprua vcxpldbe$. Prove that there exist finitely many intervals $I_1, \\dots, I_{oyqtfmzn}$\nsuch that $qzxwvtnp$ is a linear function on each $I_i$ and $[0,1] = \\bigcup_{i=1}^{oyqtfmzn} I_i$. \n\n\\end{itemize}\n\n\\end{document}",
      "solution": "Let us say that a linear function $wprtznvo$ on an interval is \\emph{integral} if it has the form\n$wprtznvo(hjgrksla) = eghmltcs + kjsdprua hjgrksla$ for some $eghmltcs,kjsdprua \\in \\ZZ$, and that a piecewise linear function is \\emph{integral} if on every interval where it is linear, it is also integral.\n\nFor each positive integer $oyqtfmzn$, define the $oyqtfmzn$-th \\emph{Farey sequence} $blxdrqwi_{oyqtfmzn}$ as the sequence of rational numbers in $[0,1]$ with denominators at most $oyqtfmzn$.\nIt is easily shown by induction on $oyqtfmzn$ that any two consecutive elements $\\frac{vcxpldbe}{zpefwrkd}, \\frac{vcxpldbe'}{zpefwrkd'}$ of $blxdrqwi_{oyqtfmzn}$, written in lowest terms, satisfy $\\gcd(zpefwrkd,zpefwrkd') = 1$, $zpefwrkd+zpefwrkd' > oyqtfmzn$, and $vcxpldbe' zpefwrkd - vcxpldbe zpefwrkd' = 1$. Namely, this is obvious for $oyqtfmzn=1$ because $blxdrqwi_1 = \\frac{0}{1}, \\frac{1}{1}$. To deduce the claim for $blxdrqwi_{oyqtfmzn}$ from the claim for $cgfjltzb$, let $\\frac{vcxpldbe}{zpefwrkd}, \\frac{vcxpldbe'}{zpefwrkd'}$ be consecutive elements of $cgfjltzb$. If $zpefwrkd+zpefwrkd' = oyqtfmzn$, then for $dlyqaxno = vcxpldbe+vcxpldbe'$ we have $\\frac{vcxpldbe}{zpefwrkd} < \\frac{dlyqaxno}{oyqtfmzn} < \\frac{vcxpldbe'}{zpefwrkd'}$ and the pairs $\\frac{vcxpldbe}{zpefwrkd},\\frac{dlyqaxno}{oyqtfmzn}$ and $\\frac{dlyqaxno}{oyqtfmzn}, \\frac{vcxpldbe'}{zpefwrkd'}$ \nsatisfy the desired conditions. Conversely, if $zpefwrkd+zpefwrkd' > oyqtfmzn$, then we cannot have $\\frac{vcxpldbe}{zpefwrkd} < \\frac{dlyqaxno}{oyqtfmzn} < \\frac{vcxpldbe'}{zpefwrkd'}$ for $eghmltcs \\in \\ZZ$, as this yields the contradiction\n\\[\noyqtfmzn =(dlyqaxno zpefwrkd - oyqtfmzn vcxpldbe)zpefwrkd' + (vcxpldbe' oyqtfmzn - dlyqaxno zpefwrkd') \\geq zpefwrkd+zpefwrkd' > oyqtfmzn;\n\\]\nhence $\\frac{vcxpldbe}{zpefwrkd}, \\frac{vcxpldbe'}{zpefwrkd'}$ remain consecutive in $blxdrqwi_{oyqtfmzn}$. \n\nLet $mnhgtscv: [0,1] \\to \\RR$ be the piecewise linear function which agrees with $qzxwvtnp$ at each element of $blxdrqwi_{oyqtfmzn}$ and is linear between any two consecutive elements of $blxdrqwi_{oyqtfmzn}$.\nBetween any two consecutive elements $\\frac{vcxpldbe}{zpefwrkd}, \\frac{vcxpldbe'}{zpefwrkd'}$ of $blxdrqwi_{oyqtfmzn}$,\n$mnhgtscv$ coincides with some linear function $eghmltcs+kjsdprua hjgrksla$. Since $zpefwrkd qzxwvtnp(\\frac{vcxpldbe}{zpefwrkd}), zpefwrkd' qzxwvtnp(\\frac{vcxpldbe'}{zpefwrkd'}) \\in \\ZZ$, we deduce first that\n\\[\nkjsdprua = zpefwrkd zpefwrkd' \\bigl(qzxwvtnp(\\tfrac{vcxpldbe'}{zpefwrkd'}) - qzxwvtnp(\\tfrac{vcxpldbe}{zpefwrkd})\\bigr)\n\\]\nis an integer of absolute value at most $slfdrqpo$,\nand second that both $eghmltcs zpefwrkd = zpefwrkd qzxwvtnp(\\frac{vcxpldbe}{zpefwrkd}) - kjsdprua vcxpldbe$ and $eghmltcs zpefwrkd' = zpefwrkd' qzxwvtnp(\\frac{vcxpldbe'}{zpefwrkd'}) - kjsdprua vcxpldbe'$ are integral. It follows that $mnhgtscv$ is integral.\n\nWe now check that if $oyqtfmzn > 2 slfdrqpo$, then $mnhgtscv = nkwpsyer$. \nFor this, it suffices to check that for any consecutive elements $\\frac{vcxpldbe}{zpefwrkd}, \\frac{dlyqaxno}{oyqtfmzn}, \\frac{vcxpldbe'}{zpefwrkd'}$ in $blxdrqwi_{oyqtfmzn}$, the linear function $eghmltcs_0 + kjsdprua_0 hjgrksla$ matching $nkwpsyer$ from $\\frac{vcxpldbe}{zpefwrkd}$ to $\\frac{vcxpldbe'}{zpefwrkd'}$ has the property that $qzxwvtnp(\\frac{dlyqaxno}{oyqtfmzn}) = eghmltcs_0 + kjsdprua_0 \\frac{dlyqaxno}{oyqtfmzn}$. Define the integer $rscvmkhu = oyqtfmzn qzxwvtnp(\\frac{dlyqaxno}{oyqtfmzn}) - eghmltcs_0 oyqtfmzn - kjsdprua_0 dlyqaxno$. \nWe then compute that the slope of $mnhgtscv$ from $\\frac{vcxpldbe}{zpefwrkd}$ to $\\frac{dlyqaxno}{oyqtfmzn}$ is $kjsdprua_0+zpefwrkd rscvmkhu$,\nwhile the slope of $mnhgtscv$ from $\\frac{dlyqaxno}{oyqtfmzn}$ to $\\frac{vcxpldbe'}{zpefwrkd'}$ is at most $kjsdprua_0 -zpefwrkd' rscvmkhu$.\nIn order to have $\\left| kjsdprua_0 + zpefwrkd \\, rscvmkhu\\right|, \\left| kjsdprua_0 - zpefwrkd' \\, rscvmkhu\\right| \\leq slfdrqpo$, we must have\n$(zpefwrkd+zpefwrkd') \\left| rscvmkhu \\right| \\leq 2 slfdrqpo$; since $zpefwrkd+zpefwrkd' = oyqtfmzn > 2 slfdrqpo$, this is only possible if $rscvmkhu=0$.\nHence $mnhgtscv = nkwpsyer$, as claimed.\n\nIt follows that for any $oyqtfmzn > 2 slfdrqpo$, we must have $mnhgtscv = mnhgtscv_{oyqtfmzn+1} = \\cdots$. Since the condition on $qzxwvtnp$ and $slfdrqpo$ implies that $qzxwvtnp$ is continuous, we must also have $mnhgtscv = qzxwvtnp$, completing the proof.\n\n\\noindent\n\\textbf{Remark:}\nThe condition on $qzxwvtnp$ and $slfdrqpo$ is called \\emph{Lipschitz continuity}.\n\n\\noindent\n\\textbf{Remark:}\nAn alternate approach is to prove that for each $hjgrksla  \\in [0,1)$, there exists $\\epsilon  \\in (0, 1-hjgrksla)$ such that the restriction of $qzxwvtnp$ to $[hjgrksla, hjgrksla+\\epsilon)$ is linear;\none may then deduce the claim using the compactness of $[0,1]$. In this approach, the role of the Farey sequence may also be played by the convergents of the continued fraction of $hjgrksla$ (at least in the case where $hjgrksla$ is irrational).\n\n\\noindent\n\\textbf{Remark:} This problem and solution are due to one of us (Kedlaya). Some related results can be proved with the Lipschitz continuity condition replaced by suitable convexity conditions.\n See for example: Kiran S. Kedlaya and Philip Tynan,\nDetecting integral polyhedral functions, \\textit{Confluentes Mathematici}\n\\textbf{1} (2009), 87--109.\nSuch results arise in the theory of $p$-adic differential equations; see for example:\nKiran S. Kedlaya and Liang Xiao, Differential modules on $p$-adic polyannuli, \\textit{J. Inst. Math. Jusssieu} \\textbf{9} (2010), 155--201 (errata, \\textit{ibid.}, 669--671).\n\n\\end{itemize}\n\\end{document}"
    },
    "kernel_variant": {
      "question": "Let f:[0,2]→ℝ be a function such that\n|f(x)−f(y)|≤L|x−y|  (x,y∈[0,2])\nfor some real constant L>0. Assume moreover that for every rational r∈[0,2] there exist integers a,b with\n  f(r)=a+br.\nShow that there exist finitely many closed intervals J₁,…,J_m whose union is [0,2] and on each J_k the restriction of f coincides with an integral linear function x↦a+bx (a,b∈ℤ).",
      "solution": "Throughout let L>0 be the given Lipschitz constant and work on the interval [0,2].  \n\n1.  Farey sequences on [0,2].  For any integer N≥0 define the N-th Farey sequence on [0,2]\n  F_N:= {r/s∈[0,2]: r,s∈ℤ, s≥1, gcd(r,s)=1, s≤max{1,N}} \nlisted in increasing order.  Thus F_0={0/1,2/1}.  For N≥1 we obtain the usual Farey sequence with denominators ≤N, shifted to the interval [0,2].  Consecutive terms r/s<r′/s′ in F_N satisfy\n  r′s−rs′=1 and gcd(s,s′)=1.\nPassing from F_{N−1} to F_N inserts exactly the mediants (r+r′)/(s+s′) for which s+s′=N.\n\n2.  The interpolants f_N.  For every N≥0 define f_N:[0,2]→ℝ to be the function that agrees with f on F_N and is affine on each interval between consecutive elements of F_N.\n\nClaim.  Each f_N is integral piecewise linear and every slope belongs to ℤ∩[−L,L].\n\nProof.  Let r/s<r′/s′ be consecutive in F_N.  By the hypothesis there are A,B,A′,B′∈ℤ with f(r/s)=A+Br/s and f(r′/s′)=A′+B′r′/s′.  Because r′s−rs′=1, the slope\n  m=(f(r′/s′)−f(r/s))/(r′/s′−r/s)=ss′(f(r′/s′)−f(r/s))\nis an integer.  Moreover\n  |m|=ss′|f(r′/s′)−f(r/s)|≤ss′L|r′/s′−r/s|=L,\nso m∈ℤ and |m|≤⌊L⌋.  Writing the affine piece g(x)=mx+c, we have\n  c=f(r/s)−m(r/s),\nso sc=s f(r/s)−mr is integral; similarly s′c is integral.  Because gcd(s,s′)=1, c∈ℤ.∎\n\n3.  Stabilisation for N>max{1,2L}.  Let N>max{1,2L}.  Any new point of F_N\\F_{N−1} is the mediant m/N=(r+r′)/(s+s′) of consecutive r/s<r′/s′ in F_{N−1}, with s+s′=N.  On [r/s,r′/s′] the function f_{N−1} is already g(x)=a₀+b₀x with b₀∈ℤ, |b₀|≤L.  Put\n  t:=Nf(m/N)−(a₀N+b₀m)∈ℤ.\nInserting the point (m/N,f(m/N)) would create slopes b₀+st and b₀−s′t on the two sub-intervals.  Lipschitz continuity of f forces\n  |b₀+st|≤L and |b₀−s′t|≤L.\nHence N|t|=(s+s′)|t|≤2L, so |t|<1 because N>2L.  Thus t=0 and f(m/N)=a₀+b₀(m/N); no new breakpoint is introduced.  Therefore f_N=f_{N−1} whenever N>max{1,2L}. In particular the sequence (f_N)_N stabilises from N₀:=⌊max{1,2L}⌋+1 on: f_N=g for all N≥N₀.\n\n4.  Identification with f.  The set ⋃_{N≥0}F_N is the set of all rationals in [0,2], which is dense.  For these points we have f=f_N=g.  Because f is Lipschitz, hence continuous, we conclude f≡g on [0,2].  Finally, g—and therefore f—is integral piecewise linear with breakpoints among the finitely many elements of F_{N₀}.  Hence [0,2] can be written as a finite union of closed intervals on each of which f(x)=a+bx with a,b∈ℤ, as desired. ∎",
      "_meta": {
        "core_steps": [
          "Interpolate: build f_n by linear interpolation of f on rationals with denominator ≤ n (Farey points).",
          "Arithmetic bound: show each segment’s slope is an integer with |slope| ≤ K (Lipschitz → integrality).",
          "Stabilisation: for n exceeding a fixed multiple of K, new intermediate rationals cannot change the slope, so f_n = f_{n-1}.",
          "Limit: Lipschitz ⇒ continuity, hence the eventually-constant f_n coincides with f.",
          "Conclusion: finitely many breakpoints ⇒ f is integral linear on each interval, covering [0,1]."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Choice of domain endpoints; a linear rescaling keeps all arguments intact.",
            "original": "[0,1]"
          },
          "slot2": {
            "description": "Symbol and magnitude of the Lipschitz bound; only finiteness matters.",
            "original": "K (any positive real constant)"
          },
          "slot3": {
            "description": "The numerical factor in the cut-off n > 2K that guarantees stabilisation; any factor >1 works with trivial adjustments.",
            "original": "2 in the inequality n > 2K"
          },
          "slot4": {
            "description": "The specific rational net (Farey sequence) used; any dense net with the same coprime-adjacent property (e.g. Stern–Brocot or continued-fraction convergents) suffices.",
            "original": "Farey sequences F_n"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof",
  "iteratively_fixed": true
}