0% found this document useful (0 votes)
13 views

Discrete Mathematics - Logic & Proofs (Propositional Logic)

The document discusses propositional logic and how it relates to computer science. It defines basic concepts like propositions, logical operators, and truth tables. It also explains how logical operations correspond to bit operations in computers using 0s and 1s.

Uploaded by

Jam Cavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Discrete Mathematics - Logic & Proofs (Propositional Logic)

The document discusses propositional logic and how it relates to computer science. It defines basic concepts like propositions, logical operators, and truth tables. It also explains how logical operations correspond to bit operations in computers using 0s and 1s.

Uploaded by

Jam Cavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Logic and Proofs

PROPOSITIONAL LOGIC
Introduction

 The rules of logic give precise meaning to mathematical


statements. These rules are used to distinguish between
valid and invalid mathematical arguments. Understand
and how to construct correct mathematical arguments.

 Logic has numerous applications to computer science.


These rules are used in the design of computer circuits,
the construction of computer programs, the verification
of the correctness of programs, and in many other ways.
The area of logic that deals with propositions is called
the propositional calculus or propositional logic. It
was first developed systematically by the Greek
philosopher Aristotle more than 2300 years ago.
Proposition is a declarative sentence (that is, a
sentence that declares a fact) that is either true
or false, but not both.

YES NO

1. Manila is the capital of the 1. What time is it?


Philippines 2. Read this carefully.

2. Manila is the capital of Canada. 3. x + 1 = 2.


4. x + y = z.
3. 1 + 1 = 2
Sentences 1 and 2 are not
4. 2 + 2 = 3 propositions because they are not
declarative sentences.
Sentences 3
Propositions 1 and 3 are true,
and 4 are not propositions because
whereas 2 and 4 are false. they are neither true nor false
Statement variables, that is, variables that represent propositions,
just as letters are used to denote numerical variables.

The conventional letters used for propositional variables are


p, q, r, s,

The truth value of a proposition is true, denoted by T, if it is a true


proposition, and the truth value of a proposition is false, denoted
by F, if it is a false proposition.
Let p be a proposition.
The negation of p, denoted by ¬p (also denoted by p), is the
statement “It is not the case that p.”

The proposition ¬p is read “not p.” The truth value of the


negation of p, ¬p, is the opposite of the truth value of p.

The negation of a proposition can also be


considered the result of the operation of
the negation operator on a proposition.
The negation operator constructs a new
proposition from a single existing
proposition.
Let p and q be propositions. The conjunction of p and
q, denoted by p ∧ q, is the proposition “p and q.” The
conjunction p ∧ q is true when both p and q are true
and is false otherwise. Example:
Find the conjunction of the propositions p and
q where:
• p is the proposition “Rebecca’s PC has
more than 16 GB free hard disk space” and
• q is the proposition “The processor in
Rebecca’s PC runs faster than 1 GHz.”

Answer: p ∧ q, is the proposition


“Rebecca’s PC has more than 16 GB free hard disk
space, and the processor in Rebecca’s PC runs
faster than 1 GHz”

” Rebecca’s PC has more than 16 GB free hard disk


space, and its processor runs faster than 1 GHz.”
The logical operators that are used to form new
propositions from two or more existing propositions.

1. conjunction
2. disjunction
3. exclusive or

These logical operators are also called connectives:


Let p and q be propositions. The disjunction of p and q,
denoted by p ∨ q, is the proposition “p or q.” The
disjunction p ∨ q is false when both p and q are false
and is true otherwise. Example:
Find the disjunction of the propositions p and q
where:
• p is the proposition “Rebecca’s PC has
more than 16 GB free hard disk space” and
• q is the proposition “The processor in
Rebecca’s PC runs faster than 1 GHz.”

Answer: p ∨ q, is the proposition

“Rebecca’s PC has at least 16 GB free hard disk


space, or the processor in Rebecca’s PC
runs faster than 1 GHz.”
Let p and q be propositions. The exclusive or of p and q,
denoted by p ⊕ q, is the proposition that is true when
exactly one of p and q is true and is false otherwise.
Conditional Statement:

Let p and q be propositions.


The conditional statement
p → q is the proposition “if
p, then q.”

The conditional statement


p → q is false when p is true
and q is false, and true
otherwise.

In the conditional statement


p → q, p is called the
hypothesis (or antecedent or
premise) and q is called the
conclusion (or consequence).
Let p be the statement “Maria learns discrete
mathematics” and q the statement “Maria will
find a good job.” Express the statement p → q
as a statement in English.

Answer: p → q

“If Maria learns discrete mathematics, then she will


