Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1.

Similar presentations


Presentation on theme: "Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1."— Presentation transcript:

1 Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1

2 Predicates A predicate is a sentence that contains a finite number of variables and becomes a statement when specific values are substituted for the variables The domain of a predicate variable is a set of all values that may be substituted in place of the variable P(x): x is a student at UPM P(x, y): x is a student at y 2

3 Predicates The sets in which predicate variables take their values may be described either in words or in symbols x  A indicates that x is an element of the set A x  A; x is not an element of the set A {1, 2, 3} refers to the set whose elements are 1, 2 and 3 Certain set of numbers that frequently referred to are 3 SymbolSetExample RSet of all real numbersAll points on a line number ZSet of all integers…,-3, -2, -1, 0, 1, 2, 3, … QSet of all rational numbers, or quotient of integers { p/q | p ∈ Z, q ∈ Z, q ≠ 0}

4 Predicates If P(x) is a predicate and x has domain D, the truth set of P(x) is the set of all elements in D that make P(x) true when substituted for x. The truth set is denoted as: {x  D | P(x)} which is read “the set of all x in D such that P(x)” True or false?: Let P(x): x 2 > x with domain set R (real numbers). 4

5 Predicates Let Q(n) be the predicate “n is a factor of 8.” Find the truth set of Q(n) if –the domain of n is the set of Z + –the domain of n is the set of Z 5 Ans: {1, 2, 4, 8} {-1, -2, -4, -8, 1, 2, 4, 8}

6 Predicates Let P(x) and Q(x) be predicates with the common domain D P(x)  Q(x) means that every element in the truth set of P(x) is in the truth set of Q(x), or equivalently for every x, P(x)  Q(x) P(x)  Q(x) means that P(x) and Q(x) have identical truth sets, or equivalently for every x, P(x)  Q(x) 6

7 Universal Quantifier,  Let P(x) be a predicate with domain D. A universal statement is a statement in the form “  x  D, P(x)”.  denotes “for all” It is true iff P(x) is true for every x from D. It is false iff P(x) is false for at least one x from D. A value of x for which P(x) is false is called a counterexample to the universal statement Examples –D = {1, 2, 3, 4, 5}:  x  D, x² >= x(True) –  x  R, x² >= x(False) Method of exhaustion 7

8 Existential Quantifier,  Let P(x) be a predicate with domain D. An existential statement is a statement in the form “  x  D, P(x)”.  denotes “there exists” It is true iff P(x) is true for at least one x from D. It is false iff P(x) is false for every x from D. Examples: –  m  Z, m² = m(True) –E = {5, 6, 7, 8, 9},  x  E, m² = m(False) 8

9 Quantifier Rewrite the following without using  and  : a.  x  R, x 2  0 b.  x  Z such that m 2 = m Ans: a.All real numbers have nonnegative squares The square of any real number is nonnegative b.m 2 =m, for some integer m Some integers equal their own square 9

10 Universal Conditional Statement Universal conditional statement “  x, if P(x) then Q(x)”: Eg:  x  R, if x > 2, then x 2 > 4 Universal conditional statement is called vacuously true or true by default iff P(x) is false for every x in D Eg: When x =1, if 1 > 2, then 1 2 > 4(True) When x = -3, if (-3) > 2, then (-3) 2 > 4(True) 10

11 Negation of Quantified Statements The negation of a universally quantified statement  x  D, P(x) is  x  D, ~P(x)  (  x  D, P(x))   x  D such that ~P(x) The negation of an existentially quantified statement  x  D, P(x) is  x  D, ~P(x)  (  x  D, P(x))   x  D such that ~P(x) Rewrite formally, formal and informal negation: No politicians are honest 11

12 Answer No politicians are honest Formal version:  politicians x, x is not honest Formal negation:  a politician x such that x is honest Informal negation: Some politicians are honest 12

13 Negation of Quantified Statements The negation of a universal conditional statement  x  D, P(x)  Q(x) is  x  D, P(x)  ~Q(x)  (  x, if P(x) then Q(x))   x such that P(x) and ~Q(x) Noted before; ~(p  q)  p  ~q Write formal negation:  people p, of p is blond then p has blue eyes Ans:  a person such that p is blond and p does not have blue eyes 13

14 Exercises Write negations for each of the following statements: –All dinosaurs are extinct –No irrational numbers are integers –Some exercises have answers –All COBOL programs have at least 20 lines –The sum of any two even integers is even –The square of any even integer is even 14

