01 Introduction (for handout)

Document Sample
scope of work template
							CS103      HO#3                                                                                                                                                    9/21/09
Introduction, policies, propositional logic




                                             CS103                                                  Today

                                                                                                          • What we will study and why
           Mathematical Foundations of Computing
                                                                                                          • How the course will be run

                                             Robert Plummer                                               • Propositional logic



                                                     9/21/09




                                                     CS103
                                                                                               8

                                 Mathematical Foundations of Computing    Number of Lectures
                                                                                               7

                                                                                               6

                                                                                               5

                                        Logic                                                  4

                                                                                               3

                                                                                               2

                                        Induction                                              1

                                                                                               0



                                        Sets, Relations, and Functions




                                                                                                                                                              ry
                                                                                                    c




                                                                                                                                                             ry
                                                                                                                n




                                                                                                                                                               s
                                                                                                                              ns
                                                                                                  gi




                                                                                                                                                            ge
                                                                                                             tio




                                                                                                                                                           eo
                                                                                                                                                          eo
                                                                                                                              io
                                                                                               Lo




                                                                                                              c




                                                                                                                                                         ua




                                                                                                                                                        Th
                                                                                                                           ct




                                                                                                                                                        Th
                                                                                                           du



                                                                                                                         un



                                                                                                                                                     ng
                                                                                                         In




                                                                                                                                                   ity
                                                                                                                                                      y
                                        Automata and Formal Languages
                                                                                                                    ,F



                                                                                                                                                 La




                                                                                                                                                  lit



                                                                                                                                               ex
                                                                                                                                                bi
                                                                                                                    ns




                                                                                                                                     d




                                                                                                                                             pl
                                                                                                                                            ta
                                                                                                                                   an
                                                                                                                  io




                                                                                                                                           m
                                                                                                                                          pu
                                                                                                               at




                                                                                                                                       Co
                                                                                                                              a



                                                                                                                                        m
                                                                                                             el



                                                                                                                         at



                                        Computability Theory                                                                         Co
                                                                                                            ,R




                                                                                                                        m
                                                                                                                      to
                                                                                                          ts



                                                                                                                    Au
                                                                                                        Se




                                        Complexity Theory




                                                                                                          Why Is CS103 Important?
                                                                                                   Proof skills
                                 16
                                 15
                                 14                                                                Way of Thinking
                                 13
                                 12
            Number of Lectures




                                 11
                                 10
                                                                                                   Foundations of CS
                                 9
                                 8
                                 7                                                                 Applications
                                 6
                                 5
                                                                                                          Programming Languages
                                 4                                                                        Compilers
                                 3
                                 2                                                                        Circuit Design
                                 1
                                 0
                                                                                                          AI
                                        Foundation               Theory                                   Cryptography

                                                                                                   Intellectually and Philosophically Interesting




                                                                                                                                                                        1
CS103      HO#3                                                                                                                   9/21/09
Introduction, policies, propositional logic



                               Course Details                                        Online Course Support
               Instructor:    Bob Plummer
                              Gates 178                                This quarter we will be using CourseWare, a new
                              Office hours M, W 3:30 – 5:00            course management system. Register for CS103 at
                              or by appointment
                                                                       https://courseware.stanford.edu
               TAs:           Louis Chatriot
                              Jeremy Hiatt                             We also have an email hotline that is closely monitored
                              Tyler Mullen                             by course staff:
                              Ilana Segall
                                                                       cs103staff@gmail.com

                      "Working Office Hours" to be announced




                                 Textbooks                                                      Exams

          1. Custom book for Logic portion of the class
                                                                       Midterm      Tuesday, Oct. 27, 7 – 9 pm
          Introduction to Theory of Computation, CS103.
          Instructor: Robert Plummer.                                  Final        Monday, Dec. 7, 12:15 – 3:15 pm

          Available at the Bookstore only                              Locations to be announced

          2. Text for the main part of the course
                                                                       Alternate exams are given on an individual basis and
          Sipser, Introduction to the Theory of Computation, 2nd Ed.   and only for emergencies or official university business

          Some course notes will also be distributed




                              Homework Policy                                                Grading

               9 written problem sets, counted equally

               Due in class                                                             Midterm         20%

               3 free late days (max. 1 on any assignment)                              Final           35%

               Not accepted more than one class period late                             Homework        45%
               Late without a late day: -10%

               You may work with others in the class, but you
               must write up your problem sets individually

               Revealing an answer denies the other person
               the opportunity for the "Aha!" experience




                                                                                                                                       2
