CS285 · Annotated SlidesChapter 1 — Logic and Proofs
Chapter 1 · Annotated slides

Logic and Proofs

Propositions and connectives, truth tables, implication and its converse / inverse / contrapositive, translating English, consistent specifications, logical equivalences and De Morgan, satisfiability, predicates and quantifiers (and negating them), nested quantifiers, and the rules of inference including resolution.

Slide text Study notes Highlight: key words Tips, tricks & traps Seen again elsewhere How it can come up
Slide 1: Slide 1
Exam weight Low

    Chapter Summary

    • Propositional Logic
      • The Language of Propositions
      • Applications
      • Logical Equivalences
    • Predicate Logic
      • The Language of Quantifiers
      • Logical Equivalences
      • Multiple Quantifiers
    • Proofs
      • Rules of Inference
    2
    Exam weight Low
    1. 1.1–1.3 propositional logic and equivalences · 1.4–1.5 predicates and quantifiers · 1.6 rules of inference.
    Tipp → q is FALSE only when p is true and q is false. Same as ¬p ∨ q, and as its contrapositive ¬q → ¬p.

    Propositional Logic Summary

    • The Language of Propositions
      • Connectives
      • Truth Values
      • Truth Tables
    • Applications
      • Translating English Sentences
      • System Specifications
      • Logic Puzzles
      • Logic Circuits
    • Logical Equivalences
      • Important Equivalences
      • Showing Equivalence
      • Satisfiability
    3
    Exam weight Low

      Propositional Logic S E C T I O N 1. 1

      4
      Exam weight Low

        Section Summary

        • Propositions
        • Connectives
          • Negation
          • Conjunction
          • Disjunction
          • Implication; contrapositive, inverse, converse
          • Biconditional
        • Truth Tables
        5
        Exam weight Low

          Logic

          • Logic is the study of consequence.
            • Given a few mathematical statements or facts, we would like to be able to draw some conclusions.
          • Logic aims to determine in which cases a conclusion is, or is not, a consequence of a set of premises.
          • Example:
            • Premise/Fact #1: If Sara eats her vegetables, then she can have a cookie.
            • Premise/Fact #2: Sara eats her vegetables.
            • Conclusion: Sara gets a cookie.
          6
          Exam weight Low
            Slide 7: C++ Example
            Exam weight Low

              Propositions

              • A proposition is a declarative sentence that is either true or false.
              • Examples of propositions: a) The Moon is made of green cheese. b) Cairo is the capital of Egypt. c) Toronto is the capital of Canada. + = 1 d) 1 0 e) 0 + 0 = 2
              • Examples that are not propositions. a) Sit down! b) What time is it? c) x + 1 = 2 d) x + y = z
              8
              Exam weight High
              1. A proposition is a declarative sentence that is either true or false, not both. Questions, commands and "x + 1 = 2" (x unknown) are NOT propositions.
              🎯 How this can come up · 1 question
              MCQ

              Which of these is a proposition?

              Slide 9: Propositional Logic
              Exam weight Low
                Slide 10: Conjunction
                Exam weight Low
                1. p ∧ q (and) is true only when both are true.
                Slide 11: Disjunction
                Exam weight Low
                1. p ∨ q (inclusive or) is false only when both are false.
                Slide 12: The Connective Or in English
                Exam weight Medium
                1. English "or" can be inclusive (∨) or exclusive (⊕: exactly one true).
                🎯 How this can come up · 1 question
                MCQ

                p ⊕ q is true when:

                Slide 13: Negation
                Exam weight Low
                  Slide 14: Implication
                  Exam weight High
                  1. p → q is FALSE only when p is true and q is false. Same as ¬p ∨ q, and as its contrapositive ¬q → ¬p.
                  2. Readings: "if p then q", "p only if q", "q whenever p", "q is necessary for p", "p is sufficient for q".
                  Exam trap"p only if q" is p → q, NOT q → p.
                  🎯 How this can come up · 2 questions
                  MCQ

                  When is p → q false?

                  True / False

                  If p is false, p → q is true no matter what q is.

                  Understanding Implication

                  • One way to view the logical conditional is to think of an obligation or contract.
                    • “If I am elected, then I will lower taxes.”
                    • “If you get 100% on the final, then you will get an A.”
                  • If the politician is elected and does not lower taxes, then the voters can say that he or she has broken the campaign pledge. Something similar holds for the professor. This corresponds to the case where is true and p is false. q
                  15
                  Exam weight Low

                    Understanding Implication (cont)

                    In q

                    there does not need to be any connection

                    • p between the antecedent or the consequent. The depends only on the truth values → p q of and. p q
                    • “meaning” of → These implications are perfectly fine, but would not be used in ordinary English.
                    • “If the moon is made of green cheese, then I have more money than Bill Gates. ”
                    • “If the moon is made of green cheese then I’m on welfare.”
                    • “If 1 + 1 = 3, then your grandma wears combat boots.”
                    16
                    Exam weight Low

                      Understanding Implication (cont)

                      • Implication ‘If...then...’ Symbol: → Terminology
                      • • p = premise, hypothesis, antecedent
                      • • q = conclusion, consequence
                      17
                      Exam weight Low
                        Slide 18: Different Ways of Expressing p q
                        Exam weight High
                        1. From p → q: converse q → p, inverse ¬p → ¬q, contrapositive ¬q → ¬p.
                        2. Only the contrapositive is equivalent to the original; the converse and inverse are equivalent to each other.
                        Memory trickCONtrapositive = CONverse + inverse together (swap AND negate).
                        🎯 How this can come up · 2 questions
                        MCQ

                        The contrapositive of "If it rains, then I stay home" is:

                        True / False

                        An implication is logically equivalent to its converse.

                        Slide 19: Converse, Contrapositive, and Inverse
                        Exam weight Low
                          Slide 20: Converse, Contrapositive, and Inverse
                          Exam weight Low
                            Slide 21: Biconditional
                            Exam weight High
                            1. p ↔ q is true when p and q have the SAME truth value ("if and only if", "necessary and sufficient").
                            🎯 How this can come up · 1 question
                            MCQ

                            p ↔ q is equivalent to:

                            Slide 22: Biconditional vs Exclusive Or
                            Exam weight Low
                            1. p ↔ q is the negation of p ⊕ q.

                            Expressing the Biconditional

                            p if and only if q ” is expressed in English:

                            • Some alternative ways “
                              • p is necessary and sufficient for q
                              • if p then q, and conversely
                              • p iff q (abbreviation of if and only if)
                            23
                            Exam weight Low

                              Truth Tables For Compound Propositions

                              • Construction of a truth table:
                              • Rows
                                • Need a row for every possible combination of values for the atomic propositions.
                              • Columns
                                • Need a column for the compound proposition (usually at far right)
                                • Need a column for the truth value of each expression that occurs in the compound proposition as it is built up.
                                  • This includes the atomic propositions
                              24
                              Exam weight High
                              1. A compound proposition with n variables has 2ⁿ rows in its truth table.
                              🎯 How this can come up · 1 question
                              MCQ

                              How many rows does the truth table of a proposition with 4 variables have?

                              Example Truth Table

                              • Construct a truth table for
                              25
                              Exam weight Low
                                Slide 26: Example Truth Table
                                Exam weight Low

                                  • Construct the truth table of the compound proposition: p  q p q → ∨ ∧
                                  27
                                  Exam weight Low

                                    28
                                    Exam weight Low
                                      Slide 29: Equivalent Propositions
                                      Exam weight Low
                                        Slide 30: Using a Truth Table to Show Non-Equivalence
                                        Exam weight Low

                                          Problem

                                          • How many rows are there in a truth table with n propositional variables?

                                          Solution: n We will see how to do this in Chapter 6.

                                          • Note that this means that with n propositional variables, we can construct 2 n distinct (i.e., not equivalent) propositions.
                                          31
                                          Exam weight Low
                                            Slide 32: Precedence of Logical Operators
                                            Exam weight High
                                            1. Precedence: ¬ first, then ∧, then ∨, then →, then ↔. So p ∨ q → ¬r means (p ∨ q) → (¬r).
                                            🎯 How this can come up · 1 question
                                            MCQ

                                            p ∧ q ∨ r is read as:

                                            33
                                            Exam weight Low

                                              Applications of Propositional Logic S E C T I O N 1. 2

                                              34
                                              Exam weight Low

                                                Applications of Propositional Logic: Summary

                                                • Translating English to Propositional Logic
                                                • System Specifications
                                                • Logic Puzzles
                                                • Logic Circuits
                                                35
                                                Exam weight Low

                                                  Translating English Sentences

                                                  • Statements in mathematics and the sciences and in natural language often are imprecise or ambiguous.
                                                  • To make such statements precise, they can be translated into the language of logic.
                                                  • Steps to convert an English sentence to a statement in propositional logic
                                                    • Identify atomic propositions and represent using propositional variables.
                                                    • Determine appropriate logical connectives
                                                  • “If I go to Harry’s or to the country, I will not go shopping.”
                                                    • p: I go to Harry’s If p or q then not r.
                                                    • q: I go to the country.
                                                    • r: I will go shopping.
                                                  Translating English Sentences
                                                  36
                                                  Exam weight Medium
                                                  1. Translate: pick atomic propositions, then join them with connectives. "You can access the Internet only if you are a CS major or not a freshman" → a → (c ∨ ¬f).

                                                  Example

                                                  Problem: Translate the following sentence into propositional logic:

                                                  if you are a computer science major or you are not a freshman, You can

                                                  “

                                                  access the Internet from campus.”

                                                  Solution:

                                                  Let a

                                                  : “You can access the internet from campus,”

                                                  c

                                                  : “You are a computer science major,” f: “You are a freshman.”

                                                  )

                                                  f

                                                  (c ∨ ¬ → a

                                                  37
                                                  Exam weight Low

                                                    System Specifications

                                                    • System and Software engineers take requirements in English and express them in a precise specification language based on logic.

                                                    Example: Express in propositional logic:

                                                    when the file system is full”

                                                    “The automated reply cannot be sent

                                                    Solution: One possible solution:

                                                    Let q denote “The automated reply

                                                    can be sent”

                                                    and p denote “The file system is full.”

                                                    q

                                                    p→ ¬

                                                    38
                                                    Exam weight Low

                                                      Consistent System Specifications

                                                      Definition: A list of propositions is consistent if it is possible to assign truth values to the proposition variables so that each proposition is true.

                                                      Exercise: Are these specifications consistent?

                                                      • “The diagnostic message is stored in the buffer or it is retransmitted.”
                                                      • “The diagnostic message is not stored in the buffer.”
                                                      • “If the diagnostic message is stored in the buffer, then it is retransmitted.”

                                                      Solution:

                                                      • Let p denote “The diagnostic message is stored in the buffer.”
                                                      • Let q denote “The diagnostic message is retransmitted”
                                                      • The specification can be written as: q, p, ¬ .
                                                      • When p is false and q is true all three statements are true. (see TT next) p ∨ p→ q

                                                      So the specification is consistent.

                                                      39
                                                      Exam weight High
                                                      1. A set of specifications is consistent if ONE assignment of truth values makes all of them true at the same time.
                                                      🎯 How this can come up · 1 question
                                                      Written

                                                      How do you check that a list of system specifications is consistent?

                                                      Slide 40: Consistent System Specifications
                                                      Exam weight Low
                                                        Slide 41: Consistent System Specifications
                                                        Exam weight Low

                                                          Consistency and Inconsistency

                                                          • Consider the following set of propositions. Do they form a consistent or inconsistent set? (1) John is at the store. (2) Corinne plays guitar. (3) Mike cheats on his taxes. (4) John is a fire-fighter.

                                                          Solution:

                                                          • Consistent. Notice that nothing in the logical form of (1)-(4) prevents all of the propositions from being true.
                                                          42
                                                          Exam weight Low
                                                            Slide 43: Raymond Smullyan
                                                            Exam weight Low

                                                              Logic/digital Circuits

                                                              • Electronic circuits; each input/output signal can be viewed as a 0 or 1.
                                                                • 0 represents False
                                                                • 1 represents True
                                                              • Complicated circuits are constructed from three basic circuits called gates.
                                                                • The inverter (NOT gate)takes an input bit and produces the negation of that bit.
                                                                • The OR gate takes two input bits and produces the value equivalent to the disjunction of the two bits.
                                                                • The AND gate takes two input bits and produces the value equivalent to the conjunction of the two bits.
                                                              • More complicated digital circuits can be constructed by combining these 3 basic circuits to produce the desired output given the input signals by building a circuit for each piece of the output expression and then combining them. For example:
                                                              Logic/digital Circuits
                                                              44
                                                              Exam weight Low
                                                              1. Logic gates: inverter (¬), AND (∧), OR (∨); circuits compute compound propositions.

                                                              Propositional Equivalences S E C T I O N 1. 3

                                                              45
                                                              Exam weight Low

                                                                Section Summary

                                                                • Tautologies, Contradictions, and Contingencies.
                                                                • Logical Equivalence
                                                                  • Important Logical Equivalences
                                                                  • Showing Logical Equivalence
                                                                • Propositional Satisfiability
                                                                  • Sudoku Example
                                                                46
                                                                Exam weight Low
                                                                  Slide 47: Tautologies, Contradictions, and Contingencies
                                                                  Exam weight High
                                                                  1. Tautology: always true (p ∨ ¬p). Contradiction: always false (p ∧ ¬p). Contingency: neither.
                                                                  🎯 How this can come up · 2 questions
                                                                  MCQ

                                                                  p ∨ ¬p is a:

                                                                  MCQ

                                                                  (p → q) ∧ p ∧ ¬q is a:

                                                                  Slide 48: Logically Equivalent
                                                                  Exam weight Low
                                                                  1. p ≡ q (logically equivalent) when p ↔ q is a tautology: same truth value in every row.

                                                                  Logically Equivalent

                                                                  q are logically equivalent

                                                                  • Show that p → q and ¬p ∨
                                                                  49
                                                                  Exam weight Low
                                                                    Slide 50: Logically Equivalent
                                                                    Exam weight Low
                                                                      Slide 51: De Morgan’s Laws
                                                                      Exam weight High
                                                                      1. De Morgan: ¬(p ∧ q) ≡ ¬p ∨ ¬q and ¬(p ∨ q) ≡ ¬p ∧ ¬q.
                                                                      Memory trickNegate each part and FLIP the operator.
                                                                      🎯 How this can come up · 1 question
                                                                      MCQ

                                                                      ¬(p ∨ q) is equivalent to:

                                                                      Key Logical Equivalences

                                                                      • Identity Laws: ,
                                                                      • Domination Laws: ,
                                                                      • Idempotent laws: ,
                                                                      • Double Negation Law:
                                                                      • Negation Laws: ,
                                                                      52
                                                                      Exam weight Low
                                                                      1. Identity, domination, idempotent, double negation, negation laws.
                                                                      Slide 53: Key Logical Equivalences ( cont )
                                                                      Exam weight Low
                                                                      1. Commutative, associative, distributive, absorption laws.
                                                                      Slide 54: More Logical Equivalences
                                                                      Exam weight High
                                                                      1. Implication laws: p → q ≡ ¬p ∨ q ≡ ¬q → ¬p; p ↔ q ≡ (p → q) ∧ (q → p).

                                                                      Constructing New Logical Equivalences

                                                                      • We can show that two expressions are logically equivalent by developing a series of logically equivalent statements.
                                                                      • To prove that we produce a series of equivalences beginning with A and ending with B.
                                                                      • Keep in mind that whenever a proposition (represented by a propositional variable) occurs in the equivalences listed earlier, it may be replaced by an arbitrarily complex compound proposition.
                                                                      55
                                                                      Exam weight Low
                                                                        Slide 56: Equivalence Proofs
                                                                        Exam weight High
                                                                        1. Equivalence proof: rewrite step by step, naming the law used at each step (no truth table).
                                                                        🎯 How this can come up · 1 question
                                                                        Written

                                                                        Show that ¬(p → q) ≡ p ∧ ¬q without a truth table.

                                                                        Slide 57: Equivalence Proofs
                                                                        Exam weight Low
                                                                          Slide 58: Equivalent Propositions
                                                                          Exam weight Low

                                                                            59
                                                                            Exam weight Low

                                                                              60
                                                                              Exam weight Low

                                                                                Derivational Proof Techniques

                                                                                • When a compound proposition involves many atomic components, the size of the truth table for the compound proposition becomes large
                                                                                • Q1: How many rows are required to construct the truth-table of: q ( (¬(s r) ¬ t) ) → (q→r ¬ ) ?  p→r
                                                                                • Q2: How many rows are required to construct the truth-table of a ∧ ∧ ∨ proposition involving n atomic components?
                                                                                • A1: 32 rows, each additional variable doubles the number of rows
                                                                                • A2: In general, n rows 2
                                                                                • Therefore, as compound propositions grow in complexity, truth tables become more and more unwieldy.
                                                                                • In such cases, it is better to use derivational proof techniques
                                                                                61
                                                                                Exam weight Low

                                                                                  62
                                                                                  Exam weight Low
                                                                                    Slide 63: Solution
                                                                                    Exam weight Low

                                                                                      Propositional Satisfiability

                                                                                      • A compound proposition is satisfiable if there is an assignment of truth values to its variables that makes it true. When no such assignments exists, the compound proposition is unsatisfiable.
                                                                                      • A compound proposition is unsatisfiable if and only if its negation is a tautology.
                                                                                      64
                                                                                      Exam weight Medium
                                                                                      1. Satisfiable: SOME assignment makes it true. Unsatisfiable: none does (its negation is a tautology).
                                                                                      🎯 How this can come up · 1 question
                                                                                      True / False

                                                                                      A compound proposition is unsatisfiable exactly when its negation is a tautology.

                                                                                      Slide 65: Questions on Propositional Satisfiability
                                                                                      Exam weight Low

                                                                                        Predicates and Quantifiers S E C T I O N 1. 4

                                                                                        66
                                                                                        Exam weight Low

                                                                                          Section Summary

                                                                                          • Predicates
                                                                                          • Variables
                                                                                          • Quantifiers
                                                                                            • Universal Quantifier
                                                                                            • Existential Quantifier
                                                                                          • Negating Quantifiers
                                                                                            • De Morgan’s Laws for Quantifiers
                                                                                          • Translating English to Logic
                                                                                          67
                                                                                          Exam weight Low

                                                                                            Propositional Logic Not Enough

                                                                                            • If we have: “All men are mortal.” “Socrates is a man.”
                                                                                            • Does it follow that “Socrates is mortal?”
                                                                                            • Can’t be represented in propositional logic. Need a language that talks about objects, their properties, and their relations.
                                                                                            68
                                                                                            Exam weight Low
                                                                                              Slide 69: Introducing Predicate Logic
                                                                                              Exam weight Low

                                                                                                Introducing Predicate Logic

                                                                                                • A generalization of propositions - propositional functions or predicates: propositions which contain variables
                                                                                                • Predicates become propositions once every variable is bound- by:
                                                                                                  • Assigning it a value from the Universe of Discourse U or
                                                                                                  • Quantifying it
                                                                                                70
                                                                                                Exam weight Low
                                                                                                  Slide 71: Introducing Predicate Logic
                                                                                                  Exam weight Low
                                                                                                    Slide 72: Propositional Functions
                                                                                                    Exam weight Low
                                                                                                    1. A propositional function P(x) becomes a proposition when x gets a value or is quantified.
                                                                                                    Slide 73: Examples of Propositional Functions
                                                                                                    Exam weight Low

                                                                                                      Compound Expressions

                                                                                                      • Connectives from propositional logic carry over to predicate logic.
                                                                                                      • If P(x) denotes “ x > find these truth values: P(3) -1) Solution: T 0,” P() -1) Solution: F 3 ∨ P( P() -1) Solution: F 3 ∧ P(
                                                                                                      • → P( Expressions with variables are not propositions and therefore do not have truth values. For example, P() y 3 ) P() y x )
                                                                                                      • ∧ P( When used with quantifiers (to be introduced next), these expressions → P( (propositional functions) become propositions.
                                                                                                      74
                                                                                                      Exam weight Low
                                                                                                        Slide 75: Quantifiers
                                                                                                        Exam weight Low
                                                                                                        1. ∀x P(x): true when P(x) holds for EVERY x in the domain. ∃x P(x): true when it holds for AT LEAST ONE.

                                                                                                        Universal Quantifier ( ) 

                                                                                                        •  x P (x) is read as For all x, P(x )” or “ For every x, P(x )” “ Examples:
                                                                                                        1. If P(x) denotes “ x > U is the integers, then  x P (x) is false.
                                                                                                        2. If P(x) denotes “ x U is the positive integers, then  x P (x) is true.
                                                                                                          • 0” and
                                                                                                        3. If P(x) denotes “ x is even U is the integers, then  x P (x) is false. 0” and ” and
                                                                                                        76
                                                                                                        Exam weight High
                                                                                                        1. One counterexample makes ∀x P(x) false.
                                                                                                        🎯 How this can come up · 1 question
                                                                                                        MCQ

                                                                                                        Domain: all integers. ∀x (x² ≥ x) is:

                                                                                                        Slide 77: Existential Quantifier( ) 
                                                                                                        Exam weight Low
                                                                                                        1. ∃x P(x) is false only when P(x) is false for every x. Over an empty domain ∃ is false and ∀ is true.
                                                                                                        Slide 78: Uniqueness Quantifier ( optional )
                                                                                                        Exam weight Low
                                                                                                          Slide 79: Thinking about Quantifiers
                                                                                                          Exam weight Low

                                                                                                            Properties of Quantifiers

                                                                                                            • The truth value of  x P(x) and  x P(x) depend on both the propositional function P(x) and on the domain U .
                                                                                                            • Examples:
                                                                                                            1. If U is the positive integers and P(x) is the statement x < then  2 ”, x “ P(x) is true, but  x P(x) is false.
                                                                                                            2. If U is the negative integers and P(x) is the statement “x < 2”, then both  x P(x) and  x P(x) are true.
                                                                                                            3. If U consists of 3, 4, and 5, and P(x) is the statement “ ”, x > 2 then both  x P(x) and  x P(x) are true.
                                                                                                              • But if P(x) is the statement “ ”, x < then both  2 x P(x) x P(x) and  are false.
                                                                                                            80
                                                                                                            Exam weight Low
                                                                                                              Slide 81: Precedence of Quantifiers
                                                                                                              Exam weight Low
                                                                                                              1. ∀ and ∃ bind tighter than all connectives: ∀x P(x) ∨ Q(x) means (∀x P(x)) ∨ Q(x).
                                                                                                              Slide 82: Predicates & Quantifiers
                                                                                                              Exam weight Low

                                                                                                                Socrates Example

                                                                                                                • Introduce the propositional functions Man(x) denoting “ is a man” x and Mortal(x) denoting “ is mortal.” x Specify the domain as all people.
                                                                                                                • The two premises are:
                                                                                                                • The conclusion is:
                                                                                                                • Later we will show how to prove that the conclusion follows from the premises.
                                                                                                                Socrates Example
                                                                                                                83
                                                                                                                Exam weight Low

                                                                                                                  Translating from English to Logic

                                                                                                                  Example: Translate the following sentence into predicate logic:

                                                                                                                  “Every student in this class has taken a course in Java.” Solution:

                                                                                                                  First decide on the domain U.

                                                                                                                  Solution: If U is all students in this class,

                                                                                                                  • define a propositional function J(x) denoting “x has taken a course in Java” and
                                                                                                                  • translate as  x J(x).

                                                                                                                  Solution: But if U is all people, also

                                                                                                                  • define a propositional function S(x) denoting “x is a student in this class” and
                                                                                                                  • translate as  . x (S(x)→ J(x))
                                                                                                                  84
                                                                                                                  Exam weight High
                                                                                                                  1. "Every student has a computer": ∀x (S(x) → C(x)). "Some student has a computer": ∃x (S(x) ∧ C(x)).
                                                                                                                  Exam trap∀ pairs with →, ∃ pairs with ∧. ∃x (S(x) → C(x)) is true as soon as one x is not a student.
                                                                                                                  🎯 How this can come up · 1 question
                                                                                                                  MCQ

                                                                                                                  Domain: all people. "Some students are lazy" is:

                                                                                                                  Translating from English to Logic

                                                                                                                  Example 2: Translate the following sentence into predicate logic:

                                                                                                                  “Some student in this class has taken a course in Java.” Solution:

                                                                                                                  First decide on the domain U.

                                                                                                                  Solution: If U is all students in this class, translate as

                                                                                                                  x J(x)

                                                                                                                  Solution: But if U is all people, then translate as

                                                                                                                   x (S(x) ∧ J(x))

                                                                                                                  85
                                                                                                                  Exam weight Low

                                                                                                                    Equivalences in Predicate Logic

                                                                                                                    • Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value
                                                                                                                      • for every predicate substituted into these statements and
                                                                                                                      • for every domain of discourse used for the variables in the expressions.
                                                                                                                    • The notation S T indicates that S T and are logically equivalent.
                                                                                                                    • Example:  x S(x)  x S(x) ¬¬ ≡ ≡
                                                                                                                    86
                                                                                                                    Exam weight Low

                                                                                                                      Thinking about Quantifiers as Conjunctions and Disjunctions

                                                                                                                      • If the domain is finite, a universally quantified proposition is equivalent to a conjunction of propositions without quantifiers and an existentially quantified proposition is equivalent to a disjunction of propositions without quantifiers.
                                                                                                                      • If U consists of the integers, , and: 1 2 3
                                                                                                                      • Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long.
                                                                                                                      Thinking about Quantifiers as Conjunctions and Disjunctions
                                                                                                                      87
                                                                                                                      Exam weight Low

                                                                                                                        Negating Quantified Expressions

                                                                                                                        • Consider  x J(x) “Every student in your class has taken a course in Java.” Here J(x) is the statement “x has taken a course in ” and Java the domain is students in your class.
                                                                                                                        • Negating the original statement gives “It is not the case that every student in your class has taken Java.” This is equivalent to “There is a student in your class who has not taken Java.” Symbolically ¬ x J(x)   and x ¬J(x) are equivalent
                                                                                                                        88
                                                                                                                        Exam weight High
                                                                                                                        1. ¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x) (De Morgan for quantifiers).
                                                                                                                        Memory trickPush ¬ inside and flip ∀ ↔ ∃.
                                                                                                                        🎯 How this can come up · 1 question
                                                                                                                        MCQ

                                                                                                                        ¬∀x (x > 0) is equivalent to:

                                                                                                                        Negating Quantified Expressions ( continued )

                                                                                                                        • Now Consider  x J(x) “There is a student in this class who has taken a course in Java.” Where J(x) is “x has taken a course in Java.”
                                                                                                                        • Negating the original statement gives “It is not the case that there is a This is equivalent to Every student in this class who has taken Java.” “ student in this class has not taken Java” Symbolically ¬ x J(x)   and x ¬J(x) are equivalent
                                                                                                                        89
                                                                                                                        Exam weight Low
                                                                                                                          Slide 90: De Morgan’s Laws for Quantifiers
                                                                                                                          Exam weight Low

                                                                                                                            Multiple Quantifiers

                                                                                                                            • Multiple Quantifiers: read left to right. . .
                                                                                                                            • Example1. Let U = R, the real numbers, P(x,y): xy= 0
                                                                                                                              • The only one that is false is the first one.
                                                                                                                            Multiple Quantifiers
                                                                                                                            91
                                                                                                                            Exam weight High
                                                                                                                            1. Nested quantifiers: order matters when they differ. ∀x ∃y (x + y = 0) is true over the integers; ∃y ∀x (x + y = 0) is false.
                                                                                                                            🎯 How this can come up · 1 question
                                                                                                                            MCQ

                                                                                                                            Domain: integers. Which is TRUE?

                                                                                                                            Multiple Quantifiers

                                                                                                                            92
                                                                                                                            Exam weight Low
                                                                                                                              Slide 93: Multiple Quantifiers
                                                                                                                              Exam weight Low
                                                                                                                              1. ∀x∀y and ∃x∃y can be swapped freely; ∀x∃y and ∃y∀x cannot.

                                                                                                                              Translation from English to Logic

                                                                                                                              Examples:

                                                                                                                              1. “Some student in this class has visited Mexico.” Solution: Let M (x) denote “ has visited Mexico” and) denote “ x S (x x is a student in this class,” and U be all people.  x (S(x) M(x))
                                                                                                                              2. “Every student in this class has visited Canada or Mexico.” ∧ Solution: Add C (x) denoting “ has visited Canada.” x  x (S(x)→ (M(x)∨C(x)))
                                                                                                                              94
                                                                                                                              Exam weight Low

                                                                                                                                Some Fun with Translating from English into Logical Expressions

                                                                                                                                • U = {fleegles, snurds, thingamabobs} F(x) : x is a fleegle S(x) : x is a snurd T(x) : x is a thingamabob Translate “Everything is a fleegle”

                                                                                                                                Solution: 

                                                                                                                                x F(x)

                                                                                                                                95
                                                                                                                                Exam weight Low

                                                                                                                                  Translation (cont)

                                                                                                                                  • U = {fleegles, snurds, thingamabobs} F(x) : x is a fleegle S(x) : x is a snurd T(x) : x is a thingamabob “Nothing is a snurd.”

                                                                                                                                  Solution: ¬  x S(x)

                                                                                                                                  What is this equivalent to?

                                                                                                                                  Solution:  x S(x)

                                                                                                                                  ¬

                                                                                                                                  96
                                                                                                                                  Exam weight Low

                                                                                                                                    Translation (cont)

                                                                                                                                    • U = {fleegles, snurds, thingamabobs} F(x) : x is a fleegle S(x) : x is a snurd T(x) : x is a thingamabob “All fleegles are snurds.”

                                                                                                                                    Solution: 

                                                                                                                                    x (F(x)→ S(x))

                                                                                                                                    97
                                                                                                                                    Exam weight Low

                                                                                                                                      Translation (cont)

                                                                                                                                      • U = {fleegles, snurds, thingamabobs} F(x) : x is a fleegle S(x) : x is a snurd T(x) : x is a thingamabob “Some fleegles are thingamabobs.”

                                                                                                                                      Solution:  x (F(x) T(x))

                                                                                                                                      ∧

                                                                                                                                      98
                                                                                                                                      Exam weight Low

                                                                                                                                        Translation (cont)

                                                                                                                                        • U = {fleegles, snurds, thingamabobs } F(x) : x is a fleegle S(x) : x is a snurd T(x) : x is a thingamabob “No snurd is a thingamabob.”

                                                                                                                                        Solution: ¬  x (S(x) T(x)) What is this equivalent to?

                                                                                                                                        ∧

                                                                                                                                        Solution:  x (

                                                                                                                                        ¬

                                                                                                                                        ¬ T(x))

                                                                                                                                        S(x) ∨

                                                                                                                                        99
                                                                                                                                        Exam weight Low

                                                                                                                                          Translation

                                                                                                                                          Consider these statements, of which the first three are premises and the fourth is a valid conclusion.

                                                                                                                                          • “All hummingbirds are richly colored .”
                                                                                                                                          • “ No large birds live on honey.” dull in color .”
                                                                                                                                          • “Birds that do not live on honey are
                                                                                                                                          • “Hummingbirds are small.”

                                                                                                                                          Let:

                                                                                                                                          P(x) , be the statements “ is a hummingbird,”

                                                                                                                                          x

                                                                                                                                          • Q(x) , be the statements “ is large,” x R(x) , be the statements “ lives on honey,” x
                                                                                                                                          • S(x) be the statements “ x is richly colored ,”
                                                                                                                                          • Assuming that the domain consists of all birds, express the statements in the argument using quantifiers and P(x) , Q(x) , R(x) , and S(x) .
                                                                                                                                          100
                                                                                                                                          Exam weight Low

                                                                                                                                            Solution:

                                                                                                                                            We can express the statements in the argument as

                                                                                                                                            • x(P(x) S(x)). →
                                                                                                                                            • ¬ x(Q(x) R(x)). ∀
                                                                                                                                            • ¬ R(x) S(x)). x( ¬ → ∃ ∧
                                                                                                                                            • x(P(x) → ¬ Q(x)). ∀ ∀
                                                                                                                                            101
                                                                                                                                            Exam weight Low
                                                                                                                                              Slide 102: Example
                                                                                                                                              Exam weight Low

                                                                                                                                                Rules of Inference

                                                                                                                                                R O S E N 1. 6

                                                                                                                                                103
                                                                                                                                                Exam weight Low
                                                                                                                                                  Slide 104: Rules of Inference
                                                                                                                                                  Exam weight Low
                                                                                                                                                  1. An argument is valid if the conclusion must be true whenever all premises are true (the conditional (p₁ ∧ … ∧ pₙ) → q is a tautology).

                                                                                                                                                  Valid Arguments in Propositional Logic

                                                                                                                                                  • Let p to represent = you have my password, q= you can log on to my email
                                                                                                                                                  • Fact 1:
                                                                                                                                                    • "If you have my password, then you can log on to my email",
                                                                                                                                                    • p→q = T
                                                                                                                                                  • Fact 2:
                                                                                                                                                    • "You cannot log on to my email",
                                                                                                                                                    • ¬q = T
                                                                                                                                                  • What can we conclude from these two facts??
                                                                                                                                                  • ¬p = T You do not have a password!!!!
                                                                                                                                                  105
                                                                                                                                                  Exam weight Low
                                                                                                                                                    Slide 106: Valid Arguments in real life!
                                                                                                                                                    Exam weight Low
                                                                                                                                                      Slide 107: Valid Arguments in Propositional Logic
                                                                                                                                                      Exam weight Low
                                                                                                                                                        Slide 108: Valid Arguments in Propositional Logic
                                                                                                                                                        Exam weight Low
                                                                                                                                                          Slide 109: Valid Arguments in Propositional Logic
                                                                                                                                                          Exam weight Low
                                                                                                                                                            Slide 110: Valid Arguments in Propositional Logic
                                                                                                                                                            Exam weight Low
                                                                                                                                                              Slide 111: The 1
                                                                                                                                                              Exam weight Low
                                                                                                                                                                Slide 112: modus ponens
                                                                                                                                                                Exam weight Low

                                                                                                                                                                  Rules of Inference for Propositional Logic

                                                                                                                                                                  3 

                                                                                                                                                                  2 

                                                                                                                                                                  2   (2)  

                                                                                                                                                                  • A valid argument can lead to an incorrect

                                                                                                                                                                  2 

                                                                                                                                                                  conclusion, if one of its premises is

                                                                                                                                                                  wrong/false!

                                                                                                                                                                  2 

                                                                                                                                                                  3 

                                                                                                                                                                   2   

                                                                                                                                                                  2 

                                                                                                                                                                  p: 2 

                                                                                                                                                                  The argument is valid as it is constructed using modus

                                                                                                                                                                  ponens.

                                                                                                                                                                  3 

                                                                                                                                                                  But one of the premises is false (q is false)

                                                                                                                                                                  q: 2   

                                                                                                                                                                  2 

                                                                                                                                                                  So, we cannot derive the conclusion is true. Also note that the conclusion q of this statement is false

                                                                                                                                                                  p  q

                                                                                                                                                                  113
                                                                                                                                                                  Exam weight Low
                                                                                                                                                                    Slide 114: The rules of inference
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                    1. The 8 rules: modus ponens, modus tollens, hypothetical syllogism, disjunctive syllogism, addition, simplification, conjunction, resolution.

                                                                                                                                                                    Modus Ponens

                                                                                                                                                                    Corresponding Tautology: (p p q q

                                                                                                                                                                    ∧ (→ )) →

                                                                                                                                                                    Example: Let p be “It is snowing.” Let q be “I will study discrete math.”

                                                                                                                                                                    If it is snowing, then I will study discrete math.”

                                                                                                                                                                    “ “It is snowing.”

                                                                                                                                                                    Therefore, I will study discrete math.”

                                                                                                                                                                    “

                                                                                                                                                                    Modus Ponens
                                                                                                                                                                    115
                                                                                                                                                                    Exam weight High
                                                                                                                                                                    1. Modus ponens: p, p → q ∴ q.
                                                                                                                                                                    🎯 How this can come up · 1 question
                                                                                                                                                                    MCQ

                                                                                                                                                                    "If it snows, school closes. It snows. Therefore school closes." uses:

                                                                                                                                                                    Modus Tollens

                                                                                                                                                                    Corresponding Tautology: (q p q p

                                                                                                                                                                    ¬

                                                                                                                                                                    ∧(→ ))→¬

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “it is snowing.” Let q be “I will study discrete math.”

                                                                                                                                                                    If it is snowing, then I will study discrete math.”

                                                                                                                                                                    “ “I will

                                                                                                                                                                    not study discrete math.”

                                                                                                                                                                    “

                                                                                                                                                                    Therefore, it is not snowing.”

                                                                                                                                                                    Modus Tollens
                                                                                                                                                                    116
                                                                                                                                                                    Exam weight High
                                                                                                                                                                    1. Modus tollens: ¬q, p → q ∴ ¬p.
                                                                                                                                                                    Exam trapp → q, q ∴ p is the fallacy of affirming the conclusion; p → q, ¬p ∴ ¬q is denying the hypothesis. Neither is valid.
                                                                                                                                                                    🎯 How this can come up · 1 question
                                                                                                                                                                    MCQ

                                                                                                                                                                    From p → q and ¬q we may conclude:

                                                                                                                                                                    Hypothetical Syllogism

                                                                                                                                                                    Corresponding Tautology: ((p q

                                                                                                                                                                    (r p r

                                                                                                                                                                    )

                                                                                                                                                                    → ) ∧ q→ ))→(→

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “it snows.” Let q be “I will study discrete math.” Let r be “I will get an A.”

                                                                                                                                                                    If it snows, then I will study discrete math.”

                                                                                                                                                                    “ “

                                                                                                                                                                    If I study discrete math, I will get an A.” Therefore, If it snows, I will get an A.”

                                                                                                                                                                    “

                                                                                                                                                                    Hypothetical Syllogism
                                                                                                                                                                    117
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                    1. Hypothetical syllogism: p → q, q → r ∴ p → r.

                                                                                                                                                                    Disjunctive Syllogism

                                                                                                                                                                    Corresponding Tautology: (p p q q ¬

                                                                                                                                                                    ∧(∨ ))→

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “I will study discrete math.” Let q be “I will study English literature.” “I will study discrete math

                                                                                                                                                                    or I will study English literature.”

                                                                                                                                                                    “I will not study discrete math.”

                                                                                                                                                                    Therefore, I will study English literature.”

                                                                                                                                                                    “

                                                                                                                                                                    Disjunctive Syllogism
                                                                                                                                                                    118
                                                                                                                                                                    Exam weight Medium
                                                                                                                                                                    1. Disjunctive syllogism: p ∨ q, ¬p ∴ q.
                                                                                                                                                                    🎯 How this can come up · 1 question
                                                                                                                                                                    MCQ

                                                                                                                                                                    "Either the file is corrupt or the disk is full. The disk is not full. So the file is corrupt." uses:

                                                                                                                                                                    Addition

                                                                                                                                                                    Corresponding Tautology: p p q

                                                                                                                                                                    )

                                                                                                                                                                    →(∨

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “I will study discrete math.” Let q be “I will visit Las Vegas.” “I will study discrete math.” “

                                                                                                                                                                    Therefore, I will study discrete math or I will visit

                                                                                                                                                                    Las Vegas.”

                                                                                                                                                                    Addition
                                                                                                                                                                    119
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                    1. Addition: p ∴ p ∨ q.

                                                                                                                                                                    Simplification

                                                                                                                                                                    Corresponding Tautology: (p q p

                                                                                                                                                                    ∧ ) →

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “I will study discrete math.” Let q be “I will study English literature.”

                                                                                                                                                                    and English literature”

                                                                                                                                                                    “I will study discrete math “

                                                                                                                                                                    Therefore, I will study discrete math.”

                                                                                                                                                                    Simplification
                                                                                                                                                                    120
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                    1. Simplification: p ∧ q ∴ p.

                                                                                                                                                                    Conjunction

                                                                                                                                                                    Corresponding Tautology: (p) q p q

                                                                                                                                                                    (

                                                                                                                                                                    )

                                                                                                                                                                    ∧ ()) →(∧

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “I will study discrete math.” Let q be “I will study English literature.” “I will study discrete math.” “I will study English literature.”

                                                                                                                                                                    Therefore, I will study discrete math and I will study English

                                                                                                                                                                    “ literature.”

                                                                                                                                                                    Conjunction
                                                                                                                                                                    121
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                    1. Conjunction: p, q ∴ p ∧ q.

                                                                                                                                                                    Resolution

                                                                                                                                                                    Resolution plays an important role in AI and is used in Prolog.

                                                                                                                                                                    Corresponding Tautology: ((p r p q q r

                                                                                                                                                                    ¬ )

                                                                                                                                                                    )

                                                                                                                                                                    ∨ ∧ (∨ )) →(∨

                                                                                                                                                                    Example:

                                                                                                                                                                    Let p be “I will study discrete math.” Let r be “I will study English literature.” Let q be “I will study databases.”

                                                                                                                                                                    not study discrete math or I will study English literature.”

                                                                                                                                                                    “I will “I will study discrete math

                                                                                                                                                                    or I will study databases.”

                                                                                                                                                                    “

                                                                                                                                                                    Therefore, I will study databases or I will study English literature.”

                                                                                                                                                                    Resolution
                                                                                                                                                                    122
                                                                                                                                                                    Exam weight High
                                                                                                                                                                    1. Resolution: p ∨ q, ¬p ∨ r ∴ q ∨ r (the clashing literal p cancels).
                                                                                                                                                                    🎯 How this can come up · 1 question
                                                                                                                                                                    MCQ

                                                                                                                                                                    From p ∨ q and ¬p ∨ r, resolution gives:

                                                                                                                                                                    Using the rules of inference to build arguments

                                                                                                                                                                    Show that the premises: It is not sunny this afternoon and it is colder than yesterday.

                                                                                                                                                                    If we go swimming it is sunny this afternoon.

                                                                                                                                                                    If we do not go swimming then we will take a canoe trip.

                                                                                                                                                                    If we take a canoe trip then we will be home by sunset.

                                                                                                                                                                    lead to the conclusion: We will be home by sunset

                                                                                                                                                                    123
                                                                                                                                                                    Exam weight High
                                                                                                                                                                    1. Build an argument as a numbered list of steps, each a premise or a rule applied to earlier steps.
                                                                                                                                                                    🎯 How this can come up · 1 question
                                                                                                                                                                    Written

                                                                                                                                                                    Premises: p → q, q → r, p. Show r with rules of inference.

                                                                                                                                                                    Slide 124: An example
                                                                                                                                                                    Exam weight Low
                                                                                                                                                                      Slide 125: Using the rules of inference to build arguments An example
                                                                                                                                                                      Exam weight Low

                                                                                                                                                                        Using the resolution rule (an example)

                                                                                                                                                                        1. Anna is skiing or it is not snowing.
                                                                                                                                                                        2. It is snowing or Bart is playing hockey.
                                                                                                                                                                        3. Consequently Anna is skiing or Bart is playing hockey. We want to show that (3) follows from (1) and (2)
                                                                                                                                                                        126
                                                                                                                                                                        Exam weight Low
                                                                                                                                                                          Slide 127: Using the resolution rule (an example)
                                                                                                                                                                          Exam weight Low
                                                                                                                                                                            Slide 128: Example
                                                                                                                                                                            Exam weight Low
                                                                                                                                                                              Slide 129: Continue
                                                                                                                                                                              Exam weight Low

                                                                                                                                                                                Another view on what we are doing

                                                                                                                                                                                You might think of this as some sort of game.

                                                                                                                                                                                You are given some statement, and you want to see if it is a valid argument and true You translate the statement into argument form using propositional variables, and make sure you have the premises right, and clear what is the conclusion You then want to get from premises/hypotheses (A) to the conclusion (B) using the rules of inference.

                                                                                                                                                                                So, get from A to B using as “moves” the rules of inference

                                                                                                                                                                                130
                                                                                                                                                                                Exam weight Low
                                                                                                                                                                                  Slide 131: Rule of inference Tautology Name p q  p [ p  ( p  q )]  q Modusponens
                                                                                                                                                                                  Exam weight Low
                                                                                                                                                                                    Slide 132: Example
                                                                                                                                                                                    Exam weight Low