1

Let's hypothesize a function $f(x)$ that checks the validity of some value $x$ in a set of number $X$. At the beginning each number is valid, so $f(x)=1$ for all $x$.

Then we define a higher-order function $g$, that takes a number $x_i$ and works on $f$, so that $g(x_i, f) = f'$ and $f'(x) = 0$ for $x = x_i$ and $f'(x) = 1$ for every other $x$.

Reapplying it on $f'$: $g(x_j, f') = f''(x)$ that returns $0$ for both $x_i$ and $x_j$ but $1$ for every other number of the set.

Is there any set of $f,g,\{x\}$ that satisfies these properties?

peterwhy
  • 22,256
pava
  • 11
  • 2
  • Does $g(x_i,f) = f'$ mean $g$ takes a function as a second argument and returns a function? – peterwhy Feb 07 '24 at 23:17
  • I'm not sure what you're trying to 'solve'. Also, not sure what 'validity' means. Would $g$ just be $g(x_i) = 0$ and $g(x_k) = 1$ for $k \neq i$? As someone else commented, it seems the domain of $g$ is the same as $f$. So, some $f'$ is unneeded. – J126 Feb 07 '24 at 23:19
  • If you mean $g$ is a higher-order function like the following, I think it would be valid:

    $$(g(x_i, _))(x) = [x_i\ne x] = \begin{cases}0, &x=x_i\ 1, &\text{otherwise}\end{cases}$$

    where the $[\ldots]$ is the Iverson bracket.

    – peterwhy Feb 07 '24 at 23:25
  • Yes I mean g as a higher-order function that takes f and a value x_i and returns f' so that f' applied over x_i = 0 but returns 1 for every other value. Than I can reapply g to f' (with another x_j) giving f'', so that f''(x) is 0 for both x_i and x_j, but 1 for every other value. – pava Feb 08 '24 at 00:19

1 Answers1

0

Define $g: (X, X\to\{0,1\})\to X \to \{0,1\}$ where

$$\begin{align*} (g(x_i, p))(x) &= \begin{cases} 0, &x=x_i\\ 0, &p(x) = 0\\ 1, &p(x) = 1 \land x\ne x_1 \end{cases}\\ &= \begin{cases} 0, &x=x_i\\ p(x), &\text{otherwise} \end{cases} \end{align*}$$

peterwhy
  • 22,256