Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional.

Similar presentations


Presentation on theme: "EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional."— Presentation transcript:

1 EE1J2 - Slide 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 EE1J2 - Slide 2 Parse Tree for “the cat devoured the tiny mouse” The cat devoured the tiny mouse DET ADJ NOUN DET NOUN VERB NP NP VP S

3 EE1J2 - Slide 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 EE1J2 - Slide 4 NameSymbolDescription Propositional variables p, q, r, p 0, p 1, p 2,… ‘atomic propositions’, not amenable to further analysis negation  not conjunction  and disjunction  or implication  if…then… Contradiction  Brackets(, ) Symbols of Propositional Logic

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

6 EE1J2 - Slide 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 EE1J2 - Slide 7 Parsing in PL (continued) S = ((p  (q  r))  ((p  (  q))  ((  q)  (  r)))) 1.S    , where:  = (p  (q  r))  = ((p  (  q))  ((  q)  (  r))) 2.Next note that   p   and   q  r 3.Finally,    , where   p   and    q and   ,   q and    r

8 EE1J2 - Slide 8 Parse Tree for S = ((p  (q  r))  ((p  (  q))  ((  q)  (  r)))) q r p p q q r          S (p  (q  r)) (p  (  q))  ((  q)  (  r)) (q  r) (p  (  q)) ((  q)  (  r)) (  q) (  r)

9 EE1J2 - Slide 9 Parse Tree for S = ((p  (q  r))  ((p  (  q))  ((  q)  (  r)))) q r p p q q r         

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

11 EE1J2 - Slide 11 Constuction of Parse Tree 1.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 2.Draw an initial ‘dummy node’

12 EE1J2 - Slide 12 Construction of Parse Tree 2.Suppose we are at a particular node in the tree 1.Move to the right to the next bracket 2.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. 3.If ‘)’, backtrack to the previous node

13 EE1J2 - Slide 13 Construction of a Parse Tree 1 1 2 1 2 3 1 2 3,4 1 2,5 3,4 1 2,5 3,4 6 1 2,5 3,4 6 7 And so on…. See Truss, example 2.1 for the complete construction ( 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

14 EE1J2 - Slide 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 EE1J2 - Slide 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 EE1J2 - Slide 16 Truth Table for  Truth table for  p pp TF FT

17 EE1J2 - Slide 17 Truth Tables for , , and  Truth tables for , , and  pq p  qp  qp  q TTTTT TFFTF FTFTT FFFFT

18 EE1J2 - Slide 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 EE1J2 - Slide 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 EE1J2 - Slide 20 Truth Table for a Complex Formula Truth table for (p  q)  ((p  q)  q) pq pqpqpqpq(p  q)  q(p  q)  ( (p  q)  q) TTTTTT TFTFFF FTTFTT FFFFFT

21 EE1J2 - Slide 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 EE1J2 - Slide 22 Abbreviated truth table (1) Abbreviated truth table for (p  q)  ((p  q)  q) (p  q)  ((p  q)  T T T T T T F T F F F T F T T F F F F F

23 EE1J2 - Slide 23 Abbreviated truth table (2) Abbreviated truth table for (p  q)  ((p  q)  q) (p  q)  ((p  q)  TTT TTT T TTF TFF F FTT FFT T FFF FFF F

24 EE1J2 - Slide 24 Abbreviated truth table (3) Abbreviated truth table for (p  q)  ((p  q)  q) (p  q)  ((p  q)  TTTTTTTTT TTFFTFFFF FTTTFFTTT FFFTFFFFF

25 EE1J2 - Slide 25 Second Example

26 EE1J2 - Slide 26 Some special formulae Tautologies Contradictory formulae Satisfiable formulae Logically equivalent formulae Logical consequence

27 EE1J2 - Slide 27 Tautologies A formula f which 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 EE1J2 - Slide 28 Truth table for tautology (p  q)  ((  p)  (  q)) Truth table for (p  q)  ((  p)  (  q)) (p  q)  ((  p)  (( q)) TTTTTFTFFT TFFTFFTTTF FFTTFTFTFT FFFTFTFTTF

29 EE1J2 - Slide 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 EE1J2 - Slide 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 EE1J2 - Slide 31 Logical Equivalence Two formulae f and g are logically equivalent if they have the same truth table

32 EE1J2 - Slide 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 consequence of , 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 EE1J2 - Slide 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


Download ppt "EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional."

Similar presentations


Ads by Google