An open sentence is a boolean expression that contains unbound variables. The truth of an open sentence
cannot be evaluated until specific values are substituted for the unbound variables. If a set of values makes an
open sentence true when substituted for the unbound variables, the values are said to satisfy the
sentence. Typically, a universe of discourse is defined, from which the values can be chosen.
Here are some example open sentences:
 `S sube ZZ` (`S` is unbound)
 `y^25y+6=0` (`y` is unbound)
A logical implication is a statement that relates two propositions. If `P` and `Q` and `P` implies `Q`,
then `P` is called the hypothesis (or antecedant) and `Q` is called the
conclusion (or consequent). The implication can be written as `P => Q`, `P == Q`, or
`P :. Q` (in decreasing order of popularity), all of which can be read "`P` implies `Q`" or "`P` entails `Q`".
A logical implication is false only if the hypothesis is true but the conclusion is false.
When the sentence "if A, then B" is encountered, where `A` or `B` is an open sentence, it is generally interpreted
as a universally quantified implication: `(AA x in UU)(A => B)`.
The symbol `AA` (read "for all" or "for every") is called the universal quantifier. It is generally
followed by a variable name, a set or expression restricting that variable, and open sentence about that variable.
This forms a new sentence which asserts that all possible substitutions for the variable satisfy the open sentence.
If the set is omitted, it is assumed to be `UU`.
For instance, the sentence `A sube B` can be defined using the universal quantifier: `(AA x in A)(x in B)`. This
says that every element in `A` exists in `B`, which is exactly what `A sube B` means. The parentheses in the
sentence are not strictly required. `AA x in A (x in B)` means the same thing, as does `AA x in A` `x in B`.
Note that the sentence containing the universal quantifier may be false. For example: `(AA n in NN)(n < 0)`.
This asserts that all natural numbers are negative, but the assertion is false.
The symbol `EE` (read "there exists") is called the existential quantifier. It is generally
followed by a variable name, a set or expression restricting that variable, and open sentence about that variable.
This forms a new sentence which asserts that there exists at least one substition for the variable that satisfies
the open sentence. If the set is omitted, it is assumed to be `UU`.
For instance, the sentence `a div b` can be defined using the existential quantifier: `(EE t in ZZ)(at=b)`. This
says that there exists an integer `t` such that `at=b`. The parentheses in the sentence are not strictly required.
`EE t in ZZ (at=b)` means the same thing, as does `EE t in ZZ` `at=b`.
Note that the sentence containing the existential quantifier may be false. For example: `(EE n in NN)(n < 0)`.
This asserts that there exists at least one natural number that is negative, but the assertion is false.
A truth set of an open sentence is the complete set of values that, when substituted for the open
variables in the sentence, make it true. For example, the truth set of `x^24x5=0` (`UU=RR`) is {1,5}.
A counterexample is a set of values that, when substituted into a logical implication, makes the
hypothesis of the implication true and the conclusion false.
A vacuously true statement is a logical implication that is true, but the truth set of its hypothesis
is the empty set. An example of a vacuously true statement is: "If `x` is a real number with `x^2<0`, then
`x=17`." The statement is true because there does not exist a counterexample, but it's rather useless
because there is no situation to which this statement can be applied.
Given propositions `P` and `Q`:
 `not (P ^^ Q) = not P vv not Q`, and
 `not (P vv Q) = not P ^^ not Q`, and
 `not (P => Q) = P ^^ not Q`, and
 `not (AA x)(P(x)) = (EE x)(not P(x))`, and
 `not (EE x)(P(x)) = (AA x)(not P(x))`
For `x in ZZ`:

"`x` is even" means: `(EE t in Z)(x=2t)`  there exists an integer `t` such that `x=2t`. More
concisely, `x` is even if `2 div x`.

"`x` is odd" means: `(EE y in Z)(x=2y+1)`  there exists an integer `y` such that `x=2t+1`.
More concisely, `x` is odd if `2 !div x`.
Note that according to this definition, the number zero is considered even.
 If `a` is even and `b` is even, then `(a+b)` and `(ab)` are even.
 If `a` is even and `b` is odd, then `(a+b)` and `(ab)` are odd.
 If `a` is odd and `b` is odd, then `(a+b)` and `(ab)` are even.
 If `a` is even or `b` is even, then `ab` is even.
 If `a` is odd and `b` is odd, then `ab` is odd.
 To prove (1) above, assume `a` is even, and `b` is any integer. In the special case where `a=0`, `ab=0`,
which is even. If `a != 0`, then we have `2 div a and a div ab`. By , we have
`2  ab`, which means that `ab` is even. By a parallel argument, `ab` is even if `b` is even and `a` is
any integer.
 To prove (2) above, let `a` and `b` be any two odd numbers. Then by definition there exist integers
