Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS100: Discrete structures

Similar presentations


Presentation on theme: "CS100: Discrete structures"— Presentation transcript:

1 CS100: Discrete structures
Discrete Mathematics -Lecture 1 - Logic CS100: Discrete structures Lecture 1: Logic Lecturer: Shaykhah

2 Discrete Mathematics -Lecture 1 - Logic
Lecture Overview Statement Logical Connectives Conjunction Disjunction Propositions Conditional Bio-conditional Converse Inverse Contrapositive Laws of Logic Quantifiers Universal Existential Computer Science Department Lecturer: Shaykhah

3 Discrete Mathematics -Lecture 1 - Logic
What is a Statement ? A statement is a sentence having a form that is typically used to express acts Examples: My name is Rawan I like orange 4 – 2 = 3 Do you live in Riyadh? تستخدم للتعبير عن الأفعال.. Computer Science Department Lecturer: Shaykhah

4 Discrete Mathematics -Lecture 1 - Logic
1.1 Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both. Are the following sentences propositions? Riyadh is the capital of K.S.A. Read this carefully. 2+2=3 x+1=2 What time is it Take two books . The sun will rise tomorrow . (Yes) (No  Because it is not declarative sentence) (Yes) البرورزيشين هي مسألة أو فرضية تعرف الحقيقة وتحدد ما اذا كانت صحيحة او خاطئة (No  Because it is neither true or false) (No  Because it is not declarative sentence) (No  Because it is not declarative sentence) (Yes) Computer Science Department Lecturer: Shaykhah

5 Logical Connectives and Compound Statement
In mathematics, the letters x, y, z, … are used to donate numerical variables that can be replaced by real numbers. Those variables can then be combined with the familiar operations +, -, x, ÷. In logic, the letters p, q, r, s, … denote the propositional variables; that can be replaced by a statements. Computer Science Department

6 1.1 Propositional Logic Propositional Logic: the area of logic that deals with propositions Propositional Variables: variables that represent propositions: p, q, r, s E.g. Proposition p – “Today is Friday.” Truth values: T, F Computer Science Department

7 1.1 Propositional Logic Examples
DEFINITION 1 Let p be a proposition. The negation of p, denoted by ¬p, is the statement “It is not the case that p.” The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p is the opposite of the truth value of p. Examples Find the negation of the following propositions and express this in simple English. “Today is Friday.” “At least 10 inches of rain fell today in Miami” . Solution: The negation is “It is not the case that today is Friday.” In simple English, “Today is not Friday.” or “It is not Friday today.” Solution: The negation is “It is not the case that at least 10 inches of rain fell today in Miami.” In simple English, “Less than 10 inches of rain fell today in Miami.”

8 1.1 Propositional Logic Exercise ..
Give the negation of the following: p: > 1 q: It is cold . r: 2+3 ≠5 g: 2 is a positive integer ¬ p: ≤ 1 ¬ q: It is not cold. ¬ r: = 5 ¬ g: 2 is not a positive integer . OR ¬g: 2 is a negative integer .

9 1.1 Propositional Logic Truth table:
Logical operators are used to form new propositions from two or more existing propositions. The logical operators are also called connectives. The Truth Table for the Negation of a Proposition. p ¬p T F

10 1.1 Propositional Logic DEFINITION 2 Let p and q be propositions. The conjunction of p and q, denoted by p Λ q, is the proposition “p and q”. The conjunction p Λ q is true when both p and q are true and is false otherwise. The Truth Table for the Conjunction of Two Propositions. p q p Λ q T T T F F T F F T F Computer Science Department

11 1.1 Propositional Logic Example
Find the conjunction of the propositions p and q where p is the proposition “Today is Friday.” and q is the proposition “It is raining today.”, and the truth value of the conjunction. Solution: The conjunction is the proposition “Today is Friday and it is raining today” OR “Today is Friday but it is raining.” The proposition is: TRUE  on rainy Fridays. FALSE  on any day that is not a Friday and on Fridays when it does not rain . Computer Science Department

