Document Sample

Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1 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 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 Symbol Set Example R Set of all real numbers All points on a line number Z Set of all integers …,-3, -2, -1, 0, 1, 2, 3, … Q Set of all rational numbers, or quotient {p/q | p ∈ Z, q ∈ Z, q ≠ 0} of integers 3 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): x2 > x with domain set R (real numbers). 4 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 • Ans: •{1, 2, 4, 8} •{-1, -2, -4, -8, 1, 2, 4, 8} 5 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 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 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 Quantifier • Rewrite the following without using and : a. x R, x2 0 b. x Z such that m2 = m • Ans: a. All real numbers have nonnegative squares The square of any real number is nonnegative b. m2 =m, for some integer m Some integers equal their own square 9 Universal Conditional Statement • Universal conditional statement “x, if P(x) then Q(x)”: • Eg: x R, if x > 2, then x2 > 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 12 > 4 (True) When x = -3, if (-3) > 2, then (-3)2 > 4 (True) 10 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 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 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 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 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 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 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 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 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 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 Logical Equivalence and Logical Implication for Quantified Statements in One Variable 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)) 21 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 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 Application: Digital Logic Circuits • Finding Boolean expression for a circuit: P ~ (Q R) 24 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 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 Application: Digital Logic Circuits • Given • Boolean expression: (P Q R) Input Output P Q R S 1 1 1 1 (P Q R) 1 1 0 0 (P Q R) 1 0 1 1 1 0 0 1 • Circuit: 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 27 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) Exercises • Construct circuits for (P Q) R • From the given input/output Input Output P Q R S table below, construct 1 1 1 0 (a) a Boolean expression 1 1 0 1 1 0 1 0 (b) a circuit 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 7 |

posted: | 8/7/2011 |

language: | English |

pages: | 29 |

OTHER DOCS BY MikeJenny

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.