First Order Logic (FOL) : Syntax and Semantics
First Order Logic (FOL) : Syntax and Semantics
Adila Krisnadhi
Semantic
Equivalences
Adila Krisnadhi
Fakultas Ilmu Komputer
Universitas Indonesia
1/27
Slideset 4
Acknowledgement First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Equivalences
2/27
Slideset 4
Outline First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
Semantic
Equivalences
2 FOL Semantics
3 Semantic Equivalences
3/27
Slideset 4
Difficult/impossible to model using propositional logic First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
Semantic
• Healthy beings are not dead. Equivalences
4/27
Slideset 4
FOL Syntactic components First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
• Variables: x1 , x2 , . . . (also y, z, . . . )
• Function symbols: f1 , f2 , . . . (also g, h, . . . ).
Each function symbol has an arity, which is a natural FOL Syntax
5/27
Slideset 4
FOL Formula First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
Semantic
• If F is a formula, then ¬F is a formula. Equivalences
6/27
Slideset 4
Exercise First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Equivalences
7/27
Slideset 4
Subformula, variable binding First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
• If a formula F occurs as a part of a formula G, then we say
Semantic
that F is a subformula of G. Equivalences
8/27
Slideset 4
Exercise First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Equivalences
9/27
Slideset 4
FOL Semantics: Structure First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
10/27
Slideset 4
Exercise First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Give two different suitable structures for the formula below: Equivalences
11/27
Slideset 4
FOL Semantics: Value of Terms First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
• If t = x is a variable, tA = xA .
• If t = f (t1 , . . . , tk ) then tA = f A (t1A , . . . , tkA )
12/27
Slideset 4
FOL Semantics: Truth Value of Formulas First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
For each formula F, define the truth value of F (written A(F))
as follows where A[x/u] is the same as A except xA[x/u] = u.
(
1, if (t1A , . . . , tkA ) ∈ PA
• A(P(t1 , . . . , tk )) =
0, otherwise FOL Syntax
( FOL Semantics
0, otherwise
(
1, if A(G) = 1 or A(H) = 1
• A(G ∨ H) =
0, otherwise
(
1, if A(G) = 0
• A(¬G) =
0, otherwise
(
1, if for all u ∈ UA , A[x/u] (G) = 1
• A(∀xG) =
0, otherwise
(
1, if there exists some u ∈ UA , A[x/u] (G) = 1
• A(∃xG) =
0, otherwise
13/27
Slideset 4
Model, satisfiability, validity, entailment First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
Semantic
write A |= F. Equivalences
14/27
Slideset 4
Entailment, logical consequence First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
15/27
Slideset 4
Example of Structures and Models I First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
Consider the sentences: James is a parent of Harry. Harry is
FOL Semantics
an orphan. Any parent of an orphan is dead.
Semantic
Equivalences
In FOL using parentOf /2, orphan/1, and dead/1 as predicates,
and james/0 and harry/0 as function symbols:
16/27
Slideset 4
Example of Structures and Models II First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
17/27
Slideset 4
Example of Structures and Models III First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
18/27
Slideset 4
Example of Structures and Models IV First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Equivalences
19/27
Slideset 4
Example Entailment I First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
dead(james)
20/27
Slideset 4
Example Entailment II First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
Semantic
∧ orphan(harry) (5) Equivalences
entails (why?)
dead(fatherOf (harry))
21/27
Slideset 4
Example Entailment III First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
human(harry) (7) Semantic
Equivalences
∧ orphan(harry) (8)
∧ ∀x(human(x) → parentOf (fatherOf (x), x)) (9)
∧ ∀x∀y((orphan(x) ∧ parentOf (y, x)) → dead(y)) (10)
entails (why?)
dead(fatherOf (harry))
22/27
Slideset 4
Example Entailment IV First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
∀x(human(x) → parentOf (fatherOf (x), x)) (11) Equivalences
entails (why?)
23/27
Slideset 4
Propositional Logic vs. FOL First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
24/27
Slideset 4
Equivalence laws I First Order Logic (FOL)
Syntax and Semantics
For every formula F, G, and H, the following equivalences hold: Adila Krisnadhi
(F ∧ F) ≡ F (Idempotency)
(F ∨ F) ≡ F (Idempotency)
(F ∧ G) ≡ (G ∧ F) (Commutativity of ∧)
FOL Syntax
(F ∨ G) ≡ (G ∨ F) (Commutativity of ∨) FOL Semantics
((F ∧ G) ∧ H) ≡ (F ∧ (G ∧ H)) (Associativity of ∧) Semantic
Equivalences
((F ∨ G) ∨ H) ≡ (F ∨ (G ∨ H)) (Associativity of ∨)
(F ∧ (F ∨ G)) ≡ F (Absorption)
(F ∨ (F ∧ G)) ≡ F (Absorption)
(F ∧ (G ∨ H)) ≡ ((F ∧ G) ∨ (F ∧ H)) (Distributivity)
(F ∨ (G ∧ H)) ≡ ((F ∨ G) ∧ (F ∨ H)) (Distributivity)
¬¬F ≡ F (Double Negation)
¬(F ∧ G) ≡ (¬F ∨ ¬G) (deMorgan’s Laws)
¬(F ∨ G) ≡ (¬F ∧ ¬G) (deMorgan’s Laws)
(F ∨ G) ≡ F, if F is a tautology
(F ∧ G) ≡ G, if F is a tautology
(F ∨ G) ≡ G, if F is unsatisfiable
(F ∧ G) ≡ F, if F is unsatisfiable
25/27
Slideset 4
Equivalence laws II First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
26/27
Slideset 4
Non-equivalence (be careful!) First Order Logic (FOL)
Syntax and Semantics
Adila Krisnadhi
FOL Syntax
FOL Semantics
Semantic
Show that: Equivalences
27/27