Logic Fol 2
Logic Fol 2
Enrico Franconi
[email protected] http://www.inf.unibz.it/franconi
Faculty of Computer Science, Free University of Bozen-Bolzano
(1/29
Reduction to satisability
Just like propositional logic:
is true under I ):
I |= ).
We need a sound and complete procedure deciding satisability: the tableaux method is a decision procedure which checks the existence of a model.
(2/29
Tableaux Calculus
Just like in propositional logic:
If a formula is satisable, the procedure will constructively exhibit a model of the formula.
The basic idea is to incrementally build the model by looking at the formula, by decomposing it in a top/down fashion. The procedure exhaustively looks at all the possibilities, so that it can eventually prove that no model could be found for unsatisable formulas.
(3/29
Tableaux Calculus
Finds a model for a given collection of sentences KB in negation normal form. 1. Consider the knowledge base KB as the root node of a refutation tree. A node in a refutation tree is called tableaux. 2. Starting from the root, add new formulas to the tableaux, applying the completion rules. 3. Completion rules are either deterministic they yield a uniquely determined successor node or nondeterministic yielding several possible alternative successor nodes (branches). 4. Apply the completion rules until either (a) an explicit contradiction due to the presence of two opposite ground literals in a node (a clash) is generated in each branch, or (b) there is a completed branch where no more rule is applicable (but. . .).
(4/29
The Calculus
The completion rules for the propositional formulas:
If a model satises a disjunction, then it also satises one of the disjuncts. It is a non-deterministic rule, and it generates two alternative branches of the tableaux.
(5/29
The Calculus
The completion rules for quantied formulas:
x. {X/t} x.
If a model satises a universal quantied formula, the it also satises the formula where the quantied variable has been substituted with some term. The prescription is to use all the terms which appear in the tableaux.
x. {X/a}
If a model satises an existential quantied formula, then it also satises the formula where the quantied variable has been substituted with a fresh new skolem constant.
(6/29
Models
The completed branch of the refutation tree gives a model of KB: the KB is satisable. Since all formulas have been reduced to ground literals (i.e., either positive or negative atomic formulas which do not contain variables), it is possible to nd an interpretation to predicates using the constants, which make all the sentences in the branch true.
If there is no completed branch (i.e., every branch has a clash), then it is not possible to nd an interpretation for the predicates making the original KB true: the KB is unsatisable. In fact, the original formulas from which the tree is constructed can not be true simultaneously.
(7/29
Example::
x. [ y . [ P (x) Q(y) ] ]
(Why?)
(8/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < COMPLETED > x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < COMPLETED > q(a) < CLASH > x. {X/t} x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < COMPLETED >
The formula is satisable. The devised model is
x. {X/t}
x. {X/a}
(9/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < CLASH > x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < CLASH > q(a) < CLASH > x. {X/t} x. {X/a}
(10/29
Example
y . (p(y) q(y)) z . (p(z) q(z)) y . (p(y) q(y)) z . (p(z) q(z)) p(a) q(a) p(a) q(a) p(a) q(a) p(a) < CLASH >
The formula is unsatisable.
x. {X/t}
x. {X/a}
(10/29
Subsumption
Instance Checking
|= P (a)
(11/29
Example
Given a theory , if PERSON
STUDENT in
(12/29
Subsumption
Subsumption can be seen as a binary relation in the space of predicates with same arity:
P/n
Q/n .
The subsumption relation is a partial ordering relation in the space of predicates of same arity.
Exercise: prove it. Hint: a partial ordering relation is a transitive, reexive, and antisymmetric relation.
b & &
INANIMATE
TOP /1
} T
PERSON
ANIMATE
COURSE
s d d
STUDENT
s d d
PROFESSOR
WORKING-STUDENT
(13/29
Model Checking
Verify that a given interpretation I is a model for a closed formula :
I |=
An interpretation is also called a relational structure.
Example:
(14/29
Logical implication is decidable if we restrict to propositional calculus. Logical implication is decidable if we restrict to FOL using only at most two variable names; such language is called L2 .
The property of (un)decidability is a general property of the problem and not of a particular algorithm solving it.
(15/29
L3
An example of L3 formula: The only baseball player in town is married to one of Jeremys daughters.
x. [ B(x) (y. [ B(y) x = y ] ) z. [ M(x, z) D(z, jeremy) (k. [ D(k, jeremy) z = k ] ) v. [ M(x, v) v = z ] ] ] x. [ B(x) (y. [ B(y) x = y ] ) y. [ M(x, y) D(y, jeremy) (x. [ D(x, jeremy) y = x ] ) v. [ M(x, v) v = y ] ] ]
(16/29
Expressive Power
Some logics can be made decidable by sacricing some expressive power. A logical language La has more expressive power than a logical language
Lb , if each formula of Lb denotes the same set of models of its correspondent formula of La , and if there is a formula of La denoting a set of models which is denoted by no formula in Lb .
Example: Consider La as FOL, and Lb as FOL without negation and disjunction. Given a common domain, the La formula x.
[ P (x) Q(x) ] has a set of models which can not be captured by any formula of Lb . (Exercise: check it out with = {a}
(17/29
a general description of all its parameters, and a statement of what properties the answer, or solution, is required to satisfy.
An algorithm is a step-by-step procedure fro solving problems. An algorithm is said to solve a problem if
it can be applied to any instance I of , and it is guaranteed always to produce a solution for that instance I .
(18/29
Computational Complexity
The goal of complexity theory is to classify problems as to their intrinsic computational difculty into general complexity classes.
Given a problem, how much computing power and/or resources (e.g., time, space) do we need in order to solve it in the worst case?
The complexity class to which a problem belongs is a general property of the problem and not of a particular algorithm solving it.
Distinguish among:
(19/29
Complexity classes
(20/29
Complexity of problems
Complexity and expressive power:
Satisability of formulas in propositional calculus is NP-complete. Unsatisability of formulas in propositional calculus is coNP-complete. Satisability of QBF formulas in FOL where there is a nite nesting of quantiers is PSPACE-complete:
Satisability of formulas in the propositional dynamic normal modal logic (PDL) is EXPTIME-complete. (Note: PDL has non rst order expressible features, but it doesnt include full FOL)
(21/29
Complexity of problems
Computational complexity depends on the reasoning problem:
(22/29
with a
Soundness: if Completeness: if
then |= |= then
(23/29
Incompleteness
Sequent calculus and natural deduction form sound and complete procedures for computing logical implication.
However, for FOL it is not guaranteed their termination, since the problem is undecidable.
It is easy to have incomplete but terminating procedures, by simply dropping some of the inference rules from the complete set.
This is a general methodology for characterising the incompleteness of algorithms: nd a complete set of inference rules, and characterise the incomplete procedure with a subset of them.
(24/29
Completeness
Given an incomplete reasoning procedure for a reasoning problem, sometimes people prefer to modify the denition of the problem in order to obtain a complete procedure.
This can be accomplished by slightly changing (weakening) the semantics of the logical language (e.g., a variant of relevance 4-valued FOL where modus ponens is no more valid is decidable, and it has a complete reasoning procedure).
(25/29
Algorithm Complexity
An sound and complete algorithm solving a reasoning problem may be or may be not optimal with respect the computational complexity of the problem.
For example, a polynomial problem may be implemented with a non-polynomial algorithm, or a PSPACE problem may be implemented with an algorithm requiring exponential space.
Optimal implementation of sound and complete algorithms may be impossible if there is no constructive proof for the computational complexity.
(26/29
Sub-optimal algorithms
Recall that computational complexity considers only the worst cases. Sub-optimal sound and complete algorithms can be faster for simple, average, and real instances of the problem, but less efcient for worst cases, than optimal algorithms.
Sub-optimal sound and complete algorithms can be compliant to software engineering requirements, i.e., they can be modular and expandable.
Sub-optimal sound and complete algorithms may be optimal when considering sub-languages belonging to a lower complexity class.
(27/29
Main lesson: Logic can be a useful tool. It allows us to represent information about a domain in a very straight-forward way then deduce additional facts using one general domain-independent algorithm: deduction. Consequently, logic lends itself to large-scale, distributed-design problems.
Each logic is made up of a syntax, a semantics, a denition of the reasoning problems and the computational properties, and inference procedures for the reasoning problems (possibly sound and complete). The syntax describes how to write correct sentences in the language, the semantics tells us what sentences mean in the real world. The inference procedure derives results logically implied by a set of premises.
(28/29
Logics differ in terms of their representation power and computational complexity of inference. The more restricted the representational power, the faster the inference in general.
Propositional logic: we can only talk about facts and whether or not they are true. In the worst case, we can use the brute force truth-table method to do inference. Proof methods such as tableaux are generally more efcient, easier to implement, and easier to understand.
First-order logic: we can now talk about objects and relations between them, and we can quantify over objects. Good for representing most interesting domains, but inference is not only expensive, but may not terminate.
(29/29