15 Multiply Quantified Statements Imagine you are in a factory and the guide tell you “There is person supervising every detail of the production process” Have both existential quantifier There is and universal quantifier every When a statement contains more than one quantifier, the actions being performed is in the order in which the quantifier occur. 15

16 Multiply Quantified Statements To establish the truth of the statement “  x in D,  y in E such P(x, y)”  Pick whatever x from set D, then find element y in E that “works” for that particular y in P(x, y) To establish the truth of the statement “  x in D, such that  y in E, P(x, y)”  Find element x in D that “works” no matter y in P(x, y) 16

17 Multiply Quantified Statements For all positive numbers x, there exists number y such that y < x There exists number x such that for all positive numbers y, y < x For all people x there exists person y such that x loves y (Informally: Everybody loves somebody) There exists person x such that for all people y, x loves y (Informally: Somebody loves everybody) 17

18 Negation of Multiply Quantified Statements The negation of  x,  y, P(x, y) is logically equivalent to  x,  y, ~P(x, y) The negation of  x,  y, P(x, y) is logically equivalent to  x,  y, ~P(x, y) 18

19 Negation of Multiply Quantified Statements Rewrite formally and negate: Everybody trusts somebody. Formally: (a)  people x,  a person y such that x trusts y. Negation: Somebody trusts nobody. Formally: (b)  a person x, such that  people y, x does not trust y. 19

20 Necessary and Sufficient Conditions, Only If  x, r(x) is a sufficient condition for s(x) means:  x, if r(x) then s(x)  x, r(x) is a necessary condition for s(x) means:  x, if s(x) then r(x)  x, r(x) only if s(x) means:  x, if r(x) then s(x) 20

21 Logical Equivalence and Logical Implication for Quantified Statements in One Variable 21  x  D, (P(x)  Q(x)  (  x  D, P(x))  (  x  D, Q(x))  x  D, (P(x)  Q(x))  (  x  D, P(x))  (  x  D, Q(x)) (  x  D, P(x))  (  x  D, Q(x))   x  D, (P(x)  Q(x))  x  D, (P(x)  Q(x))  (  x  D, P(x))  (  x  D, Q(x))

22 Application: Digital Logic Circuits Digital Logic Circuit is a basic electronic component of a digital system Values of digital signals are 0 or 1 (bits) Black Box is specified by the signal input/output table Input/output table = truth table Three gates: AND-gate, OR-gate, NOT-gate

23 Application: Digital Logic Circuits Combinational circuit is a combination of logical gates Combinational circuit always correspond to some Boolean expression, such that input/output table of a table and a truth table of the expression are identical 23

24 Application: Digital Logic Circuits Finding Boolean expression for a circuit: P  ~ (Q  R) 24

25 Application: Digital Logic Circuits Determining output for a given input: Move from left to right through the diagram, tracing the action of each gate on the input signals Constructing the input/output table for a circuit: list the all possible combinations for input signals, and find the output for each by tracing through the unit 25

26 Application: Digital Logic Circuits A recognizer is a circuit that outputs 1 for exactly one particular combination of input signals and outputs 0’s for all other combinations Multiple-input AND and OR gates Finding a circuit that corresponds to a given input/output table: –Construct equivalent Boolean expression using disjunctive normal form: for all outputs of 1 construct a conjunctive form based on the truth table row. All conjunctive forms are united using disjunction –Construct a digital logic circuit equivalent to the Boolean expression

27 Application: Digital Logic Circuits Given 27 InputOutput PQRS 1111 1100 1011 1001 0110 0100 0010 0000 Boolean expression: (P  Q  R)  (P   Q  R)  (P   Q   R) Circuit:

28 Application: Digital Logic Circuits Two digital logic circuits are equivalent iff their input/output tables are identical Simplification of circuits by using Theorem 1.1.1 to simplify the Boolean expression Another way to simplify circuit by using –Scheffer stroke, | (NAND, AND-gate followed by NOT-gate) –Peirce arrow,  (NOR, OR-gate followed by NOT-gate)

29 Exercises Construct circuits for (P  Q)   R From the given input/output table below, construct (a) a Boolean expression (b) a circuit InputOutput PQRS 1110 1101 1010 1000 0111 0100 0010 0000


Download ppt "Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1."

Similar presentations


Ads by Google