460 likes | 635 Views
Discrete Mathematics CS 2610. August 19, 2008. Agenda . Propositional logic Logical equivalences Predicate logic. Logic. Logic is a discipline that studies the principles and methods used to construct valid arguments.
E N D
Discrete Mathematics CS 2610 August 19, 2008
Agenda • Propositional logic • Logical equivalences • Predicate logic
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. • An argument is a related sequence of statements to demonstrate the truth of an assertion • premises are assumed to be true • conclusion, the last statement of the sequence, is taken to be true based on the truth of the others statements.
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. • An argument is valid if the conclusion follows logically from the truth of the premises. • Logic is the foundation for expressing formal proofs in all branches of mathematics.
Propositional Logic Propositional Logicis the logic of compound statements built from simpler statements using LogicalBooleanconnectives. The truth value of a proposition is true, denoted by T, if it is true, and false, denoted by F it is false A proposition is a declarative sentence that is either TRUE or FALSE (not both).
Logical Operators • Compound propositions : built up from simpler propositions using logical operators • Negation -- NOT -- “” • Conjunction -- AND -- “” • Disjunction -- OR -- “” • Exclusive Or -- XOR -- “” • Implication -- “”
Implication Some terminology, for an implication p q • Its converseis:q p. • Its inverseis:¬p ¬ q. • Itscontrapositive is: ¬q ¬p
Biconditional Biconditional operator (): • Partly similar to the English usage of “If and only if.” Thebiconditional p q is true when qand p have the same truth values and false otherwise.
Operator Precedence By convention…
Truth Tables • The truth values of compound propositions can be determined using a truth table that includes a row for every possible combination of truth values.
Logic and Bit Operations • A bit is a binary digit: 0 or 1. • Bits are usually used to represent truth values. • By convention: 0 represents “false”; 1 represents “true”. • Bit operations correspond to logical operators, replacing false by 0 and true by 1 • A Bit String is an ordered sequence of bits.
Logic and Bit Operations • Bitwise operations acting on two bitstrings align the strings and then operate on corresponding pairs of bits 1110 0010 0011 0110 1101 0100
Propositional Equivalences • A tautologyis a proposition that is always true. • Ex.: p Øp p Øp p Ø p T T T F F T
Propositional Equivalences • A contradictionis a proposition that is always false. • Ex.: p Ø p p Øp p Ø p F F T F F T
Propositional Equivalences • A contingency is a proposition that is neither a tautology nor a contradiction. • Ex.: p¬p p Øp p Ø p F T T F F T
Logical Equivalence • If p and q are propositions, then p is logically equivalent toq if and only if their truth tables are the same. • “p is equivalent to q.” is denoted by p q • p, q are logically equivalent if their biconditional p q is a tautology.
Logical Equivalences • Identity p T p p F p • Domination p T T p F F • Idempotent p p p p p p • Double negation (p) p
Logical Equivalences • Commutative: p q q p p q q p • Associative: (p q ) r p ( q r ) (p q ) r p ( q r )
Logical Equivalences • Distributive: p (q r ) (p q ) (p r ) p (q r ) (p q ) (p r ) • De Morgan’s: (p q ) p q (De Morgan’s I) (p q ) p q (De Morgan’s II)
Logical Equivalences • Absorption: p (p q ) p p (p q ) p • Negation: p pF p pT • A useful LE involving : p q p q
DeMorgan’s Identities DeMorgan’s can be extended for simplification of negations of complex expressions • Conjunctional negation: (p1 p2 … pn) (p1 p2 … pn) • Disjunctional negation: (p1p2…pn) (p1p2…pn)
Fallacies Mistakes in proof by applying contingencies instead of tautologies are fallacies. • Affirming the conclusion (Common Mistake) If it is Sunday afternoon, then I go to the movies I go to the movies It is Sunday afternoon It’s Saturday Night!!
Fallacies • Denying the hypothesis If an animal flies then the animal is a bird The animal does not fly The animal is not a bird It’s a penguin!!
Predicate Logic UGA(x) = “x is a UGA student.” Universe of Discourse – all people x is a variable that represents an arbitrary individual in the Universe of Discourse A predicate P, or propositional function, is a function that maps objects in the universe of discourse to propositions • UGA(Mark Richt) is a proposition. • UGA(x) is not a proposition. UGA(x) is like an English predicate template • __________ is a UGA student
Predicate Logic By convention, • Uppercase Roman letters, P, Q, R…, are used to denote predicates • Lowercase Roman letters, x,y,z, are used to denote variables for objects. • Note: this is reversed in Prolog
Predicate Logic • P(x): x > 0 Universe of Discourse (UD): Integers -- Z P(1): 1>0=T; P(50): 50>0=T; P(-10): -10>0= F P(x) is not a proposition
Predicate Logic • F(x): x is Female UD: all people F(Maria)=T F(Edward)=F F(x) is not a proposition
Aside – common sets • Z -- set of integers {… -2, -1, 0, 1, 2, …} • Z+ -- set of positive integers {1, 2, 3, …} • R -- set of real numbers • N -- set of natural numbers {0, 1, 2, …} • Q -- set of rational numbers {p/q | p, qєZ, q ≠ 0}
Predicate Logic • A predicate that states a property about one object is called monadic predicate. • UGA(x) • P(x) • F(x) • A monadic predicate takes one argument. • UD(x): all people
Predicate Logic • A predicate of the form P(x1,…,xn), n>1 that states the relationships among the objects x1,…,xn is called polyadic. Also, n-place predicate or n-ary predicate. • It takes n>1 arguments • UD(x1,…,xn)= UD(x1) x UD(x2) x… UD(xn)
Predicate Logic • L(x,y): x loves y UD(x)=UD(y)=all people L(Adam,Mary)=T L(Mike,Jill)=F • Q(x,y,z): x+y = z UD(x)=UD(y)=UD(z): Real numbers Q(1,1,2)=T Q(1,2,5)=F
Predicate Logic: Universal Quantifier Suppose that P(x) is a predicate on some universe of discourse. The universal quantification of P(x) (x P(x) ) is the proposition: “P(x) is true for all x in the universe of discourse.”
Predicate Logic: Universal Quantifier x P(x) reads “for all x, P(x) is True” • x P(x) is TRUE means P(x) is true for all x in UD(x). • x P(x) is FALSE means there is at least one x in UD(x) for which P(x) is false.
Predicate Logic: Universal Quantifier • ID(x) means x has a student ID. UD(x): UGA students x ID(x) means “for any UGA student x, x has a student ID” “every UGA student has a student ID”
Predicate Logic: Universal Quantifier IsFemale(x) means x is a Female UD(x): UGA students x IsFemale(x) means “for any UGA student x, x is a female” “Every UGA student is a female!” Mike is a UGA student who is a male Mike is a counterexamplefor x IsFemale(x)
Predicate Logic: Universal Quantifier In the special case that the universe of discourse U, is finite, (U = {a1, a2, a3, …, an}) x P(x) corresponds to the proposition: P(a1) P(a2) … P(an) We can write a program to loop through the elements in the universe and check each for truthfulness. If all are true, then the proposition is true. Otherwise it is false!
Predicate Logic: Existential Quantifier Suppose P(x) is a predicate on some universe of discourse. The existential quantification of P(x) is the proposition: “There exists at least one x in the universe of discourse such that P(x) is true.”
Predicate Logic: Existential Quantifier x P(x) reads “for some x, P(x)” or “There exists x, P(x) is True” x P(x) is TRUE means there is an x in UD(x) for which P(x) is true. x P(x) is FALSE means : for all x in UD(x) is P(x) false
Predicate Logic: Existential Quantifier Examples: • F(x) means x is female. UD(x): UGA students x F(x) means • For some UGA student x, x is a female. • There exists a UGA student x who is a female.
Predicate Logic: Existential Quantifier • Y(x) means x is less than 5 years old UD(x): UGA students x Y(x) means • for some UGA student x, x is less than 5 years old • there exists a UGA student x such that x is less than 5 years old What will be the truth-value of x Y(x) if the UD is all people?
Predicate Logic: Existential Quantifier In the special case that the universe of discourse, U, is finite, (U = {x1, x2, x3, …, xn}) x P(x) corresponds to the proposition: P(x1) P(x2) … P(xn) We can write a program to loop through the elements in the universe and check each for truthfulness. If all are false, then the proposition is false. Otherwise, it is true!
Predicates - Quantifier negation x P(x) means “P(x) is true for some x.” What about x P(x) ? It is not the case that [“P(x) is true for some x.”] “P(x) is not true for all x.” x P(x) Existential negation: x P(x) x P(x).
Predicates - Quantifier negation x P(x) means “P(x) is true for every x.” What about x P(x) ? It is not the case that [“P(x) is true for every x.”] “There exists an x for which P(x) is not true.” x P(x) Universal negation: x P(x) x P(x).
Predicate Logic - Binding • The scope of a quantifier is the part of the logical expression to which the quantifier is applied. Note the use of parentheses! Example: x (P(x) Q(x)) y R(y) S(z) Scope of x Scope of y
Predicate Logic - Binding • An occurrence of a variable is bound if it is known or in the scope of a quantifier. Otherwise, it is free. Examples: • P(x) • P(5) • x P(x) • x (P(x) Q(x)) y R(y) S(z)
Predicate Logic - Binding • An expression with zero free variables is an actual proposition Ex. Q(x) : x > 0, R(y): y < 10 x Q(x) y R(y)