Mathematics for Computing
-
Upload
daria-riley -
Category
Documents
-
view
27 -
download
4
description
Transcript of Mathematics for Computing
![Page 1: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/1.jpg)
Mathematics for Computing
Lecture 2:Computer Logic and Truth Tables
Dr Andrew Purkiss-TrewCancer Research UK
![Page 2: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/2.jpg)
Logic
Propositions
Connective Symbols / Logic gates
Truth Tables
Logic Laws
![Page 3: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/3.jpg)
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.
![Page 4: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/4.jpg)
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
![Page 5: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/5.jpg)
Connective Symbols
Connective Symbol
and ٨
or ٧
not ~ or ¬
if-then →
if-and-only-if ↔
![Page 6: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/6.jpg)
Conjugation
Logical ‘and’
Symbol ٨Written p ٨ q Alternative forms p & q, p . q, pqLogic gate version
pq pq
![Page 7: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/7.jpg)
Disjunction
Logical ‘or’
Symbol ٧Written p ٧ qAlternative form p + qLogic gate version
pq p + q
![Page 8: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/8.jpg)
Negation
Logical ‘not’
Symbol ~Written ~pAlternative forms ¬p, p’, p Logic gate version
p ~p
![Page 9: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/9.jpg)
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
![Page 10: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/10.jpg)
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
![Page 11: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/11.jpg)
Tautologies
Always true
p ~p p ٧ ~p
T F T
F T T
p ~p p ٧ ~p
T F T
F T T
![Page 12: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/12.jpg)
Contradictions
Always false
p ~p p ٨ ~p
T F F
F T F
![Page 13: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/13.jpg)
Website for Lecture Notes
http://www.cryst.bbk.ac.uk/~bpurk01/MfC/index2007.html
![Page 14: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/14.jpg)
End of First Logic 1?
Place marker
![Page 15: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/15.jpg)
Mathematics for Computing
Lecture 3:Computer Logic and Truth Tables 2
Dr Andrew Purkiss-TrewCancer Research UK
![Page 16: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/16.jpg)
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
![Page 17: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/17.jpg)
Conditional
Logical ‘if-then’
Symbol →Written p → q
p q p → q
T T T
T F F
F T T
F F T
![Page 18: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/18.jpg)
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
![Page 19: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/19.jpg)
converse and contrapositive
The converse of p → q is q → p
The contrapositive of p → q is ~q → ~p
![Page 20: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/20.jpg)
Laws of Logic
Laws of logic allow use to combine connectives and simplify propositions.
![Page 21: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/21.jpg)
Double Negative Law
~ ~ p ≡ p
![Page 22: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/22.jpg)
Implication Law
p → q ≡ ~p ٧ q
![Page 23: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/23.jpg)
Equivalence Law
p ↔ q ≡ (p → q) ٨ (q → p)
![Page 24: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/24.jpg)
Idempotent Laws
p ٨ p ≡ p
p ٧ p ≡ p
![Page 25: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/25.jpg)
Commutative Laws
p ٨ q ≡ q ٨ p
p ٧ q ≡ q ٧ p
![Page 26: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/26.jpg)
Associative Laws
p ٨ (q ٨ r) ≡ (p ٨ q) ٨ r
p ٧ (q ٧ r) ≡ (p ٧ q) ٧ r
![Page 27: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/27.jpg)
Distributive Laws
p ٨ (q ٧ r) ≡ (p ٨ q) ٧ (p ٨ r)
p ٧ (q ٨ r) ≡ (p ٧ q) ٨ (p ٧ r)
![Page 28: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/28.jpg)
Identity Laws
p ٨ T ≡ p
p ٧ F ≡ p
![Page 29: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/29.jpg)
Annihilation Laws
p ٨ F ≡ F
p ٧ T ≡ T
![Page 30: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/30.jpg)
Inverse Laws
p ٨ ~p ≡ F
p ٧ ~p ≡ T
![Page 31: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/31.jpg)
Absorption Laws
p ٨ (p ٧ q) ≡ p
p ٧ (p ٨ q) ≡ p
![Page 32: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/32.jpg)
de Morgan’s Laws
~(p ٨ q) ≡ ~p ٧ ~q
~(p ٧ q) ≡ ~p ٨ ~q
![Page 33: Mathematics for Computing](https://reader037.fdocuments.in/reader037/viewer/2022103023/56812c6b550346895d9101a5/html5/thumbnails/33.jpg)