12 1.1 Propositional Logic Note:
DEFINITION 3 Let p and q be propositions. The disjunction of p and q, denoted by p ν q, is the proposition “p or q”. The disjunction p ν q is false when both p and q are false and is true otherwise. Note: inclusive or : The disjunction is true when at least one of the two propositions is true. The Truth Table for the Disjunction of Two Propositions. p q p ν q T T T F F T F F T F E.g. “Students who have taken calculus or computer science can take this class.” – those who take one OR both classes. Computer Science Department

13 1.1 Propositional Logic Example
Find the disjunction of the propositions p and q where p is the proposition “Today is Friday.” and q is the proposition “It is raining today.”, and the truth value of the conjunction. Solution: The conjunction is the proposition “Today is Friday or it is raining today” The proposition is: TRUE  whether today is Fridays or a rainy day including rainy Fridays FALSE  on days that are not a Fridays and when it does not rain . Computer Science Department

14 1.1 Propositional Logic exclusive or : The disjunction is true only when one of the proposition is true. E.g. “Students who have taken calculus or computer science, but not both, can take this class.” – only those who take ONE of them. Computer Science Department

15 1.1 Propositional Logic DEFINITION 4 Let p and q be propositions. The exclusive or of p and q, denoted by 𝒑⊕𝒒 , is the proposition that is true when exactly one of p and q is true and is false otherwise. The Truth Table for the Exclusive Or (XOR) of Two Propositions. p q p q T T T F F T F F F T

16 Conditional Statements
1.1 Propositional Logic Conditional Statements DEFINITION 5 Let p and q be propositions. The conditional statement p → q, is the proposition “if p, then q.” The conditional statement is false when p is true and q is false, and true otherwise. In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). A conditional statement is also called an implication. Example: “If I am elected, then I will lower taxes.” p → q implication: elected, lower taxes T T | T not elected, lower taxes F T | T not elected, not lower taxes F F | T elected, not lower taxes T F | F

17 1.1 Propositional Logic Example:
Let p be the statement “Maria learns discrete mathematics.” and q the statement “Maria will find a good job.” Express the statement p → q as a statement in English. Solution: Any of the following - “If Maria learns discrete mathematics, then she will find a good job. “Maria will find a good job when she learns discrete mathematics.” “For Maria to get a good job, it is sufficient for her to learn discrete mathematics.” “Maria will find a good job unless she does not learn discrete mathematics.” Computer Science Department

18 1.1 Propositional Logic Equivalent Statements:
Other conditional statements: Converse of p → q : q → p Contrapositive of p → q : ¬ q → ¬ p Inverse of p → q : ¬ p → ¬ q Equivalent Statements: Statements with the same truth table values. Converse and Inverse are equivalents. Contrapositive and p → q are equivalents. Computer Science Department

19 1.1 Propositional Logic “if and only if” can be expressed by “iff”
DEFINITION 6 Let p and q be propositions. The biconditional statement p ↔ q is the proposition “p if and only if q.” The biconditional statement p ↔ q is true when p and q have the same truth values, and is false otherwise. Biconditional statements are also called bi-implications. p ↔ q has the same truth value as (p → q) Λ (q → p) “if and only if” can be expressed by “iff” Example: Let p be the statement “You can take the flight” and let q be the statement “You buy a ticket.” Then p ↔ q is the statement “You can take the flight if and only if you buy a ticket.” Implication: If you buy a ticket you can take the flight. If you don’t buy a ticket you cannot take the flight. Computer Science Department

20 1.1 Propositional Logic The Truth Table for the Biconditional p ↔ q.
T T T F F T F F T F

21 1.1 Propositional Logic Exercise .. ¬𝑝 ¬𝑝→¬𝑞 ¬ 𝑝∨𝑞
Let p and q be the propositions   p : I bought a lottery ticket this week. q : I won the million dollar jackpot on Friday. Express each of these propositions as an English sentence. ¬𝑝 ¬𝑝→¬𝑞 ¬ 𝑝∨𝑞 I did not buy a lottery ticket this week. If I did not buy a lottery ticket this week, then I did not win the million dollar jackpot on Friday. I did not buy a lottery ticket this week, and I did not win the million dollar jackpot on Friday.

