Set operations on commutative ring epimorphisms (intersections, unions and complements) Given a commutative ring $R$, I am interested in the ring epimorphisms outgoing from $R$. In the opposite category of affine schemes, those quotient objects become subobjects of Spec $R$ and I study their set operations like union, intersection and complement.
Epimorphisms from $R$ are ordered by factorization, have a maximum element $\text{id}_R:R\to R$, a minimum element $R\to 0$, and any two epics $f:R\to A, g:R\to B$ have a lower bound which is their pushout $A\otimes_R B$. The lower bounds represent the intersections of the corresponding affine schemes. For upper bounds (unions), I am considering the pullback of the pushout of $f$ and $g$, which is $(f,g):R\to U$ with
$$U=\{(a,b)\in A\times B \;/\; a\otimes_R 1 = 1\otimes_R b\}$$
When the pushout $A\otimes_R B$ is zero, then $U$ is just the product $A\times B$, and $(f,g):R\to A\times B$ is the upper bound indeed. We can prove $(f,g)$ is an epimorphism by computing tensors to get $(a,b)\otimes_R (1,1)= (1,1)\otimes_R (a,b)$. When the pushout is not zero, then we don't have $(1,0)\in U$ and cannot separate the tensor into a sum of simpler terms. As another possible definition of unions, observe that epimorphisms out of $R$ have arbitrary intersections (infinite tensor products), so we could think of the intersection of all epimorphisms out of $R$ that are greater than both $f$ and $g$. However those epimorphisms form a proper class, not a set, so this union is not well defined, unless we manage to reduce it to a set. If this fails too, is there still another proof of existence of unions?
For the complement of an epic $f:R\to A$, my first tentative was searching for an epic $g:R\to B$ such as $f\lor g =\text{id}_R$ and $f\land g=0$. However, from what we just said, $f\land g=0$ yields $f\lor g = (f,g) : R\to A\times B$. And the product $A\times B$ is never an integral domain, because $(1,0)(0,1)=0$, so when $R$ is integral, they cannot be isomorphic. Therefore Boolean complements fail. We can still search for Heyting complements, i.e. the greatest $g:R\to B$ such as $f\land g=0$. But those probably fail too, because the punctured plane is not an affine scheme. Can we prove the epimorphism $K[X,Y] \to \frac{K[X,Y]}{\langle X,Y\rangle}$ does not have a Heyting complement?
I imagine the answers to those questions give some of the motivations of the upgrade from affine schemes to general schemes.
 A: Let $R$ be a commutative ring. In this answer, an $R$-epi will be an epimorphism of commutative rings $R↠A$. A commutative $R$-algebra $A$ is an $R$-epi if and only if $A⊗_RA = A$. We order $R$-epis in the "geometrical" direction, by saying that $A ≤ B$ if there is a morphism $B→A$ such that $R↠B→A = R↠A$.
Since the category of commutative rings is cocomplete, $R$-epis are a (not necessarily small) complete poset. But actually, there is a set of $R$-epis, as shown in the paper Caractérisation des épimorphismes par relations et générateurs (as was pointed out to me in this answer). Let's just summarize the argument here. Isbell's zigzag lemma says that $R→A$ is epi if and only if every element $a ∈ A$ can be written as $XYZ$ with $X$, $Y$ and $Z$ matrices over $A$ such that:

*

*The resulting product $XYZ$ is a $1×1$ matrix whose only entry is $a$.

*All the entries of $Y$, $XY$ and $YZ$ are in the image of $R$ in $A$.

We can show that $a$ is characterized not only by $X$,$Y$,$Z$ (as their product), but also by $Y$, $XY$ and $YZ$. Indeed, if $b = X'Y'Z'$ is another element of $A$ with $X'Y' = XY$, $Y' = Y$ and $Y'Z' = YZ$, then
$$a = XYZ = X'Y'Z = X'YZ = X'Y'Z' = b\text{.}$$
As a consequence, $|A| ≤ \max(|R|,\aleph_0)$.
We conclude that $R$-epis are a complete poset, and hence also cocomplete: to build the supremum of a subset, take the infimum of all the upper bounds. This infimum is also described as an infinite tensor product over $R$, see this question.

