0% found this document useful (0 votes)
55 views43 pages

Logic Fol 2

The document discusses logic using first-order logic. It introduces reduction to satisfiability, the tableaux calculus method for checking satisfiability, and provides examples of how it can be used to determine if a formula is satisfiable or not. It also discusses other reasoning problems like subsumption and model checking.

Uploaded by

munich_1502
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views43 pages

Logic Fol 2

The document discusses logic using first-order logic. It introduces reduction to satisfiability, the tableaux calculus method for checking satisfiability, and provides examples of how it can be used to determine if a formula is satisfiable or not. It also discusses other reasoning problems like subsumption and model checking.

Uploaded by

munich_1502
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Logic Using First Order Logic

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:

A formula is satisable iff there is some interpretation I that satises (i.e.,

is true under I ):

I |= ).

Validity, equivalence, and entailment can be reduced to satisability:


is a valid (i.e., a tautology) iff is not satisable. is equivalent to ( ) iff is valid.

iff |= and |= |= iff is not satisable .

entails ( |= ) iff is valid (deduction theorem).

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:

The Tableaux Calculus is a decision procedure solving the problem of satisability.

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.

With respect to propositional logic, the notion of model is different.

(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 conjunction, then it also satises each of the conjuncts

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

Negation Normal Form


The above set of completion rules work only if the formula has been translated into Negation Normal Form, i.e., all the negations have been pushed down.

Example::

(x. [ y . [ P (x) Q(y) ] ])


becomes

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}

q(a) < CLASH > = {a}, pI = {a}, q I = .

(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}

q(a) < CLASH >

(10/29

Other Reasoning Problems

Subsumption

|= P Q P and Q predicate symbols of the same arity P subsumes Q in |= . [ Q() P () ] x x x

Instance Checking

The constant a is an instance of the unary predicate P

|= P (a)

(11/29

Example
Given a theory , if PERSON

STUDENT in

and if STUDENT(john) is valid in then PERSON(john) is valid 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:

= {a, b}, P (a), Q(b).


is a model of the formula:

y . [ P (y) Q(y) ] z . [ P (z) Q(z) ]

(14/29

Termination and Decidability


Given a logic L, a reasoning problem is said to be decidable if there exists a computational process (e.g., an algorithm, a Turing Machine, a computer program, etc.) that solves the problem in a nite number of steps, i.e., the process always terminates.

The problem of deciding whether a formula is logically implied by a theory

is undecidable in full FOL.


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

Problems and Algorithms

A problem is a general question to be answered. A problem is described by giving:


a general description of all its parameters, and a statement of what properties the answer, or solution, is required to satisfy.

An instance of a problem is obtained by specifying values for all parameters.

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:

worst case average case

hard and easy cases

(19/29

Complexity classes

P NP coNP PH PSPACE EXPTIME NEXPTIME DECIDABLE

(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:

Q1 x1 . Q2 x2 . . . . [ (x1 , x2 , . . .) ], where Qi is either or .

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)

Satisability of L2 formulas is NEXPTIME-complete.

(21/29

Complexity of problems
Computational complexity depends on the reasoning problem:

Model checking of FOL formulas is polynomial.

(22/29

The classical inference systems


Usually proof theory studies the properties of inference systems for logical implication based on some sort of sequent calculus, or of natural deduction. While this seems appropriate from a mere theoretical point of view, it turns out that such systems are hardly implementable, due to their non-deterministic and non-constructive foundations. Basically, these proof systems formalise the notion of derivability set of inference rules. In this context:

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

Summary of Part I of the course

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

You might also like