find a good job.”

“Maria will find a good job when she learns discrete


mathematics.”

“For Maria to get a good job, it is sufficient for her to


learn discrete mathematics.”

“Maria will find a good job unless she does not learn
discrete mathematics.”
What is the value of the variable x after the statement
if 2 + 2 = 4 then x := x + 1

if x = 0 before this statement is encountered?

(The symbol := stands for assignment.


The statement x := x + 1 means the assignment of the value of x + 1
to x.)

Solution: Because 2 + 2 = 4 is true,


the assignment statement x := x + 1 is executed.
Hence, x has the value 0 + 1 = 1 after this statement is encountered.
Related Conditional Statement:

The proposition q → p is called the converse of p → q.

The contrapositive of p → q is the proposition ¬q →¬p.

The proposition ¬p →¬q is called the inverse of p → q.

These three conditional statements formed from p → q, only the


contrapositive always has the same truth value as p → q.
Example:
What are the contrapositive, the converse, and the inverse of the conditional
statement “The home team wins whenever it is raining?”

Because “q whenever p” is one of the ways to express the conditional statement


p → q, the original statement can be rewritten as
“If it is raining, then the home team wins.”

Answers:
the converse is:
“If the home team wins, then it is raining.” (q → p)

the contrapositive of this conditional statement is:


“If the home team does not win, then it is not raining.” (¬q →¬p)

the inverse is:


“If it is not raining, then the home team does not win.” (¬p →¬q)

Only the contrapositive is equivalent to the original statement.


Biconditionals

Let p and q be propositions.


The biconditional statement
p ↔ q is the proposition
“p if and only if q.”

The biconditional statement


p ↔ q is true when p and q
have the same truth values,
and is false otherwise.

Biconditional statements are


also called bi-implications.
Truth Tables of Compound Propositions
Construct the truth table of the compound
proposition (p ∨¬q) → (p ∧ q).
Precedence of Logic Operations

We can construct compound propositions using the negation operator and the
logical operators defined so far.

We will generally use parentheses to specify the order in which logical operators
in a compound proposition are to be applied.

For instance, (p ∨ q) ∧ (¬r) is the conjunction of p ∨ q and ¬r.

However, to reduce the number of parentheses, we specify that the negation


operator is applied before all other logical operators. This means that ¬p ∧ q is
the conjunction of ¬p and q, namely, (¬p) ∧ q, not the negation of the
conjunction of p and q, namely¬(p ∧ q).
Precedence of Logic Operations

Another general rule of precedence is that the conjunction


operator takes precedence over
the disjunction operator, so that p ∧ q ∨ r means (p ∧ q) ∨ r rather
than p ∧ (q ∨ r).

Because this rule may be difficult to remember, we will continue to


use parentheses so that the order of the disjunction and
conjunction operators is clear.
Precedence of Logic Operations

Finally, it is an accepted rule that the conditional


and biconditional operators → and ↔ have lower
precedence than the conjunction and disjunction
operators, ∧ and ∨.

Consequently, p ∨ q → r is the same as (p ∨ q) → r.

We will use parentheses when the order of the


conditional operator and biconditional operator is
at issue, although the conditional operator has
precedence over the biconditional operator.
Logic and Bit Operations

Computers represent information using bits. A bit is a symbol with


two possible values, namely, 0 (zero) and 1 (one). This meaning of
the word bit comes from binary digit, because zeros and ones are
the digits used in binary representations of numbers.

The well-known statistician John Tukey introduced this terminology


in 1946. A bit can be used to represent a truth value, because
there are two truth values, namely, true and false.

As is customarily done, we will use a 1 bit to represent true and a


0 bit to represent false. That is, 1 represents T (true), 0 represents F
(false).

A variable is called a Boolean variable if its value is either true or


false. Consequently, a Boolean variable can be represented
using a bit.
Logic and Bit Operations
Logic and Bit Operations
Computer bit operations correspond to the logical connectives.

By replacing true by a one and false by a zero in the truth tables for
the operators ∧, ∨, and ⊕,
A bit string is a sequence of zero or more bits. The length
of this string is the number of bits in the string.

Example: 101010011 is a bit string of length nine.


We can extend bit operations to bit strings. We define the bitwise
OR, bitwise AND, and bitwise XOR of two strings of the same length
to be the strings that have as their bits the OR, AND, and XOR of
the corresponding bits in the two strings, respectively. We use the
symbols ∨,∧, and ⊕ to represent the bitwise OR, bitwise AND, and
bitwise XOR operations, respectively.

Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 01
1011 0110 and 11 0001 1101.

You might also like