CS103      HO#3                                                                                                                                  9/21/09
Introduction, policies, propositional logic



                                  The Flu                                                        The Flu

                Course policies will be adjusted if necessary
                                                                                  A large outbreak will be a serious matter
                Under consideration:
                                                                                        -- This class is available online;
                        -- More late days                                                  so if you have flu symptoms,
                        -- Alternate method of submission                                  DON'T COME
                        -- Drop one assignment
                        -- Alternate exams
                        -- Take-home exams
                        -- More generous curve

                For now, the announced policies are in effect




                          Propositional Calculus                                          Propositional Calculus

               A proposition is a declarative statement that is               The first thing we will study is how to combine
               either true or false (but not both).                           propositions into larger propositions and how
                                                                              to determine the truth value of the results.

               Bob is teaching this class.                                                         Negation

               3>2                                                            It is not the case that Bob is teaching this class.

               It is snowing outside.
                                                                              It is not the case that it is snowing outside.
               This program sorts any list of positive integers
               into non-decreasing order.




                                                                               Logical Operators a.k.a. Boolean Connectives
                          Propositional Calculus
                                                                       Negation                        ¬p is true if and only if p is false.
           So that we can discuss the rules of propositional                                                    ¬p is read "not p".
           calculus in a compact way, we will use propositional
           variables such as p, q, r, ... to stand for propositions.
                                                                       Disjunction                     p ∨ q is true if and only if
                                                                                                       p is true, q is true, or both are true.
           Propositional variables have one of two possible values:                                             p ∨ q is read "p or q".
                 true, which we denote by T, and
                 false, which we denote by F.
                                                                       Conjunction                     p ∧ q is true if and only if
           We will use logical operators to describe the ways that
                                                                                                       both p and q are true.
           we can build larger propositions from smaller ones.
                                                                                                              p ∧ q is read "p and q".




                                                                                                                                                      3
CS103      HO#3                                                                                                                                                      9/21/09
Introduction, policies, propositional logic



                  Logical Operators a.k.a. Boolean Connectives                                  Logical Operators a.k.a. Boolean Connectives

         Negation              p ¬p          ¬p is true if and only if p is false.     Negation              p ¬p          ¬p is true if and only if p is false.
                               T F                    ¬p is read "not p".                                    T F                    ¬p is read "not p".
                               F T                                                                           F T

         Disjunction                         p ∨ q is true if and only if              Disjunction       p   q   p∨q       p ∨ q is true if and only if
                                             p is true, q is true, or both are true.                     T   T    T        p is true, q is true, or both are true.
                                                      p ∨ q is read "p or q".                            T   F    T                 p ∨ q is read "p or q".
                                                                                                         F   T    T
                                                                                                         F   F    F

         Conjunction                         p ∧ q is true if and only if              Conjunction       p   q   p∧q       p ∧ q is true if and only if
                                             both p and q are true.                                      T   T   T         both p and q are true.
                                                    p ∧ q is read "p and q".                             T   F   F                p ∧ q is read "p and q".
                                                                                                         F   T   F
                                                                                                         F   F   F

                                                                                           In a truth table, we are not concerned with what p and q mean.
                                                                                           Each stands for a proposition that can be true or false.




                  Logical Operators a.k.a. Boolean Connectives                                  Logical Operators a.k.a. Boolean Connectives

                                             p ⊕ q is true if and only if                                                  p ⊕ q is true if and only if
         Exclusive Or      p   q   p⊕q       p is true or q is true, but not both.     Exclusive Or      p   q   p⊕q       p is true or q is true, but not both.
                           T   T    F                                                                    T   T    F
                           T   F    T        I.e., p ⊕ q is true if and only if                          T   F    T        I.e., p ⊕ q is true if and only if
                           F   T    T        p and q have different truth values.                        F   T    T        p and q have different truth values.
                           F   F    F                                                                    F   F    F
                                               p ⊕ q is read "p exclusive or q".                                             p ⊕ q is read "p exclusive or q".

                                                                                           We will use parentheses to build larger propositions.

                                                                                           For example
                                                                                                                p⊕q
                                                                                           is true exactly when
                                                                                                            (p ∨ q) ∧ ¬(p ∧ q)
                                                                                           is true.




                          Evaluating a compound expression                                              Evaluating a compound expression

                                                   1. Locate the main connective.                                                1. Locate the main connective.
                                                      This will be the last one you                                                 This will be the last one you
                                                      evaluate.                                                                     evaluate.
              p   q     (p ∨ q) ∧ ¬(p ∧ q)                                                  p   q     (p ∨ q) ∧ ¬(p ∧ q)
              T   T                                                                         T   T                                2. Work from the "inside out",
              T   F                                                                         T   F                                   placing the value of each
              F   T                                                                         F   T                                   sub-expression under its
              F   F                                                                         F   F                                   connective.




                                                                                                                                                                          4
