Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program.

Similar presentations


Presentation on theme: "Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program."— Presentation transcript:

1 Logical Form and Logical Equivalence M260 2.1

2 Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program will generate an error message. Therefore if the computer does not generate an error message then the syntax is correct and the execution does not result in division by zero.

3 Logical Form Example 2 If x is a Real number such that x 2, then x 2 >4. Therefore if x 2  4, then x  -2 and x  2.

4 Logical Form Example 1 If (the syntax is faulty) or (execution results in division by zero), then (the program will generate an error message). Therefore if (the computer does not generate an error message) then (the syntax is correct) and (the execution does not result in division by zero).

5 Logical Form Example 1 If (p) or (q), then (r). Therefore if (not r) then (not p) and (not q).

6 Logical Form Example 2 If (x 2), then (x 2 >4). Therefore if (x 2  4), then (x  -2) and (x  2).

7 Logical Form Example 2 If (p) or (q), then (r). Therefore if (not r), then (not p) and (not q).

8 Logical Form vs Content Examples 1 and 2 have the same form: If p or q, then r. therefore if not r, then not p and not q. These examples have different values for the propositional variables p and q.

9 Formal Logic Goals Avoid Ambiguity Obtain Consistency Elucidate Proof Mechanisms

10 Mathematical Vocabulary New terms are defined using previously defined terms. Initial terms remain undefined. Undefined terms in logic: sentence, true, false.

11 Logic Symbols ~   ~ denotes “not” Negation of p is ~p.

12 Logic Symbols ~    denotes “and” Conjunction of p and q is p  q.  denotes “or” Disjunction of p and q is p  q. Precedence: first ~ then  and  (unordered)

13 Truth Values True False

14 Precedence Examples ~p  q ~p  ~q ~ (p  q)

15 Let p, q and r be 0<x, x<3, and x=3 Rewrite x  3 q  r Rewrite 0<x<3 p  q Rewrite 0<x  3 p  (q  r)

16 Negation Truth Table p~p TF FT

17 Conjunction Truth Table pq pqpq TTT TFF FTF FFF

18 Disjunction Truth Table pq p  q TTT TFT FTT FFF

19 Statement Form Statement variables Logical connectives Truth table

20 Exclusive Or p or q but not both (p  q)  ~(p  q) Do a truth table

21 Exclusive Or Truth Table pq p  qp  q~(p  q) (p  q)  ~(p  q)

22 Exclusive Or Truth Table pq p  qp  q~(p  q) (p  q)  ~(p  q) TT TF FT FF

23 Exclusive Or Truth Table pq p  qp  q~(p  q) (p  q)  ~(p  q) TTTTF TFTFT FTTFT FFFFT

24 Exclusive Or Truth Table pq p  qp  q~(p  q) (p  q)  ~(p  q) TTTTFF TFTFTT FTTFTT FFFFTF

25 Logical Equivalence Statement Forms are logically equivalent if, and only if, they have the same truth tables. P  Q

26 Logical Equivalence Examples 6>22<6 p  q q  p p~(~p)

27 De Morgan’s Laws ~(p  q)  ~p  ~ q ~(p  q)  ~p  ~ q Do truth tables

28 ~(p  q)  ~p  ~ q pq~p~q p  q~(p  q)~p  ~q

29 ~(p  q)  ~p  ~ q pq~p~q p  q~(p  q)~p  ~q TT TF FT FF

30 ~(p  q)  ~p  ~ q pq~p~q p  q~(p  q)~p  ~q TTFFTFF TFFTTFF FTTFTFF FFTTFTT

31 Practice Negations John is six feet tall and weighs at least 200 pounds. John is not six feet tall or he weighs less than 200 pounds.

32 Practice Negations The bus was late or Tom’s watch was slow. The bus was not late and Tom’s watch was not slow.

33 Jim is tall and thin. Logical And and Or are only allowed between statements.

34 Tautologies and Contradictions A tautology is a statement form that is always true regardless of the values of the statement variables. A contradiction is a statement form that is always false regardless of the values of the statement variables

35 Logically Equivalent Forms Commutative laws Associative laws Distributive laws Identity laws Negation laws Double negative law Idempotent laws De Morgan’s laws Universal bound laws Absorption laws Negations of tautologies and contradictions

36 Logical Equivalences p  q  _________p  q  ________ (p  q)  r  _______(p  q)  r  _______ p  (q  r)  ______p  (q  r)  _______ p  t  __________p  c  __________ p  ~p  _________p  ~p  _________ ~(~p)  ________ p  p  __________p  p  __________ ~(p  q )  _______~(p  q )  _______ p  t  __________p  c  __________ p  (p  q)  ______p  (p  q)  ______ ~t  ___________~c  ___________

37 Logical Equivalences p  q  q  p p  q  q  p (p  q)  r  p  (q  r) (p  q)  r  p  (q  r) p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) p  t  pp  c  p p  ~p  tp  ~p  c ~(~p)  p p  p  pp  p  p ~(p  q )  ~p  ~q ~(p  q )  ~p  ~q p  t  tp  c  c p  (p  q)  pp  (p  q)  p ~t  c~c  t


Download ppt "Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program."

Similar presentations


Ads by Google