Вы находитесь на странице: 1из 15

Expression Trees for Formulas

Group 10
BSIT – SE 3A
Discrete Mathematics
Expression Tree
- visual representation for the way that a
formula is built from proposition and logical
operators

Discrete Mathematics - Expression Trees


for Formulas
Figure 1.1 Representation for p

A proposition is
represented by a
single node.

Discrete Mathematics - Expression Trees


for Formulas
Figure 1.2 Representation for p v q

p vq

p q

Expression involving two


propositions and a logical
operator.

Discrete Mathematics - Expression Trees


for Formulas
How to build an expression tree?
- Place the final expression at the top of the
representation
- Put the expression that are operated on to form
the final expression underneath
- Join by lines the nodes representing the
expression operated on and the node
representing the result of the operation

Discrete Mathematics - Expression Trees


for Formulas
Figure 1.3 Expression Tree of ((p v q) ^ r)

((p v q) ^ r)

(p v q)

p q

Discrete Mathematics - Expression Trees


for Formulas
Figure 1.3 Expression Tree of((¬ p) v q) → (r → p)

((¬p) v q) → (r → p)

((¬p) v q) (r → p)

(¬p)

q r p

p
Discrete Mathematics - Expression Trees
for Formulas
The expression tree for a proportion p, for T or
for F of a single node as shown:

p T F

Discrete Mathematics - Expression Trees


for Formulas
If φ is a formula with expression tree TΦ, then
an expression of T (¬Φ) is

T (¬Φ)

Discrete Mathematics - Expression Trees


for Formulas
If φ and Ψ are formulas with expression
trees Tφ and TΨ, respectively, then an
expression of tree T(φ ^ Ψ) is
T(φ ^ Ψ)

φ Ψ

Discrete Mathematics - Expression Trees


for Formulas
T(φ V Ψ) T(φ → Ψ)

T(φ ↔ Ψ)
φ Ψ φ Ψ
T(φ V Ψ) T(φ → Ψ)

φ Ψ
T(φ ↔ Ψ)
Discrete Mathematics - Expression Trees
for Formulas
Let χ be a formula with expression tree T, and
let Ψ be a formula with expression tree U.
Then χ is a subformula of Ψ if, for some node
χ of U, T χ = U χ.

Discrete Mathematics - Expression Trees


for Formulas
(r ^ (¬(¬(p v q) ) ) )

For the expression (¬(¬(p v q) ) )


tree T, determine
the subformulas r (¬(p v q) )
defines by p and
(¬(p v q)) (p v q)

p q
Discrete Mathematics - Expression Trees
for Formulas
Solution: (¬(p v q) )

(p v q)

p q

The subtrees Tp and T(¬(p v q))

Discrete Mathematics - Expression Trees


for Formulas
Expression Trees for Formulas

END

Discrete Mathematics - Expression Trees


for Formulas

Вам также может понравиться