COMP 2711H: Lecture 1

Date: 2024-09-01 23:02:24

Reviewed:

Topic / Chapter: Propositional Logic

summary

❓Questions
  • Is there any practical difference between logic / boolean algebra?
  • Is Boolean algebra "algebra" because we have XYZ?

Notes

Introduction to the Course
  • COMP 2711H

    • πŸ‘¨β€πŸ«Honors, so we will put infinite pressure on you HAHA
      • 0 coding, 100% theoretical
      • this session: easy (unlike others)
    • ~50%: have A's
      • but thou shalt suffer before getting it!
    • talking about basics: proof, proposition, set of natural numbers
Introduction to Propositions
  • Propositional logic

    • proposition any statement that can be true / false (not both)
      • πŸ‘¨β€πŸ«or 1 or 0, as we are CS PPL
      • if you can't assign Boolean value: not a statement
        • e.g. "close the door" not boolean
      • usually using for var. names
      • atomic proposition prop. that can't be further broken down
      • for combination: use operators like ("neg")
        • and we often draw truth table to represent the value
  • Logical operators

    • negation: or

      • "it is not the case that "

        • read as "not "
      • (!p) ? 1 : 0

      • always opposite of

        10
        01
      • examples

        • "Prof. Amir uses Kali Linux for his desktop"
        • "Prof. Amir doesn't use Kali Linux for his desktop"
    • disjunction:

      • " or "

      • (p || q) ? 1 : 0

      • 0 only if both and are 0

        111
        101
        011
        000
    • conjunction:

      • " and "

      • (p && q) ? 1 : 0

      • 1 only if both and are T

      • πŸ‘¨β€πŸ« logical operator: kind of "promise" on condition

        111
        100
        010
        000
    • exclusive or (xor):

      • 1 when exactly one of and is T

        • 0 otherwise
      • ((p && !q) || (!p && q)) ? 1 : 0

        • or: (p ^ q) ? 1 : 0 (bit-wise though)
        110
        101
        011
        000
    • implication

      • cond. state.:

        • = prop. "if then "
      • : hypothesis / premise

      • : conclusion / consequence / implication

      • (!p || (p && q)) ? 1 : 0

      • πŸ‘¨β€πŸ«: any connection in : not needed

        • simply depending on its values
      • πŸ‘¨β€πŸ«: also, kind of promise

        • "if you are in classroom 2456, then you are Y1 student"
      • can be combined, like:

        111
        100
        011
        001
      • examples

        • if the moon is made of green cheese, then I have more money than Bill Gates
          • πŸ‘¨β€πŸŽ“ as the hypothesis is false, the true value of conclusion doesn't matter
          • πŸ‘¨β€πŸŽ“ you broke the promise (more like, premise) first!!!
    • πŸ‘¨β€πŸ« dual

      • let be a statement
      • is the statement obtained by following replacement
      • example
  • Conditional statement

    • necessary / sufficient conditions

      • if , then
        • : sufficient condition of
        • : necessary condition of
      • examples
        • if I am elected, then taxes will be lowered
        • if elected: sufficient to know "tax will be lowered"
        • if not "tax will be lowered" it must be that I am not elected
      • other ways for
        • if , then
        • if
        • when
        • implies
        • follows from
        • is a sufficient condition for
        • is a necessary condition for
        • only if (falsity of : implies falsity of )
    • converse, contrapositive

      • (below: of )

      • converse:

      • contrapositive:

      • inverse:

      • : equivalent to its contrapositive

        TTTT
        TFFF
        FTTT
        FFTT
    • bi-conditional statement

      • bicon. state.:

        • = prop. " if and only if "
        • or: iff
      • T when and have the same truth value

        • or
      • equivalent

        • if and only if
        • iff
        • is "necessary and sufficient" for
        • if then , and conversely
        TTT
        TFF
        FTF
        FFT
Proof / Propositional Equivalence
  • Tautology and contradiction

    • tautology: compound proposition, that is always true
      • no matter values of the prop. vars in it
        • πŸ‘¨β€πŸ«: to proof: to show that certain statement is a tautology
    • contradiction: compound proposition, that is always false
    • contingency: compound proposition that is neither a tautology nor a contradiction
    • example
      • is a tautology
        • as well as
        • as premise: always 0
      • is a contradiction
      • is a contingency
  • Boolean algebra

    • conjunction, disjunction, or negation: can be implemented in hardware easily
      • πŸ‘¨β€πŸ« but, how can gates output true when all conjunctions are false?
        • for simplicity, just imagine there is an extra power line
graph TD;
      OR(( ∨ )) --> c_1[ ];
      a_1[ ] --> OR;
      b_1[ ] --> OR;
      AND(( ∧ )) --> c_2[ ];
      a_2[ ] --> AND;
      b_2[ ] --> AND;
      NOT(( Β¬ )) --> c_3[ ];
      a_3[ ] --> NOT;
  • let's build a simple adder!

    • bit 0 adder:
      • : defined as
      • read as, "XOR"
    • carry:
    • bit 1:
    • πŸ‘¨β€πŸŽ“use 2611 knowledge
    • πŸ‘¨β€πŸ«: one thing you can't ask: "where will this course be useful?"
  • Logical equivalence

    • compound prop. always having the same truth values: logically equivalent
      • i.e. is a tautology
      • notation: (or )
      • : not a logical operator
      • : not a compound prop., but a statement!
        • that is a tautology
      • example:
        • πŸ‘¨β€πŸŽ“ you can use truth table to compare! (manual)
    • use of
      • : denotes logical equivalence, regardless of var. values
      • : binary logical operator
      • : not used on propositions
        • only on two mathematical quantities
  • Propositional equivalences

    • πŸ‘¨β€πŸ« many algebraic rules also work here!
      • consider as addition, and as multiplication
    major equivalences
    NameEquivalence
    Identity laws
    Domination laws
    Idempotent laws
    Double negation laws
    Commutative laws
    Associative laws
    Distributive laws
    De Morgan's laws
    Absorption laws
    Negation laws
    Involving cond. states
    Involving bicond. states.
  • Examples

    • Use De Morgan's laws to express the negations of "Alice will send a secret message or Bob will send a secret message" and "today is Saturday and today is a holiday".
      • Alice & Bob
        • := Alice will send a secret message
        • := Bob will send a secret message
        • expr :=
        • expr==
        • = "Alice will NOT send a secret message and Bob will NOT send a secret message"
      • Today is...
        • := today is Saturday
        • := today is a holiday
        • expr :=
        • expr==
    • Show that and are logically equivalent by developing a series of logical equivalences.
    • Show that and are logically equivalent by developing a series of logical equivalences.
      1. =
    • Show that is a tautology by developing a series of logical equivalences.
Rules of Inference
  • Rules of inference

    • theorem: statement that is always true (or: is a tautology)

    • we can write theorem as

    • better, we can define proof

      • you can either fill in size table...
      • or: you use "inference" from existing tautology
    • proof for is

      • a sequence of statements
    • s.t. for each , either is true

      1. for some
        • i.e. the premise
      2. is a tautology
        • i.e. can be implied from prev. statements
    • πŸ‘¨β€πŸ« "one rule is actually enough"

      • but we introduce multiple for now
  • Rules

    • modus ponens
      • thereafter, you can use as a tautology
      • or: " is a tautology"
      • πŸ‘¨β€πŸ« just another way of writing a tautology!
      • πŸ‘¨β€πŸ« the actual, only real rule here
    • syllogism
      • or: "" is a tautology
    • modus tollens