You are on page 1of 11

CS 511, Fall 2019, Handout 02

Syntax of Propositional Logic

Assaf Kfoury

September 03, 2019

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 1 of 11


Syntax of the wff’s of Propositional Logic

I Reading: [LCS, Section 1.3]

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 2 of 11


Syntax of the wff’s of Propositional Logic

I Reading: [LCS, Section 1.3]


I The wff’s of propositional logic are obtained by applying the construction
rules below, and only these, finitely many times.
One basis step:
0. every propositional atom (i.e., propositional variable) p is a WFF

Four induction steps:


1. if ϕ is a wff, then so is (¬ϕ)

2. if ϕ and ψ are wff’s, then so is (ϕ ∧ ψ)

3. if ϕ and ψ are wff’s, then so is (ϕ ∨ ψ)

4. if ϕ and ψ are wff’s, then so is (ϕ → ψ)

Remember this inductive definition: We use it later in syntax-directed proofs.

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 3 of 11


Syntax of the wff’s of Propositional Logic

I More succintly, in BNF (Backus Naur Form):

ϕ ::= p | (¬ϕ) | (ϕ ∧ ϕ) | (ϕ ∨ ϕ) | (ϕ → ϕ)

This is the same as in [LCS, page 33].

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 4 of 11


Syntax of the wff’s of Propositional Logic

I More succintly, in BNF (Backus Naur Form):

ϕ ::= p | (¬ϕ) | (ϕ ∧ ϕ) | (ϕ ∨ ϕ) | (ϕ → ϕ)

This is the same as in [LCS, page 33].

I Or, in Extended BNF – some occurrences of ‘ϕ’ are replaced by ‘ψ ’:

ϕ ::= p | (¬ϕ) | (ϕ ∧ ψ) | (ϕ ∨ ψ) | (ϕ → ψ)

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 5 of 11


Syntax of the wff’s of Propositional Logic

I More succintly, in BNF (Backus Naur Form):

ϕ ::= p | (¬ϕ) | (ϕ ∧ ϕ) | (ϕ ∨ ϕ) | (ϕ → ϕ)

This is the same as in [LCS, page 33].

I Or, in Extended BNF – some occurrences of ‘ϕ’ are replaced by ‘ψ ’:

ϕ ::= p | (¬ϕ) | (ϕ ∧ ψ) | (ϕ ∨ ψ) | (ϕ → ψ)

I Or, more abstractly by omitting parentheses, in Extended BNF:

ϕ ::= p | ¬ϕ | ϕ ∧ ψ | ϕ ∨ ψ | ϕ → ψ

Parentheses are used only to set an order of precedence among logical


connectives {¬, ∧, ∨, →}.

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 6 of 11


Parse Trees of wff’s

I A fully-parenthesized wff:
 
¬((¬P) ∨ (Q ∧ (¬P)))

→ ¬((¬P) → (Q ∨ (¬R)))

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 7 of 11


Parse Trees of wff’s

I A fully-parenthesized wff:
 
¬((¬P) ∨ (Q ∧ (¬P)))

→ ¬((¬P) → (Q ∨ (¬R)))

I Same wff with all parentheses omitted:

¬ ¬P ∨ Q ∧ ¬P
→ ¬ ¬P → Q ∨ ¬R

(an incomprehensible mess!)

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 8 of 11


Parse Trees of wff’s

I A fully-parenthesized wff:
 
¬((¬P) ∨ (Q ∧ (¬P)))

→ ¬((¬P) → (Q ∨ (¬R)))

I Same wff with all parentheses omitted:

¬ ¬P ∨ Q ∧ ¬P
→ ¬ ¬P → Q ∨ ¬R

(an incomprehensible mess!)

I Same wff minimally parenthesized:

¬ (¬ P ∨ (Q ∧ ¬ P))
→ ¬ (¬ P → (Q ∨ ¬ R))

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 9 of 11


Parse Trees of wff’s
No parentheses in the parse tree

I A fully-parenthesized wff:
 
¬((¬P) ∨ (Q ∧ (¬P))) ¬ ¬

→ ¬((¬P) → (Q ∨ (¬R)))

I Same wff with all parentheses omitted: ∨ →

¬ ¬P ∨ Q ∧ ¬P
→ ¬ ¬P → Q ∨ ¬R ¬ ∧ ¬ ∨

(an incomprehensible mess!)


P Q ¬ P Q ¬
I Same wff minimally parenthesized:

¬ (¬ P ∨ (Q ∧ ¬ P))
P R
→ ¬ (¬ P → (Q ∨ ¬ R))
Parse trees are very nice,
but more difficult to store.
Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 10 of 11
( THIS PAGE INTENTIONALLY LEFT BLANK )

Assaf Kfoury, CS 511, Fall 2019, Handout 02 page 11 of 11

You might also like