So I'm trying to come up with a simple explanation on the difference between if and iff, whilst also testing my understanding.
Are these statements valid:
X > 2 if X = 5
X= 5 iff X = 5
So I'm trying to come up with a simple explanation on the difference between if and iff, whilst also testing my understanding.
Are these statements valid:
X > 2 if X = 5
X= 5 iff X = 5
Yes, both are valid.
"$q$ if $p$" means "if $p$ then $q$", or "$p$ implies $q$", written symbolically $p \to q$ or $p\!\implies\! q$. This statement is true unless $p$ is true and $q$ is false. Note, dangerous bend: if $p$ is false, then the statement is true no matter what the truth value of $q$ is. So, "if $0=1$ then I'm Napoleon" is true, at least by convention, but so is "if $0=1$ then 5 = 5". (If both $p,q$ are false then the statement is true too.) However, "if $0=0$ then I'm Napoleon" is false, assuming I'm not Napoleon.
"iff" is shorthand for "if and only if", so let's deal with "only if" first. Though it's less common in English than "if", "A only if B" means: A is true only when B is true — that is, it's not possible to have both A true and B false. That is, not: A and not B. Symbolically, $\neg(A \land \neg B)$. As it happens, that's exactly equivalent to $A\to B$. So "A only if B" means $A\to B$.
Now, "iff", or "if and only if". "$p$ iff $q$" means "$p$ if $q$, and $p$ only if $q$". Thus, it means $(p\to q)$ and $(q\to p)$. This is usually written as $p \leftrightarrow q$, or $p \!\iff\! q$.
Notice that $p \to q$ is true precisely when the truth value of $p$ is less than or equal to the truth value of $q$. So $p \leftrightarrow q$ is true precisely when $p$ and $q$ have the same truth value: either both are true, or both are false; each implies the other.
In short:
When you use if it means that the statement in the LHS is valid only when the condition in the RHS is satisfied. On the other hand when we use iff(if and only if) it means that the statement on LHS is valid when the statement in RHS is valid and also its converse is true, i.e. the statement in RHS is valid when the statement the statement in LHS is true.
Let us take the example you've taken:
X>2 is valid when X=5. But X>2 does not mean that X=5.
The examples you've chosen are not such a good examples, but I think you get my point.
A concise explanation is:
Let me explain.
Write $\mathbb{B} = \{0,1\}$ for the set of truthvalues. Furthermore, lets make the following definitions, for each and every set $X$:
You can see immediately that an $n$-ary operation on $\mathbb{B}$ is exactly the same thing as an $n$-ary predicate on $\mathbb{B}$. So on the set of truthvalues, the notions of "operation" and "predicate" agree. Pretty cool, huh?
Now every set $X$ comes equipped with a $2$-ary predicate $=_X : X^2 \rightarrow \mathbb{B}.$ Also, $\mathbb{B}$ carries an obvious order predicate. Hence we have two very important 2-ary predicates on $\mathbb{B}$, namely $=_\mathbb{B}$ and $\leq_\mathbb{B}.$ But remember that a predicate on $\mathbb{B}$ is the same thing as an operation on $\mathbb{B}$. So we can think of $=_\mathbb{B}$ and $\leq_\mathbb{B}$ and $\geq_\mathbb{B}$ as operations on $\mathbb{B}$. Suppose we want to emphasize that we are indeed thinking of them as operations. Then we denote these operations $\Leftrightarrow$ and $\Rightarrow$ and $\Leftarrow$ respectively.
For example, the statement "$X=5$ iff $X=5$" is just saying "$(X=5) =_\mathbb{B} (X=5)$." Obviously, this is true for each and every real number $X$ we could possibly choose.
Anyway, there's at least one more important issue here, which is that implicitly, the statement "$X=5$ iff $X=5$" is shorthand for the statement "for each and every real number $X$, $X=5$ iff $X=5$." So its really an abuse of notation. See here for more information about this kind of thing.