Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Foundations: Logic and Proofs

Similar presentations


Presentation on theme: "The Foundations: Logic and Proofs"— Presentation transcript:

1 The Foundations: Logic and Proofs

2 1.1 Propositional Logic Introduction
A proposition is a declarative sentence that is either true or false, but not both. Example 1: Washington DC is the capital of the United State. Toronto is the capital of Canada. 1+1=2 2+2=4

3 Example 2. What time is it? Read this carefully. x+1=2 x+y=z

4 We use letters to denote propositional variables
We use letters to denote propositional variables. The truth table of a proposition is true, denoted by T, if it is a true proposition and false, denoted by F, if it is a false proposition. The area of logic that deals with propositions is called propositional calculus or propositional logic.

5 The proposition p is read “not p”.
New propositions, called compound propositions, are formed from existing propositions using logical operators. Let p be a proposition. The negation of p, denoted by p (also denoted by ). Is the statement “It is not that 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. p p T F

6 The negation of a proposition can also be considered the result of the operation of the negation operator on a proposition. We will now introduce the logical operators that are used to form new propositions from two or more propositions. These logical operators are called connectives.

7 Let p and q be propositions
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. p q pq T F

8 Let p and q be propositions
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. p q pvq T F

9 Example: Find the conjunction and 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”.

10 Let p and q be propositions
Let p and q be propositions. The exclusive or of p and q, denoted by pq, is the proposition that is true when exactly one of p and q is true and is false otherwise. p q pq T F

11 Conditional Statements
Let p and q be propositions. The conditional statement pq is the proposition “if p, then q”. The conditional statement pq is false when p is true and q is false, and true otherwise. In the conditional statement pq, p is called hypothesis (or antecedent or premise) and q is called conclusion (or consequence).

12 A conditional statement is also called an implication.
q pq T F A conditional statement is also called an implication.

13 pq “if p, then q” “if p, q” “p is sufficient for q” “q if p”
“q when p” “a necessary condition for p is q” “q unless p” “p implies q” “p only if q” “a sufficient condition for q is p” “q whenever p” “q is necessary for p” “q follows from p”

14 Example: Let p be the statement “Maria learns discrete mathematics” and q the statement “Maria find a good job.” Express the statement pq. If Maria learns discrete mathematics, then she will find a good job.

15 pq. The proposition qp is called the converse of pq. The contrapositive of pq is the proposition q  p. The proposition p  q is called the inverse of pq.

16 Biconditional statements are also called bi-implications.
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 pq T F

17 “p is necessary and sufficient condition for q”
“if p then q, and conversely” “p iff q” pq has the same truth value as (pq) (qp)

18 Truth Tables of Compounds Propositions
Construct the truth table of the compound proposition (pq) (pq). P q q pq p  q (pq) (p  q) T T F T T F F T F F

19 Precedence of logical operators
1 2 3 4 5

20 Applications

21 Translating English Sentences
You can access the Internet from campus only if you are a computer science major or you are not a freshman. A: You can access the Internet from campus. C: you are a computer science major . F: you are a freshman. A(CF)

22 System Specifications
Example: The automated reply cannot be send when the file system is full. p: the automated reply can be send q: the file system is full qp

23 System specifications should be consistent, that is, they should not contain conflicting requirements that could be used to derived a contradiction.

24 Example: Determine whether the system specifications are consistent:
The diagnosis message is stored in the buffer or it is retransmitted. The diagnosis message is not stored in the buffer. If the diagnosis message is stored in the buffer, then it is retransmitted. p: the diagnosis message is stored. q: the diagnosis message is retransmitted. pq, p, pq p is false and q is true

25 Example: Can we add one more specification: The diagnosis message is not retransmitted.

26 Boolean Searches Web page searching

27 Logic Puzzles Smullyan posed many puzzles about an island that has two kinds of inhabitants, knights, who always tell the truth, and the opposites, knaves, who always lie. You encounter two people A and B. What are A and B if A says “B is a knight” and B says “The two of us are opposite types”? Both A and B are knaves. Try more?

28 Logic and Bit Operations
Truth value Bit T 1 F x y xy xy xy 1

29 Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings

30 1.2 Propositional Equivalences
A compound proposition that is always true is called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither a tautology nor a contradiction is called a contingency. Example: pp is a tautology and pp is a contradiction.

31 The compound propositions p and q are called logical equivalent if pq is a tautology. The notation pq denotes that p and q are logical equivalent. The symbol  is sometimes used instead of  to denote logical equivalence.

32 Example: Show that (pq) and pq are logical equivalent
T T T F T F F T F F

33 Show that pq and pq are logical equivalent.
Show that p(qr) and (pq)(pr) are logical equivalent.