22 Truth Tables of Compound Propositions
1.1 Propositional Logic Truth Tables of Compound Propositions We can use connectives to build up complicated compound propositions involving any number of propositional variables, then use truth tables to determine the truth value of these compound propositions. Example: Construct the truth table of the compound proposition (p ν ¬q) → (p Λ q) The Truth Table of (p ν ¬q) → (p Λ q). p q ¬q p ν ¬q p Λ q (p ν ¬q) → (p Λ q) T T T F F T F F F T

23 Types of statements A statements that is true for all possible values of its propositional variables is called tautology (𝑝∨𝑞)↔(𝑞∨𝑝) 𝑝∨∼𝑝 A statement that is always false is called contradiction 𝑝∧∼𝑝 A statement that can be either true or false, depending of the values of its propositional variables, is called a contingency (𝑝⟶𝑞)∧(𝑝∧𝑞) Examples of a Tautology and a Contradiction. p ¬p p ν ¬p p Λ ¬p T F Computer Science Department

24 Precedence of Logical Operators
1.1 Propositional Logic Precedence of Logical Operators We can use parentheses to specify the order in which logical operators in a compound proposition are to be applied. To reduce the number of parentheses, the precedence order is defined for logical operators. Precedence of Logical Operators. Operator Precedence 1 Λ ν 2 3 4 5 E.g. ¬p Λ q = (¬p ) Λ q p Λ q ν r = (p Λ q ) ν r p ν q Λ r = p ν (q Λ r)

25 1.1 Propositional Logic Exercise .. find the truth table of the following proposition p ˄ ( ¬( q ˅ ¬p)) p q ¬p q ˅ ¬p ¬( q ˅ ¬p) p ˄ ( ¬( q ˅ ¬p)) T F

26 Translating English Sentences
1.1 Propositional Logic Translating English Sentences English (and every other human language) is often ambiguous. Translating sentences into compound statements removes the ambiguity. Example: How can this English sentence be translated into a logical expression? “You cannot ride the roller coaster if you are under 4 feet tall and you are not older than 16 years old.” Solution: Let q, r, and s represent “You can ride the roller coaster,” “You are under 4 feet tall,” and “You are older than 16 years old.” The sentence can be translated into: (r Λ ¬ s) → ¬q.

27 1.1 Propositional Logic Example: How can this English sentence be translated into a logical expression? “You can access the Internet from campus only if you are a computer science major or you are not a freshman.” Solution: Let a, c, and f represent “You can access the Internet from campus,” “You are a computer science major,” and “You are a freshman.” The sentence can be translated into: a → (c ν ¬f ) .

28 1.1 Propositional Logic Exercise ..
Write the following statement in logic : If I do not study discrete structure and I go to movie , then I am in a good mood . Solution : p: I study discrete structure , q: I go to movie , r: I am in a good mood (¬p ˄ q )➝ r

29 Logic and Bit Operations
1.1 Propositional Logic Logic and Bit Operations Computers represent information using bits. A bit (Binary Digit) is a symbol with two possible values, 0 and 1. By convention, 1 represents T (true) and 0 represents F (false). A variable is called a Boolean variable if its value is either true or false. Bit operation – replace true by 1 and false by 0 in logical operations. Table for the Bit Operators OR, AND, and XOR. x y 𝑥∨𝑦 𝑥∧𝑦 𝑥⊕𝑦 1

30 1.1 Propositional Logic DEFINITION 7 A bit string is a sequence of zero or more bits. The length of this string is the number of bits in the string. Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit string and Solution: bitwise OR bitwise AND bitwise XOR Computer Science Department

31 1.2 Propositional Equivalences
Introduction DEFINITION 1 A compound proposition that is always true, no matter what the truth values of the propositions that occurs in it, is called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither a tautology or a contradiction is called a contingency. Examples of a Tautology and a Contradiction. p ¬p p ν ¬p p Λ ¬p T F

32 1.2 Propositional Equivalences
Logical Equivalences DEFINITION 2 The compound propositions p and q are called logically equivalent if p ↔ q is a tautology. The notation p ≡ q denotes that p and q are logically equivalent. Compound propositions that have the same truth values in all possible cases are called logically equivalent. Example: Show that ¬p ν q and p → q are logically equivalent. Truth Tables for ¬p ν q and p → q . p q ¬p ¬p ν q p → q T F

