Professional Documents
Culture Documents
01 Logic1
01 Logic1
1-1
Lecture 1
Course Overview
Chapter 1. The Foundations
1.1 Propositional Logic
1-2
What is Mathematics, really?
It’s not just about numbers!
Mathematics is much more than that:
1-4
So, what’s this class about?
What are “discrete structures” anyway?
“Discrete” - Composed of distinct, separable
parts. (Opposite of continuous.)
discrete:continuous :: digital:analog
“Structures” - Objects built up from simpler
objects according to some definite pattern.
“Discrete Mathematics” - The study of
discrete, mathematical (i.e. well-defined
conceptual) objects and structures.
1-5
Discrete Objects/Concepts and
Structures We Study
Trees
Propositions
Predicates
Proofs
Sets
Functions
Orders of Growth
Algorithms
Integers
Summations
Sequences
Strings
Permutations
Combinations
Graphs
1-6
Why Study Discrete Math?
The basis of all of digital information
processing is: Discrete manipulations of
discrete structures represented in memory.
It’s the basic language and conceptual
foundation for all of computer science.
Discrete math concepts are also widely used
throughout math, science, engineering,
economics, biology, etc., …
A generally useful tool for rational thought!
1-7
Uses for Discrete Math in
Computer Science
Advanced algorithms & data structures
Programming language compilers & interpreters
Computer networks
Operating systems
Computer architecture
Database management systems
Cryptography
Error correction codes
Graphics & animation algorithms, game engines,
etc.…
i.e., the whole field!
1-8
Course Topics
Logic and Proofs (Chap. 1)
Basic Structures (Chap. 2)
Sets, Functions, Sequences and Summations
Algorithms, Integers, and Matrices (Chap. 3)
Induction and Recursion (Chap. 4)
Counting (Chap. 5)
Discrete Probability (Chap. 6)
1-9
1.1 Propositional Logic
Logic
Study of reasoning.
Specifically concerned with whether reasoning is correct.
Focuses on the relationship among statements, not on the
content of any particular statement.
Gives precise meaning to mathematical statements.
Propositional Logic is the logic that deals with
statements (propositions) and compound statements
built from simpler statements using so-called
Boolean connectives.
Some applications in computer science:
Design of digital electronic circuits.
Expressing conditions in programs.
Queries to databases & search engines.
1-10
Definition of a Proposition
Definition: A proposition (denoted p, q, r, …) is simply:
a statement (i.e., a declarative sentence)
with some definite meaning,
1-11
Examples of Propositions
It is raining. (In a given situation)
Beijing is the capital of China. (T)
2 + 2 = 5. (F)
1 + 2 = 3. (T)
A fact-based declaration is a proposition,
even if no one knows whether it is true
11213 is prime.
1-12
Examples of Non-Propositions
The following are NOT propositions:
Who’s there? (interrogative, question)
of non-constant value)
1-13
Truth Tables
An operator or connective combines one or more
operand expressions into a larger expression. (e.g., “+” in numeric
expressions.)
Unary operators take one operand (e.g., −3);
Binary operators take two operands (e.g. 3 4).
Propositional or Boolean operators operate on propositions
(or their truth values) instead of on numbers.
The Boolean domain is the set {T, F}. Either of its elements is
called a Boolean value.
An n-tuple (p1,…,pn) of Boolean values is called a Boolean n-tuple.
An n-operand truth table is a table that assigns a Boolean value to
the set of all Boolean n-tuples.
1-14
Some Popular Boolean Operators
1-15
The Negation Operator
The unary negation operator “¬” (NOT)
transforms a proposition into its logical negation.
E.g. If p = “I have brown hair.”
then ¬p = “It is not the case that I have brown
hair” or “I do not have brown hair.”
The truth table for NOT:
p p
T F
F T
Operand Result
column column
1-16
The Conjunction Operator
The binary conjunction operator “” (AND)
combines two propositions to form their logical
conjunction.
1-17
Conjunction Truth Table
Operand columns
p q pq
T T T
T F F
F T F
F F F
Note that a conjunction p1 p2 … pn of n
propositions will have 2n rows in its truth table
1-18
The Disjunction Operator
The binary disjunction operator “” (OR)
combines two propositions to form their
logical disjunction.
1-19
Disjunction Truth Table
p q pq
T T T
T F T Note difference
F T T from AND
F F F
Note that pq means that p is true, or q is
true, or both are true!
So, this operation is also called inclusive or,
because it includes the possibility that both
p and q are true.
1-20
The Exclusive-Or Operator
1-21
Exclusive-Or Truth Table
p q pq
Note difference
T T F from OR.
T F T
F T T
F F F
Note that pq means that p is true, or q is
true, but not both!
This operation is called exclusive or,
because it excludes the possibility that both
p and q are true.
1-22
Natural Language is Ambiguous
Note that the English “or” can be ambiguous
regarding the “both” case!
p q p "or" q
“Pat is a singer or T T ?
Pat is a writer.” -
T F T
“Pat is a man or
F T T
Pat is a woman.” -
F F F
Need context to disambiguate the meaning!
For this class, assume “or” means inclusive ().
1-23
The Implication Operator
The conditional statement (aka implication)
p q states that p implies q.
I.e., If p is true, then q is true; but if p is not true,
then q could be either true or false.
E.g., let p = “You study hard.”
q = “You will get a good grade.”
p q = “If you study hard, then you will
get a good grade.” (else, it could go either way)
p: hypothesis or antecedent or premise
q: conclusion or consequence
1-24
Implication Truth Table
p q pq
T T T
The only
T F F False case!
F T T
F F T
p q is false only when p is true but q is not true.
p q does not require that p or q are ever true!
E.g. “(1=0) pigs can fly” is TRUE!
1-25