1 / 33

EE1J2 – Discrete Maths Lecture 3

EE1J2 – Discrete Maths Lecture 3. Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional logic – truth tables Truth tables for complex formulae Tautologies, contradictory and satisfiable formulae, logical equivalence, logical consequence.

Télécharger la présentation

EE1J2 – Discrete Maths Lecture 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EE1J2 – Discrete Maths Lecture 3 • Syntax of Propositional Logic • Parse trees revised • Construction of parse trees • Semantics of propositional logic – truth tables • Truth tables for complex formulae • Tautologies, contradictory and satisfiable formulae, logical equivalence, logical consequence

  2. The cat devoured the tiny mouse DET ADJ NOUN DET NOUN VERB NP NP VP S Parse Tree for “the cat devoured the tiny mouse”

  3. Syntax of Propositional Logic • The formal language of propositional logic is much much simpler than NL • The valid sentences of propositional logic are called formulae (or, well-formed formulae • First stage is to define the basic symbols of the language

  4. Name Symbol Description Propositional variables p, q, r, p0, p1, p2,… ‘atomic propositions’, not amenable to further analysis negation  not conjunction  and disjunction  or implication  if…then… Contradiction  Brackets (, ) Symbols of Propositional Logic

  5. Formal Language Definition of Propositional Logic • Each propositional variable is a formula, and contradiction  is a formula • If f and g are formulae then (f), f, fg, fg, fg are also formulae • A sequence of symbols is a formula if and only if it can be derived using 1 and 2

  6. Parsing in Propositional Logic • Consider S = ((p  (q  r))  ((p  (q))((q)  ( r)))) • To tell whether or not this is a well-formed formula in Propositional Logic we need to find a parse • First note that S can be written as S 

  7. Parsing in PL (continued) S = ((p  (q  r))  ((p  (q))((q)  ( r)))) • S  , where:  = (p  (q  r))  = ((p  (q))((q)  ( r))) • Next note that p and  q  r • Finally, , where p and q and, q and r

  8. q q r q r p    p       Parse Tree forS = ((p  (q  r))  ((p  (q))((q)  ( r)))) (q) (r) (q) ((q)  ( r)) (p  (q)) (q  r) (p  (q  r)) (p  (q))((q)  ( r)) S

  9. q qr qr p    p       Parse Tree forS = ((p (q  r))  ((p (q))((q)  (r))))

  10. Construction of a Parse Tree • Once brackets have been inserted, parse tree can normally be constructed • Alternatively, apply the following procedure:

  11. Constuction of Parse Tree • Number the brackets (1 (2 p  (3 q  r)4 )5 (6 (7 p  (8q)9 )10 (11 (12q)13 (14 r)15 )16 )17)18 • Draw an initial ‘dummy node’

  12. Construction of Parse Tree • Suppose we are at a particular node in the tree • Move to the right to the next bracket • If ‘(‘ , form a new downward edge to the right of any existing children. Go to the new node at the end of the new edge. • If ‘)’, backtrack to the previous node

  13. 1 1 1 1 1 1 1 2 2 2 2,5 6 2,5 2,5 6 3 3,4 3,4 3,4 7 3,4 Construction of a Parse Tree (1 (2 p  (3 q  r)4 )5 (6 (7 p  (8q)9 )10 (11 (12q)13 (14 r)15 )16 )17)18 And so on…. See Truss, example 2.1 for the complete construction

  14. Example (from last lecture) (a  c  p  m)  ((m  a)  p)  ((l  p) (a  m)) First add brackets to remove ambiguity: (((al) p) m)  (((m  a)  p)  ((l  p) (a  m)))

  15. Semantics of Propositional Logic • The truth (T) or falsehood (F) of a formula in propositional logic can be determined once the truth values of the atomic formulae are known • A truth table shows the truth values of a complex formula given all possible combinations of truth values of its atomic formulae

  16. Truth table for  p p T F F T Truth Table for 

  17. Truth tables for , , and  p q p q p  q p  q T T T T T T F F T F F T F T T F F F F T Truth Tables for , , and 

  18. Truth Table for ‘’ • The truth table for the ‘’ symbol needs some thought [Truss, p 54]. • If q is true and p is true, then the assertion p q is intuitively true • If q is false and p is true, then the assertion p q is intuitively false • For the two cases where p is false, the argument is that the implication “if p then q” is true by default, since if p is false then no further action is required

  19. Truth Table for a Complex Formula • Consider the formula (pq)((pq)q) • Extract all of the possible sub-formulae pq pq (pq)q (pq)( (pq)q) • Construct a truth table, with columns for p and q, and each of the complex ‘sub’-formulae listed above

  20. Truth table for (pq)((pq)q) p q pq pq (pq)q (pq)( (pq)q) T T T T T T T F T F F F F T T F T T F F F F F T Truth Table for a Complex Formula

  21. ‘Abbreviated’ truth tables • As number of atomic propositions increases, number of rows in table increases • As complexity of formula increases, number of columns in the truth table increases • Tables become cumbersome • Solution to second problem is ‘abbreviated’ truth tables • Display truth value for a sub-formula under the last connective used in its formation

  22. Abbreviated truth table for (pq)((pq)q) (p  q)  ((p  q)  q) T T T T T T F T F F F T F T T F F F F F Abbreviated truth table (1)

  23. Abbreviated truth table for (pq)((pq)q) (p  q)  ((p  q)  q) T T T T T T T T T F T F F F F T T F F T T F F F F F F F Abbreviated truth table (2)

  24. Abbreviated truth table for (pq)((pq)q) (p  q)  ((p  q)  q) T T T T T T T T T T T F F T F F F F F T T T F F T T T F F F T F F F F F Abbreviated truth table (3)

  25. Abbreviated truth table for ((p(qr))((p)(rq)) ((p  (q  r))  (( p)  (r  q)) T T T T T T F T F T T T T F T F F F F T F F T T T T F T T T F T F T F F T T F T F T F T F F T F F F T T T T T F T T T T F F T F F T T F T F T T F F F T T F T F F T F F F F F T F T T F T F T F Second Example

  26. Some special formulae • Tautologies • Contradictory formulae • Satisfiable formulae • Logically equivalent formulae • Logical consequence

  27. Tautologies • A formula fwhich is true for all possible truth values of its atomic propositions is called a tautology, (or said to be valid) • If f is a tautology, write ⊨f • Example: the formula (p  q)  ((p)  (q)) is a tautology

  28. Truth table for (p  q)((p)  (q)) (p  q)  ((  p)  ( q)) T T T T T F T F F T T F F T F F T T T F F F T T F T F T F T F F F T F T F T T F Truth table for tautology (pq)((p)(q))

  29. Contradictory and Satisfiable Formulae • Let f be a formula, then • f is contradictory if it is false for all assignments of truth values to its atomic propositions • f is satisfiable if it is true for at least one assignment of truth values to its atomic propositions

  30. Consequences… • It follows that: • f is contradictory if and only if f is a tautology, • f is satisfiable if and only if it is not contradictory

  31. Logical Equivalence • Two formulae f and g are logically equivalent if they have the same truth table

  32. Logical Consequence • Let  be a set of formulae and f a formula • f is a logical consequence of  if for any assignment of truth values to atomic propositions for which all of the members of  true, f is also true • If f is a logical consequenceof , write ⊨f • Note: this is consistent with ⊨f when f is a tautology • This is important! It is the basis of formalisation of arguments

  33. Summary of Lecture 3 • Parse trees revised • Construction of parse trees • Semantics of propositional logic – truth tables • Truth tables for complex formulae, abbreviated truth tables • Tautologies, contradictory and satisfiable formulae, logical equivalence, logical consequence

More Related