Functions of finite subsets of a set I found an old exam and this question appeared:
Let $X$ be a set and $X^{fin}$ denote the set of all finite subsets of $X$. We say for $n\in\mathbb{N}$ that $X$ is $n$-good if there exists a function $f:X^{fin}\rightarrow X^{fin}$ such that for all subsets $A$ of cardinality $n$ there exists $B\subsetneq A$ such that $A\subseteq f(B)$. Show that $X$ is $n+2$-good iff $|X|\leq \aleph_n$.
Edit: This problem makes since contrary to what I initially thought. For the case where $n=0$ we have that if $\vert X \vert\leq \aleph_0$ then if it is finite we can simply set the function to be the constant function $f(A)=X$ as Erick Wofsey pointed out or you could just send the empty set to $X$ and leave everything constant. In the case where $\vert X \vert=\aleph_0$ we can wlog asume $X=\omega$ and let $f$ send $\{a\}\mapsto a+1=\{0,1,\dots,a\}$ This funciton has the desired property.
Edit 2: I believe I have a solution for the $(\leftarrow)$ implication:
We proceed by induction on $n$ and we already shown the base case. Wlog we can assume that $X=\omega_{n+1}$. For each $\alpha\in\omega_{n+1}$ we have it's one of it's initial segments so it's cardinality is $\aleph_n$ so there is a $n$-good function $f_\alpha:\alpha^{fin}\rightarrow\alpha^{fin}$ by the induction hypothesis. We set $\tilde{f}_\alpha$ to be defined on all the finite sets of $\alpha+1$ that contain $\alpha$ to itself by $A\cup\{\alpha\}\mapsto f_\alpha(A)\cup\{\alpha\}$. Let $f=\bigcup_{\alpha\in\omega_{n+1}}f_\alpha$. This is the $n+1$-good function we were looking for.
 A: Let me prove the slightly stronger statement that for any $n\in\mathbb{N}$, $X$ is $(n+1)$-good iff $|X|<\aleph_n$ (this is stronger than your statement only in that it includes the case $n=0$).  We will use induction on $n$.  The base case $n=0$ is trivial: for $X$ to be $n$-good, the only possible choice of $B$ is $\emptyset$ so you need $f(\emptyset)$ to contain every singleton, i.e. $f(\emptyset)=X$, which is allowed iff $X$ is finite.  (Taking $f(\emptyset)=X$ also shows that every finite set is $n$-good for all $n>0$.)
For the induction step, we will prove that for $n>0$, an infinite set $X$ is $(n+1)$-good iff every subset of $X$ of strictly smaller cardinality is $n$-good.  For the forward direction, suppose $X$ is $(n+1)$-good (witnessed by a function $f$) and $Y\subset X$ has strictly smaller cardinality.  Let $$Z=Y\cup\bigcup_{A\in Y^{fin}}f(A).$$ Then $Z$ also has strictly smaller cardinality than $X$ ($Z$ is finite if $Y$ is finite, and $|Z|\leq|Y|$ if $Y$ is infinite).  In particular, $Z$ is not all of $X$, so we can pick some $x\in X\setminus Z$.  Now define $g:Y^{fin}\to Y^{fin}$ by $g(A)=f(A\cup\{x\})\cap Y$.  I claim that $g$ witnesses that $Y$ is $n$-good.  To prove this, let $A\subseteq Y$ have $n$ elements.  Then $A\cup\{x\}$ has $n+1$ elements, so there is some $B\subset A\cup\{x\}$ such that $A\cup\{x\}\subseteq f(B)$.  Now by our choice of $x$, this $B$ must contain $x$, since otherwise $B$ would be contained in $Y$ so $f(B)\subseteq Z$ could not contain $x$.  We then have $g(B\setminus\{x\})=f(B)\cap Y\supseteq A$, so $B\setminus \{x\}$ is our required subset of $A$.
Conversely (and this argument is basically the same as the one you propose), suppose every subset of $X$ of strictly smaller cardinality is $n$-good.  Pick a total ordering $\leq$ on $X$ such that for each $x\in X$, $I(x)=\{y\in X:y< x\}$ has cardinality strictly smaller than that of $X$ (for instance, $\leq$ could be a well-ordering of $X$ of minimal length).  For each $x\in X$, pick a function $g_x:I(x)^{fin}\to I(x)^{fin}$ witnessing that $I(x)$ is $n$-good.  Now define $f:X^{fin}\to X^{fin}$ as follows: if $A\subseteq X$ is any nonempty subset, let $x$ be its greatest element with respect to $\leq$ and define $f(A)=g_x(A\setminus\{x\})\cup\{x\}$.  (And define $f(\emptyset)$ to be whatever you want.)  I claim that this $f$ witnesses that $X$ is $(n+1)$-good.  Indeed, suppose $A\subset X$ has $n+1$ elements and let $x$ be its greatest element.  Since $g_x$ witnesses that $I(x)$ is $n$-good, there is a subset $B\subset A\setminus\{x\}$ such that $A\setminus \{x\}\subseteq g_x(B)$.  We then have $f(B\cup\{x\})=g_x(B)\cup\{x\}\supseteq A$, so $B\cup\{x\}$ is the desired subset of $A$.