`m` and `n` such that `a=2m+1` and `b=2n+1`. Then `ab = (2m+1)(2n+1) = (4mn+2m+2n+1) = 2(2mn+m+n)+1`.
Since there exists an integer `z = 2mn+m+n` where `2z+1 = ab`, then `ab` must be odd, by definition.
Given `x,y in ZZ` with `x != 0`, `x` is a divisor of `y` if there exists an integer `t` such that
`x*t=y`.
`(EE t in ZZ)(x*t=y)`
If `x` is a divisor of `y`, we can also say "`x` divides `y`", and we write "`x div y`". 0 is not a divisor of
any integer, but all nonzero integers are divisors of zero, and of course 1 is a divisor of every integer. A
proper divisor of `y` is a divisor `x` such that `x != y`.
Similarly, given `a,b in NN`, `a div b` if `(EE u in NN)(a*u=b)`.
If `y` is not zero, then there are only finitely many divisors, because by ,
`x<=y`.
For `n in ZZ`, the set of multiples of `n` is
`{n*t:t in ZZ}`
The set of multiples of `n` can be abbreviated `nZZ`. Each element of this set is called a multiple
of `n`.
For `x,y in ZZ`, `t` is a common divisor of `x` and `y` if `t div x and t div y`.
Every pair of integers has at least one common divisor, because 1 divides every integer. If `x` or `y` is
nonzero, then there are only finitely many common divisors. (See .)
For `x,y in ZZ`, `t` is the greatest common divisor (GCD) of `x` and `y` if:
`t div x and t div y and (AA u in ZZ)(u div x and u div y => u <= t)`
This definition says that `t` is the GCD of `x` and `y` if it is a common divisor of `x` and `y`, and every other
common divisor is less than or equal to `t`. The greatest common divisor of `x` and `y` is written `GCD(x,y)`.
If `x` or `y` is nonzero then a GCD exists because there are only finitely many common divisors
(see ), and one of them is the greatest. If `x` and `y` are both zero, then there is no
GCD because there are infinitely many common divisors. The GCD is always positive because 1 is a common divisor
of every pair of integers, and 1 is greater than all nonpositive integers.
For `x,y in ZZ`, `t` is a common multiple of `x` and `y` if `t` is a multiple of `x` and `t` is a
multiple of `y`.
For `x,y in ZZ{0}`, `t` is the least common multiple (LCM) of `x` and `y` if:
 `t` is a positive common multiple of `x` and `y`, and
 Every positive common multiple of `x` and `y` is greater than or equal to `t`.
