Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses.

Similar presentations


Presentation on theme: "CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses."— Presentation transcript:

1 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses

2 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 2 City of Königsberg (Kaliningrad)

3 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 3 Bridges of Königsberg Must the route have a matching exit to each land mass for each entry? For a particular land mass, can the total number of entries and exits be and odd number? Can there be an odd number of bridges to a land mass with an even entry/exit count? So, there must be either no land masses with an odd number of bridges, or exactly two. Right? How many land masses have an odd number of bridges? Problem Find a route that crosses each bridge exactly once TILT Adapted from Singh, Fermat’s Enigma, Walker & Co, 1997

4 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 4 Tracing a Square and Its Diagonals If it’s possible to do such a tracing, how many corners will have an odd number of lines emanating from them? None. Or two, right? Square + Diagonals Problem  Start at any corner  Trace some line to another corner  Then trace from that corner to another  Keep going until all six lines are traced  Don’t trace any line more than once TILT Euler solved the bridges of Königsberg problem in the 1700s. The field of graph theory includes problems of this kind.

5 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 5 Logic a tool for careful reasoning  Software and hardware development Formal logic can lead to defect-free products Used in chip design (since Pentium disaster) Used in safety-critical software Used in network-secure software Positive influence on all software development  Foundation for programming languages Lambda calculus – semantic base for all PLs Type checking and type inference – basis in logic Computation models – limits of computabilty  Artificial intelligence, database systems Grounded in formal logic

6 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 6 all three consistent Propositional Logic Starting Here What does this mean?  Proposition – atomic entity, true or false Capital letters denote propositional variables –Standing for specific propositions –P, Q, … specific propositions - value: true or false Lowercase letters are metavariables –Denoting propositional formulas –a, b, … value: formula, such as P, (P  Q), …  Calculus a method of reasoning by computation of symbols  Propositional Calculus Scheme for calculating with logic formulas  Three different Propositional Calculuses Semantics-based reasoning – truth tables Syntax-based reasoning – inference rules Equational reasoning – Boolean algebra

7 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 7 Logical Operators  Logical And P  Q, (P  Q)  R, …  Logical Or P  Q, P  (Q  R), …  Logical Not  P, ((  P)  Q), …  Logical Implication P  Q, (P  Q)  Q, …  Logical Equivalence P  Q, (P  Q)  (Q  P)  Exclusive Or P  Q, (P  Q)  R, …  Logical operators provide ways to combine propositions for calculation

8 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 8 Truth Table – Logical And  True iff both operands are True  Define P = x  0, Q = x  10  P  Q is True iff x is between 0 and 10 P Q P  Q False False False False True False True False False True True True Pronounced “if and only if”

9 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 9 Truth Table – Logical Or  True iff either operand is True  Define P = x  0, Q = x  10  P  Q is True iff x is outside 0 to 10  This is the “inclusive or”  Usually and/or in English P Q P  Q False False False False True True True False True True True True

10 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 10 Truth Table – Logical Not  True iff operand is False  Define P = x  0, Q = x  10   P is True iff x is non-negative   (P  Q) is True iff x is between 0 and 10 P  P False True True False

11 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 11 Truth Table – Logical Implication  False iff 1 st operand is True and 2 nd False  Define P = x  10, Q = x  0  Consider x = 15, x = 5, and x = -5  P  Q is True, regardless of x’s value That is, third line in table does not occur  Q  P is False when x is between 0 and 10 So, line 3 in table sometimes applies to this formula  This confirms intuition about inference We expect to infer Q, knowing P (P  Q is True) But not vice versa (cannot always infer P, knowing Q) P Q P  Q False False True False True True True False False True True True

12 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 12 Truth Table – Logical Equivalence  True iff both operands have the same value  P  Q has same value as (P  Q)  (Q  P) P Q P  Q False False True False True False True False False True True True

13 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 13 Truth Table – Exclusive Or  True iff operands have different values  Define P = x  0, Q = y  0  P  Q is True iff (x, y) is in 2 nd or 4 th quadrant  P  Q also has same value as  (P  Q) P Q P  Q False False False False True True True False True True True False Quadrant 1 x > 0, y > 0 Quadrant 2 x 0 Quadrant 4 x > 0, y < 0 Quadrant 3 x < 0, y < 0 y x

14 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 14 Well-Formed Formulas — WFFs the syntax of logic formulas Classes of WFFs  True  False  Any propositional variable  (  p) if p is a WFF  (p  q) if p and q are WFFs  (p  q) if p and q are WFFs  (p  q) if p and q are WFFs  (p  q) if p and q are WFFs  (p  q) if p and q are WFFs Examples  True  False  P, Q, …  (  P), (  Q), (  (  P)), …  (P  Q), ((  P)  (P  Q)), …  (P  Q), ((P  Q)  (  Q)), …  (P  Q), ((P  Q)  (P  Q)), …  (P  Q), ((P  Q)  (Q  P)), …  (P  Q), ((  P)  Q), … This syntax defines WFFs In case of missing parens: Precedence:       Association: P  (Q  R) atomic formulas formulas with connectives (not atomic) Inductive definition

15 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 15 Confirming WFFness by Analyzing Constituents WFF? ((P  Q)  ((  P)  Q)) Constituents (must be WFFS) ( P  Q) ((  P)  Q) Constituents (of constituents) P Q (  P) Q Constituents (of constituents of constituents) P Yes, it’s a WFF – constituents match WFF patterns all the way down to atomic formulas

16 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 16 Constituent Analysis Can Confirm non-WFFness, Too WFF? (( P  (  (  Q)))  ((  P)  Q)) ( P  (  (  Q))) ((  P)  Q) Constituents (must be WFFS) Constituents (of constituents) P (  (  Q)) (  P) Q Constituents (of constituents of constituents) (  Q) P Whoops!  Q not a WFF No WFF begins with  TILT

17 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 17 Semantic Reasoning with Truth Tables Proposition (WFF): ((P  Q)  ((  P)  Q)) P Q False False True True False True False True ( P  Q) (  P) True False ((  P)  Q) False True ( ( P  Q)  ((  P)  Q)) False True Some True: prop is Satisfiable If they were all True: Tautology All False: Contradiction (not satisfiable) If prop is True when all variables areTrue: P, Q ( ( P  Q)  ((  P)  Q)) Formal statement about meaning Proved via truth table double turnstile

18 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 18 Another Truth Table Proposition (WFF): (((  P)  Q)  ((  P)  Q)) P Q False False True True False True False True False ((  P)  Q) (  P) True False ((  P)  Q) False True ( ( ((  P)  Q)  ((  P)  Q)) False True False Prop is False when all variables areTrue P, Q ((  P)  Q)  ((  P)  Q))

19 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 19 Why Reasoning with Truth Tables Is Infeasible  Works fine when there are 2 variables  {T,F}  {T,F} = set of potential values of variables  2  2 lines in truth table  Three variables — starts to get tedious  {T,F}  {T,F}  {T,F} = set of potential values  2  2  2 lines in truth table  Twenty variables — definitely out of hand  2  2  …  2 lines (2 20 )  You want to look at a million lines?  If you did, how would you avoid making errors?  Hundreds of variables — not in a million years

20 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 20 End of Lecture


Download ppt "CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses."

Similar presentations


Ads by Google