Presentation is loading. Please wait.

Presentation is loading. Please wait.

Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine.

Similar presentations


Presentation on theme: "Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine."— Presentation transcript:

1 Propositional Logic

2 Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine whether it is correct or not. Logic: To determine whether the reasoning is valid or invalid. 2

3 Foundations of Logic Logic is a tool for working with complicated compound statements. It includes:  A language for expressing them.  A concise notation for writing them.  A methodology for objectively reasoning about their truth or falsity.  It is the foundation for expressing formal proofs in all branches of mathematics. 3

4 Foundations of Logic In logic we are interested in true or false of statements, and how the truth/falsehood of a statement can be determined from other statements. However, instead of dealing with individual specific statements, we are going to use symbols to represent arbitrary statements so that the results can be used in many similar but different cases. The formalization also promotes the clarity of thought and eliminates mistakes.

5 Introduction to Propositional Logic Propositional logic is a logic at the sentential level. The smallest unit we deal with in propositional logic is a sentence. We do not go inside individual sentences and analyze or discuss their meanings. We are going to be interested only in true or false of sentences, and major concern is whether or not the truth or falsehood of a certain sentence follows from those of a set of sentences, and if so, how. Thus sentences considered in this logic are not arbitrary sentences but are the ones that are true or false. This kind of sentences are called propositions.propositions

6 Propositional Logic  Good notation greatly facilitates clear thinking, intuition, and insight. It removes the irrelevant to help us see true relationships that would otherwise be invisible  Good manipulation skills allow us to proceed from one conclusion to the next quickly, confidently, and verifiably. 6

7 A proposition (p, q, r, …) is simply a statement (i.e., a declarative sentence) with a definite meaning, having a truth value that’s either true (T) or false (F) (never both, neither, or somewhere in between).  “It is raining.” (Given a situation.)  “Beijing is the capital of China.”  “1 + 2 = 3”  “Who’s there?”  Jim is a Vegetarian.  It is raining.  Asad likes biscuits.  “Just do it!”  “1 + 2” Propositional Logic These are not Propositions 7

8 Propositional Logic is the logic of compound statements built from simpler statements using Boolean connectives.  Basic Applications:  Design of digital electronic circuits.  Expressing conditions in programs.  Queries to databases & search engines. Propositional Logic 8

9 If a proposition is true, then we say it has a truth value of "true"; if a proposition is false, its truth value is "false".

10 Representation 1World A B ON(A,B) T  ON(A,B) F ON(A,B) F A  ON(A,B) T B Truth depends on Interpretation 10

11 Propositional Logic Also "x is greater than 2", where x is a variable representing a number, is not a proposition, because unless a specific value is given to x we can not say whether it is true or false, nor do we know what x represents.

12 Similarly "x = x" is not a proposition because we don't know what "x" represents hence what "=" means. For example, while we understand what "3 = 3" means, what does "Air is equal to air" or "Water is equal to water" mean ? Does it mean a mass of air is equal to another mass or the concept of air is equal to the concept of air ? We don't quite know what "x = x" mean. Thus we can not say whether it is true or not. Hence it is not a proposition.

13 Elements used for constructing complex propositions Simple sentences which are true or false are basic propositions. Larger and more complex sentences are constructed from basic propositions by combining them with connectives. Thus propositions and connectives are the basic elements of propositional logic. Though there are many connectives, we are going to use the following five basic connectives here: They are also denoted by the symbols: respectively.

14 The Negation Operator The unary negation operator “¬” (NOT) transforms a prop. into its logical negation. If p = “I have brown hair.” then ¬p = “I do not have brown hair.” 14

15 Negation of p Let p be a proposition. The statement “It is not the case that p” is also a proposition, called the “negation of p” or ¬p (read “not p”). p = The sky is blue. p = The sky is not blue. The Truth Table for the Negation of a Proposition p ¬p T F F T 15

