Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Maths 2. Propositional Logic Objective

Similar presentations


Presentation on theme: "Discrete Maths 2. Propositional Logic Objective"— Presentation transcript:

1 Discrete Maths 2. Propositional Logic Objective
, Semester 2, 2. Propositional Logic Objective to re-introduce propositional logic

2 1. Propositions A proposition is a sentence that is either true or false. Examples The Moon is made of green cheese. Bangkok is the capital of Thailand. 1 + 0 = 1 0 + 0 = 2 Examples that are not propositions: Sit down! What time is it? x + 1 = 2 x + y = z

3 Propositional variables: p, q, r, s, …
A proposition that is always true = T A proposition that is always false = F Logical connectives (operators): Negation ¬ Conjunction ∧ Disjunction ∨ Implication → Biconditional ↔ Compound Propositions are built from logical operators and smaller propositions: p ∧ q (p ∨ q) → s

4 2. Negation (not, ¬) The negation of p is ¬p and has the truth table: Example: If p is “The earth is round”, then ¬p is “The earth is not round” p ¬p T F

5 Venn Diagram for ¬ Draw p as a set inside the universal domain U.
So ¬p is true in the gray area: U P

6 3. Conjunction (and, ∧) The conjunction of p and q is p ∧ q
Example: If p is “I am at home” and q is “It is raining” then p ∧q is “I am at home and it is raining” p q p ∧ q T F

7 Venn Diagram for ∧ Represent p and q as sets. p ∧ q is true in the gray area:

8 4. Disjunction (or, ∨) The disjunction of p and q is p ∨q
Example: If p is “I am at home” and q is “It is raining” then p ∨q is “I am at home or it is raining” p q p ∨q T F

9 Venn Diagram for ∨ Represent p and q as sets. p ∨ q is true in the gray area: Note, that ∨ has a bigger true area than ∧

10 5. Implication (if-then, →)
p →q is an implication which can be read as “if p then q ” Example: If p is “I am at home” and q is “It is raining” then p →q is “If I am at home then it is raining” p q p →q T F

11 Logical Jargon for p →q p can be called the hypothesis (or antecedent or premise) q can be called the conclusion (or consequent)

12 Many Ways of Saying p →q if p then q p implies q p only if q q unless ¬p q when p q if p q whenever p p is sufficient for q q follows from p q is necessary for p Very confusing, and if-then is extra confusing because it is NOT the same as a programming if-then or English if-then

13 → Confusion when p = F The following implications are true (i.e p → q is T) but make no sense as English “If the moon is made of green cheese then I have more money than Bill Gates. ” “If = 3 then my grandmother is old” p = F q = F p = F q = T

14 Two Ways to Avoid Confusion
Do not think of p → q as if-then. Instead: 1. Translate → into simpler logical connectives (usually ¬ and ∨). or 2. Draw a venn diagram

15 p → q is the same as ¬p ∨ q There are many other ways of rewriting →, but memorize this one.

16 Venn Diagram of p → q as ¬p ∨ q
The easiest way of drawing a Venn diagram for → is to use ¬p ∨ q. It is true in the gray area: 1 2 is like 3 4

17 Example p = "it is raining"; q = " I have an umbrella"
Being able to draw a dot means p  q is true for this case. p = "it is raining"; q = " I have an umbrella" There are four cases to draw: It is raining and I have an umbrella It is raining and I do not have an umbrella It is not raining and I have an umbrella It not is raining and I do not have an umbrella No example, so p  q is false for this case

18 6. Converse, Inverse, Contrapositive
More uses of , with special names: q →p is the converse of p →q ¬ p → ¬ q is the inverse of p →q ¬q → ¬ p is the contrapositive of p →q useful later

19 Examples “If it is sunny then I go shopping” (p  q)
Converse: If I go shopping then it is sunny Contrapositive: If I do not go shopping, then it is not sunny Inverse: If it is not sunny, then I do not go shopping.

20 7. Biconditional (iff, ↔) The biconditional p ↔q is read as “p if and only if q ” or "p iff q" True when p and q have the same value. If p is “I am at home.” and q is “It is raining.” then p ↔q is “I am at home if and only if it is raining.” p q p ↔q T F

21 Also known as Equivalence ()
p  q is true when p and q have the same value. Also called logical equality.  is used when defining equivalences between propositional statements (see section 10 and later).

22 8. Tautologies, Contradictions
A tautology is a proposition which is always true. Example: p ∨¬p A contradiction is a proposition which is always false. Example: p ∧¬p p ¬p p ∨¬p p ∧¬p T F

23 9. Bigger Truth Tables A truth table for p q r r p  q p  q → r T F

24 Truth Tables do not Scale Up
How many rows are there in a truth table with n propositional variables? 2n (true and false cases for each variable) Truth tables cannot easily be written for more complex propositions.

25 10. Proving Equivalences We can prove equivalences using truth tables.
Example: is ¬(p ∧ q)  ¬p ∨ ¬q ? lhs  rhs T T T T yes, the same

26 Example: is ¬(p ∧ q)  ¬p ∧ ¬q ?
lhs  rhs T F F T no, not the same

27 De Morgan’s Laws Augustus De Morgan This truth table shows that De Morgan’s Second Law holds. p q ¬p ¬q (p∨q) ¬(p∨q) ¬p∧¬q T F the same

28 Implication and contrapositive are equivalent.
Also, converse and inverse are equivalent the same the same

29 Equivalence is Very Useful
If we have: complicated proposition  simple proposition Then we can replace the complex one with the simple one. Equivalence is also useful for replacing logical operators. See the circuit examples in the next section.

30 Proving Equivalences with Truth Tables
We can prove equivalences using truth tables but tables become very big for complex propositions. We need a different technique for proving the equivalence of larger propositions. rewrites; see section 13

31 11. Logic Circuits Electronic circuits; each input/output signal can be viewed as a 0 or 1. 0 represents False 1 represents True Complicated circuits are constructed from three basic circuits called gates. The inverter (NOT gate) takes an input bit and produces the negation of that bit. The OR gate takes two input bits and produces the value equivalent to the disjunction of the two bits. The AND gate takes two input bits and produces the value equivalent to the conjunction of the two bits. continued

32 More complicated digital circuits can be constructed by combining these basic circuits . For example:

33 Simplifying Circuits 
Simplify circuits (i.e. use less gates), by using equivalences. p p q and not q or not ¬(p ∧ q)  ¬p ∨ ¬q Two gates compared to three gates; different gates; less wiring

34 p p q or and p ∨ (p ∧ q)  p Zero gates compared to two gates; less wiring

35 12 continued

36 More Logical Equivalences

37 13. Equivalence Proofs Using Rewrites
To prove that , we produce a series of equivalences beginning with A and ending with B. Each line rewrites the left-hand side (lhs) to the right-hand side (rhs) by using the logic equivalences from section 12. A1  A2

38 Example: Is Solution: ? Yes

39 Example: Is In English, is the proposition a tautology. Solution:
? Yes

40 14. More Information Discrete Mathematics and its Applications Kenneth H. Rosen McGraw Hill, 2007, 7th edition chapter 1, sections 1.1 – 1.3


Download ppt "Discrete Maths 2. Propositional Logic Objective"

Similar presentations


Ads by Google