CS103      HO#3                                                                                                                                                     9/21/09
Introduction, policies, propositional logic



                      Evaluating a compound expression                                         Evaluating a compound expression

            The first two                                                                       This will be next.
                                           1. Locate the main connective.                                                        1. Locate the main connective.
            to evaluate.
                                              This will be the last one you                                                         This will be the last one you
                                              evaluate.                                                                             evaluate.
            p   q   (p ∨ q) ∧ ¬(p ∧ q)                                            p   q    (p ∨ q) ∧ ¬(p ∧ q)
            T   T                          2. Work from the "inside out",         T   T                                          2. Work from the "inside out",
            T   F                             placing the value of each           T   F                                             placing the value of each
            F   T                             sub-expression under its            F   T                                             sub-expression under its
            F   F                             connective.                         F   F                                             connective.
                        The values
                        go here.                                                                                                 3. Some of your evaluations
                                                                                                                                    will involve columns on the
                                                                                                                                    right side of the table.




                      Evaluating a compound expression                                         Evaluating a compound expression

                                           1. Locate the main connective.
                                              This will be the last one you                      p q         (p ∨ q) ∧ ¬(p ∧ q) p ⊕ q
                                              evaluate.
            p   q   (p ∨ q) ∧ ¬(p ∧ q)                                                           T   T            T     F    F    T           F
            T   T                          2. Work from the "inside out",                        T   F            T     T    T    F           T
            T   F                             placing the value of each                          F   T            T     T    T    F           T
            F   T                             sub-expression under its                           F   F            F     F    T    F           F
            F   F                             connective.

                                           3. Some of your evaluations                    The joint truth table shows that the two
                                              will involve columns on the
                                                                                          expressions are logically equivalent (i.e.,
                                              right side of the table.
                                                                                          that they have the same truth conditions).
                                           4. You are done when you have
                                              placed values under the main                Rosen shows another way to do this on
                                              connective.                                 page 10.




                     Our notation for logical equivalence
                     is the symbol ≡


                            (p ∨ q) ∧ ¬(p ∧ q) ≡ p ⊕ q

                                                                              p       q    r             p    ∨       ¬ (q   ∨     ¬ (r   ∧       p))
            Note that ≡ is an abbreviation for "is equivalent to".            T       T    T                                              T
                                                                              T       T    F                                              F
            It is NOT a logical operator.
                                                                              T       F    T                                              T
                                                                              T       F    F                                              F
                                                                              F       T    T                                              F
                                                                              F       T    F                                              F
                                                                              F       F    T                                              F
                                                                              F       F    F                                              F




                                                                                                                                                                         5
CS103      HO#3                                                                                                  9/21/09
Introduction, policies, propositional logic




           p   q   r   p   ∨   ¬ (q   ∨   ¬ (r   ∧   p))   p    q   r      p   ∨   ¬ (q    ∨   ¬ (r   ∧   p))
           T   T   T                      F      T         T    T   T                      T   F      T
           T   T   F                      T      F         T    T   F                      T   T      F
           T   F   T                      F      T         T    F   T                      F   F      T
           T   F   F                      T      F         T    F   F                      T   T      F
           F   T   T                      T      F         F    T   T                      T   T      F
           F   T   F                      T      F         F    T   F                      T   T      F
           F   F   T                      T      F         F    F   T                      T   T      F
           F   F   F                      T      F         F    F   F                      T   T      F




           p   q   r   p   ∨   ¬ (q   ∨   ¬ (r   ∧   p))   p    q   r      p   ∨   ¬ (q    ∨   ¬ (r   ∧   p))
           T   T   T           F      T   F      T         T    T   T          T   F       T   F      T
           T   T   F           F      T   T      F         T    T   F          T   F       T   T      F
           T   F   T           T      F   F      T         T    F   T          T   T       F   F      T
           T   F   F           F      T   T      F         T    F   F          T   F       T   T      F
           F   T   T           F      T   T      F         F    T   T          F   F       T   T      F
           F   T   F           F      T   T      F         F    T   F          F   F       T   T      F
           F   F   T           F      T   T      F         F    F   T          F   F       T   T      F
           F   F   F           F      T   T      F         F    F   F          F   F       T   T      F




                                                               How many binary logical operators can there be?


                                                                                   p   q   ?
           p   q   r   p   ∨   ¬ (q   ∨   ¬ (r   ∧   p))
           T   T   T       T   F      T   F      T                                 T   T
           T   T   F       T   F      T   T      F                                 T   F
           T   F   T       T   T      F   F      T                                 F   T
           T   F   F       T   F      T   T      F                                 F   F
           F   T   T       F   F      T   T      F
           F   T   F       F   F      T   T      F
           F   F   T       F   F      T   T      F
           F   F   F       F   F      T   T      F




                                                                                                                      6

						
Related docs