16 Negation For any proposition  (¬¬p)  p  (¬¬true)  true  (¬¬false)  false 16

17 Conjunction Operator The binary conjunction operator “” (AND) combines two propositions to form their logical conjunction. If p=“I will have salad for lunch.” q=“I will have steak for dinner.” then pq=“I will have salad for lunch and I will have steak for dinner.” 17

18 Conjunction of p and q Let p and q be propositions. The proposition “p and q,” denoted by pq is true when both p and q are true and is false otherwise This is called the conjunction of p and q. The Truth Table for the Conjunction of two propositions p q p  q T T T T F F F T F F F F 18

19 Truth Table pq ¬q p  (¬q) True False TrueFalseTrue FalseTrueFalse TrueFalse  The truth table for p(¬q) 19

20 The Disjunction Operator The binary disjunction operator “” (OR) combines two propositions to form their logical disjunction. p=“That car has a bad engine.” q=“That car has a bad carburetor.” pq=“Either that car has a bad engine, or that car has a bad carburetor.” 20

21 Disjunction of p and q Let p and q be propositions. The proposition “p or q,” denoted by pq, is the proposition that is false when p and q are both false and true otherwise. The Truth Table for the Disjunction of two propositions p q p  q T T T T F T F T T F F F 21

22 The Exclusive Or Operator The binary exclusive-or operator “” (XOR) combines two propositions to form their logical “exclusive or” p = “I will earn an A in this course,” q = “I will drop this course,” p  q = “I will either earn an A for this course, or I will drop it (but not both!)” 22

23 Exclusive or of p and q Let p and q be propositions. The exclusive or of p and q, denoted by pq, is the proposition that is true when exactly one of p and q is true and is false otherwise. The Truth Table for the Exclusive OR of two propositions p q p  q T T F T F T F T T F F F 23

24 The Implication Operator The implication p  q states that p implies q. It is FALSE only in the case that p is TRUE but q is FALSE. E.g. p=“A ball is shot.” q=“The runs are made.” p  q = “If ball is shot then runs are made” (else it could go either way) 24

25 Implication pq Let p and q be propositions. The implication pq is the proposition that is false when p is true and q is false, and true otherwise. In this implication p is called the hypothesis (or antecedent or premise) and q is called the conclusion(or consequence). The Truth Table for the Implication of pq. p q p  q T T T T F F F T T F F T 25

26 Implications  If p, then q  p implies q  if p,q  p only if q  p is sufficient for q  q if p  q whenever p  q is necessary for p 26

27 Biconditional Equivalence Let p and q be propositions. The bi-conditional pq is the proposition that is true when p and q have the same truth values and is false otherwise. “p if and only if q, p is necessary and sufficient for q”. The Truth Table for the bi- conditional pq. p q p  q T T T T F F F T F F F T 27

28 p: You learn the simple things well. q: The difficult things become easy.  You do not learn the simple things well.  If you learn the simple things well then the difficult things become easy.  If you do not learn the simple things well, then the difficult things will not become easy.  The difficult things become easy but you did not learn the simple things well.  You learn the simple things well but the difficult things did not become easy. Simple Exercise 28

29 Solution: Simple Exercise p: You learn the simple things well. q: The difficult things become easy.  You do not learn the simple things well.  If you learn the simple things well then the difficult things become easy.  If you do not learn the simple things well, then the difficult things will not become easy.  The difficult things become easy but you did not learn the simple things well.  You learn the simple things well but the difficult things did not become easy. pp pqpq  p   q p   q q   p 29

30 Converse and Contrapositive For the proposition P, t the proposition Q  P is called its converse, and the proposition is called its contrapositive.For example for the proposition "If it rains, then I get wet", Converse: If I get wet, then it rains. Contrapositive: If I don't get wet, then it does not rain. The converse of a proposition is not necessarily logically equivalent to it, that is they may or may not take the same truth value at the same time. On the other hand, the contrapositive of a proposition is always logically equivalent to the proposition. That is, they take the same truth value regardless of the values of their constituent variables. Therefore, "If it rains, then I get wet." and "If I don't get wet, then it does not rain." are logically equivalent. If one is true then the other is also true, and vice versa.