34 Some important equivalences
Identity laws pTp pFp Domination laws p  TT p  FF ppp ppp Double negation law (p)p Commutative laws pq qp pq qp

35 Associative laws p(qr) p(qr) p (qr) p (q  r) Distributive laws p(qr) (pq)(pr) p(qr) (pq)(pr) De Morgan’s laws (pq) pq (p q) pq Absorption laws p(p  q) p p (pq) p Negation laws pp T p p F

36 1.3 Predicates and Qualifiers
Example: Let P(x) denote the statement “x>3”. What are the truth values of P(4) and P(2)? Example: Let A(x) denote the statement “Computer x is under attack by and intruder.” Suppose that of the computers on campus, only CS2 and MATH1 are currently under attack by intruders. What are the truth values of A(CS1), A(CS2), and A(MATH1)?

37 A statement of the form P(x1,x2,…,xn) is the value of the propositional function P at the n-tuple (x1,x2,…,xn), and P is also called a n-place predicate or a n-ary predicate. Propositional functions occur in computer programs. For example: “if x>0 then x:=x+1”. P(x) is “x>0”.

38 Quantifiers Many mathematical statements assert that a property is true for all values of a variable in a particular domain, caller the domain of discourse (or the universe of discourse), often just referred to as the domain.

39 The universal quantification of P(x) is the statement “P(x) for all values of x in the domain”.
The notation x P(x) denote the universal quantification of P(x). Here  is called 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 is called a counterexample of x P(x).

40 Example: Let P(x) be the statement “x+1>x
Example: 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. Example: 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. Example: Suppose that P(x) is “ >0.” Show that P(x) is false by finding an counterexample.

41 The existential 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 existential quantifier of P(x). Here  is called existential quantifier. The existential quantifier x P(x) is read as “there is an x such that P(x),” “There is at least one x such that P(x)”. Or “For some x P(x).

42 Example: Let P(x) denote the statement “x>3”
Example: Let P(x) denote the statement “x>3”. What is the truth value of the quantification x P(x), where the domain consists of all real numbers? Example: Let Q(x) denote the statement “x=x+1”. What is the truth value of the quantification x Q(x), where the domain consists of all real numbers? Example: What is the truth value of x P(x), where P(x) is the statement “ > 10” and the universe of discourse consists of positive integer not exceeding 4?

43 Uniqueness quantifier
The notation x P(x) [or 1x P(x)] states “There exists a unique x such that P(x) is true.”

44 Statements involving predicates and quantifiers are logical equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation ST to indicate that two statements S and T involving predicates and quantifiers are equivalent.

45 x (P(x) Q(x))x P(x)  x Q(x).
De Morgan’s Laws for Quantifiers x P(x)x P(x). x P(x)x P(x).

46 Applications

47 1.4 Nested Quantifiers Example: Assume that the domain for the variables x,y, and z consists of all real nembers. x y (x+y=y+x) (commutative law) x  y (x+y =0) (additive inverse) x y z (x+(y+z))=((x+y)+z) (associative law)

48 Example: Translate into English the statement
xy ((x> 0) (y<0)(xy<0)) where the domain for both variables consists of all real numbers.

49 The order of Quantifiers
Let the domain for x, y, and z are real numbers. xy (x+y=0) (True)  xy (x+y=0) (False) x y (x+y=y+x) y x (x+y=y+x)  x  y z (x+y=z) (True) z  x  y (x+y=z) (False)

50 Negating Nested Quantifiers
Example: Express the negation of the statement xy (xy=1) so that no negation precedes a quantifier.  ( xy (xy=1)) x y(xy1)

51 1.5 Rules of Inference An argument in propositional logic is a sequence of proposition. All but the final proposition in the argument are called premises and the final proposition is called conclusion. An argument is valid if 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. An argument form is valid if no matter which particular propositions are substituted for the propositional variables in its premises, the conclusion is true if the premises are all true.

52 p pq addition rule Example. It is below freezing now. Therefore, it is either below freezing or raining now.

53 pq p simplification Example. It is below freezing and rainng now. Therefore, it is either below freezing.

54 [q(p  q)]  p modus tollens
[(p  q)  (q r)] (p  r) Hypothetical syllogism [(p  q)   p ] q Disjunctive syllogism [(p ) (q)] (p  q) Conjunction [(p  q)  (p  r)] (q  r) Resolution

55 x P(x) P( c ) (Universal instantiation) P( c) for an arbitrary c  x P(x) (Universal generalization)  x P(x) (Existential instantiation) P( c) for some arbitrary c  x P(x) ) (Existential generalization)

56 1.6 Introduction to Proofs
Some terminology Theorem Propositions Axioms Lemma Corollary conjecture

