I'm currently reading "The Handbook of Applied Cryptography" (The full textbook is available as pdf documents from that page) and I'm struggling to understand some of the notation in Chapter 2 that's used on pages 51 and 52.
I've screenshotted the relevant sections:


My source of confusion comes from the (X-μ) in the first image. I don't really get it since X is meant to be a function and p is a number, I don't get how I can do integer subtraction (or maybe it's set difference) with that type mismatch? There must be something about the notation I'm not understanding.
My confusion with the second piece of notation is similar, how does one compute the cardinality of a function minus an number? Looking at this from a programmer's perspective there seems to be type violations here.
The numbers subtracted from $X$ are to be understood as constant functions; subtraction is done pointwise. So $(X-\mu)(z)=X(z)-\mu$, and similarly with $p$ in place of $\mu$. The vertical lines in the second confusion mean absolute value (again computed pointwise), not cardinality.