31 If-then statements appear in various forms in practice. Thus if one is true then all the others are also true, and if one is false all the others are false. For instance, instead of saying "If she smiles then she is happy", we can say "If she smiles, she is happy", "She is happy whenever she smiles", "She smiles only if she is happy" etc. without changing their truth values. "Only if" can be translated as "then". For example, "She smiles only if she is happy" is equivalent to "If she smiles, then she is happy". Note that "She smiles only if she is happy" means "If she is not happy, she does not smile", which is the contrapositive of "If she smiles, she is happy". You can also look at it this way: "She smiles only if she is happy" means "She smiles only when she is happy". So any time you see her smile you know she is happy. Hence "If she smiles, then she is happy". Thus they are logically equivalent.

32 Reasoning is done on propositions using inference rules. For example, if the two propositions "if it snows, then the school is closed", and "it snows" are true, then we can conclude that "the school is closed" is true. In everyday life, that is how we reason. BUT…..

33 To check the correctness of reasoning, we must check whether or not rules of inference have been followed to draw the conclusion from the premises.

34 One solution for that is to use symbols (and mechanize it). Each sentence is represented by symbols representing building block sentences, and connectives. For example, if P represents "it snows" and Q represents "the school is closed", then the previous argument can be expressed as

35 [ [ P -> Q ] ^ P ] -> Q, or P -> Q P ----------------------------- Q

36 To convert English statements into a symbolic form, we restate the given statements using the building block sentences, those for which symbols are given, and the connectives of propositional logic (not, and, or, if-then, if- and-only-if), and then substitute the symbols for the building blocks and the connectives.

37 Tautologies and Contradictions A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are. Ex. p  p A contradiction is a comp. prop. that is false no matter what! Ex. p  p Other compound propositions are contingencies. 37

38 Solution  (p q)  ( q   p) pq p  q q   p(p q)  ( q   p) True False True FalseTrue False True Every entry in the final column is true so the proposition is a tautology. 38

39 Solution  ( p q) (p   q ) pq  p  q p   q( p q) (p   q ) True False TrueFalseTrue FalseTrue False True There is one false entry and three true entries in the final column so it is a contingency. 39

40 Solution  (p p)  ( p   p) p p p (p p) p   p (p p)  ( p   p) True FalseTrueFalse TrueFalseTrueFalse Every entry in the final column is false so the proposition is a contradiction. 40

41 Prove: pq(pq)  (qp) pqp  q p  q q  p (p  q)  (q  p) TTT T T T TFF F T F FTF T F F FFT T T T We call this bi-conditional equivalence. 41

42 List of Logical Equivalences pT  p; pF  pIdentity Laws pT  T; pF  FDomination Laws pp  p; pp  p Idempotent Laws (p)  pDouble Negation Law pq  qp; pq  qpCommutative Laws (pq) r  p (qr); Associative Laws (pq)  r  p  (qr) 42

43 List of Equivalences p(qr)  (pq)(pr)Distribution Laws p(qr)  (pq)(pr) (pq)(p  q)De Morgan’s Laws (pq)(p  q) p  p  TTautology p  p  FContradiction (pq)  (p  q)Implication Equivalence 43

44 Inverse, Converse, Contrapositive Some terminology:  The inverse of p  q is: ¬ p  ¬q.  The converse of p  q is: q  p.  The contrapositive of p  q is: ¬q  ¬ p.  One of these has the same meaning (same truth table) as p  q. Can you figure out which? 44

45 Precedence of Logical Operators Operator ¬ Precedence 1  2323  4545 45

46 Example

47

48 Thankyou


Download ppt "Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine."

Similar presentations


Ads by Google