At first sight, logic can be confusing. A lot of this is because it can be quite abstract (well, at least it can feel abstract compared to things such as algebra 11 1 Not abstract algebra!). The key thing (in my view) to understand is that logic is well-defined; there is a strict set of rules according to which logical expressions can be manipulated, much like there is with "normal" algebra.
For example, consider this well-known fact about any and addition
There are some analogous rules for logical expressions. However, instead of a whole series of numbers, in logic every value is in the set - i.e. it is either \saytrue or \sayfalse. We can define an "operator" (i.e. something which takes two values and outputs a new one, just like the familiar addition operator). For example, let us create a new operator . We can define the result of by considering what happens in every case
If both values are true, i.e. , then the output is also true.
If one value is true and the other is false, i.e. or then the output is false.
In the other case (i.e. ) then the output is false.
Based on this definition (which corresponds to a logical operator known as \saylogical and, so named because the output is true whenever both inputs are and false in every other case) we can determine a similar relationship. Specifically,
Hopefully this makes intuitive sense, but first we need to define ! It’s a variable, just like was above - i.e. it can be anything we want, so long as it is a boolean (whereas can be anything we want, so long as it is a real number). If is true, then as in this case, and if is false, then as for this case .
This is logic which is generally useful in other areas of mathematics.