You want to construct the union of $R↠A$ and $R↠B$ as the pullback of $A$ and $B$ over $A⊗_RB$. This works if $A⊗_RB = 0$, but it may fail otherwise.
Let's first see why it works if $A⊗_RB = 0$. This is because the pullback is then $A×B = A⊕B$ and we have
$$(A⊕B)⊗(A⊕B) = (A⊗A)⊕(A⊗B)⊕(B⊗A)⊕(B⊗B) = (A⊗A)⊕(B⊗B) = A⊕B\text{.}$$
More concretely, we have for all $(α,β) ∈ A×B$ the following computation.
$$\begin{align*}
(α,β)⊗(1,1) &= (α,0)⊗(1,0) + (α,0)⊗(0,1) + (0,β)⊗(1,0) + (0,β)⊗(0,1)\\
&= (1,0)⊗(α,0) + 0 + 0 + (0,1)⊗(0,β)\\
&= (1,1)⊗(α,β)
\end{align*}$$
If $A⊗_RB ≠ 0$, we still can reproduce the same computation but it shows that if $(α,β) ∈ A×B$ is such that $α⊗1 = 1⊗β$ in $A⊗B$, then $(α,β)⊗(1,1) = (1,1)⊗(α,β)$ in $A×B$ but not in $\{(x,y)∈A×B\,|\,x⊗1=1⊗y\}$ since we go out of this subring for the computation below.
$$\begin{align*}
(α,β)⊗(1,1) &= (α,0)⊗(1,0) + (α,0)⊗(0,1) + (0,β)⊗(1,0) + (0,β)⊗(0,1)\\
&= (1,0)⊗(α,0) + (1,0)⊗(0,β) + (0,1)⊗(α,0) + (0,1)⊗(0,β)\\
&= (1,1)⊗(α,β)
\end{align*}$$
Here is a counter-example where $R → \{(x,y)∈A×B\,|\,x⊗1=1⊗y\}$ is not epi. Take $R = k[x,y]$ for $k$ a field. Take $A = k[x,y,x^{-1}]$ and $B = k[x,y]/(y)$. (Geometrically, the union is the plane minus a punctured line.) Then $A⊗B = k[x,x^{-1},y]/(y)$ and the pullback of $A$ and $B$ over $A⊗B$ is the set of $P(x,y) ∈ A$ such that $P(x,0) ∈ k[x]$. In other words, it is
$$k[x,y,y/x^n\text{ for $n≥1$}] = \{u(x) + (y/x^n) v(x,y) \,|\, u(x) ∈ k[x],\,v(x,y)∈k[x,y],\,n≥1\}\text{.}$$
To prove $k[x,y]→k[x,y,y/x^n\text{ for $n≥1$}]$ is not epi, we must find a commutative $k$-algebra $T$ with two elements $x,y$ and two sequences $(u_n)_{n≥1}$, $(v_n)_{n≥1}$ such that:

*

*$u_1 x = y = v_1 x$

*$u_{n+1}x = u_n$ and $v_{n+1}x = v_n$ for all $n≥1$

*$u_1 ≠ v_1$
If we can find that, we have two different morphisms $k[x,y,y/x^n\text{ for $n≥1$}] → T$ coinciding on $x$ and $y$, sending $y/x^n$ to $u_n$ or $v_n$. I don't know if there is a "standard" ring satisfying these conditions... But we can always take the free one. We start by building the free commutative monoid $M$ satisfying these conditions. It is generated by elements $x$, $y$, $u_n$ and $v_n$ for $n≥1$. We also put $u_0 = v_0 = y$. The axioms are that $u_n = u_{n+1} x$ and $v_n = v_{n+1} x$ for all $n$. Here is an explicit description of it (I won't prove it is the free such monoid but we don't need that).

*

*The elements of $M$ are the pairs $(x,y) ∈ ℤ^2$ with $y≥0$, and $y>0$ if $x<0$, plus eventually a decoration if $x<0$ and $y=1$. Here is a drawing of this monoid (the black dots are the elements). We have $x = (1,0)$, $y = (0,1)$, $u_n = (-n,1)$ and $v_n = (-n,1)^*$.



*

*Multiplication is simply addition, and we keep the decoration whenever it is possible.

We take $T = k[M]$, the formal combinations of elements of $M$, and this shows $k[x,y] → k[x,y,y/x^n\text{ for $n≥1$}]$ is not epi.

The last question is to know if $R$-epis are a Heyting algebra. They are not. The pseudocomplement of $k[x,y]→k[x,y]/(x,y)$ doesn't exist: this pseudocomplement has to be bigger than $k[x,y]→k[x,y,x^{-1}]$ and $k[x,y,y^{-1}]$, but the union of these two is the whole plane $k[x,y]$ (in our setting), which is not disjoint from the point.
