330 likes | 568 Views
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.
E N D
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
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”
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
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
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, fg, fg, fg are also formulae • A sequence of symbols is a formula if and only if it can be derived using 1 and 2
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
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
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
q qr qr p p Parse Tree forS = ((p (q r)) ((p (q))((q) (r))))
Construction of a Parse Tree • Once brackets have been inserted, parse tree can normally be constructed • Alternatively, apply the following procedure:
Constuction of Parse Tree • Number the brackets (1 (2 p (3 q r)4 )5 (6 (7 p (8q)9 )10 (11 (12q)13 (14 r)15 )16 )17)18 • Draw an initial ‘dummy node’
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
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 (8q)9 )10 (11 (12q)13 (14 r)15 )16 )17)18 And so on…. See Truss, example 2.1 for the complete construction
Example (from last lecture) (a c p m) ((m a) p) ((l p) (a m)) First add brackets to remove ambiguity: (((al) p) m) (((m a) p) ((l p) (a m)))
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
Truth table for p p T F F T Truth Table for
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
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
Truth Table for a Complex Formula • Consider the formula (pq)((pq)q) • Extract all of the possible sub-formulae pq pq (pq)q (pq)( (pq)q) • Construct a truth table, with columns for p and q, and each of the complex ‘sub’-formulae listed above
Truth table for (pq)((pq)q) p q pq pq (pq)q (pq)( (pq)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
‘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
Abbreviated truth table for (pq)((pq)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)
Abbreviated truth table for (pq)((pq)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)
Abbreviated truth table for (pq)((pq)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)
Abbreviated truth table for ((p(qr))((p)(rq)) ((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
Some special formulae • Tautologies • Contradictory formulae • Satisfiable formulae • Logically equivalent formulae • Logical consequence
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
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 (pq)((p)(q))
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
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
Logical Equivalence • Two formulae f and g are logically equivalent if they have the same truth table
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
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