Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Propositional Logic

Propositional Logic

Ifeanyi Oraelosi

April 19, 2015
Tweet

More Decks by Ifeanyi Oraelosi

Other Decks in Science

Transcript

  1. 1. A robot may not injure a human being or,

    through inaction, allow a human being to come to harm. 2. A robot must obey the orders given it by human beings, except where such orders would conflict with the First Law. 3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. Isaac Asimov The Three Laws of Robotics
  2. What is Discrete Mathematics? The study of mathematical structures that

    are fundamentally discrete. • Typical textbook definition • Not useful - especially to more pragmatic people like software developers.
  3. What is Discrete Mathematics? • A branch of mathematics (obviously!).

    • Objects of study have distinct values e.g integers, booleans as opposed to objects with continuous values like real numbers (floating-point numbers). • Involves the study of algorithms, their implementations and efficiencies.
  4. What is Discrete Mathematics? Branches: • Logic: valid reasoning and

    inference. [software testing and debugging] • Set Theory: collections of objects [relational databases] • Number Theory: properties of numbers [cryptography] • Graph Theory: graphs and networks [social networks]
  5. “For the things we have to learn before we can

    do them, we learn by doing them.” Aristotle
  6. Big Teaser. A cockroach in the specs. After a grueling

    four hours of writing tests for PunchStopper, a new crowdsourcing application, Mirabel decides to implement the features. Fortunately, the first test passes but the application vomits errors in the bash terminal. Mirabel does some investigating and arrives at the following premises: - If the code on line 115 is wrong then the code on line 245 is wrong too. - The code on line 67 is wrong or the code on line 245 is correct but the first test will fail if the code on line 67 is wrong. - The first test passed. By applying the rules of inference,can you arrive at a conclusion?
  7. Teaser for the day. Knights and Knaves #1 A very

    special island is inhabited only by knights and knaves. Knights always tell the truth, and knaves always lie. You meet two inhabitants: Tunde and Eniola. Tunde tells you that Eniola is a knave. Eniola says, `Neither Tunde nor I are knaves.' Can you determine who is a knight and who is a knave?
  8. What is a proposition? A proposition is a declarative sentence

    (a sentence that declares a fact) that is either true or false, but not both.
  9. What is a proposition? Examples: - npm is better than

    gem - Is this class boring? - x + 5 = 4 - Programmers are lazy and arrogant. - She likes rational arguments.
  10. Propositional variables, constants and connectives. Propositional variable A variable, often

    an alphabetical symbol, that represents a proposition. Examples: - n could represent the proposition “npm is better than gem” - p could represent the proposition “Programmers are lazy and arrogant.”
  11. Propositional variables, constants and connectives. Propositional constant The truth value

    of a proposition; either of the booleans “true” (T) or “false” (F). Example: - The truth value of the variable n which represents the proposition “npm is better than gem” is true. The can be rephrased as n is true.
  12. Propositional variables, constants and connectives. Propositional connective A symbol that

    connects two or more propositions in a grammatically valid way to create a compound proposition. Also known as logical operators. Examples: - n ∧ p is the compound proposition “npm is better than gem and programmers are lazy and arrogant”. - n ∨ p is the compound proposition “npm is better than gem or programmers are lazy and arrogant or
  13. Truth tables. The formal specification for a propositional connective. A

    truth table lists all possible combinations of the values of the variables and gives the corresponding values of the compound proposition.
  14. Truth tables. Format: variable a variable b connective + variables

    truth value for a truth value for b truth value for connective truth value for a truth values for b truth value for connective ... ... ...
  15. “But I don't want to go among mad people,' said

    Alice. 'Oh, you can't help that,' said the cat. 'We're all mad here.” Lewis Caroll