ICS 253 Logic Sets An Overview Week 1
- Slides: 32
ICS 253 Logic & Sets (An Overview) Week 1 9/18/2021 Sultan Almuhammadi 1
Keywords (1): Proposition Conjunction Disjunction Negation Compound proposition Truth Table Logically equivalence 9/18/2021 Sultan Almuhammadi 2
Getting started n Proposition: n n Conjunction: (and) n n p^q Disjunction: (or) n n true/false statement cannot be both at the same time e. g. Today is Monday pvq Negation: (not) n 9/18/2021 ~p Sultan Almuhammadi 3
Example: p ^ q is a “compound” proposition (logical expression) The value of this proposition (expression) depends on the values of p and q. n 9/18/2021 e. g. Today is Monday ^ (2+3 = 5) Sultan Almuhammadi 4
Truth table: p ^ q 9/18/2021 p q p^q T T F F F T F F Sultan Almuhammadi 5
Truth table: p v q 9/18/2021 p q pvq T T F F F Sultan Almuhammadi 6
Keywords (2) Conditional proposition: if p then q p q Biconditional proposition: p p if and only if q q 9/18/2021 Sultan Almuhammadi 7
Keywords (2) Conditional proposition: if p then q (read: p implies q ) p q Biconditional proposition: p p if and only if q (write: p iff q for short) q 9/18/2021 Sultan Almuhammadi 8
Keywords (2) Conditional proposition: if p then q (read: p implies q ) p q p -> q Biconditional proposition: p p if and only if q (write: p iff q for short) q p <--> q 9/18/2021 Sultan Almuhammadi 9
Truth Tables: if_then and iff 9/18/2021 p q p -> q p <-> q T T T F F F T T Sultan Almuhammadi 10
Truth Tables (Example) 9/18/2021 p q ~p T T ? T F ? F T ? F F ? Sultan Almuhammadi ~p v q p -> q 11
Truth Tables 9/18/2021 p q ~p ~p v q T T F ? T F F ? F T T ? F F T ? Sultan Almuhammadi p -> q 12
Truth Tables 9/18/2021 p q ~p ~p v q p -> q T T F T ? T F F F ? F T T T ? F F T T ? Sultan Almuhammadi 13
Truth Tables 9/18/2021 p q ~p ~p v q p -> q T T F T T T F F F T T T Sultan Almuhammadi 14
Logically equivalent Truth Tables 9/18/2021 (~p v q) = (p -> q) p q ~p ~p v q p -> q T T F T T T F F F T T T Sultan Almuhammadi 15
Exer 1. (p -> q) = (~p v q) n If it is Wednesday, John has discussion. n n If you don’t study hard, you will fail. n n It is not Wed, or John has discussion. Study hard or you fail. I have a meeting on Friday. n 9/18/2021 I have a meeting today, or it is not Friday. Sultan Almuhammadi 16
Logical Equivalence: p q n n n (p -> q ) (~p v q ) ~( p v q ) ~p ^ ~q [De Morgan’s] ~( p ^ q ) ~p v ~q [De Morgan’s] (p <--> q) (p -> q) ^ (q -> p) (p <--> q) (~p v q) ^ (~q v p) Remember: I use = for 9/18/2021 Sultan Almuhammadi 17
Binary Logic n n n 9/18/2021 p has one of two values: True / False p cannot have both. Values can be {T, F}, {0, 1}, {High, Low} Sultan Almuhammadi 18
Keywords (3): - Propositional logic First order logic Domain of discourse Sets Natural Numbers (N) Integers (Z) Rational Numbers (Q) Irrational Numbers ( Q’ ) Real Numbers (R) Prime numbers 9/18/2021 Sultan Almuhammadi 19
First Order Logic - Propositional logic - - E. g. p ^ q -> r First order logic - 9/18/2021 E. g. p(x) ^ q(y) x and y are from some Domain of discourse. The value of p(x) depends on x. Sultan Almuhammadi 20
Sets - Notations: - 9/18/2021 Upper case letters: A, B X, Y Elements can be listed in braces {…} E. g. A = {1, 2, 5} Elements can be described: E. g. B = set of all even numbers. Or B = {x | x is an even number} E. g. C = {a : a is even and 1< a <10} The size of set A is denoted by |A| E. g. |A| = 3 , |B| = ∞ , |C| = 4 Sultan Almuhammadi 21
Sets - Membership - - // x belongs to A, Subsets - - x A y A A B B N // can be equal // proper-subset The Empty Set: denoted by = { } The Universe: U = set of all elements. 9/18/2021 Sultan Almuhammadi 22
Set Operations - Intersection - - Union - - A B = { x | x A and x B} A B = { x | x A or x B} Complement - 9/18/2021 E’ = Ē = { x | x E } Sultan Almuhammadi 23
Number Systems - Integers: - - Natural Numbers: - - Q = {a/b | a, b Z and b 0} Irrational Numbers: - - N = {0, 1, 2, 3, … } (nonnegative integers) Rational Numbers: - - Z = { …, -3, -2, -1, 0, 1, 2, 3, …} Z+ = {1, 2, 3, …} (positive integers) Q’ = { x | x R and x Q} Prime numbers: - 9/18/2021 {x | x N and x is divisible by 1 and x only} Sultan Almuhammadi 24
Examples: - Which of the following is true? - 9/18/2021 2 N 2 Z 2 N Z x N x Z N Z Z Z Sultan Almuhammadi 25
Warm up: - Domain of discourse (the domain) - - Set {x | x is prime} Set {x | x is even and x is prime} For all x, P(x) x P(x) For some x, P(x) x P(x) Eg. x, x > 1 (domain = N) x, y, x > y (domain = N) 9/18/2021 Sultan Almuhammadi 26
Exer 1: - x y (x > y) x y (x < y) 9/18/2021 (domain (domain of of of discourse discourse Sultan Almuhammadi is is is R) N) Z) Q) N) Z) 27
Exer 1: Solution - x y (x > y) - - - 9/18/2021 (domain of discourse is N) False, for y = x x y (x < y) - (domain of discourse is Q) False, for y = x + 1 x y (x < y) - (domain of discourse is Z) True, for y = x + 1 x y (x > y) - (domain of discourse is N) True, for x = 2, y = 1 x y (x < y) - - False, for x = 1, y = 2 x y (x > y) - (domain of discourse is R) (domain of discourse is Z) False, for y = x - 1 Sultan Almuhammadi 28
Negation: - E. g. - - Universal quantifier - - Domain: set of all horses p(x) : x is a black horse q(x): x is a white horse x p(x) /* all horses are black */ Negation: ~ x p(x) = x ~p(x) Existential quantifier - 9/18/2021 x p(x) Negation: ~ x p(x) = x ~p(x) Sultan Almuhammadi 29
Negation: - e. g. 1. - - x y (x > y) = x [ y (x > y) ] Negation: ~ x [ y (x > y) ] = x ~ y (x > y) = x y ~ ( x > y) = x y ( x ≤ y) e. g. 2. - 9/18/2021 x y z (x < z) ^ (z < y) Negation: ~ x y z (x < z) ^ (z < y) = x y z ~ [ (x < z) ^ (z < y) ] = x y z (x ≥ z) V (z ≥ y) Sultan Almuhammadi 30
Exer 2: n Domains: n n X = all ics 253 students Q = all questions in an ics 253 exam p(x, q) = student x solved question q n Write the following in symbolic notation: A. Everybody got full mark. B. Nobody got full mark. C. Negation of A. (Not everybody got full mark). D. Negation of B. E. There was a hard question nobody solved it. F. Negation of E. Solutions? n 9/18/2021 Sultan Almuhammadi 31
Quiz (A 1) (A 1: for practice only, not counted) n Domains: n n X = all ics 253 students Q = all questions in an ics 253 exam p(x, q) = student x solved question q n Write the following in symbolic notation: “There is exactly one student who got full mark. ” Solution: ? n 9/18/2021 Sultan Almuhammadi 32
- Ics 253
- Ics 253
- Which ics functional area establishes tactics
- Ics 400: advanced ics for complex incidents-aberdeen
- Image sets
- Programmable logic ic
- Week by week plans for documenting children's development
- Kv charts in software testing
- Kibd-253
- Psych 253
- Csc 253
- 253 meaning in the bible
- En 253
- Chem 253
- Dlpp-167
- National archives gb rail 253/516
- Csc 253
- Texes educational diagnostician 253
- Arahan perbendaharaan terimaan
- First order logic vs propositional logic
- Is it x y or y x
- Combinational logic vs sequential logic
- Combinational logic sequential logic 차이
- First order logic vs propositional logic
- Cryptarithmetic problem logic+logic=prolog
- If x = 0 and y = 1, which output line is enabled?
- First order logic vs propositional logic
- Project management plan example
- Convex and concave
- Diploid contains 2 sets of chromosomes
- Mutually disjoint sets example
- Calpads code sets
- Hard skills and soft skills