hcju/stacksqa huggingface dataset:
Let us observe that given $V$ and $V \to Y$ as in (2) without any further assumption on $f$ we see that the morphism $X \times_Y V \to V$ corresponds to a surjective morphism $B \to A$ in $\textit{WAdm}^{Noeth}$ by Formal Spaces, Lemma \ref{formal-spaces-lemma-closed-immersion-into-countably-indexed}. \medskip\noindent Assume (1). By Lemma \ref{lemma-base-change-rig-surjective} we see that $\text{Spf}(A) \to \text{Spf}(B)$ is rig-surjective. Let $I \subset B$ be an ideal of definition. Since $B$ is adic, $I^m \subset B$ is an ideal of definition for all $m \geq 1$. If $I^m J^n \not = 0$ for all $n, m \geq 1$, then $IJ$ is not nilpotent, hence $V(IJ) \not = \Spec(B)$. Thus we can find a prime ideal $\mathfrak p \subset B$ with $\mathfrak p \not \in V(I) \cup V(J)$. Observe that $I(B/\mathfrak p) \not = B/\mathfrak p$ hence we can find a maximal ideal $\mathfrak p + I \subset \mathfrak m \subset B$. By Algebra, Lemma \ref{algebra-lemma-exists-dvr} we can find a discrete valuation ring $R$ and an injective local ring homomorphism $(B/\mathfrak p)_\mathfrak m \to R$. Clearly, the ring map $B \to R$ cannot factor through $A = B/J$. According to Lemma \ref{lemma-monomorphism-rig-surjective} this contradicts the fact that $\text{Spf}(A) \to \text{Spf}(B)$ is rig-surjective. Hence for some $n, m$ we do have $I^n J^m = 0$ which shows that (2) holds. \medskip\noindent Assume (2). By Lemma \ref{lemma-upshot} it suffices to show that $\text{Spf}(A) \to \text{Spf}(B)$ is rig-surjective. Pick an ideal of definition $I \subset B$ and an integer $n$ such that $I J^n = 0$. Consider a ring map $B \to R$ where $R$ is a discrete valuation ring and the image of $I$ is nonzero. Since $R$ is a domain, we conclude the image of $J$ in $R$ is zero. Hence $B \to R$ factors through the surjection $B \to A$ and we are done by definition of rig-surjective morphisms.
Let $I$ and $J$ be ideals of a ring $B$ such that $IJ^n = 0$ and $I(J/J^2) = 0$. Then $I^nJ = 0$ (proof omitted). Hence this lemma follows from a trivial combination of Lemmas \ref{lemma-closed-immersion-rig-smooth} and \ref{lemma-closed-immersion-rig-surjective}.
Let $\pi \in A$ be the uniformizer. Recall that an $A$-module is flat if and only if the $\pi$-power torsion is $0$. \medskip\noindent First assume that $X$ is an affine formal algebraic space. Then $X = \text{Spf}(B)$ with $B$ an adic Noetherian $A$-algebra. In this case we set $X' = \text{Spf}(B')$ where $B' = B/\pi\text{-power torsion}$. It is clear that $X'$ is flat over $A$ and that $X' \to X$ is a closed immersion. Let $g : Y \to X$ be a morphism of locally Noetherian formal algebraic spaces with $Y$ flat over $A$. Choose a covering $\{Y_j \to Y\}$ as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. Then $Y_j = \text{Spf}(C_j)$ with $C_j$ flat over $A$. Hence the morphism $Y_j \to X$, which correspond to a continuous $R$-algebra map $B \to C_j$, factors through $X'$ as clearly $B \to C_j$ kills the $\pi$-power torsion. Since $\{Y_j \to Y\}$ is a covering and since $X' \to X$ is a monomorphism, we conclude that $g$ factors through $X'$. \medskip\noindent Let $X$ and $\{X_i \to X\}_{i \in I}$ be as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. For each $i$ let $X'_i \to X_i$ be the flat part as constructed above. For $i, j \in I$ the projection $X'_i \times_X X_j \to X'_i$ is an \'etale (by assumption) morphism of schemes (by Formal Spaces, Lemma \ref{formal-spaces-lemma-presentation-representable}). Hence $X'_i \times_X X_j$ is flat over $A$ as morphisms representable by algebraic spaces and \'etale are flat (Lemma \ref{lemma-representable-flat}). Thus the projection $X'_i \times_X X_j \to X_j$ factors through $X'_j$ by the universal property. We conclude that $$ R_{ij} = X'_i \times_X X_j = X'_i \times_X X'_j = X_i \times_X X'_j $$ because the morphisms $X'_i \to X_i$ are injections of sheaves. Set $U = \coprod X'_i$, set $R = \coprod R_{ij}$, and denote $s, t : R \to U$ the two projections. As a sheaf $R = U \times_X U$ and $s$ and $t$ are \'etale. Then $(t, s) : R \to U$ defines an \'etale equivalence relation by our observations above. Thus $X' = U/R$ is an algebraic space by Spaces, Theorem \ref{spaces-theorem-presentation}. By construction the diagram $$ \xymatrix{ \coprod X'_i \ar[r] \ar[d] & \coprod X_i \ar[d] \\ X' \ar[r] & X } $$ is cartesian. Since the right vertical arrow is \'etale surjective and the top horizontal arrow is representable and a closed immersion we conclude that $X' \to X$ is representable by Bootstrap, Lemma \ref{bootstrap-lemma-after-fppf-sep-lqf}. Then we can use Spaces, Lemma \ref{spaces-lemma-descent-representable-transformations-property} to conclude that $X' \to X$ is a closed immersion. \medskip\noindent Finally, suppose that $Y \to X$ is a morphism with $Y$ a locally Noetherian formal algebraic space flat over $A$. Then each $X_i \times_X Y$ is \'etale over $Y$ and therefore flat over $A$ (see above). Then $X_i \times_X Y \to X_i$ factors through $X'_i$. Hence $Y \to X$ factors through $X'$ because $\{X_i \times_X Y \to Y\}$ is an \'etale covering.
(Aside: the diagonal is always locally of finite type by Formal Spaces, Lemma \ref{formal-spaces-lemma-diagonal-morphism-formal-algebraic-spaces} and $X \times_{\text{Spf}(A)} X$ is locally Noetherian by Formal Spaces, Lemmas \ref{formal-spaces-lemma-base-change-finite-type} and \ref{formal-spaces-lemma-locally-finite-type-locally-noetherian}. Thus imposing the conditions on the diagonal morphism makes sense.) The diagram $$ \xymatrix{ X' \ar[r] \ar[d] & X' \times_{\text{Spf}(A)} X' \ar[d] \\ X \ar[r] & X \times_{\text{Spf}(A)} X } $$ is cartesian. Hence $X' \to X' \times_{\text{Spf}(A)} X'$ is rig-\'etale and rig-surjective by Lemma \ref{lemma-base-change-rig-surjective}. Choose an affine formal algebraic space $U$ and a morphism $U \to X'$ which is representable by algebraic spaces and \'etale. Then $U = \text{Spf}(B)$ where $B$ is an adic Noetherian topological ring which is a flat $A$-algebra, whose topology is the $\pi$-adic topology where $\pi \in A$ is a uniformizer, and such that $A/\pi^n A \to B/\pi^n B$ is of finite type for each $n$. For later use, we remark that this in particular implies: if $B \not = 0$, then the map $\text{Spf}(B) \to \text{Spf}(A)$ is a surjection of sheaves (please recall that we are using the fppf topology as always). Repeating the argument above, we see that $$ W = U \times_{X'} U = X' \times_{X' \times_{\text{Spf}(A)} X'} (U \times_{\text{Spf}(A)} U) \longrightarrow U \times_{\text{Spf}(A)} U $$ is a closed immersion and rig-\'etale and rig-surjective. We have $U \times_{\text{Spf}(A)} U = \text{Spf}(B \widehat{\otimes}_A B)$ by Formal Spaces, Lemma \ref{formal-spaces-lemma-fibre-product-affines-over-separated}. Then $B \widehat{\otimes}_A B$ is a flat $A$-algebra as the $\pi$-adic completion of the flat $A$-algebra $B \otimes_A B$. Hence $W = U \times_{\text{Spf}(A)} U$ by Lemma \ref{lemma-closed-immersion-rig-smooth-rig-surjective}. In other words, we have $U \times_{X'} U = U \times_{\text{Spf}(A)} U$ which in turn means that the image of $U \to X'$ (as a map of sheaves) maps injectively to $\text{Spf}(A)$. Choose a covering $\{U_i \to X'\}$ as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. In particular $\coprod U_i \to X'$ is a surjection of sheaves. By applying the above to $U_i \coprod U_j \to X'$ (using the fact that $U_i \amalg U_j$ is an affine formal algebraic space as well) we see that $X' \to \text{Spf}(A)$ is an injective map of fppf sheaves. Since $X'$ is flat over $A$, either $X'$ is empty (if $U_i$ is empty for all $i$) or the map is an isomorphism (if $U_i$ is nonempty for some $i$ when we have seen that $U_i \to \text{Spf}(A)$ is a surjective map of sheaves) and the proof is complete.
One direction is trivial. For the other, suppose that $\text{Spf}(R) \to Y$ is an adic morphism such that there exists an extension of complete discrete valuation rings $R \subset R'$ with $\text{Spf}(R') \to \text{Spf}(R) \to X$ factoring through $Y$. Consider the fibre product diagram $$ \xymatrix{ \text{Spf}(R') \ar[r] \ar[rd] & \text{Spf}(R) \times_Y X \ar[r] \ar[d]^p & X \ar[d]^f \\ & \text{Spf}(R) \ar[r] & Y } $$ The morphism $p$ is locally of finite type as a base change of $f$, see Formal Spaces, Lemma \ref{formal-spaces-lemma-base-change-finite-type}. The diagonal morphism $\Delta_p$ is the base change of $\Delta_f$ and hence is rig-\'etale and rig-surjective. By Lemma \ref{lemma-flat-and-diagonal-rig-surjective} the flat locus of $\text{Spf}(R) \times_Y X$ over $R$ is either $\emptyset$ or equal to $\text{Spf}(R)$. However, since $\text{Spf}(R')$ factors through it we conclude it is not empty and hence we get a morphism $\text{Spf}(R) \to \text{Spf}(R) \times_Y X \to X$ as desired.
(Finite type morphisms of formal algebraic spaces are discussed in Formal Spaces, Section \ref{formal-spaces-section-finite-type}.) Namely, suppose that $Z \to X$ is a morphism from a scheme into $X$ such that $|Z|$ maps into $T$. From the cartesian square above we see that $Z \times_X X'$ is an algebraic space representing $Z \times_{X_{/T}} X'_{/T'}$. Since $Z \times_X X' \to Z$ is locally of finite type by Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-base-change-finite-type} we conclude.
(Quasi-compact morphisms of formal algebraic spaces are discussed in Formal Spaces, Section \ref{formal-spaces-section-quasi-compact}.) We have to show that $(X'_{/T'})_{red} \to (X_{/T})_{red}$ is a quasi-compact morphism of algebraic spaces. By Formal Spaces, Lemma \ref{formal-spaces-lemma-reduction-completion} this is the morphism $Z' \to Z$ where $Z' \subset X'$, resp.\ $Z \subset X$ is the reduced induced algebraic space structure on $T'$, resp.\ $T$. It follows that $Z' \to f^{-1}Z = Z \times_X X'$ is a thickening (a closed immersion defining an isomorphism on underlying topological spaces). Since $Z \times_X X' \to Z$ is quasi-compact as a base change of $f$ (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-base-change-quasi-compact}) we conclude that $Z' \to Z$ is too by More on Morphisms of Spaces, Lemma \ref{spaces-more-morphisms-lemma-thicken-property-morphisms}.
(Separation conditions on morphisms of formal algebraic spaces are discussed in Formal Spaces, Section \ref{formal-spaces-section-separation-axioms}.) We have to show that if $\Delta_f$ is quasi-compact, resp.\ a closed immersion, then the same is true for $\Delta_{f_{/T}}$. This follows from the discussion in Remark \ref{remark-diagonal-gives-diagonal} and Lemmas \ref{lemma-quasi-compact-gives-quasi-compact} and \ref{lemma-closed-immersion-gives-closed-immersion}.
The strategy of the proof is this: reduce to the case where $X$ and $X'$ are affine, translate the affine case into algebra, and finally apply Lemma \ref{lemma-rig-smooth}. We urge the reader to skip the details. \medskip\noindent Choose a surjective \'etale morphism $W \to X$ with $W = \coprod W_i$ a disjoint union of affine schemes, see Properties of Spaces, Lemma \ref{spaces-properties-lemma-cover-by-union-affines}. For each $i$ choose a surjective \'etale morphism $W'_i \to W_i \times_X X'$ where $W'_i = \coprod W'_{ij}$ is a disjoint union of affines. In particular $\coprod W'_{ij} \to X'$ is surjective and \'etale. Denote $f_{ij} : W_{ij} \to W_i$ the given morphism. Denote $T_i \subset W_i$ and $T'_{ij} \subset W_{ij}$ the inverse images of $T$. Since taking the completion along the inverse image of $T$ produces cartesian diagrams (see above) we have $(W_i)_{/T_i} = W_i \times_X X_{/T}$ and similarly $(W'_{ij})_{/T'_{ij}} = W'_{ij} \times_{X'} X'_{/T'}$. Moreover, recall that $(W_i)_{/T_i}$ and $(W'_{ij})_{/T'_{ij}}$ are affine formal algebraic spaces. Hence $\{W'_{ij})_{/T'_{ij}} \to X'_{/T'}\}$ is a covering as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. By Lemma \ref{lemma-rig-smooth-morphisms} we see that it suffices to prove that $$ (W'_{ij})_{/T'_{ij}} \longrightarrow (W_i)_{/T_i} $$ is rig-smooth. Observe that $W'_{ij} \to W_i$ is locally of finite type and induces a smooth morphism $W'_{ij} \setminus T'_{ij} \to W_i \setminus T_i$ (as this is true for $f$ and these properties of morphisms are \'etale local on the source and target). Observe that $W_i$ is locally Noetherian (as $X$ is locally Noetherian and this property is \'etale local on the algebraic space). Hence it suffices to prove the lemma when $X$ and $X'$ are affine schemes. \medskip\noindent Assume $X = \Spec(A)$ and $X' = \Spec(A')$ are affine schemes. Since $X$ is Noetherian, we see that $A$ is Noetherian. The morphism $f$ is given by a ring map $A \to A'$ of finite type. Let $I \subset A$ be an ideal cutting out $T$. Then $IA'$ cuts out $T'$. Also $\Spec(A') \to \Spec(A)$ is smooth over $\Spec(A) \setminus T$. Let $A^\wedge$ and $(A')^\wedge$ be the $I$-adic completions. We have $X_{/T} = \text{Spf}(A^\wedge)$ and $X'_{/T'} = \text{Spf}((A')^\wedge)$, see proof of Formal Spaces, Lemma \ref{formal-spaces-lemma-formal-completion-types}. By Lemma \ref{lemma-rig-smooth} we see that $(A')^\wedge$ is rig-smooth over $(A. I)$ which in turn means that $A^\wedge \to (A')^\wedge$ is rig-smooth which finally implies that $X'_{/T'} \to X_{/T}$ is rig smooth by Lemma \ref{lemma-rig-smooth-morphisms}.
(The statement makes sense by Lemma \ref{lemma-map-completions-finite-type} and Formal Spaces, Lemma \ref{formal-spaces-lemma-formal-completion-types}.) Let $R$ be a complete discrete valuation ring with fraction field $K$. Let $p : \text{Spf}(R) \to X_{/T}$ be an adic morphism of formal algebraic spaces. By Formal Spaces, Lemma \ref{formal-spaces-lemma-adic-into-completion} the composition $\text{Spf}(R) \to X_{/T} \to X$ corresponds to a morphism $q : \Spec(R) \to X$ which maps $\Spec(K)$ into $U$. Since $U' \to U$ is proper and surjective we see that $\Spec(K) \times_U U'$ is nonempty and proper over $K$. Hence we can choose a field extension $K'/K$ and a commutative diagram $$ \xymatrix{ \Spec(K') \ar[r] \ar[d] & U' \ar[r] \ar[d] & X' \ar[d] \\ \Spec(K) \ar[r] & U \ar[r] & X } $$ Let $R' \subset K'$ be a discrete valuation ring dominating $R$ with fraction field $K'$, see Algebra, Lemma \ref{algebra-lemma-exists-dvr}. Since $\Spec(K) \to X$ extends to $\Spec(R) \to X$ we see by the valuative criterion of properness (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-characterize-proper}) that we can extend our $K'$-point of $U'$ to a morphism $\Spec(R') \to X'$ over $\Spec(R) \to X$. It follows that the inverse image of $T'$ in $\Spec(R')$ is the closed point and we find an adic morphism $\text{Spf}((R')^\wedge) \to X'_{/T'}$ lifting $p$ as desired (note that $(R')^\wedge$ is a complete discrete valuation ring by More on Algebra, Lemma \ref{more-algebra-lemma-completion-dvr}).
The diagonal $\Delta_f : X' \to X' \times_X X'$ is a closed immersion and the restriction $U' \to U' \times_U U'$ of $\Delta_f$ is surjective. Hence the lemma follows from the discussion in Remark \ref{remark-diagonal-gives-diagonal} and Lemma \ref{lemma-completion-proper-surjective-rig-surjective}.
By Formal Spaces, Lemmas \ref{formal-spaces-lemma-formal-completion-types} the source and target of the arrow are locally Noetherian formal algebraic spaces. The other conditions follow from Lemmas \ref{lemma-proper-gives-proper}, \ref{lemma-etale-gives-rig-etale}, \ref{lemma-completion-proper-surjective-rig-surjective}, and \ref{lemma-separated-mono-open-diagonal-rig-surjective}.
The morphism $f'$ is proper by Formal Spaces, Lemma \ref{formal-spaces-lemma-base-change-proper}. The morphism $f'$ is rig-etale by Lemma \ref{lemma-base-change-rig-etale}. Then morphism $f'$ is rig-surjective by Lemma \ref{lemma-base-change-rig-surjective}. Set $X' = X \times_ Y'$. The morphism $\Delta_{f'}$ is the base change of $\Delta_f$ by the adic morphism $X' \times_{Y'} X' \to X \times_Y X$. Hence $\Delta_{f'}$ is rig-surjective by Lemma \ref{lemma-base-change-rig-surjective}.
The notation using the subscript ${}_{/T}$ in the statement refers to the construction which to a morphism of schemes $g : V \to X$ associates the morphism $g_{/T} : V_{/g^{-1}T} \to X_{/T}$ of formal algebraic spaces; it is a functor from the category of schemes over $X$ to the category of formal algebraic spaces over $X_{/T}$, see Section \ref{section-completion-functor}. Having said this, the lemma is just a reformulation of Lemma \ref{lemma-fully-faithful-etale-over-complement}.
Consider the fibre product $E = X \times_Y Z \to X$. By assumption the open immersion $X \setminus T \to X$ factors through $E$ and any morphism $\varphi : X' \to X$ with $|\varphi|(|X'|) \subset T$ factors through $E$ as well, see Formal Spaces, Section \ref{formal-spaces-section-completion}. By More on Morphisms of Spaces, Lemma \ref{spaces-more-morphisms-lemma-check-smoothness-on-infinitesimal-nbhds} this implies that $E \to X$ is \'etale at every point of $E$ mapping to a point of $T$. Hence $E \to X$ is an \'etale monomorphism, hence an open immersion (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-etale-universally-injective-open}). Then it follows that $E = X$ since our assumptions imply that $|X| = |E|$.
Let $E$ be the equalizer of $a$ and $b$. Then $E$ is an algebraic space and $E \to X$ is locally of finite type and a monomorphism, see Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-properties-diagonal}. Our assumptions imply we can apply Lemma \ref{lemma-factor} to the two morphisms $f = \text{id} : X \to X$ and $g : E \to X$ and the closed subset $T$ of $|X|$.
The notation using the subscript ${}_{/T}$ in the statement refers to the construction which to a morphism $f : X' \to X$ of algebraic spaces associates the morphism $f_{/T} : X'_{/f^{-1}T} \to X_{/T}$ of formal algebraic spaces, see Section \ref{section-completion-functor}. The morphisms $s, t : R \to U$ are \'etale over $X \setminus T$ by assumption. Since the formal completions of the maps $s, t : R \to U$ are \'etale, we see that $s$ and $t$ are \'etale for example by More on Morphisms, Lemma \ref{more-morphisms-lemma-check-smoothness-on-infinitesimal-nbhds}. Applying Lemma \ref{lemma-factor} to the morphisms $\text{id} : R \times_{U \times_X U} R \to R \times_{U \times_X U} R$ and $\Delta : R \to R \times_{U \times_X U} R$ we conclude that $(t, s)$ is a monomorphism. Applying it again to $(t \circ \text{pr}_0, s \circ \text{pr}_1) : R \times_{s, U, t} R \to U \times_X U$ and $(t, s) : R \to U \times_X U$ we find that ``transitivity'' holds. We omit the proof of the other two axioms of an equivalence relation.
The notation using the subscript ${}_{/T}$ in the statement refers to the construction which to a morphism $f : X' \to X$ of algebraic spaces associates the morphism $f_{/T} : X'_{/f^{-1}T} \to X_{/T}$ of formal algebraic spaces, see Section \ref{section-completion-functor}. We will also use the notion $U \subset X$ and $U' \subset X'$ to denote the open subspaces with $|U| = |X| \setminus T$ and $U' = |X'| \setminus f^{-1}T$ introduced in Section \ref{section-completion-functor}. \medskip\noindent After replacing $X'$ by $X' \amalg U$ we may and do assume the image of $X' \to X$ contains $U$. Let $$ R = X' \amalg_{U'} (U' \times_U U') $$ be the pushout of $U' \to X'$ and the diagonal morphism $U' \to U' \times_U U' = U' \times_X U'$. Since $U' \to X$ is \'etale, this diagonal is an open immersion and we see that $R$ is an algebraic space (this follows for example from Spaces, Lemma \ref{spaces-lemma-glueing-algebraic-spaces}). The two projections $U' \times_U U' \to U'$ extend to $R$ and we obtain two \'etale morphisms $s, t : R \to X'$. Checking on each piece separatedly we find that $R$ is an \'etale equivalence relation on $X'$. Set $X'' = X'/R$ which is an algebraic space by Bootstrap, Theorem \ref{bootstrap-theorem-final-bootstrap}. By construction have the factorization as in the lemma and the morphism $X'' \to X$ is locally of finite type (as this can be checked \'etale locally, i.e., on $X'$). Since $U' \to U$ is a surjective \'etale morphism and since $s^{-1}(U') = t^{-1}(U') = U' \times_U U'$ we see that $U'' = U \times_X X'' \to U$ is an isomorphism. Finally, we have to show the morphism $X' \to X''$ induces an isomorphism $X'_{/T} \to X''_{/T}$. To see this, note that the formal completion of $R$ along the inverse image of $T$ is equal to the formal completion of $X'$ along the inverse image of $T$ by our choice of $R$! By our construction of the formal completion in Formal Spaces, Section \ref{formal-spaces-section-completion} we have $X''_{/T} = (X'_{/T}) / (R_{/T})$ as sheaves. Since $X'_{/T} = R_{/T}$ we conclude that $X'_{/T} = X''_{/T}$ and this finishes the proof.
We already know the functor is fully faithful, see Lemma \ref{lemma-completion-functor-fully-faithful}. Essential surjectivity. Let $g : W \to X_{/T}$ be a morphism of formal algebraic spaces with $W$ locally Noetherian and $g$ rig-\'etale. We will prove $W$ is in the essential image in a number of steps. \medskip\noindent Step 1: $W$ is an affine formal algebraic space. Then we can find $U \to X$ of finite type and \'etale over $X \setminus T$ such that $U_{/T}$ is isomorphic to $W$, see Lemma \ref{lemma-algebraize-rig-etale-affine}. Thus we see that $W$ is in the essential image by Lemma \ref{lemma-smash-away-from-T}. \medskip\noindent Step 2: $W$ is separated. Choose $\{W_i \to W\}$ as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. By Step 1 the formal algebraic spaces $W_i$ and $W_i \times_W W_j$ are in the essential image. Say $W_i = (X'_i)_{/T}$ and $W_i \times_W W_j = (X'_{ij})_{/T}$. By fully faithfulness we obtain morphisms $t_{ij} : X'_{ij} \to X'_i$ and $s_{ij} : X'_{ij} \to X'_j$ matching the projections $W_i \times_W W_j \to W_i$ and $W_i \times_W W_j \to W_j$. Consider the structure $$ R = \coprod X'_{ij},\quad V = \coprod X'_i,\quad s = \coprod s_{ij},\quad t = \coprod t_{ij} $$ (We can't use the letter $U$ as it has already been used.) Applying Lemma \ref{lemma-equivalence-relation} we find that $(t, s) : R \to V \times_X V$ defines an \'etale equivalence relation on $V$ over $X$. Thus we can take the quotient $X' = V/R$ and it is an algebraic space, see Bootstrap, Theorem \ref{bootstrap-theorem-final-bootstrap}. Since completion commutes with fibre products and taking quotient sheaves, we find that $X'_{/T} \cong W$ as formal algebraic spaces over $X_{/T}$. \medskip\noindent Step 3: $W$ is general. Choose $\{W_i \to W\}$ as in Formal Spaces, Definition \ref{formal-spaces-definition-formal-algebraic-space}. The formal algebraic spaces $W_i$ and $W_i \times_W W_j$ are separated. Hence by Step 2  the formal algebraic spaces $W_i$ and $W_i \times_W W_j$ are in the essential image. Then we argue exactly as in the previous paragraph to see that $W$ is in the essential image as well. This concludes the proof.
If $f$ is quasi-compact, then $g$ is quasi-compact by Lemma \ref{lemma-quasi-compact-gives-quasi-compact}. Conversely, assume $g$ is quasi-compact. Choose an \'etale covering $\{X_i \to X\}$ with $X_i$ affine. It suffices to prove that the base change $X' \times_X X_i \to X_i$ is quasi-compact, see Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-quasi-compact-local}. By Formal Spaces, Lemma \ref{formal-spaces-lemma-characterize-quasi-compact-morphism} the base changes $W_i \times_{X_{/T}} (X_i)_{/T}  \to (X_i)_{/T}$ are quasi-compact. By Lemma \ref{lemma-functoriality-completion-functor} we reduce to the case described in the next paragraph. \medskip\noindent Assume $X$ is affine and $g : W \to X_{/T}$ quasi-compact. We have to show that $X'$ is quasi-compact. Let $V \to X'$ be a surjective \'etale morphism where $V = \coprod_{j \in J} V_j$ is a disjoint union of affines. Then $V_{/T} \to X'_{/T} = W$ is a surjective \'etale morphism. Since $W$ is quasi-compact, then we can find a finite subset $J' \subset J$ such that $\coprod_{j \in J'} (V_j)_{/T} \to W$ is surjective. Then it follows that $$ U \amalg \coprod\nolimits_{j \in J'} V_j \longrightarrow X' $$ is surjective (and hence $X'$ is quasi-compact). Namely, we have $|X'| = |U| \amalg |W_{red}|$ as $X'_{/T} = W$.