CSC 203 Discrete Structure Lesson Note
CSC 203 Discrete Structure Lesson Note
DISCRETE STRUCTURE
Department of Computer
Science
Kwara State University,
Malete.
LOGIC
What is propositional logic?
This is a branch of logic that deals with propositions
and their relationships through logical connectives.
What is a proposition?
A proposition is a declarative statement that is either
True (1) or False (0) but cannot be both. T is used to
denote TRUE and F to denote FALSE.
PROPOSITIONAL LOGIC
Examples of propositions:
Milk is white
Abuja is the capital of Nigeria
Humans are just fish with legs
2+3=5
Examples of non-propositions:
Sit down
What time is it?
x+1=2
2+x>8
Logical Connectives
1. NOT (¬) or NEGATION: This flips the value of the proposition.
This corresponds to the English “It is not the case”. (e.g. if P denotes
“the earth is round”, then ¬P denotes “The earth is not round”).
2. AND (∧) or CONJUNCTION: This is true if and only if both
propositions are true. This corresponds to the English “and”,
“although”, “but”, “however”.(e.g. if P denotes “I am at home” and
Q denotes “It is raining” then P ∧ Q denotes “I am at home and it is
raining”).
3. OR (∨) or DISJUNCTION: This is true if either proposition or both
are true. This corresponds to the English “or” and “unless”.(e.g. if P
denotes “I am at home” and Q denotes “It is raining” then P ∨ Q
denotes “I am at home or it is raining).
4. CONDITIONAL (→) or IMPLICATION: This is false when the
antecedent(P) is true and the consequent(Q) is false. True in all other
courses. This corresponds to English “if-then”. (e.g. if P denotes “I am
at home” and Q denotes “It is raining” then P → Q denotes “if i am
at home then it is raining”).
Ans:If I write an exam and I cheat then I will get caught and I will fail
Example 2
Translate the following into propositional logic:
If James does not die then Mary will not get any money and
James family will be happy.
Solution
P= James dies
Q=Mary will get money
R=James family will be happy
(¬P)→(¬Q Ʌ R)
Example 3
Translate the following into propositional logic:
A student gets A in CSC 201 if and only if his weighted total is ≥ 95%
Solution
P= A student gets A in CSC 201
Q= His weighted total is ≥ 95%
P↔Q
Interpreting propositional logic syntax
Each well formed formula can be drawn syntactically showing all connectives
and which wffs they attach to.
Truth Table
We can calculate complex well formed formulas (wff) using truth tables.
Truth table list all the possibilities of truth for each set of simple
propositions.
P P Q P Q R
1 1 1 1 1 1
1 1 0
0 1 0 1 0 1
0 1 1 0 0
0 0 0 1 1
0 1 0
0 0 1
0 0 0
Truth Conditions
1. Negation (¬)
P ¬P
1 0
0 1
Mathematically,
Val (¬P)= 1- Val(P)
2. Conjunction (Ʌ):
P Q PɅQ
1 1 1
1 0 0
0 1 0
0 0 0
Mathematically,
Min(Val(P), Val(Q))
3. Disjunction (v)
P Q PvQ
1 1 1
1 0 1
0 1 1
0 0 0
Mathematically,
Max(Val(P),Val(Q))
4. Conditional/Implication (→)
P Q P→Q
1 1 1
1 0 0
0 1 1
0 0 1
Mathematically,
=1 iff Val(P) ≤ Val(Q)
5. Biconditional (↔)
P Q P↔Q
1 1 1
1 0 0
0 1 0
0 0 1
6. Exclusive Orꚛ
P Q PꚛQ
T T F
T F T
F T T
F F F
Example 1
Analyze the statement below using the truth table:
If you get more doubles than any other player you will lose, or that if you lose
you must have bought the most properties.
Solution:
P= You get more doubles than any other player
Q= You will lose
R= You must have bought the most properties
(P Ʌ Q) → (R Ʌ S)
Using the truth table:
TAUTOLOGY, CONTRADICTION, AND CONTINGENCY
• A tautology is a compound proposition which is always true for all
possible truth values of the propositions that occur in it.
Example 1: P v ¬P
Example 2: (((P→Q) Ʌ (Q→R)) → (P → R))
• A contradiction is a compound proposition which is always false for all
possible truth value of the propositions that occur in it.
Example 1: P Ʌ ¬P
Example 2: (Q Ʌ P) V (Q Ʌ ¬P)
SATISFIABILITY VS UNSATISFIABILITY
• Satisfiability: A compound proposition is satisfiable if there is at least one true result
in its truth table.
• Unsatisfiability: A compound proposition is unsatisfiable if it does not have a single
true result in its truth table.
The last column of the two truth tables are identical. Therefore, (P→Q) and (Q v ¬P) are
logically equivalent.
DeMorgan’s Law
This law is used to simplify or transform expressions that explicitly
involve negation (¬). It addresses how negation interacts with logical
conjunctions (∧) and disjunctions (∨).e.g
Negation of a conjunction: ¬(P ∧ Q) ≡ (¬P V ¬Q)