Theorem 7.7 is stated and proved as follows in Loring Tu's An Introduction to manifolds:

However, it seems that the deduction which involves Figure 7.4 in the proof is not so rigorous, so I want to know if there's a deduction involving only pure logic, rather than graphs.
The product topology on $S\times S $ is definitionally that generated by the basis of products $A\times B$ of open subsets $A,B$ of $S$. Thus every open set $J$ in $S\times S$ can be written as a union $J= \bigcup_{n=1}^\infty A_i \times B_i$, where $A_i, B_i$ are open in $S$.
Setting $J:=S\times S \setminus R$, we obtain the result.