1
Foundations of AI
- 9. Predicate Logic
Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution
Wolfram Burgard & Luc De Raedt & Bernhard Nebel
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal - - PowerPoint PPT Presentation
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard & Luc De Raedt & Bernhard Nebel 1 Contents Motivation Syntax and Semantics Normal Forms
1
Wolfram Burgard & Luc De Raedt & Bernhard Nebel
2
3
4
0-ary predicate: propositional logic atoms 0-ary function: constant
5
Terms (represent objects): 1. Every variable is a term. 2. If t1,t2,…,tn are terms and f is an n-ary function, then f f f f (t1,t2,…,tn) is also a term. Terms without variables: ground terms. Atomic Formulae (represent statements about objects) 1. If t1,t2,…,tn are terms and P is an n-ary predicate, then P(t1,t2,…,tn) is an atomic formula. 2. If t1 and t2 are terms, then t1 = t2 is an atomic formula. Atomic formulae without variables: ground atoms.
6
7
–
8
Our example: ∀x[Block(x)⇒Red(x)],Block(a) For all objects x: If x is a block, then x is red and a is a block. Generally:
universe.
in the universe (made true by the quantified expression).
Similar to propositional logic, we define interpretations, satisfiability, models, validity, …
9
I,…,tn I)
I,…,tn I ∈ PI
10
11
12
Set of all variables V. Function α: VD Notation: α[x/d] is the same as α up to point x. For x : α[x/d](x) = d. Interpretation of terms under I, α:
I,α,…,tn I,α)
Satisfiability of atomic formulae:
I,α,…,tn I,α ∈ PI
13
14
I,α,…,tn I,α ∈ P I
15
{(x d1), (y d2)} = = = = α D = RedI {d1} = BlockI d2 = bI d1 = aI {d1,…,dn | n > 1} = D Block(a), Block(b) ∀x (Block(x) ⇒ Red(x)) = Questions: 1. I,α Ñ Ñ Ñ Ñ Block(b) ¬Block(b)? 2. I,α Ñ Ñ Ñ Ñ Block(x) ⇒ (Block(x) ¬Block(y))? 3. I,α Ñ Ñ Ñ Ñ Block(a) . Block(b)? 4. I,α Ñ Ñ Ñ Ñ ∀x (Block(x) ⇒ Red(x))? 5. I,α Ñ Ñ Ñ Ñ ?
16
∀x[R( y , z ) . ∃y{¬P(y,x) R(y, z )}] Boxed appearances of y and z are free. All other appearances of x,y,z are bound. Formulae with no free variables are called closed formulae or
Note: With closed formulae, the concepts logical equivalence, satisfiability, and implication, etc. are not dependent on the variable assignment α (i.e. we can always ignore all variable assignments). With closed formulae, α can be left out on the left side of the model relationship symbol:
17
An interpretation I is called a model of ϕ under α if I,α Ñ Ñ Ñ Ñ ϕ A PL1 formula ϕ can, as in propositional logic, be satisfiable, unsatisfiable, falsifiable, or valid. Analogously, two formulae are logically equivalent (ϕ≡ψ), if for all I,α : I,α Ñ Ñ Ñ Ñ ϕ iff I,α Ñ Ñ Ñ Ñ ψ Note: P(x) ≡ P(y)! Logical Implication is also analogous to propositional logic. Question: How can we define derivation? /
18
19
∃x (ϕ ψ) if x not free in ψ
h
(∃xϕ) ψ ∃x (ϕ . ψ) if x not free in ψ
h
(∃xϕ) . ψ ∀x (ϕ ψ) if x not free in ψ
h
(∀xϕ) ψ ∀x¬ϕ
h
¬∃xϕ ∃x¬ϕ
h
¬∀xϕ ∃x (ϕ ψ)
h
∃xϕ ∃xψ ∀x (ϕ . ψ)
h
∀xϕ . ∀xψ ∀x (ϕ . ψ) if x not free in ψ
h
(∀xϕ) . ψ
20
Example: ¬∀x[(∀x P(x)) ⇒ Q(x)] ¬∀x[¬(∀x P(x)) Q(x)] ∃x [(∀x P(x)) . ¬Q(x)] and now? Solution: Renaming of variables ϕ[x/t] comes from ϕ, in which all free appearances of x in ϕ are replaced by the term t. Lemma: Let y be a variable that does not appear in ϕ. Then it holds that ∀xϕ h ∀yϕ[x/y] and ∃xϕ h ∃yϕ[x/y]. Theorem: There exists an algorithm that calculates the prenex normal form of any formula.
21
22
23
24
The set of ground terms (or Herbrand Universe) over a set of SNF formulae θ* is the (infinite) set of all ground terms formed from the symbols of θ* (in case there is no constant symbol, one is added). This set is denoted by D(θ*) The Herbrand expansion E(θ*) is the instantiation of the Matrix ψi of all formulae in θ* through all terms t ∈D(θ*): E(θ*)={ψi[x1/t1,…, xn/tn] | (∀ x1,…, xnψi) ∈ θ*, tj ∈D(θ*)} Theorem (Herbrand): Let θ* be a set of formulae in SNF. Then θ* is satisfiable iff E(θ*) is satisfiable. Note: If D(θ*) and θ* are finite, then the Herbrand expansion is finite finite propositional logic theory. Note: This is used heavily in AI and works well most of the time!
25
26
We can construct a semi-decision procedure for validity, i.e. we can give a (rather inefficient) algorithm that enumerates all valid formulae step by step. Theorem: The set of valid (and unsatisfiable) formulae in PL1 is recursively enumerable. What about satisfiable formulae? Theorem (undecidability of PL1): It is undecidable, whether a formula of PL1 is valid. (Proof by reduction from PCP) Corollary: The set of satisfiable formulae in PL1 is not recursively enumerable. In other words: If a formula is valid, we can effectively confirm this fact. Otherwise, we can end up in an infinite loop.
27
28
quantifier prefix + (quantifier-free) Matrix ϕ:
– Use distribution rule
29
Assumption: All formulae in the KB are clauses. Equivalently, we can assume that the KB is a set of clauses. Due to commutativity, associativity, and idempotence of , clauses can also be understood as sets of literals. The empty set of literals is denoted by . Set of clauses: ∆ ∆ ∆ ∆ Set of literals: C, D Literal:
30
31
32
1 1
n n i i i i
i i
33
34
35
1 2 1 2 1 2 1 2 3 1 2 3 1 2 2 1
36
for all ,
i j
w s w s i j =
{P(x,f(y),B),P(x,f(B),B)} s={y/B,s/A} not the simplest unifier s={y/B} most general unifier (mgu)
37
38
39
{P(x,A, f(y)),P(w,B, z)} {P(x,A, f(y)),P(x,B, z)} {P(x,y,f(y)),P(x,B, z)}
( ) Initialize 0; Initialize ; Initialize {}; * If is a singleton, then output . Otherwise, continue. Let be the disagreement set of If there exists a var and Uni a term y f
k k k k k k k k
Terms k T Terms T D T v t σ σ ← = =
1 1
in D such that does not occur in , continue. Otherwise, exit with failure. { / }; { / }; 1; Goto *
k k k k k k k k k k k
v t v t T T v t k k σ σ
+ +
← ← ← +
40
– –
41
θ ∨ ∨ ¬ ∨ ∨ ¬ ∨ ∨ ¬ ∨ ¬ P(x) Q(f(x)) R(g(x)) Q(f(A)) P(x) Q(f(x)) R(g(y)) Q(f(A)) {A/x} P(A) R(g(y)) P(x) Q(x,y) P(A) R(B, z) Resolve and Standardizing the variables apart gives and Substitution = Resolvent Resolve and Stand θ ∨ ¬ {A/x} Q(A,y) R(B, z) ardizing the variables apart Substitution = and Resolvent
42
– –
43
44
45
46
47
48
49
– most state of the art theorem provers for PL1 – the programming language Prolog
– not dealt with : search/resolution strategies
– Translation into finite propositional theory is possible.
50
PL1 is definitely very expressive, but in some circumstances we would like more…
∀x,y [(x=y) ⇔ {∀p[p(x) ⇔ p(y)]}] Validity is no longer semi-decidable (we have lost compactness)
λx,y[∃z P(x,z) . Q(z,y)] defines a new predicate of arity 2 Reducible to PL1 through Lambda-Reduction
→ Reduction to PL1: ∃x [ϕ(x) . ∀y {ϕ(y) ⇒ x = y}]
51
considerably more expressive power than propositional logic.
together with connectors and quantifiers, can be put together to produce formulae.
interpretation function.
reduced to satisfiability in propositional logic (although infinite sets of formulae can arise under certain circumstances).