Note that if `x=0` or `y=0`, the least common multiple is defined to be zero.
The least common multiple of `x` and `y` is written `LCM(x,y)`.
Given `x,y in Z{0}`, there exists a positive common multiple of `x` and `y`.
Let `z=xyc`, where `c in {1,1}`. If `xy` is negative, let `c=1`. Otherwise, let `c=1`. Then, `z>0`, and since
`z=xyc`, `z` is a multiple of both `x` and `y`. Therefore, every pair of nonzero integers `x` and `y` has a
positive common multiple. Furthermore, since the set of possible positive common multiples is bounded from
below (by zero), there exists a common multiple that is less than or equal to all others. So every pair
of nonzero integers has a least common multiple.
If `a div b`, then `a div nb` for all `n in ZZ`.
If `a div b`, then there exists an integer `m` such that `am=b`. Given any integer `n`, `n*b=n*am=a*nm`, and
clearly `a div a*nm`. Therefore, `a div nb`.
If `a div b and c div d`, then `a div bd and c div bd and ac div bd`.
If `a div b and b div c`, then `a div b+c and a div bc`.
If `a div b` and `a div c`, then there exist integers `m` and `n` such that `am=b` and `an=c`. Then
`b+c=am+an=a(m+n)`. Clearly, `a div a(m+n)`, so `a div b+c`. Similarly, `a div bc`.
If `a div b and b div c`, then `a div c`.
If `a div b` and `b div c`, then by definition there exist integers `m` and `n` such that `am=b` and `bn=c`.
Substituting `am` for `b` in `bn=c`, we get `amn=c`. Because there exists an integer `mn` such that
`a*mn=c`, `a div c`.
For `a,b in NN`, if `a div b`, then `a<=b`.
By , there exists a natural number `m` such that `am=b`. By
, we know that `a<=am`, and since `am=b`, `a<=b`.
This can be extended to the integers because the absolute value of a nonzero integer is a natural
number. For `x,y in ZZ` where `y != 0`, if `x div y` then `x<=y`
For `a,b in NN`, if `a div b and a!=b`, then `a<=b/2`.
If `a div b and b div a`, then `a=b`.
For `a,b,c in NN`, if `a div b and b div c and a<=sqrt(c) and b<=sqrt(c)`, then `ab div c`.
If `b` is odd and `a div b`, then `a` is odd.
This basically says that all divisors of odd numbers are themselves odd.
If `t` is a common divisor of `x` and `y`, then `t div GCD(x,y)`.
If `GCD(a,b)=1` (ie, `a` and `b` are relatively prime) and `t!=0`, then `GCD(at,bt)=t`.
If `a` and `b` are relatively prime, then their sets of divisors have nothing in common except 1. So if we
multiply both numbers by `t`, the sets of divisors of the resulting products will have nothing in common except
1 and `t`, so the GCD of the products will be `t`.
`LCM(x,y)=(xy)/(GCD(x,y))`
If `d=GCD(x,y)` then `d div x and d div y`. By definition, there exist integers `m` and `n` such that `x=md` and
`y=nd`. Then `xy=md*nd`. We can divide `xy` by `d`, producing `(xy)/d=mnd`. This quantity is still a common
multiple of `x` and `y` (because it's equal to both `nx` and `my`). Because `d=GCD(x,y)`, `m` and `n` are
the smallest possible numbers such that `x=md` and `y=nd`. That is to say, `mnd=(xy)/d` is the least common
multiple.
For `t in NN` where `t>1`, `t` is prime if the only divisors of `t` are 1 and `t` itself. More
concisely, if `t` is prime, then:
`(AA x in NN)(x div t => [x=1 or x=t])`
If `t` is not prime (and `t>1`), then `t` is composite. That is:
`(EE u,v in NN)(u>1 and v>1 and t=uv)`
The number 1 is neither prime nor composite.
For all `a,b in NN`, `ab>=a and ab>=b`. That is, the product of two natural numbers is at least as large
as both of its factors.
We'll first prove that `ab>=a`. Because `b` is a natural number, we know that `b>=1`. This gives two cases:
 `b=1`. Since `n xx 1=n` for all `n`, we know that `ab=a`.
 `b>1`. Recall that if `x>y and c>0`, then `cx > cy`. If `x=b`, `y=1`, `c=a`, we have `b>1` and `a>0`
(because `a` is a natural number), so `ab>a`.
Therefore, `ab>=a`. By a parallel argument, `ab>=b`.
A linear Diophantine equation is an equation of the form `ax+by=c`, where all variables are integers.
Two numbers `x` and `y` are relatively prime means:
GCD(x,y)=1
Given `a,b,c,d in ZZ`, if `d div a` and `d div b` and `d !div c`, then the equation
`ax+by=c` has no integer solution for `x` and `y`.
Assume by way of contradiction that the equation does have an integer solution. Then by
we know that `d div ax and d div by`, and by ,
we know that `d div (ax+by)`, which means that `d div c`.
However, we've stated that `d !div c`, so that is impossible. Therefore, the equation has no solutions.
Given `a,b,c in ZZ` with `a` and `b` not both equal to zero, and `d=GCD(a,b)`. If the diophantine equation
`ax+by=c` has an integer solution for `x` and `y`, then `d div c`. (Note that this is not the same as saying
"If `d div c`, then the equation has a solution.)
We'll prove this by proving the contrapositive: if `d !div c`, then the diophantine equation has no solutions.
Because `d=GCD(a,b)`, `d div a and d div b` by , and by applying
, we can see that the equation has no solutions.
For `x in RR`, `x` is rational means:
`(EE p in ZZ,q in NN)(x=p/q)`
That is, a rational number is a number that can be expressed as the quotient of an integer and a natural number.
`QQ` does not have .
To prove this theorem, we need to be able to show that there exists a subset of the rationals that is bounded
above but doesn't have a rational or that there exists a subset of the rationals that is bounded
below but doesn't have a rational .
Consider the set `S={n in QQ : n>0 and n^2<2}`. `S` is a subset of the rationals. We will prove that this
set does not have a rational lub. Since `sqrt(2)` is clearly an upper bound for this set, but `sqrt(2)` is
irrational, a rational lub (call it `p`) would have to be near to, but greater or less than `sqrt(2)`. We'll
consider each case.

`0 < p^2 < 2`. If `0 < p^2 < 2` then `p in S` and so `p` must be the maximum of `S`.
Then, by definition there is no element of `S` greater than `p`. But consider `q = p + (2p^2)/(p+2) =
(2p+2)/(p+2)`. If it can be proven that `q > p` and `q^2 < 2`, then `q in S`, and that would contradict
`p` being the lub of `S`. Since `p^2 < 2`, then `2p^2 > 0`, and since `p > 0`, then `p+2 > 0`.
Therefore, `(2p^2)/(p+2)` is positive, and so `q > p`. It only remains to show that `q^2 < 2`. `q^22 =
((2p+2)^2)/((p+2)^2)  2 = (4p^2+8p+4)/((p+2)^2)  2 = (4p^2+8p+4(2p^2+8p+8))/((p+2)^2) =
(2p^24)/((p+2)^2) = (2(p^22))/((p+2)^2)`. Since `p^2 < 2`, `p^22 < 0`, so the numerator is
negative. And since `p > 0`, the denominator is positive. Thus, `q^22 < 0`, so `q^2 < 2`. So `S`
does not have a maximum, and if it has a rational lub, it cannot be less than `sqrt(2)`.

`p^2 > 2`. If `p^2 > 2` and `p` is the lub of `S`, then there can exist no rational number `q` such that
`sqrt(2) < q < p`. But consider the same formula as above, `q = p + (2p^2)/(p+2) = (2p+2)/(p+2)`.
If it can be proven that `q < p` and `q^2 > 2`, then that would contradict `p` being the lub of `S`.
Since `p^2 > 2`, then `2p^2 < 0`, and since `p > 0`, then `p+2 > 0`. Therefore, `(2p^2)/(p+2)` is
negative, so `q < p`. It only remains to show that `q^2 > 2`. `q^22 = (2(p^22))/((p+2)^2)`, and since
`p^2 > 2`, then the numerator is positive, and since `p > 0`, the denominator is positive. Therefore,
`q^22 > 0`, so `q^2 > 2`. So `S` cannot have a rational lub greater than `sqrt(2)`.
Since `S` cannot have a rational lub that is less than, equal to, or greater than `sqrt(2)`, `S` cannot have
a rational lub. Therefore, `QQ` does not have the completeness property.
For `x in RR` and `S sube RR`, "`x` is an upper bound for `S`" means:
`(AA y in S)(x >= y)`
Similarly, "`x` is a lower bound for `S`" means:
`(AA y in S)(x <= y)`
An upper of a set does not need to be a member of that set, but if the set does contain its own
upper bound, it is called an of the set.
If a set has an upper bound, it is said to be bounded above, and if it has a lower bound, it is said
to be bounded below. A set with both an upper and lower bound is bounded. If it does not
have both, it is unbounded.
Given `S sube RR`, `x` is said to be the maximum (or largest element) of `S`,
and we write `x="max "S`, if `x in S` and `x` is an upper bound for `S`.
Similarly, `y` is said to be the minimum (or smallest element) of
`S`, and we write `x="min "S`, if `y in S` and `y` is a lower bound for `S`.
An extremum (plural "extrema") is either a minimum or a maximum. Not all sets have a minimum or a
maximum. Note the difference between an extremum and an upper or lower bound. An extremum of `S` is in `S`, but
an upper or lower bound need not be.
For `x in RR` and `S sube RR`, `x` is the least upper bound (lub) (or supremum) of `S`
(denoted "lub of `S`" or "`"sup " S`") if:
`(AA y in S)(x >= y) and (AA z in RR)(z" is an upper bound for "S => z >= x)`
Similarly, "`x` is the greatest lower bound (glb) (or infimum) of `S`" (denoted
"glb of `S`" or "`"inf " S`") means:
`(AA y in S)(x <= y) and (AA z in RR)(z" is a lower bound for "S => z <= x)`
If a set contains its own least upper bound, then the set has a equal to the lub. Similarly,
if a set contains its own greatest lower bound, the set has a equal to the glb.
For `S sube RR`, `S` has the completeness property if:
 Every nonempty subset `T` of `S` which is bounded above by an element of `RR` has a
in `S`, and
 Every nonempty subset `T` of `S` which is bounded below by an element of `RR` has a
in `S`.
Note that the lub and glb must be in `S`, though they need not be in `T`.
Some nonempty subsets of the real numbers do not have , even if they are bounded. That is,
even though the set may be bounded above or below, they lack a maximum or minimum element (or both). This of
course can only be the case for infinite sets.
Consider the set `S=[0,1]`. Clearly, the infimum of this set is 0, and the supremum is 1. Both 0 and 1
are also in the set, so the set has both extrema. Now consider the set `T=[0,1)`. 1 is clearly an upper bound
for this set, but is it the least upper bound? In fact it is, and `T` has no maximum element.
By definition, the set `T` contains every number `n` where `0 <= n < 1`. Assume by way of contradiction
that there does exist an upper bound for `T` (call it `u`) that is less than 1. Since `u` would have to be
very close to 1, we won't consider `u <= 0`. Then we have `0 < u < 1`. But given any such `u`, we can
always find another number `v` such that `u < v < 1`, which would contradict `u` being an upper bound.
For instance, let `v=(u+1)/2`. If we can prove that `u < (u+1)/2 < 1`, then we will have shown that any
number less than 1 cannot be an upper bound for `T`. Similarly, we will have shown that `T` has no maximum
element, since a greater element that is also within `T` can always be found.
We will now prove that `u < (u+1)/2 < 1`. Because `u < 1`,
`u+u=2u < u+1 < 2`. Then, dividing by 2, we can see that `u < (u+1)/2 < 1`.
A set is an unordered collection of objects. The objects in a set are called its elements or
members.
Sets contain only distinct objects, so the sets {1,2,3} and {3,2,2,1} are equal.
If `x` is a member of set `S`, we write `x in S`. If `x` is not a member of set `S`, we write `x !in S`.
There are a number of special sets with the following denotations:

`O/`: This represents the empty set (also known as the null set). The empty set has
no elements.

`NN`: This represents the natural numbers (also known as counting numbers).
Unfortunately, there is no general agreement as to this set's exact definition. It can refer to either the
set of positive integers or the set of
nonnegative integers. In contexts where `NN` represents the nonnegative integers, `PP` often represents
the positive integers (however, a few authors even use `PP` to represent the nonnegative integers). Where
`NN` represents the positive integers, `WW` often represents the nonnegative
integers. `NN_0` is sometimes used to indicate the nonnegative integers, and `NN^**` or
`NN^+` are sometimes used to indicate the positive integers.
To avoid ambiguity, the following symbols are recommended:
Set  Symbol 
integers  `ZZ` 
positive integers  `ZZ^+` 
nonnegative integers  `ZZ^**` 
negative integers  `ZZ^` 
On this web site, `NN` will denote the positive integers.

`WW`: This represents the whole numbers, which are usually defined to be the nonnegative
integers. But `WW` is occasionally used to represent the positive integers, so to avoid ambiguity it may be
best to use the symbols above. On this web site, `WW` represents the nonnegative integers.

`QQ`: This represents the rational numbers, which are all the numbers that can be represented as
an integer divided by a natural number (a positive integer).

`RR`: This represents the real numbers.

`CC`: This represents the complex numbers.

`UU`: This is the universe of discourse, which is a set that represents the overall framework of
the given situation. Usually this is some standard set such as `RR` or `ZZ`.
Notation such as `QQ^+` for positive rational numbers or `RR^(>=0)` for nonnegative real numbers is sometimes
used.
A subset of a set `B` is another set `A` such that:
`(AA x in A)(x in B)`
This definition says that all elements in `A` exist in `B`.
If `A` is a subset of `B`, we write `A sube B`. Note that a set is always a subset of itself, and `O/` is a
subset of every set. If `A` is a subset of `B` and `A != B`, then we write `A sub B` and say that `A` is a
proper subset of `B`. Notice how the `sub` and `sube` symbols resemble the `<` and `<=` symbols.
The negated forms of these symbols are `!sub` and `!sube`.
A superset of a set `B` is another set `A` such that `B sube A`. We can write `A supe B` to denote
this. If `A` is a superset of `B` and `A != B`, we say `A` is a proper superset of `B`, and we write
`A sup B`. The negated forms are `!sup` and `!supe`.
The union of two sets `A` and `B` is a set `C` such that:
`(AA x in C)(x in A or X in B)`
This definition says that the union of `A` and `B` contains all of the elements that exist in either `A` or `B`
(or both). The union of `A` and `B` is written `A uu B` (read "`A` union `B`"). Union is commutative,
associative, and distributive.
The intersection of two sets `A` and `B` is a set `C` such that:
`(AA x in C)(x in A and x in B)`
This definition says that the intersection of `A` and `B` contains all the elements that exist in both `A` and
`B`. The intersection of `A` and `B` is written `A nn B` (read "`A` intersect `B`"). Intersection is commutative,
associative, and distributive.
The difference of two sets `A` and `B` is a set `C` such that:
`(AA x in C)(x in A and x !in B)`
This definition says that the difference of `A` and `B` contains all elements that exist in `A` but not in `B`.
The difference of `A` and `B` is written `AB` (read "`A` minus `B`").
The complement of a set `A` is equal to `UUA`, where `UU` is the universe of discourse. The complement
of `A` is written `A'`. So if `x in A` then `x !in A'`, and vice versa.
Because the set complement operation depends on the universe of discourse, it is only
meaningful if a universe has been defined (or can be assumed).
Given a set `A`, the power set of `A` (written `PS(A)`) is the set containing all subsets of `A`
(including `A` itself):
`PS(A) = {S:S sube A}`
Note that the power set of the empty set is a set containing the empty set (ie, {`O/`}), not the empty set
itself. Power set is distributive over intersection, but not over union.
The cartesian product of two sets `A` and `B` is a third set containing all possible ordered pairs
`(x,y)` where `x in A` and `y in B`.
`A xx B = {(x,y) : x in A and y in B}`
`A` and `B` are called factors of `A xx B`. The cartesian product is also known as the cross
product, or simply the product. The cartesian product is not associative or commutative, but
it is distributive.
More generally, the cartesian product of `N` sets `S_1 xx S_2 xx ... xx S_N` is a set containing all possible
ordered lists `(c_1, c_2, ..., c_N)` where `c_i in S_i` (ie, `c_1 in S_1, c_2 in S_2`, etc).
The cardinality of a set is the number of elements it contains. The cardinality of a set `A` is
written `A`.
Two sets `A` and `B` are disjoint if they have no elements in comment. That is, if `A nn B = O/`.
Given `S sube RR`, `S` is an interval if:
`(AA u,v in S)(AA x in RR)(u < x < v => x in S)`
By this definition, `O/` is not an interval, any set containing a single real number is an interval, and
any finite set containing more than one real number is not an interval (because given any two distinct
elements of the set, there would be a real number between them that is not in the set).
The cardinality of the power set `PS(A)` is equal to `2^A`, which is the number of permutations that can be
formed from elements of `A`.
The cardinality of the cartesian product `A xx B` is equal to `AB`.
If `A sube B and B sube C`, then `A sube C`.
Given `x in A`, we need to show that `x in C`. By we know that if `x in A`, then `x in B`,
and if `x in B`, then `x in C`. Therefore, `x in C`.
If `A sube B`, then `PS(A) sube PS(B)`.
Given `S in PS(A)`, we need to show that `S in PS(B)`. By , we know that
`S sube A`, and by we know that `S sube B`. And if `S sube B`, then `S in PS(B)`,
by the definition of power set. Therefore, `PS(A) sube PS(B)`.
If `PS(A) sube PS(B)`, then `A sube B`.
We know that `A in PS(A)` by , and by we know that `A in PS(B)`, which
means that `A sube B`.
If `A sube B` and `C sube D`, then `A nn C sube B nn D`.
Given `z in A nn C`, we need to show that `z in B nn D`. If `z in A nn C`, then by ,
we know that `z in A` and `z in C`. Then, by , we know that `z in B` and `z in D`, which means
that `z in B nn D`, as desired. Therefore `A nn C sube B nn D`.
If `A sube B` and `B sube A`, then `A=B`.
By we know that every element in `A` is in `B`, and every element in `B` is in `A`.
Thus, all possible elements are in both sets or neither. Since there are no differences between the sets,
they must be equal.
For any sets `A` and `B`:
 `(A uu B)' = A' nn B'`, and
 `(A nn B)' = A' uu B'`
This proof has two parts.

To prove (1) above, we will show that the two sides of the equation are subsets of each other.
 First we'll show that `(A uu B)' sube A' nn B'`.
Given `x in (A uu B)'`, we need to show that `x in A' nn B'`. We know that
`x !in A uu B`, by . Then, because `x !in A uu B`, we know that
`x !in A and x !in B`, by . If `x !in A`, then `x in A'`, by definition. Similarly,
`x in B'`. Therefore, `x in A' nn B'`.
 Now we'll show that `A' nn B' sube (A uu B)'`. Given `x in A' nn B'`, we need to show that
`x in (A uu B)'`. We know that `x in A'` and `x in B'`, by . Then by
, we know that `x !in A` and `x !in B`. Then, `x !in A uu B`, which means
that `x in (A uu B)'`, as desired.
Since they are subsets of each other, we know that they are equal by .

To prove (2) above, we will show that the two sides of the equation are subsets of each other.
 First we'll show that `(A nn B)' sube A' uu B'`. Given `x in (A nn B)'`, we need to show that
`x in A' uu B'`. We know that `x !in A nn B`, by , which means
that `x !in A and x !in B`. This means `x in A' and x in B'`, which means that `x in A' uu B'`, as
desired.
 Now we'll show that `A' uu B' sube (A nn B)'`. Given `x in A' uu B'`, we need to show that
`x in (A nn B)'`. We know that `x in A' or x in B'`, by , which means that
`x !in A or x !in B`, by . This means that `x` is not in both `A` and `B`,
so it's not in `A nn B`, which means it is in `(A nn B)'`.
Since they are subsets of each other, we know that they are equal by .
If `A sube B and C sube D`, then `A xx C sube B xx D`.
Given any `(x,y) in A xx C`, we need to be able to show that `(x,y) in B xx D`. We know from
that if `(x,y) in A xx C`, then `x in A` and `y in C`. And given that
`A sube B and C sube D`, we further know that `x in B and y in D`, by . And then it becomes
clear that `(x,y) in B xx D`.
If `A xx B sube A xx C and A != O/`, then `B sube C`.
Given `y in B`, we need to show that `y in C`. Because `A != O/`, we know `A` contains at least one element,
so we'll take `x in A` as well. Now `(x,y) in A xx B`, and by , we know that
`(x,y) in A xx C`, which means that `y in C`, by .
If `A xx B = A xx C and A != O/`, then `B = C`.
To show that `B = C`, we will show that `B sube C` and `C sube B`. Since `A xx B = A xx C`, we know that
`A xx B sube A xx C`, by . And given that `A != O/`, we can apply
to show that `B sube C`. Similarly, we can show that `C sube B`. Therefore,
by , `B = C`.
`A nn (B uu C) = (A nn B) uu (A nn C)`
To prove the equality, we will show that each side of the equation is a subset of the other.
 Suppose `x in A nn (B uu C)`. We know that `x in A and x in B uu C`. The union gives two possibilities,
and we'll examine both:
 `x in B`. If `x in B`, then we know `x in A nn B`, and that `x in (A nn B) uu (A nn C)`, by
and , respectively.
 `x in C`. By a parallel argument, if `x in C`, then `x in (A nn B) uu (A nn C)`.
Because `x in (A nn B) uu (A nn C)` in both cases, we know that `A nn (B uu C) sube (A nn B) uu (A nn C)`.
 Now suppose `x in (A nn B) uu (A nn C)`. We need to show that `x in A nn (B uu C)`. The union gives two
cases, which we'll examine:
 `x in (A nn B)`. In this case `x in A` and `x in B`. Then it's clear that `x in B uu C`, and
`x in A nn (B uu C)`.
 `x in (A nn C)`. By a parallel argument, `x in A nn (B uu C)`.
Because `x in A nn (B uu C)` in both cases, we know that `(A nn B) uu (A nn C) sube A nn (B uu C)`.
Because the two sets are subsets of each other, we know they are equal by .
`A uu (B nn C) = (A uu B) nn (A uu C)`
To prove the equality, we will show that each side of the equation is a subset of the other.
 Suppose `x in A uu (B nn C)`. The union gives two possibilities, and we'll examine both:
 `x in A`. If `x in A`, then we know `x in A uu B and x in A uu C`, and that
`x in (A uu B) nn (A uu C)`, by and , respectively.
 `x in (B nn C)`. We know that `x in B and x in C`. Then clearly `x in A uu B and x in A uu C`, and so
then `x in (A uu B) nn (A uu C)`.
Because `y in (A uu B) nn (A uu C)` in both cases, we know that `A uu (B nn C) sube (A uu B) nn (A uu C)`.
 Now suppose `y in (A uu B) nn (A uu C)`. We need to show that `y in A uu (B nn C)`. By
, we know that `y in A uu B and y in A uu C`. Now either `y in A` or `y !in A`,
and we'll examine both cases.
 `y in A`. If `y in A`, then clearly `y in A uu (B nn C)`.
 `y !in A`. If `y !in A`, then in order for `y in A uu B and A in A uu C` to be true,
`y in B and y in C` must be true. Therefore `y in B nn C`, and then clearly `y in A uu (B nn C)`.
Because `y in A uu (B nn C)` in both cases, we know that `(A uu B) nn (A uu C) sube A uu (B nn C)`.
Because the two sets are subsets of each other, we know they are equal by .
The distributes over union, intersection, and subtraction:
 `A xx (B uu C) = (A xx B) uu (A xx C)`
 `A xx (B nn C) = (A xx B) nn (A xx C)`
 `A xx (B  C) = (A xx B)  (A xx C)`
This proof is broken up into three subproofs: cartesian product
distributes over union, cartesian product distributes
over intersection, and cartesian product distributes
over difference.
`A xx (B uu C) = (A xx B) uu (A xx C)`
To prove that the two sets are equal, we'll show that they are subsets of each other.
 Given `(x,y) in A xx (B uu C)`, we need to show that `(x,y) in (A xx B) uu (A xx C)`. By
, we know that `x in A` and `y in B uu C`. This gives two cases:
 `y in B`. If `y in B`, then `(x,y) in A xx B`, and so `(x,y) in (A xx B) uu (A xx C)`.
 `y in C`. By a parallel argument, `(x,y) in (A xx B) uu (A xx C)`.
In both cases, `(x,y) in (A xx B) uu (A xx C)`, so `A xx (B uu C) sube (A xx B) uu (A xx C)`.

Given `(x,y) in (A xx B) uu (A xx C)`, we need to show that `(x,y) in A xx (B uu C)`. The union gives
two cases:

`(x,y) in (A xx B)`. By , we know that `x in A and y in B`. Therefore,
`y in B uu C`, so `(x,y) in A xx (B uu C)`.
 `(x,y) in (A xx C)`. By a parallel argument, `(x,y) in A xx (B uu C)`.
In both cases, `(x,y) in A xx (B uu C)`, so `(A xx B) uu (A xx C) sube A xx (B uu C)`.
Because each side of the equation is a subset of the other, they must be equal.
`A xx (B nn C) = (A xx B) nn (A xx C)`
To prove that the two sets are equal, we'll show that they are subsets of each other.
 Given `(x,y) in A xx (B nn C)`, we need to show that `(x,y) in (A xx B) nn (A xx C)`. By
, we know that `x in A` and `y in B nn C`, so clearly
`(x,y) in (A xx B) and (x,y) in (A xx C)`. In other words, `(x,y) in (A xx B) nn (A xx C)`, so
`A xx (B nn C) sube (A xx B) nn (A xx C)`.

Given `(x,y) in (A xx B) nn (A xx C)`, we need to show that `(x,y) in A xx (B nn C)`.
We know that `(x,y) in (A xx B) and (x,y) in (A xx C)`. By ,
`x in A and y in B and y in C`. Therefore, `y in B nn C` and `(x,y) in A xx (B nn C)`,
so `(A xx B) nn (A xx C) sube A xx (B nn C)`.
Because each side of the equation is a subset of the other, they must be equal.
`A xx (B  C) = (A xx B)  (A xx C)`
To prove that the two sets are equal, we'll show that they are subsets of each other.

Given `(x,y) in A xx (B  C)`, we need to show that `(x,y) in (A xx B)  (A xx C)`. By
, we know that `x in A` and `y in B  C`, which means that `y in B and y !in C`,
by . That means `(x,y) in (A xx B)` but `(x,y) !in (A xx C)`, and so
`(x,y) in (A xx B)  (A xx C)`. Therefore, `A xx (B  C) sube (A xx B)  (A xx C)`.

Given `(x,y) in (A xx B)  (A xx C)`, we need to show that `(x,y) in A xx (B  C)`.
We know that `(x,y) in (A xx B) and (x,y) !in (A xx C)`. By ,
`x in A and y in B and y !in C`. Therefore, `y in B  C` and `(x,y) in A xx (B  C)`,
so `(A xx B)  (A xx C) sube A xx (B  C)`.
Because each side of the equation is a subset of the other, they must be equal.
`PS(A nn B) = PS(A) nn PS(B)` ( distributes over intersection)
We will prove the equality by showing that the two sets are subsets of each other.

Given `S in PS(A nn B)`, `S sube A nn B` by . Clearly, then, `S sube A` and `S sube B`.
And this means that `S in PS(A)` and `S in PS(B)`, so `S in PS(A) nn PS(B)`, and
`PS(A nn B) sube PS(A) nn PS(B)`.

Given `T in PS(A) nn PS(B)`, we know that `T sube A and T sube B` by , and so
`T sube A nn B`, which means `T in PS(A nn B)`, so `PS(A) nn PS(B) sube PS(A nn B)`.
Thus, `PS(A nn B) = PS(A) nn PS(B)`.
Note that power set does not distribute over union (ie, `PS(A uu B) = PS(A) uu PS(B)` is not true in general).
As a counterexample, consider the case where `A={1,2}` and `B={3,4}`. Then `A uu B = {1,2,3,4}`, which means
that `{1,2,3,4} in PS(A uu B)`. However, `PS(A) = {O/,{1},{2},{1,2}}` and `PS(B) = {O/,{3},{4},{3,4}}`.
Clearly, `{1,2,3,4} !in PS(A) uu PS(B)`, so `PS(A uu B) != PS(A) uu PS(B)` in this case.
A function from `A` to `B` is set of ordered pairs `S sube A xx B` such that:
 `(AA u in A)(EE v in B)((u,v) in S)`, and
 `(AA u in A)(AA v,w in B)((u,v) in S and (u,w) in S => v=w)`
For sets `A` and `B`, "`f:A>B`" means `f` is a function from `A` to `B`. If `f` is a function, then
"`f(u)=v`" means `(u,v) in f`.
The set `A` is called the function's domain and the set `B` is called the function's
codomain. The above definition basically says that a) for every element `u` in `A`, `f(u) in B`,
and b) if `f(u)=v and f(u)=w`, then `v=w` (ie, each element of the function's domain maps to exactly one
element of the function's codomain). The word "range" is sometimes used to refer to a function's codomain,
and sometimes to refer to its .
The image set of a function is the subset of the function's
onto which elements of its are mapped.
The image set of a function `f:A>B`, is defined as
`{f(t):t in A}`
and may be written as `Im(f) or f(A)`.
A function is surjective if the function's image set equals its codomain.
A function `f:A>B` is surjective (or "onto") if
`(AA v in B)(EE u in A)(f(u)=v)
More concisely, `f` is surjective if `Im(f)=B`. This essentially means that every element of the function's
codomain is mapped to by some element of its domain.
A function is injective (or "onetoone") if no element of its
is mapped to by more than one element of its domain.
A function `f:A>B` is injective if
`(AA u,w in A)(f(u)=f(w) => u=w)`
This means that no element of the function's is mapped to by more than one
element of its domain. In order for a function to be invertible, it
must be onetoone.
A function is bijective if it is both and .
Given `f:A>B` and `g:B>C`, the composition of `f` and `g` (written `g@f` and read "`g`
composition `f`" or "`g` of `f`") is the subset of `A xx C` equal to
`{(u,w) in A xx C : g(f(u))=w}`
In other words, `(u,w) in g@f` means `w=g(f(u))`, and `(g@f)(x) = g(f(x))` for all `x`.
For a function `f` with domain `RR`, `f` is strictly increasing if:
`(AA x,y in RR)(x<y => f(x)<f(y))`
If there exists a function from `A` to `B`, then `A=B`.
Given `f:A>B` where `A=B` and `A` and `B` are finite, any or
function must be .
Given `f:A>A` where `A` is infinite, there exist functions that are but not
and vice versa.
Given `f:A>B`, if `B=O/`, then `A=O/`.
Assume by way of contradiction that `B=O/` but `A!=O/`. Then there is an element `u in A`. By the
, there exists an element `v in B` such that
`(u,v) in A xx B`. But `B=O/` so there can be no such element. Therefore, if `B=O/`, then `A=O/`.
Given `f:A>B`, if `A=O/`, then `f=O/ and Im(f)=O/`.
This theorem is really two theorems in one, so we'll address each separately.

Assume by way of contradiction that `A=O/` but `f!=O/`. Then by , there is an
element `(u,v) in A xx B`, but because `A=O/`, this cannot be the case. Therefore, if `A=O/`, then `B=O/`.

Assume by way of contradiction that `A=O/` but `Im(f)!=O/`. Then, there exists an element `v` in the image
set. By , there exists an element `u in A` such that `f(u)=v`. But since `A=O/`, that
cannot be the case. Therefore, if `A=O/`, then `Im(f)=O/`.
The number of distinct functions from a finite domain `A` to a finite codomain `B` is given by
`B^A`. This is the number of distinct lists of length `A` that can formed using elements
from `B`.
The number of distinct injective functions from a finite domain `A` to a finite domain `B` is
given by `{(0,if A>B),((B!)/((BA)!),otherwise):}}`. This is equal to the number of
permutations of `B` containing `A` elements.
The number of distinct surjective functions from a finite domain `A` to a finite domain `B`
is given by `{(0,if A<B),(B^(AB)xxB!,otherwise):}}`. This is equal to the number of
permutations of `B` times the number of unique lists of length `AB`
that can be formed using elements from `B`.
The number of distinct injective functions from a finite domain `A` to a finite domain `B` is
given by `{(0,if A!=B),(B!,otherwise):}}`. This is equal to the number of permutations of `B`.