Propositions: Chapter 1: The Foundations: Logic and Proofs
Propositions: Chapter 1: The Foundations: Logic and Proofs
Propositions
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is
either true or false, but not both.
Example:
All the following declarative sentences are propositions.
Solution:
Solution: Let a, c, and f represent “You can access the Internet from campus,” “You
are a computer science major,” and “You are a freshman.” The sentence can be
translated into:
a → (c ν ¬ f ).
EXAMPLE 2
Solution: Let q, r, and s represent “You can ride the roller coaster,” “You are under 4
feet tall,” and “You are older than 16 years old,” respectively. Then the sentence can
be translated to
(r ∧ ¬ s) → ¬ q.
Let G be the function that assigns a grade to a student in our discrete mathematics class.
EXAMPLE 2
Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24), (Carla, 21), (Desire, 22),
(Eddie, 24), and (Felicia, 22). Here each pair consists of a graduate student and this
student’s age. Specify a function determined by this relation.
EXAMPLE 6
Let f1 and f2 be functions from R to R such that f1(x) = x2 and f2(x) = x − x2. What are
the functions f1 + f2 and f1f2?
Solution:
From the definition of the sum and product of functions, it follows that
(f1 + f2)(x) = f1(x) + f2(x) = x2 + (x − x2) = x
and
(f1f2)(x) = x2(x − x2) = x3 − x4.
When f is a function from A to B, the image of a subset of A can also be defined.
Start with the second element, for each item in the input list:
“Insert” it into the correct place in the sorted output list generated so far. Like so:Find
the location where the new item should be inserted using linear or binary search.Then,
shift the items from that position onwards up by one position. Put the new item in the
remaining hole.
Use the insertion sort to put 3, 2, 4, 1, 5 into increasing order
Insert the 2nd element 2 in the right position:
3 > 2 ⇒ put 2 in front of 3. ⇒ 2, 3, 4, 1, 5
Insert the 3rd element 4 in the right position:
4 > 2 ⇒ do nothing. Move to the next comparison.
4 > 3 ⇒ do nothing. Done. ⇒ 2, 3, 4, 1, 5
Insert the 4th element 1 in the right position:
2 > 1 ⇒ put 1 in front of 2. ⇒ 1, 2, 3, 4, 5
Insert the 5th element 5 in the right position:
5 > 1 ⇒ do nothing. Move to the next comparison.
5 > 2 ⇒ do nothing. Move to the next comparison.
5 > 3 ⇒ do nothing. Move to the next comparison.
5 > 4 ⇒ do nothing. Done. ⇒ 1, 2, 3, 4, 5
Alternatively, we can estimate the size of f (x) when x > 2. When x > 2, we have
2x ≤ x2 and 1 ≤ x2. Consequently, if x > 2, we have
0 ≤ x2 + 2x + 1 ≤ x2 + x2 + x2 = 3x2
It follows that C = 3 and k = 2 are also witnesses to the relation f (x) is O(x2).
Observe that O(x2) can be replaced by any function with larger values than x2,
e.g., f(x)= x2+2x+1 is O(x3), f(x) is O(x2+x+7), O(x2+2x+1)
In this example, f(x)=x2+2x+1, g(x)=x2, we say both of these big-O relationships are
of the same order Sometimes written as f(x) = O(g(x))
It is acceptable to write f(x) ∈ O(g(x)) as O(g(x)) represents the set of functions that
are O(g(x))
Example: 1 Caesar Cipher (Page 295)
Cryptography:
Cryptography is a method of protecting information and communications through the
use of codes, so that only those for whom the information is intended can read and
process it. The prefix "crypt-" means "hidden" or "vault" -- and the suffix "-graphy"
stands for "writing."
EXAMPLE 1
What is the secret message produced from the message “MEET YOU IN THE
PARK” using the Caesar cipher?
Solution. First replace the letters in the message with numbers. This produces
12 4 4 19 24 14 20 8 13 19 7 4 15 0 17 10.
Now replace each of these numbers p by f(p) = (p + 3) mod 26. This gives
15 7 7 22 1 17 23 11 16 22 10 7 18 3 20 13.
Translating this back to letters produces the encrypted message “PHHW BRX LQ WKH SDUN.”
where a and b are integers, chosen so that f is a bijection. (The function f (p) = (ap +b) mod
26 is a bijection if and only if gcd(a, 26) = 1.) Such a mapping is called an affifine
transformation, and the resulting cipher is called an affine cipher.
Graphs and Graph Models: Page 641
Graphs:
A graph G = (V , E) consists of V , a nonempty set of vertices (or nodes) and E, a set
of edges. Each edge has either one or two vertices associated with it, called its
endpoints. An edge is said to connect its endpoints.
Finite Graph:
A graph with a finite vertex set and a finite edge set is called a finite graph. In this
book we will usually consider only finite graphs.
Infinite Graph:
The set of vertices V of a graph G may be infinite. A graph with an infinite vertex
set or an infinite number of edges is called an infinite graph
Now suppose that a network is made up of data centers and communication links
between computers. We can represent the location of each data center by a point and
each communications link by a line segment, as shown in Figure 1.
This computer network can be modeled using a graph in which the vertices of the
graph represent the data centers and the edges represent communication links. In
general, we visualize
FIGURE 2 A Computer Network with Multiple Links between Data Centers.
A computer network may contain multiple links between data centers, as shown in
Figure 2. To model such networks we need graphs that have more than one edge
connecting the same pair of vertices.
Graphs that may have multiple edges connecting the same vertices are called multi
graphs. When there are m different edges associated to the same unordered pair of
vertices {u, v}, we also say that {u, v} is an edge of multiplicity m. That is, we can
think of this set of edges as m different copies of an edge {u, v}.
Example# 6
Cycles A cycle Cn, n ≥ 3, consists of n vertices v1, v2,..., vn and edges {v1, v2}, {v2,
v3},...,{vn−1, vn}, and {vn ,v1}. The cycles C3, C4, C5, and C6 are displayed in Figure 4.
Table: 1 (Page 644)
Figure: 1 and 2 (Page 745 and 746)
FIGURE 1 The Bernoulli Family of Mathematicians.
A rooted tree is called an m-ary tree if every internal vertex has no more than m
children. The tree is called a full m-ary tree if every internal vertex has exactly m
children. An m-ary tree with m = 2 is called a binary tree.
EXAMPLE 3
Are the rooted trees in Figure 7 full m-ary trees for some positive integer m?
Solution:
T1 is a full binary tree because each of its internal vertices has two children. T2 is a
full 3-ary tree because each of its internal vertices has three children. In T3 each
internal vertex has five children, so T3 is a full 5-ary tree. T4 is not a full m-ary tree for
any m because some of its internal vertices have two children and others have three
children.
Example: 1,2 and 3 (Page 811 and 812)
Ways to Solve Problems:
In Boolean Algebra The complement of an element, denoted with a bar, is defined by
0 = 1 and 1 = 0. The Boolean sum, denoted by + or by OR, has the following values:
1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0.
1 · 1 = 1, 1 · 0 = 0, 0 · 1 = 0, 0·0=0