Upload
maralah-wilson
View
26
Download
7
Embed Size (px)
DESCRIPTION
Mathematics for Computing. Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK [email protected]. Logic. Propositions Connective Symbols / Logic gates Truth Tables Logic Laws. Propositions. - PowerPoint PPT Presentation
Citation preview
Mathematics for Computing
Lecture 2:Computer Logic and Truth Tables
Dr Andrew Purkiss-TrewCancer Research UK
Logic
Propositions
Connective Symbols / Logic gates
Truth Tables
Logic Laws
Propositions
Definition: A proposition is a statement that is either true or false. Which ever of these (true or false) is the case is called the truth value of the proposition.
Connectives
Compound propositione.g. ‘If Brian and Angela are not both happy, then either Brian is not happy or Angela is not happy’
Atomic proposition:‘Brian is happy’ ‘Angela is happy’
Connectives:and, or, not, if-then
Connective Symbols
Connective Symbol
and ٨
or ٧
not ~ or ¬
if-then →
if-and-only-if ↔
Conjugation
Logical ‘and’
Symbol ٨Written p ٨ q Alternative forms p & q, p . q, pqLogic gate version
pq pq
Disjunction
Logical ‘or’
Symbol ٧Written p ٧ qAlternative form p + qLogic gate version
pq p + q
Negation
Logical ‘not’
Symbol ~Written ~pAlternative forms ¬p, p’, p Logic gate version
p ~p
Truth Tables
p ~p
T F
F T
p q p ٨ q
T T T
T F F
F T F
F F F
p q p ٧ q
T T T
T F T
F T T
F F F
Compound Propositions
p q ~q
T T F
T F T
F T F
F F T
~(p ٨ ~q)
p q ~q p ٨~q
T T F F
T F T T
F T F F
F F T F
p q ~q p ٨~q ~(p ٨ ~q)
T T F F T
T F T T F
F T F F T
F F T F T
p q
T T
T F
F T
F F
Tautologies
Always true
p ~p p ٧ ~p
T F T
F T T
p ~p p ٧ ~p
T F T
F T T
Contradictions
Always false
p ~p p ٨ ~p
T F F
F T F
Website for Lecture Notes
http://www.cryst.bbk.ac.uk/~bpurk01/MfC/index2007.html
End of First Logic 1?
Place marker
Mathematics for Computing
Lecture 3:Computer Logic and Truth Tables 2
Dr Andrew Purkiss-TrewCancer Research UK
Logical Equivalence
Logical ‘equals’
Symbol ≡
Written p ≡ p
p q ~p ~q ~p ٨ ~q
~(~p ٨ ~q)
T T F F F T
T F F T F T
F T T F F T
F F T T T F
p ٧ q
T
T
T
F
Conditional
Logical ‘if-then’
Symbol →Written p → q
p q p → q
T T T
T F F
F T T
F F T
Biconditional
Logical ‘if and only if’
Symbol ↔Written p ↔ q
p q p ↔ q
T T T
T F F
F T F
F F T
converse and contrapositive
The converse of p → q is q → p
The contrapositive of p → q is ~q → ~p
Laws of Logic
Laws of logic allow us to combine connectives and simplify propositions and prove that logical equivalences are correct.
Double Negative Law
~ ~ p ≡ p
Implication Law
p → q ≡ ~p ٧ q
Equivalence Law
p ↔ q ≡ (p → q) ٨ (q → p)
Idempotent Laws
p ٨ p ≡ p
p ٧ p ≡ p
Commutative Laws
p ٨ q ≡ q ٨ p
p ٧ q ≡ q ٧ p
Associative Laws
p ٨ (q ٨ r) ≡ (p ٨ q) ٨ r
p ٧ (q ٧ r) ≡ (p ٧ q) ٧ r
Distributive Laws
p ٨ (q ٧ r) ≡ (p ٨ q) ٧ (p ٨ r)
p ٧ (q ٨ r) ≡ (p ٧ q) ٨ (p ٧ r)
Identity Laws
p ٨ T ≡ p
p ٧ F ≡ p
Annihilation Laws
p ٨ F ≡ F
p ٧ T ≡ T
Inverse Laws
p ٨ ~p ≡ F
p ٧ ~p ≡ T
Absorption Laws
p ٨ (p ٧ q) ≡ p
p ٧ (p ٨ q) ≡ p
de Morgan’s Laws
~(p ٨ q) ≡ ~p ٧ ~q
~(p ٧ q) ≡ ~p ٨ ~q
End of Logic