Things to Remember Logic Truth Tables

advertisement
Things to Remember
Logic
Truth Tables
N.B You must remember all the above truth tables as they are the building blocks of
logic.
A
T
T
F
F
B
T
F
T
F
A B
T
F
F
F
A B
T
T
T
F
AB
T
F
T
T
AB
T
F
F
T
A
F
T
Definition: Logical Equivalence.
Two wffs or logical expressions (composed of the same variables) are logically
equivalent if they have the same truth values for every combination of the truth values
of the variables and are written P  Q .
Definition: A tautology is a wff which is always true for all truth values of its variables
or propositions.
Note: A tautology can be represented by 1.
Definition: A contradiction is a wff which is always false for all truth values of its
variables or propositions.
Note: A contradiction can e represented by 0.
Definition: A contingency is a wff which is has a mixture of truth (T) and false(F) for
all truth values of its variables or propositions.
.
Statistics
Definition: Mean The mean denoted by x of n data values x1 , x2 , x3 , xn is
i n
x  x2  x3    xn

x 1
n
x
i 1
n
i
.
Definition: Variance s 2 and Standard Deviation s : The variance s 2 of a set of data
set is the average of the squares of the deviations of the data from the mean, that is if we
have n set of data x1 , x2 , x3 ,, xn then
s 
2
x1  x 2  x2  x 2  x3  x 2    xn  x 2
n 1
i n

 x
i 1
i
 x
2
where x is the mean.
n 1
The standard deviation s is the square root of the variance s 2 , that is
in
s
 x
i 1
i
 x
.
n 1
Octal Code
0
1
2
3
4
5
6
7
000
001
010
011
100
101
110
111
0000
0001
0010
0011
0100
0101
0110
0111
2
0
1
2
3
4
5
6
7
Hexadecimal Code
1000
1001
1010
1011
1100
1101
1110
1111
8
9
10---A
11---B
12---C
13---D
14---E
15---F
Simple Interest
Thus the future value(FV or maturity value) of a simple interest investment of PV euros
at an annual rate of r for a period of t years is
FV  PV (1  r * t )
This is the amount that you would have at the end of the period. You can also solve for
the present value PV given the future value FV you expect at an interest rate r after a
certain number of years t namely,
FV
.
PV 
(1  r * t )
Compound Interest
Thus we have the formula for Compound Interest namely,
FV  PV (1  i) n
where i 
r
and
m
r  annual rate
m  number of compounding periods per year
i  rate per compounding period
n  Total number of compounding periods
PV  Pr incipal ( present value)
FV  Amount( future value ) at the end of n periods .
Given the future value FV (or accumulated amount)we can find the present value PV
(or principal) at a given annual rate r after a given number of compounding periods. We
just reverse the formula
FV  PV (1  i) n
to
PV 
.
FV
 FV (1  i )  n .
(1  i ) n
Functions
Definition Let A and B be sets. A function f from A to B is a rule that assigns to each
element of A exactly one element of B . The set A is called the domain and the set B
the codomain .
If f is a function from A to B we indicate this by writing f : A  B ,
.
In computing, many functions are not functions whose graphs are continuous curves
like above but discrete functions ( usually given by arrow diagrams) as shown below.
Example Consider the set A  1,2,3,namely the domain and the set B  1,2,3,4the
Codomain and the discrete function f from A  B defined as follows
f : A  B, by f (1)  3 , f (2)  2 and f (3)  2 shown in the arrow diagram
below.
f (1)  3
f ( 2)  2
f (3)  2
Note: 3 is called the image of 1 under f
Note the domain is A  1,2,3,the codomain B  1,2,3,4 and the Range  2,3.
This is a function since it is given by a rule and every element in the domain is mapped to
an element in the codomain This is typical of the discrete functions in computing.
Definition A function is onto if its range is equal to its codomain.
The above function is not onto since its range  2,3  codomain 1,2,3,4.
Definition A function is one-to-one if no two distinct elements of the domain have the
same image.
Above function is not one-to-one since the two elements of the domain 2 and
3 have the same image namely 2 in the codomain.
The importance of the properties of (i) onto and (ii) one-to-one for functions is that
these two properties ensure that the function has an inverse according to the following
theorem
Theorem If a function f : A  B is (i) onto and (ii) one-to-one then f (x) has an
inverse f 1 : B  A .
Example Consider the set A  a, b, c,namely the domain and the set B  1,2,3the
codomain and the discrete function f from A  B defined as follows
f : A  B, by f (a)  2 , f (b)  1 and f (c )  3 shown in the arrow diagram
below.
f (a)  2
f (b)  1
f (c )  3
Now the above function f has an inverse f 1 : B  1,2,3  A  a, b, c given by
f 1 (2)  a
f 1 (1)  b
f 1 (3)  c .
You just reverse the process.
The big deal is that if a function f is onto and one-to-one then it has an inverse f
then you can go from f to f 1 and from f 1 to f .
1
Download