33 1.2 Propositional Equivalences
Exercise .. Show that this statements ((p ˄ ‎q) → (p ˅ ‎q)) is tautology , by using ‎The truth table : p q q ˄ p p ˅ ‎q‎ ‎(p ˄ ‎q) → (p ˅ ‎q)‎ T F

34 Discrete Mathematics -Lecture 1 - Logic
Laws of Logic Identity Laws p v F ≡ p p ^ T ≡ p Domination Laws p v T ≡ T P ^ F ≡ F Computer Science Department Lecturer: Shaykhah

35 Discrete Mathematics -Lecture 1 - Logic
Laws of Logic Idempotent Laws p v p ≡ p p ^ p ≡ p Double Negation Law ¬(¬p) ≡ p Commutative Laws p v q ≡ q v p p ^ q ≡ q ^ p Computer Science Department Lecturer: Shaykhah

36 Discrete Mathematics -Lecture 1 - Logic
Laws of Logic Association Laws (p v q ) v r ≡ p v (q v r) Distributive Laws p v (q ^ r ) ≡ (p v q) ^ (p v r) p ^ (q v r) ≡ (p ^ q) v (p ^ r) Computer Science Department Lecturer: Shaykhah

37 Contd. De Morgan’s Laws Absorption Laws p v (p ^ q) ≡ p
~ (p v q) ≡ ~p ^ ~q ~ (p ^ q) ≡ ~p v ~q Absorption Laws p v (p ^ q) ≡ p p ^ (p v q) ≡ p Computer Science Department

38 Contd. Complement Laws p v ~p ≡ T p ^ ~p ≡ F ~ ~p ≡ p ~ T ≡ F , ~F ≡ T
p → q ≡ ¬p ˅ q ¬(p → q ) ≡ p Λ ¬q Note: See tables 7 & 8 page 25 Computer Science Department

39 1.2 Propositional Equivalences
Discrete Mathematics -Lecture 1 - Logic 1.2 Propositional Equivalences Constructing New Logical Equivalences Example: Show that ¬(p → q ) and p Λ ¬q are logically equivalent. Solution: ¬(p → q ) ≡ ¬(¬p ν q) ≡ ¬(¬p) Λ ¬q (by the second De Morgan law) ≡ p Λ ¬q (by the double negation law) Lecturer: Shaykhah

40 1.2 Propositional Equivalences
Example: Show that (p Λ q) → (p ν q) is a tautology. Solution: To show that this statement is a tautology, we will use logical equivalences to demonstrate that it is logically equivalent to T. (p Λ q) → (p ν q) ≡ ¬ (p Λ q) ν (p ν q) ≡ (¬ p ν ¬q) ν (p ν q) (by the first De Morgan law) ≡ (¬ p ν p) ν (¬ q ν q) (by the associative and communicative law for disjunction) ≡ T ν T ≡ T Note: The above examples can also be done using truth tables.

41 Exercises Simplify the following statement (p v q ) ^ ~p Show that
~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r (p → q) v (p → r) ≡ p → q v r Computer Science Department

42 Exercises – Continue (p v q ) ^ ~p ≡ ~p ^ ( p v q )
≡ ( ~p ^ p ) v ( ~ p ^ q ) ≡ F v ( ~p ^ q ) ≡ ~p ^ q Computer Science Department

43 Exercises – Continue ~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r
≡ ~p ^ r ^ (~q v q) v (p ^ r) ≡ ~p ^ r ^ T v (p ^ r) ≡ ~p ^ r v (p ^ r) ≡ (~p ^ r) v (p ^ r) ≡ r ^ (~p v p) ≡ r ^ T ≡ r Computer Science Department

44 Exercises – Continue (p → q) v (p → r) ≡ p → q v r ≡ ¬𝑝⋁𝑞 ⋁(¬𝑝⋁𝑟)
≡ ¬𝑝⋁𝑞 ⋁(¬𝑝⋁𝑟) ≡¬𝑝 ⋁𝑞⋁¬𝑝⋁𝑟 ≡ ¬𝑝 ⋁¬𝑝⋁𝑞⋁𝑟 ≡ ¬𝑝⋁𝑞⋁𝑟 ≡ ¬𝑝⋁(𝑞⋁𝑟) ≡ 𝑝→(𝑞⋁𝑟) Computer Science Department

