1 / 30

Lecture 8 Introduction to Logic

Lecture 8 Introduction to Logic. CSCI – 1900 Mathematics for Computer Science Spring 2014 Bill Pine. Lecture Introduction. Reading Kolman - Section 2.1 Logical Statements Logical Connectives / Compound Statements Negation Conjunction Disjunction Truth Tables Quantifiers

gasha
Télécharger la présentation

Lecture 8 Introduction to Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 8Introduction to Logic CSCI – 1900 Mathematics for Computer Science Spring 2014 Bill Pine

  2. Lecture Introduction • Reading • Kolman - Section 2.1 • Logical Statements • Logical Connectives / Compound Statements • Negation • Conjunction • Disjunction • Truth Tables • Quantifiers • Universal • Existential CSCI 1900

  3. Statement of Proposition • Proposition (statement of proposition) – a declarative sentence that is either true or false, but not both • Examples: • Star Trek was a TV series: True • 2+3 = 5: True • Do you speak Klingon? This is a question, not a statement CSCI 1900

  4. Statement of Proposition (cont) • x - 3 = 5: a declarative sentence, but not a statement since it is true or false depending on the value of x • Take two aspirins: a command, not a statement • The current temperature on the surface of the planet Venus is 800oF: a proposition of whose truth is unknown to us • The sun will come out tomorrow: a proposition that is either true or false, but not both, although we will have to wait until tomorrow to determine the answer CSCI 1900

  5. Notation • x, y, z, … denote variables that can represent real numbers • p, q, r,… denote propositional variables that can be replaced by statements • p: The sun is shining today • q: It is cold CSCI 1900

  6. Negation (Not) • If p is a statement, the negation of p is the statement not p • Denoted ~p ( alternately: !p or p or p ) • If p is True, • ~p is False • If p is False, • ~p is True • not is a unary operator for the collection of statements and ~p is a statement if p is a statement CSCI 1900

  7. Negation Truth Table CSCI 1900

  8. Examples of Negation • If p: 2+3 > 1 Then ~p: 2+3 < 1 • If q: It is night Then • ~q: It is not the case that it is night, • It is not night • It is day CSCI 1900

  9. Conjunction • If p and q are statements • The conjunction of p and q is the compound statement “p and q” • Denoted p  q • p  q is true only if both p and q are true • Example: • p: ETSU parking permits are readily available • q: ETSU has plenty of parking • p  q = ? CSCI 1900

  10. Conjunction Truth Table CSCI 1900

  11. English Conjunctives • The following are common conjunctives in English: And, Now, But, Still, So, Only, Therefore, Moreover, Besides, Consequently, Nevertheless, For, However, Hence, Both... And, Not only... but also, While, Then, So then CSCI 1900

  12. Disjunction (Inclusive) • If p and q are statements, • The (inclusive) disjunction of p and q is the compound statement “p or q” • Denoted p  q • p  q is true if either p is true or q is true or both are true • Example: • p: I am a male q: I am under 90 years old • p  q = ? • p: I am a male q: I am under 20 years old • p  q = ? CSCI 1900

  13. Disjunction (Inclusive) Truth Table CSCI 1900

  14. Exclusive Disjunction • If p and q are statements • The exclusive disjunction true if either p is true or q is true, but not both are true • Denoted p  q • Example: • p: It is daytime • q: It is night time • p  q (in the exclusive sense) = ? CSCI 1900

  15. Disjunction(Exclusive) Truth Table CSCI 1900

  16. Exclusive versus Inclusive • Depending on the circumstances, some English disjunctions are inclusive and some of exclusive. • Examples of Inclusive • “I have a dog” or “I have a cat” • “It is warm outside” or “It is raining” • Examples of Exclusive • Today is either Tuesday or it is Thursday • The light is either on or off CSCI 1900

  17. Compound Statements • A compound statement is a statement made by joining simple propositions with logical connectors • For n individual propositions, there are 2n possible combinations of truth values • The truth table contains 2n rows identifying the truth values for the statement represented by the table • Use parenthesis to denote order of precedence •  has precedence over  • Use parenthesis to ensure meaning is clear CSCI 1900

  18. Truth Tables as Tools • Compound statements can be easily and systematically investigated with truth tables • Assign a portion of the compound statement to a column • Final column represents the complete compound statement CSCI 1900

  19. Compound Statement Example (pq) (~p) CSCI 1900

  20. Quantifiers • Recall from Section 1.1, a set may be defined by its properties {x | P(x)} • For a specific element e to be a member of the set, P(e) must evaluate to “true” • P(x) is called a predicate or a propositional function CSCI 1900

  21. Computer Science Functions • if P(x) then execute certain steps • while Q(x) do specified actions CSCI 1900

  22. Universal Quantification • Universal quantification of the predicate P(x) means “For all values of x, P(x) is true” • Denoted x P(x) • The symbol  is called the universal quantifier • The order in which multiple universal quantifications are applied does not matter (e.g., xy P(x,y) ≡ yx P(x,y) ) CSCI 1900

  23. Universal Examples: • P(x): -(-x) = x • This predicate makes sense for all real numbers x R • The universal quantification of P(x), x P(x), is a true statement, because for all real numbers, -(-x) = x • Q(x): x+1<4 • x Q(x) is a false statement, because, for example, Q(5) is not true CSCI 1900

  24. Existential Quantification • Existential quantification of a predicate P(x) is the statement: “There exists a value of x for which P(x) is true.” • Denoted x P(x) • Existential quantification may be applied to several variables in a predicate • The order in which multiple existential quantifications are considered does not matter CSCI 1900

  25. Existential Examples: • P(x): -(-x) = x • The existential quantification of P(x), x P(x), is a true statement, because there is at least one real number where -(-x) = x • Q(x): x+1<4 •  x Q(x) is a true statement, because, for example, Q(2) is true • Nota Bene:  is not the complement of  • An Example • N(x): x≠x • x N(x) is false and x N(x) is also false CSCI 1900

  26. Applying Both  and  Quantifications • Order of application matters • Example:Let A and B be n x n matrices • The statement A ( B | A + B = In ) • Reads: for every A there is a B such that A + B = In • Prove by coming up for equations for bii and bij (ji) • Now reverse the order: B (A |A + B = In) • Reads: there exists a B, for all A, such that ,A + B = In • The second proposition is F A L S E ! CSCI 1900

  27. Assigning Quantification - 1 • Let p: x R(x) [R(x): a person is good] • If p is true then  x ~R(x) is false • If every person is good, then there does not exist person who is not good • If p is true then  x R(x) is true • If every person is good, then there exists a person who is good • If p is false then  x ~R(x) is true • If not every person is good, then there exists a person who is not good CSCI 1900

  28. Assigning Quantification - 2 • Let p: x R(x) [R(x): a person is good] • If p is true then x ~R(x) is false • If there exists a person who is good, then it is not true that all people are not good • If p is false then x ~R(x) is true • If there does not exist a good person then every person is not good CSCI 1900

  29. Implications of the Previous Slide • Assume a statement is made that “for all x, P(x) is true” • If we can find one case that is not true • The statement is false • If there isn’t one case that is not true • The statement is true • Example:  positive integers, n, n P(n) = n2- n+ 41 is a prime number • This is false because  an integer resulting in a non-prime value, i.e.,  n such that P(n) is false CSCI 1900

  30. Key Concepts Summary • Statement of Proposition • Logical Connectives / Compound Statements • Negation • Conjunction • Disjunction • Truth Tables • Quantifiers • Universal • Existential CSCI 1900

More Related