ee1j2 - slide 1 ee1j2 – discrete maths lecture 3 syntax of propositional logic parse trees revised...
Post on 19-Dec-2015
220 views
TRANSCRIPT
![Page 1: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/1.jpg)
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
![Page 2: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/2.jpg)
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
![Page 3: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/3.jpg)
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
![Page 4: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/4.jpg)
EE1J2 - Slide 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
![Page 5: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/5.jpg)
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, fg, fg, fg are also formulae
3. A sequence of symbols is a formula if and only if it can be derived using 1 and 2
![Page 6: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/6.jpg)
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
![Page 7: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/7.jpg)
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
![Page 8: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/8.jpg)
EE1J2 - Slide 8
Parse Tree forS = ((p (q r)) ((p (q))((q) ( r))))
q r pp
q q r
S
(p (q r)) (p (q))((q) ( r))
(q r) (p (q))((q) ( r))
(q)(q) (r)
![Page 9: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/9.jpg)
EE1J2 - Slide 9
Parse Tree forS = ((p (q r)) ((p (q))((q) ( r))))
q r pp
q q r
![Page 10: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/10.jpg)
EE1J2 - Slide 10
Construction of a Parse Tree
Once brackets have been inserted, parse tree can normally be constructed
Alternatively, apply the following procedure:
![Page 11: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/11.jpg)
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’
![Page 12: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/12.jpg)
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
![Page 13: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/13.jpg)
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
![Page 14: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/14.jpg)
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)))
![Page 15: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/15.jpg)
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
![Page 16: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/16.jpg)
EE1J2 - Slide 16
Truth Table for
Truth table for
p p
T F
F T
![Page 17: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/17.jpg)
EE1J2 - Slide 17
Truth Tables for , , and 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
![Page 18: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/18.jpg)
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
![Page 19: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/19.jpg)
EE1J2 - Slide 19
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
![Page 20: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/20.jpg)
EE1J2 - Slide 20
Truth Table for a Complex Formula
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
![Page 21: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/21.jpg)
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
![Page 22: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/22.jpg)
EE1J2 - Slide 22
Abbreviated truth table (1)
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
![Page 23: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/23.jpg)
EE1J2 - Slide 23
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 F T F F F
F T T F F T T
F F F F F F F
![Page 24: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/24.jpg)
EE1J2 - Slide 24
Abbreviated truth table (3)
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
![Page 25: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/25.jpg)
EE1J2 - Slide 25
Second ExampleAbbreviated 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
![Page 26: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/26.jpg)
EE1J2 - Slide 26
Some special formulae Tautologies Contradictory formulae Satisfiable formulae Logically equivalent formulae Logical consequence
![Page 27: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/27.jpg)
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
![Page 28: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/28.jpg)
EE1J2 - Slide 28
Truth table for tautology (pq)((p)(q))
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
![Page 29: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/29.jpg)
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
![Page 30: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/30.jpg)
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
![Page 31: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/31.jpg)
EE1J2 - Slide 31
Logical Equivalence Two formulae f and g are logically
equivalent if they have the same truth table
![Page 32: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/32.jpg)
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
![Page 33: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 3 Syntax of Propositional Logic Parse trees revised Construction of parse trees Semantics of propositional](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d2a5503460f949fe49b/html5/thumbnails/33.jpg)
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