45 Exercises – Continue Show that this statements (¬ q ˄ (p  q )  ¬p is tautology , by using ‎The laws of logic : ‎‎≡ ‎ ¬ (¬ q ˄ (p  q ) ˅ ¬p ‎‎‎≡ ¬ (¬ q ˄ (¬p ˅ q ) ˅ ¬p ‎‎‎≡ q ˅ ¬ (¬p ˅ q ) ˅ ¬p ‎ ‎‎≡ (¬p ˅ q ) ˅ ¬ (¬p ˅ q ) ‎‎≡ T Computer Science Department

46 Exercises – Continue Without using truth tables prove the statement
(P ∧( P ➝ q)) ➝ q is tautology. (P ∧( P ➝ q)) ➝ q ≡¬ 𝑝˄ 𝑝→𝑞 ˅𝑞 ≡ ¬𝑝˅¬(¬𝑝˅𝑞 ˅ 𝑞 ≡ ¬𝑝˅ 𝑞 ˅¬ ¬𝑝˅ 𝑞 ≡𝑇 Computer Science Department

47 1.5 Rules of Inference page 63
Valid Arguments in Propositional Logic: DEFINITION 1 An argument in propositional logic is a sequence of propositions. All but the final proposition in the final argument are called premises and the final proposition is called the conclusion.. An argument is valid of the truth of all its premises implies that the conclusion is true. An argument form in propositional logic is a sequence of compound propositions involving propositional variables. 20-Nov-18 Computer Science Department

48 1.5 Rules of Inference page 63
Example: “If you have access to the network, then you can change your grade” “You have access to the network” ∴ “You can change your grade” Valid Argument 20-Nov-18 Computer Science Department

49 Rules of Inference for Propositional Logic:
We can always use a truth table to show that an argument form is valid. This is a tedious approach. when, for example, an argument involves 9 different propositional variables. To use a truth table to show this argument is valid. It requires 2⁹= 512 different rows !!!!!!! 20-Nov-18 Computer Science Department

50 Rules of Inference: Fortunately, we do not have to resort to truth tables. Instead we can first establish the validity of some simple argument forms, called rules of inference. These rules of inference can then be used to construct more complicated valid argument forms. 20-Nov-18 Computer Science Department

51 Hypothetical syllogism
Rules of Inference Name Tautology Modus ponens [p ^ (p  q)]  q p p  q ∴q Modus tollens [ q ^ (p  q)]   p  q ∴  p Hypothetical syllogism [(p  q) ^ (q  r)]  (p  r) q  r ∴ p  r Disjunctive syllogism [(p v q) ^  p]  q p v q P ∴ q Addition p  (p v q) ∴ (p v q) Simplification (p ^ q)  p p ^ q ∴ p Conjunction (p) ^ (q)  (p ^ q) q ∴ (p ^ q) Resolution (p v q) ^ (p v r)  (q v r) p v r ∴ q v r 20-Nov-18 Computer Science Department

52 Rules of Inference (Cont.) :
EXAMPLE State which rule of inference is the basis of the following statement: “it is below freezing now. Therefore, it is either freezing or raining now” SOLTUION: Let p: “it is below freezing now” q: “it is raining now” Then this argument is of the form p (Addition) ∴ p v q 20-Nov-18 Computer Science Department

53 Rules of Inference (Cont.) :
EXAMPLE “ it is below freezing and it is raining now. Therefore, it is below freezing” SOLUTION: Let p: “it is below freezing now” q: “it is raining now” Then this argument is of the form p ^ q (Simplification) ∴ p 20-Nov-18 Computer Science Department

54 Rules of Inference (Cont.) :
What rule of inference is used in each of these arguments ? If it is rainy, then the pool will be closed. It is rainy. Therefore, the pool is closed. SOLUTION: Let p: “It is rainy” q: “the pool is closed” Then this argument is of the form p pq (Modus ponens) ∴q 20-Nov-18 Computer Science Department

55 Rules of Inference (Cont.) :
What rule of inference is used in each of these arguments ? If I go swimming, then I will stay in the sun too long. If I stay in the sun too long, then I will sunburn. Therefore, if I go swimming, then I will sunburn. SOLUTION: Let p: “I go swimming” q: “I stay in the sun too long” r: “I will sunburn” Then this argument is of the form p→q q→ r (Hypothetical syllogism) p→r 20-Nov-18 Computer Science Department

56 Rules of Inference (Cont.) :
What rule of inference is used in each of these arguments ? If it snows today, the university will close. The university is not closed today. Therefore, it did not snow today. SOLUTION: Let p: “it snows today” q: “The university is not closed today” Then this argument is of the form  q pq (Modus tollens) ∴ p 20-Nov-18 Computer Science Department

57 Using Rules of Inference to Build Arguments:
When there are many premises, several rules of inference are often needed to show that an argument is valid. 20-Nov-18 Computer Science Department

58 Using Rules of Inference to Build Arguments (Cont.):
Find the argument form for the following argument and determine whether it is valid or invalid. If I try hard and I have talent, then I will become a musician. If I become a musician, then I will be happy. ∴ If I will not happy, then I did not try hard or I do not have talent. It's valid, Hypothetical syllogism. 20-Nov-18 Computer Science Department

59 Using Rules of Inference to Build Arguments (Cont.):
Find the argument form for the following argument and determine whether it is valid or invalid. If I drive to work, then I will arrive tired. I do not drive to work. ∴ I will not arrive tired. It's invalid 20-Nov-18 Computer Science Department

60 Using Rules of Inference to Build Arguments (Cont.):
Find the argument form for the following argument and determine whether it is valid or invalid. I will become famous or I will become a writer. I will not become a writer. ∴I will become famous Its valid, Disjunctive syllogism 20-Nov-18 Computer Science Department

61 Using Rules of Inference to Build Arguments (Cont.):
Find the argument form for the following argument and determine whether it is valid or invalid. If taxes are lowered, then income rises. Income rises. ∴Taxes are lowered It's invalid 20-Nov-18 Computer Science Department

62 Using Rules of Inference to Build Arguments (Cont.) :
EXAMPLE Show that the hypotheses “it is not sunny this afternoon and it is colder than yesterday,” “we will go swimming only if it is sunny,” “if we do not go swimming, then we will take a canoe trip,” “and “if we take a canoe trip, we will be home by sunset.” lead to “we will be home by sunset” 20-Nov-18 Computer Science Department

63 Let p: “it is sunny this afternoon”
Using Rules of Inference to Build Arguments (Cont.) : SOLUTION Let p: “it is sunny this afternoon” q: “it is colder than yesterday” r: “we will go swimming” s: “we will take a canoe trip” t: “we will be home by sunset” The hypotheses become  p ^ q, r  p,  r  s, s  t the conclusion is t 20-Nov-18 Computer Science Department

64 Cont’d: We construct an argument to show that our hypotheses lead to desired conclusion as follows Step Reason  p ^ q Hypothesis  p Simplification using (1) r  p Hypothesis  r Modus tollens (2,3)  r  s Hypothesis s Modus ponens (4,5) s  t Hypothesis t Modus ponens (6,7) Note that if we used the truth table, we would end up with 32 rows !!! 20-Nov-18 Computer Science Department

65 Resolution: Computer programs make use of rule of inference called resolution to automate the task of reasoning and proving theorems. This rule of inference is based on the tautology ((p v q) ^ (¬ p v r))  ( q v r ) 20-Nov-18 Computer Science Department

66 Resolution (Cont.): EXAMPLE Use resolution to show that the hypotheses “Jasmine is skiing or it is not snowing” and “it is snowing or Bart is playing hockey” imply that “Jasmine is skiing or Bart is playing hockey” 20-Nov-18 Computer Science Department

67 Resolution (Cont.): SOLUTION p: “it is snowing”, q: “Jasmine is skiing”, r: “Bart is playing hockey” We can represent the hypotheses as ¬ p v q and p v r, respectively Using Resolution, the proposition q v r, “Jasmine is skiing or Bart is playing hockey” follows 20-Nov-18 Computer Science Department

68 1.3 Quantifiers page 33 So far we have discussed the propositions in which each statement has been about a particular object. In this section we shall see how to write propositions that are about whole classes of objects. Consider the statement: p: x is an even number The truth value of p depends on the value of x. e.g. p is true when x = 4, and false when x = 7 Computer Science Department

69 1.Universal Quantifiers
DEFINITION 1 The universal quantification of p(x) is the statement “P(x) for all values of x in the domain.” The notation ∀ x P(x) denotes the universal quantification of P(x). Here ∀is called the universal quantifier. We read ∀ x P(x) as “for all x P(x)” or “for every x P(x) ”. An element for which P(x) is false called counterexample of ∀ x P(x) “For all values of x, P(x) is true”. For every x For any x ∀ x Every x We assume that only values of x that make sense in P(x) are considered. ∀ x P(x) Computer Science Department

70 1.Universal Quantifiers
Example 8.. Let P(X) be the statement “x+1>x”. What is the truth value of the quantification ∀ x P(x), where the domain consists of all real numbers? Solution The quantification ∀ x P(x),is true because P(x) is true for all real numbers. Computer Science Department

71 1.Universal Quantifiers
Example 9.. Let Q(X) be the statement “x < 2”. What is the truth value of the quantification ∀ x Q(x), where the domain consists of all real numbers? Solution Q(x) is not true for every real number x, because Q(3) is false. That is, x=3 is a counterexample for the statement ∀ x Q(x), thus ∀ x Q(x) is false Computer Science Department

72 1.Universal Quantifiers
Example 11.. What is the truth value of the quantification ∀ x P(x), where P(X) is the statement “x2 < 10” and the domain consists of the positive integers not exceeding 4 ? Solution The statement ∀ x P(x) is the same as the conjunction P(1) ^ P(2) ^ P(3) ^ P(4) Because the domain consists of the positive integers 1,2,3 and 4. Because P(4), which the statement “42 < 10” is false, it follows that ∀ x P(x) is false. Computer Science Department

73 2.Existential Quantifiers
DEFINITION 2 The essential quantification of p(x) is the proposition “There exists an element x in the domain such that P(x).” We use the notation ∃ x P(x) for the essential quantification of P(x). Here ∃ is called the essential quantifier. In some situations, we only require that there is at least one value for which the predicate is true. The existential quantification of a predicate P(x) is the statement “there exists a value of x, for which P(x) is true. ∃x P(x) There is a dog without tail (∃ a dog) (a dog without tail) Computer Science Department

74 2.Existential Quantifiers
Example 16.. What is the truth value of ∃ x P(x), where P(X) is the statement “x2 > 10” and the universe of discourse consists of the positive integers not exceeding 4? Solution Because the domain is {1, 2, 3, 4}, the proposition ∃ x P(x) is the same as the disjunction P(1) v P(2) v P(3) v P(4) Because P(4), which the statement “42 > 10” is true, it follows that ∃x P(x) is true. Computer Science Department

75 Quantifiers - Negation
Rule: ∀x p(x)  ∃x ¬p(x) ∃x p(x)  ∀ x ¬p(x) Negate the following: ( ∀ integers x) (x > 8)  (∃ an integer x) (x ≤ 8) Negate the following; (∃ an integer x) (0 ≤ x ≤ 8)  ( ∀ integers x) (x < 0 OR x > 8) Computer Science Department

76 Quantifiers Exercise .. p(x): x is even q(x): x is a prime number r(x,y): x+y is even . Write an English sentence that represent the following : ∀x P(x) ∃x Q(x) ∀x ∃y R(x,y) Find negation for a. and b. ∃x ¬p(x) there is exist x where x is odd ∀x ¬q(x) for every x where x not prime number for every x where x is even there is exists x where x is a prime number for all x there exists y where x+y is even Computer Science Department

77 Any Questions Refer to chapter 1 of the book for further reading
Computer Science Department


Download ppt "CS100: Discrete structures"

Similar presentations


Ads by Google