Formal Foundations I: All About Logic and Stuff - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Formal Foundations I: All About Logic and Stuff

Description:

The system of typographic logic we will study at the beginning of this course ... p = 'Bob's new car is red.', p = 'Bob's new car is not red. ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 18
Provided by: rober52
Category:

less

Transcript and Presenter's Notes

Title: Formal Foundations I: All About Logic and Stuff


1
Formal Foundations IAll About Logic and Stuff
  • Helpful Reading
  • Rosen 1.1-1.3

2
Why study logic?
  • In order to make assertions about, well,
    anything, we need to be precise
  • The system of typographic logic we will study at
    the beginning of this course aims to give
    structure to the way we will discuss the
    characteristics of computer science
  • Logic is itself directly applicable to computer
    circuitry (logic gates, bit representations)

3
The Fundamental Unit of LogicThe Proposition
  • Notion of truth and falsity from our everyday
    conversation
  • A proposition is a statement that is either true
    or false (not both, and not neither) at some
    given time
  • I am a bottle of wine is a proposition
  • I hate wine is a proposition
  • Drink this wine is NOT a proposition

4
The Binary Connectives
  • More interesting statements can be created
    through the combination of two propositions using
    binary connectives
  • A binary connective is a method for determining
    the aggregate truth value of two propositions --
    the result of connecting two propositions is
    another proposition
  • Common binary connectives are AND, OR, and XOR,
    and they get their meanings from English

5
Meanings of the Connectives
  • AND (Ù)
  • If p is a proposition, and q is a proposition,
    then p Ù q is true exactly when both p and q are
    true (I hate wine AND I hate beer)
  • OR (Ú)
  • p Ú q is true if either p is true or q is true
    (She can visit on Sunday OR Tuesday) -- both
    can be true
  • XOR (Ã…)
  • p Ã… q is true if either p is true or q is true
    but NOT both (You can have soup OR salad)
  • English is a terribly ambiguous language! (when
    it comes to logic)

6
Implications
  • Another common form of binary connective is the
    implication ()
  • Stated as if p, then q written pq
  • Alternately p implies q. q if p.
  • If it is raining, then we wont go to the
    beach.
  • Implications are one-way!
  • Nothing says we will go to the beach if its not
    raining, but we definitely wont go if it is

7
Negations
  • If p is a proposition, then Øp is its negation
    (opposite)
  • p I like wine., Øp I dont like wine.
  • p Bobs new car is red., Øp Bobs new car
    is not red.
  • Øp is true exactly when p is false, and vice
    versa
  • Negation is a unary operator on propositions -
    precedence over binary

8
A Propositional Calculus
  • Represent absolute truth with T, absolute falsity
    with F
  • Assign letters to various propositions
  • Binary connectives are used to join the
    propositions
  • GOAL Particular assignments of T and F to each
    proposition consistently yield the overall truth
    value of the proposition as a whole

9
Truth Tables
10
Logical Equivalence
  • Two compound propositions over some set of
    component propositions are logically equivalent
    if they have the same truth value for each
    possible assignment to component propositions
  • This also means that they are logically
    equivalent if they imply each other, i.e. if
    (pq) Ù (qp) is always true
  • Leads to some well-known reductions

11
Common Equivalences
  • Used to reduce complex propositions
  • De Morgan 1 Ø(p Ù q) Û Øp Ú Øq
  • De Morgan 2 Ø(p Ú q) Û Øp Ù Øq
  • Implication pq Û Øp Ú q
  • Double negation Ø(Øp) Û p
  • Distributive 1 p Ù (q Ú r) Û (p Ù q) Ú (p Ù r)
  • Distributive 2 p Ú (q Ù r) Û (p Ú q) Ù (p Ú r)
  • Replace parts of complex propositions with
    logically equivalent ones

12
Propositions vs. Predicates
  • In computer science, we are often concerned with
    statements whose truth or falsity depends on
    unknown values
  • x gt 5 is an interesting statement that is NOT a
    proposition (what is x?)
  • Algorithm A is faster than Algorithm B is
    another such statement (what is A? B?)
  • A statement whose truth is dependent on unknowns
    is a predicate

13
The Predicate Calculus
  • Predicates become propositions when their unknown
    values are specified from some universe of
    discourse, then propositional calculus rules
    apply
  • Denote a predicate P over unknown x by P(x) --
    note capital P
  • If P(x) x gt 2 and Q(x) x lt 4, and the
    universe of discourse is the integers, then
  • P(3) Ù Q(2) Û T
  • P(3) Ù Q(4) Û F

14
Quantifiers
  • Often we are interested in proving that a
    predicate either holds for the whole universe of
    discourse, or for at least one element in the
    universe of discourse
  • Universal Quantifier ("), for all
  • P(x) is true for all x from the universe of
    discourse, written "x P(x)
  • Existential Quantifier (), exists
  • P(x) is true for at least one x from the
    universe of discourse, written x P(x)
  • Quantifying a predicate makes a proposition

15
Caveats for Quantifiers
  • Caveat 1 Negation is tricky
  • Ø("x P(x)) Û x Ø P(x)
  • Ø(x P(x)) Û "x Ø P(x)
  • Caveat 2 Existence does not equal specification
  • (x P(x)) Ù (x Q(x)) DOES NOT imply that x
    (P(x) Ù Q(x)) -- it may not be the same x that
    satisfies P(x) and Q(x).

16
Logic and Computers
  • A bit is either ON or OFF (1 or 0), and a
    proposition is either true or false -- a truth
    value can be represented as a bit
  • Bit strings are sequences of 0s and 1s
  • Binary connectives can be applied to bit strings
    by applying the connective to each bit in
    sequence
  • 01100101 Ù 11010101 01000101
  • 10010101 Ú 01101010 11111111
  • 10010110 Ã… 11111111 01101001

17
What Next?
  • The notion of proof
  • Generally, proofs aim to show beyond a doubt that
    for some p and q, pq
  • Inductive proofs aim to show the truth of a
    proposition "n P(n) where n is from the universe
    of discourse of some infinite subset of all the
    integers (e.g. n gt 1)
  • Also, techniques for proving x P(x)
  • We can use the underlying rules of the
    propositional calculus to simplify life
Write a Comment
User Comments (0)
About PowerShow.com