For example, defining a processor and proving its correctness. You begin with small sets like [math]\mathbb{B} = \{ 0, 1 \}[/math] and [math]\mathbb{B}^n[/math], you define maps for binary interpretation
[math]\langle \cdot \rangle : \mathbb{B}^n \rightarrow [ 0 : 2^n - 1][/math]
and two’s complement interpretation
[math][ \cdot ] : \mathbb{B}^n \rightarrow [ -2^{n-1} : 2^{n-1} - 1][/math]
Then you define labeled directed acyclic graphs; a hardware circuit is just one such graph where the labels are the gates, such as [math]\land, \lor, \neg, \oplus[/math].
Then you can define graphs that compute addition of two binary numbers, such as the parallel prefix circuit, and you can prove for input values [math]a,b \in \mathbb{B}^n[/math] and carry-in [math]c_0 \in \mathbb{B}[/math] and the output [math]s \in \mathbb{B}^n[/math] and carry-out [math]c_n \in \mathbb{B}[/math] that the darn thing really adds the numbers, i.e., the two’s complement interpretation of the output+carry is equal to the sum of the two’s complement interpretation of the inputs and the carry bit
[math][ c_n \circ s ] = [ a ] + [ b ] + c_0[/math]
and the same for the binary interpretation
[math]\langle c_n \circ s \rangle = \langle a \rangle + \langle b \rangle + c_0[/math]
At this point with set theory we can understand that the same parallel prefix adder works for both binary numbers and two’s complement numbers, now isn’t that a miracle.
Furthermore, by adding only an inverter and a parallel XOR, you can use the same hardware that is normally used for adding for subtracting, using the congruence
[math]- [ b ] \equiv [ ! b ] + 1 \mod 2^n[/math]
To explain all of this with set theory takes about two double lectures (4 hours) in a first semester lecture (If you’re confused, that’s okay — I haven’t shown you the explanation. You can look it up in a number of standard textbooks on system and hardware architecture, for example, System Architecture - An Ordinary Engineering Discipline | Wolfgang J. Paul | Springer).
There is another way to understand this, which is called experience. In other words, you should understand it with your stomach. The problem is that the stomach is not very good at understanding computer science, whereas the brain is. As a consequence, understanding that the parallel prefix adder works for both binary and two’s complement numbers, and for subtraction of them, takes the stomach years.
And that is why set theory (or in some cases type theory) is applied in computer science.