Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK

Similar presentations


Presentation on theme: "Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK"— Presentation transcript:

1 Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK a.purkiss@mail.cryst.bbk.ac.uk

2 Logic Propositions Connective Symbols / Logic gates Truth Tables Logic Laws

3 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.

4 Connectives Compound proposition e.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

5 Connective Symbols ConnectiveSymbol and ٨ or ٧ not ~ or ¬ if-then → if-and-only-if ↔

6 Conjugation Logical ‘and’ Symbol ٨ Written p ٨ q Alternative forms p & q, p. q, pq Logic gate version p q pq

7 Disjunction Logical ‘or’ Symbol ٧ Written p ٧ q Alternative form p + q Logic gate version p q p + q

8 Negation Logical ‘not’ Symbol ~ Written ~p Alternative forms ¬p, p’, p Logic gate version p~p

9 Truth Tables p~p TF FT pqp ٨ qp ٨ q TTT TFF FTF FFF pqp ٧ qp ٧ q TTT TFT FTT FFF

10 Compound Propositions pq~q TTF TFT FTF FFT ~(p ٨ ~q) pq~qp ٨~q TTFF TFTT FTFF FFTF pq~qp ٨~q ~(p ٨ ~q) TTFFT TFTTF FTFFT FFTFT pq TT TF FT FF

11 Tautologies Always true p~pp ٧ ~p TFT FTT p~pp ٧ ~p TFT FTT

12 Contradictions Always false p~pp ٨ ~p TFF FTF

13 Website for Lecture Notes http://www.cryst.bbk.ac.uk/~bpurk01/http://www.cryst.bbk.ac.uk/~bpurk01/MfC/index2007.html

14 End of First Logic 1? Place marker

15 Mathematics for Computing Lecture 3: Computer Logic and Truth Tables 2 Dr Andrew Purkiss-Trew Cancer Research UK a.purkiss@mail.cryst.bbk.ac.uk

16 Logical Equivalence Logical ‘equals’ Symbol ≡ Written p ≡ p pq~p~q~p ٨ ~q~(~p ٨ ~q) TTFFFT TFFTFT FTTFFT FFTTTF p ٧ q T T T F

17 Conditional Logical ‘if-then’ Symbol → Written p → q pqp → q TTT TFF FTT FFT

18 Biconditional Logical ‘if and only if’ Symbol ↔ Written p ↔ q pqp ↔ q TTT TFF FTF FFT

19 converse and contrapositive The converse of p → q is q → p The contrapositive of p → q is ~q → ~p

20 Laws of Logic Laws of logic allow use to combine connectives and simplify propositions.

21 Double Negative Law ~ ~ p ≡ p

22 Implication Law p → q ≡ ~ p ٧ q

23 Equivalence Law p ↔ q ≡ (p → q) ٨ ( q → p)

24 Idempotent Laws p ٨ p ≡ p p ٧ p ≡ p

25 Commutative Laws p ٨ q ≡ q ٨ p p ٧ q ≡ q ٧ p

26 Associative Laws p ٨ (q ٨ r) ≡ ( p ٨ q) ٨ r p ٧ (q ٧ r) ≡ ( p ٧ q) ٧ r

27 Distributive Laws p ٨ (q ٧ r) ≡ ( p ٨ q) ٧ (p ٨ r) p ٧ (q ٨ r) ≡ ( p ٧ q) ٨ (p ٧ r)

28 Identity Laws p ٨ T ≡ p p ٧ F ≡ p

29 Annihilation Laws p ٨ F ≡ F p ٧ T ≡ T

30 Inverse Laws p ٨ ~p ≡ F p ٧ ~p ≡ T

31 Absorption Laws p ٨ (p ٧ q) ≡ p p ٧ (p ٨ q) ≡ p

32 de Morgan’s Laws ~(p ٨ q) ≡ ~p ٧ ~q ~(p ٧ q) ≡ ~p ٨ ~q

33


Download ppt "Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK"

Similar presentations


Ads by Google