L07_IntroLogic_print

# L07_IntroLogic_print - COMP170 Discrete Mathematical Tools...

This preview shows pages 1–7. Sign up to view the full content.

1 COMP170 Discrete Mathematical Tools for Computer Science Discrete Math for Computer Science K. Bogart, C. Stein and R.L. Drysdale Section 3.1, pp. 91-101 Intro to Logic Version 2.0: Last updated, May 13, 2007 Slides c ± 2005 by M. J. Golin and G. Trippen

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 3.1 Equivalence and Implication Equivalence of Statements Truth Tables DeMorgan’s Laws Implication If and Only If
3 Equivalence of Statements (1) if ((i+j ((j > q) || (List1[i] List2[j]))) (2) List3[k] = List1[i] (3) i = i+1 (4) else (5) List3[k] = List2[j] (6) j = j+1 (7) k = k+1 (1) if (((i+j || ((i+j p) List2[j]))) (2) List3[k] = List1[i] (3) i = i+1 (4) else (5) List3[k] = List2[j] (6) j = j+1 (7) k = k+1 Consider the two pieces of code on the left. They are taken from two diﬀerent versions of Mergesort . Do they do the same thing? “and” || = “or” Code is same except for line 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 (1) ((i+j ((j > q) || (List1[i] List2[j]))) (1’) (((i+j || ((i+j p) List2[j]))) = “and” || = “or” Are they equivalent? Let’s rewrite using s (i+j p+q) t (i p) u (j > q) v (List[i] List2[j]) (1) s and t and ( u or v ) (1’) ( s and t and u ) or ( s and t and v ) Now set w ( s and t ) (1) w and ( u or v ) (1’) ( w and u ) or ( w and v ) equal?
5 Notation for symbolic compound statements: Symbols ( s, t , etc. ), called variables , standing for statements The symbol , denoting and The symbol , denoting or The symbol denoting exclusive or The symbol ¬ , denoting not Left and right parentheses ( , ) We just transformed our code into symbolic compound statements and now want to develop a theory of how to determine whether two such statements are equal (equivalent) logical connectives

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Bigger compound statements are built out of smaller ones (1) w
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/25/2010 for the course COMP COMP170 taught by Professor M.j.golin during the Spring '10 term at HKUST.

### Page1 / 26

L07_IntroLogic_print - COMP170 Discrete Mathematical Tools...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online