57 Understand How Theorems are stated

58 Methods of Proving Theorems
Direct proof Proof by contraposition Proof by contradiction Mistakes in proofs

59 Direct Proofs Example. Given a direct proof of the theorem “If n is an odd integer then n2 is odd.” Example: Given a direct proof that if m and n are both perfect squares, then mn is also a perfect square.

60 Proof by Contraposition
Example: Prove that n is an integer and 3n+2 is odd, then n is odd. Example: Prove that if n=ab, where a and b are positive integers, then an1/2 or bn1/2

61 Vacuous and trivial proofs
Example: Show that the position P(0) is “If n>1, then n2>n” and the domain consists of all integers. Example: Let P(n) by “If a and b are positive integers with ab, then anbn,” where the domain consists of all integers. Show that P(0) is true.

62 A little proof strategy
Example: Proof that the sum of two rational numbers is rational. Proof. Let r=p/q with q0 and s=t/u with u0. Then r+s=(pu+qt)/(qu). Example: Proof that if n is an integer and n2 is odd, then n is odd.

63 Proof by Contradiction
Example: Show That at least four of any 22 days must fall on the same day of the week. Example: Prove that is irrational. Example: Give a proof by contradiction of the theorem “If 3n+2 is odd, then n is odd.”

64 Proofs of Equivalence Example: Proof the theorem “If n is a positive integer, then n is odd if and only if n2 is odd. Example: Show that these statements about integer n are equivalent P1: n is even P2: n-1 is odd P3: n2 is even

65 Counterexamples Show that the statement “Every positive integer is the sum of the squares of two integers” is false. 3 is not the sum of the squares of two integers.

66 Mistakes in Proofs

67 1.7 Proof Methods and Strategy
Exhaustive Proof Example: Prove that if n is a positive integer with n4. Example: Prove that the only consecutive positive integers not exceeding 100 that are perfect powers are 8 and 9.

68 Proof by Cases Example: Prove that n is an integer, then n.
Example: Use the proof by cases to show that |xy|=|x||y| where x and y are real numbers.

69 Leveraging Proof by Cases
Example: Formulate a conjecture about decimal digits that occur as the final digit of the square of an integer and prove this result. Example: Show that there is no solutions in integers x and y of

70 Existence Proof Example: A constructive existence proof. Show that there is a positive integer that can be written as the sum of cubes of positive integers in two ways.

71 Non constructive Existence Proof
Example: Show that there exist irrational number x and y such that xy is rational. 21/2 is irrational x=y=21/2 If xy is rational, done If xy is irrational, let X=xy. Then Xy =2 is rational

72 Chomp is a game played by two player
Chomp is a game played by two player. In this game, cookies are laid out on a rectangular grid. The cookie in the top left is poisoned. The two players take turns making moves; at each move, a player is required to eat a remaining cookie, together with all cookies to the right and/or below it. The loser is the player who has no cookie but to eat the poisoned cookie. We ask whether one of the two players has the winning strategy.

73

74

75

76 Uniqueness Proofs Example. Show that if a and b are real numbers and a0, then there is a unique real number r such that ar+b=0. Existence Uniqueness

77 Proof Strategies Forward and backward reasoning
Example: Given two positive real numbers x and y, prove that the arithmetic means is greater than or equal to the geometric mean; i.e.,

78

79 Example: Suppose that two people play a game taking turns moving one, two, or three stones at a time from a pile that begins with 15 stones. The person who removes the last stone wins the game. Show that the first player win the game no matter what the second player does.

80 Adapting Existing Proofs
Example: Prove that is irrational.

81 Looking for Counterexamples
Example: The statement that “Every positive integer is the sum of two squares of integers” is not true by finding counterexamples. Yet, it is proved that “Every positive integer is the sum of three squares of integers”.

82 Exercise: 1.1 27(f) 1.2 28, 29 1.3 12, 31, 35 , 27, 31

83 Example: Can we tile the standard chessboard using dominos?
Example: Can we tile a board obtained by removing one of the corner squares of a standard chess board? Example: Can we tile a board obtained by deleting the upper left and the left lower corner squares of the corner squares of a standard chess board? Example: Can we use straight triominoes to a standard chess board? Example: Can we use straight triominoes to a standard chess board with one of its four corners removed?

84 The Roles of Open Problems
Fermat’s last theorem: The equation has no solutions in integers x, y, and z with xyz0 whenever n is an integer with n>2. The 3x+1 conjecture: Let T to be the transformation that sends an even integer x to x/2 and odd integer x to 3x+1. For any positive integer x, when we repeatedly apply the transformation T, we will eventually reach the integer 1.


Download ppt "The Foundations: Logic and Proofs"

Similar presentations


Ads by Google