Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

64
Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004

Transcript of Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Page 1: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Knowledge From the Logical Point of View

Tutorial by

Marie Duží and Petr Jirků

2004

Page 2: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Motto:

Zeal without knowledge is a runaway horse.

There is no royal road to learning.

Page 3: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Overview

• Introduction

• The role of logic in understanding the concept of knowledge

• Logical languages and systems for knowledge representation

• Theoretical background of programming languages suitable to express knowledge

Page 4: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Why Do We Need Knowledge?

• To understand the external world• To communicate with each other

(explicit knowledge)

• To be able to act in an adequate way even in critical situations (derivation of implied knowledge is necessary)

Knowledge is power!

Page 5: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

What Is Knowledge?

“…každému soudu, který odpovídá pravdě, propůjčuji jméno poznatku. … .” Bernard Bolzano

Knowledge is a true justified beliefPossible characteristics of knowledge (acquisition)

(a priori knowledge vs. a posteriori knowledge, knowledge by acquiatance and knowledge by description, occurrence vs. disposition)

• Knowledge owner (agent/s)• Knowledge (of P) is a justified belief of an agent that P

is true

Page 6: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Logic for KnowledgeWhat we can expect from logic?

• Languages and logics for knowledge representation (classical: propositional logic, first-order logic, high-order logic; modal, many-valued and fuzzy logics)

• Intentional logics (Montague, transparent intentional logic)

• Epistemic logics (Kripkean semantics, „syntactic“ approaches)

Page 7: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Labyrinth of Knowledge Representation Tools

• Declarative and Procedural knowledge,• Implicite and Explicit knowledge,• Reasoning (forward, backward, abductive, monotonic

vs. nonmonotonic),• If-then rules, Cognitive structures,• Production systems, • Frames, Objects, Concepts,• Neural networks, Semantic nets• Planning, Intelligent search• Unique vs. Multiple Representations

Page 8: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Possible Definitions of Knowledge

• Knowledge is truth justifiable belief (analytical necessity)• Knowledge is relation between agent A and

a meaning of proposition P (nomic necessity)• Knowledge is justifiable belief of agent A

that proposition P is true (epistemic necessity)

Page 9: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Different Systems

• Intentional Systems

• Hyperintensional Systems

• Extensional Systems

Page 10: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Epistemic Logics Axioms• All zero-order tautologies• (K) K φ K (φ ψ ) K ψ axiom of logical rationality (epistemic modality K is closed wrt implication)  Inference rules • (MP) Modus ponens: From formulas φ and φ ψ

derive ψ . • (NEC) Necesitation: From a formula φ derive K φ.

Page 11: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Stronger Epistemic Logics

• (T) K φ φ knowledge implies truth

• (D) K φ K φ logical racionality

• (4) K φ K K φ positive introspection

• (5) K φ K K φ negative introspection 

Page 12: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Other Nonclassical Logics

• Conditional Logic• Deontic Logic• Dynamic Logic• Erotetic Logic (Logic of Questions)• Intuitionistic Logic• Modal Logic• Many-valued and Fuzzy Logic• Paraconsitent Logic• Partial Logic• Temporal Logic

Page 13: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Reasoning

Hide not your talents, they for use were made.

What’s a Sun-dial in the Shade?

(Benjamin Franklin)

Page 14: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Classical Logical Derivability(A. Tarski)

F set of formulas

Cn: P(F) —> P(F) operation on F such that

• Reflexivity X Cn(X)

• Monotonicity If X Y then

Cn(X) Cn(Y)

• Transitivity Cn(Cn(X)) = Cn(X)

hold.

Page 15: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Various types of inferences

• De-duction• In-duction• Ab-duction• …-duction

Page 16: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Deduction

All the rabbits in the hat are white.

These rabbits are from the hat.

• Therefore: These rabbits are from the hat.

Rule (premise)

Fact (premise)

• Fact (conclusion)

Page 17: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Induction

These rabbits are white.

All the rabbits are from the hat.

• These rabbits are from the hat.

Fact (premise)

Fact (premise)

• Rule (conclusion)

Page 18: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Abduction

All the rabbits in the hat are white.

These rabbits are white.

• That is so These rabbits are from the hat.

Rule (premise)

Fact (premise)

• Fact (conclusion)

Page 19: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Abduction II

B – Theoretical Background (deductively closed)G - Set of goals that should be explaned How to find a set H of hypotheses for which 1. ( B H) ⊨ G, or G ∊ Cn(B H)   2. ( B H) is not inconsistent   3. H A a G H =   4. not ( B ⊨ G )   5. There is no set H´ H, such that B H´ ⊨ G

Page 20: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Abduction III

• Example (minimality of explanation) p => r p and q => r{p, q} is an explanation for r but it is not

minimal for r while {p} is minimal• Basicality of explanation (Feyrabend) Expanation is basic if is not explainable in

terms of other explanations

Page 21: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Abduction IV

• Example

r => g

w => g

g => s

Interpretation:

s – shoes are wet, r - reined last night,

w – watering-can was on, g – grass is wet

Page 22: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Strengh of abductive closures

• How good is hypothesis H independently on alternatives

• How decisively H overcome alternatives

• How complete was searching in space of alternatives

Page 23: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Logic and Programming

Languages for Logically-Oriented Knowledge Bases consist of

• K - language of formulas describing a kb (facts and/or rules)

• Q - language of questions

• A - language of answers

• QA System answ : K x Q → A

Page 24: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Most Typical Examples

• First Order Theory

• Relational Data Bases

• Simple Deductive Data Bases

• Disjunctive Deductive Data Bases

• General Logic Programs

Page 25: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

First Order Theory

• K = Q = A, In = classical logical consequence operation Cn (or relation ⊢, which is monotonic relation on the set of wffs).

Page 26: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Relational Data Bases

• K = set of ground atomic formulas (positive facts) represented by tables or relations

• Q = SQL

• A = {yes, no}

• It is non-monotonic since it is represented as set difference in relational algebra

Page 27: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Simple Deductive Data Bases

• K = set of positive facts and rules of the form A :- B1, … , BN.,

where A is an atomic first-order formula Bi are literals and negation is treated as failure.

• Q = set of atomic formulas

• A = {yes, no}

• In = linear resolution with selected element

Page 28: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Disjunctive Data Bases

• K = set of disjunctions of literals and rules as in simple deductive db

• Q = set of literals

• A = {yes, no} with substitution

• In = linear resolution

Page 29: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

General Logic Programs

• They are equivalent to closed first order theories.

• K – set of general clauses

• Q – set of general clauses

• In – classical logical consequence operation (or logical derivability relation)

Page 30: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Hierarchy of DifferentMonotonic Derivabilities

• Theory is persistent if true/false formulas remain true/false after adding new formulas.

• Theory is reliable if truth/falsity of a formula in partial models entail its truth/falsity in every information completion.

• Theory is determined if each formula is determined, i.e. its truth/falsity is uniquely determined in the complete model.

If the system is both determined and persistent, then it is reliable.

Page 31: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Dynamics of Knowledge

• Expansion (T, φ)

• Contraction (T, φ)

• Revision (T, φ)

Postulates of rationality

Peter Gardenfors

Page 32: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Hirarchy of Different Nonmonotonic Derivabilities I

• A formula φ is arguable when there is fixpoint f of nm-Cn operation that includes it.

• A formula φ is conceivable when its negation is not derivable from T.

• Formula is doubtless, if its negation is not arguable.

Page 33: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Hierarchy of Different Nonmonotonic Derivabilities II• Safe

• Forseable

• Plausible

• Uncontroversial

• Realizable

• Undeniable

Page 34: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Major Nonmonotonic Logics

• Fixpoint logics (default logics, modal nonmonotonic logics, epistemic logics, TMS, RMS)

• Model preference logics (close-world assumptions, circumscription, conditional logic)

• Systems for abductive reasoning (dependency networks, assumption-based TMS, RMS)

Page 35: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Default Logic

• R. Reiter, 1970

Default rules are rules of the form

If α and if also β can be consistently

assumed then γ.

(α ; β / γ)

Page 36: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Default Theories

T = [F, D] F set of first-order formulas D finite set of (closed) defaults

Extension(s) of default theories: fixpoints of nonmonotonic consequence

operation which involves all facts and it is closed to both logical rules and defaults

Page 37: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Examples I

• Theory with two extensions

F = {b => ¬a and ¬c}

D = {( ;a / a), ( ;b / b), ( ;c / c)}

E1 = Cn( F {b})

E2 = Cn( F {a, c})

Page 38: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Examples II

• Theory with just one extension

F = { }

D = {( ; a / ¬b); ( ;b / ¬c), ( ;c / d)}

E = Cn({¬b, d})

Page 39: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Examples III

• Theories without extension

F = { }

D = {( true ; a / ¬ a }

F = {a}

D = {(a ; b and c / c), (c ; ¬ b / ¬ b) }

Page 40: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Various kinds of defaults

• General defaults

(α ; β / γ)

• Seminormal defaults

(true ; β and γ / γ)

• Normal defaults

(true ; γ / γ) guarrantee existence of extension

Page 41: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lambda kalkul I

Teory of algorithms, recursion, metalanguage for Lisp

• λ-calcul Alonzo Church 30ties in last century.

Axioms and rules (Scott, Plotkin)                     Axioms for λ-abstraction• (λ x . M) = (λy . M [x / y] ) if y is not free in M

-rule• ((λ x.M) N) = M [x / N ] -rule

Page 42: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lambda kalkul II

               Rules for equalities of terms

• Reflexivity

• Symetry

• Transitivity

Page 43: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lambda kalkul III

                 Inference rules

• From M=M´ derive NM = NM’

• From M=M´ odvoď MN = M’N

• From M=M´ infer

M = (λ x . M) = (λ x . M’)

Page 44: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lambda kalkul IV

When we understand binary relations of reduction (→) and equality (=) as primitive (not defined) terms, we can λ-calculus equivalently describe by the following axioms and rules (after Barendreght):

• (λ x . M) N → M[x / N]) (β reduction)• (λ x . Mx) → M (η reduction)

Page 45: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Realization (languages for knowledge representation)

• Languages for AI

(FRL, KRL, KL-One, …)

• Logic Programming

• Algorithmic Programming

Page 46: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Two programming languages supported by well

understandable mathematical theories

• (Horn) fragnent of predicate logic (implementation: Prolog with various extensions)

• Recursion theory and/or lambda calculus (implementation: Lisp and its clones)

Page 47: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lisp

• List processing language

• S-expressions; atoms, lists. The empty list; Manipulating lists (car, cdr, cons)

• M-expressions

• Recursive definitions

• Conditional expressions

• Lambda expressions

Page 48: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

S-expressions

• Symbolic expressions: atoms (natural numbers, words, lists of atoms or sublists)

• Examples (a b c) (1 3 5) (2 2 2) (2 2 2 ) ( ) nil ((Monday Tuesday) (a 1 b 2)) Extra blanks are ignored, not extra parentheses.

They can completely change the meaning of expression!

Page 49: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Manipulating lists (car, cdr, cons)

• Car, cdr are for splitting and/or constructing lists (car returns head i.e. the first element of a list, cdr returns its tail, cons joins a head to a tail) Examples (in M-notation)

car `(a b c) ==> a cdr `(a b c) ==> (b c) cdr cdr `(a b c) ==> (c) cons `a nil ==> a cons `(a) `(b c) ==> (a b c)

Page 50: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Conditional expressions

• Three-argument function

(if predicate then-value else-value)

Page 51: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Lambda expressions

• Lambda expressions are used to define functions

(lambda

(list-of-parameter-names) function-body)• Examples

( lambda (x y) (cons y (cons x nil)))

(`lambda (x y) cons y cons x nil A B) ==> (B A)

(f A B) ==> (B A)

Page 52: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

How to bind a function symbol with the function definition?

• Define (f x y) cons y cons x nil

• (`lambda (f ) (f A B)

`lambda (x y) cons y cons x nil)

Page 53: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Prolog

• Programming in logic

1972 A. Colmerauer, P. Roussel

(Université Marseille-Luminy)

1977 Warren (University of Edinburgh)

• Logické symboly ∀ ∃ ∊ ¬⋀⋁⇒ ⊨ ⊢ λx

Page 54: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Definite Clause Programs

• Logic Programming as Mechanized Deduction

• Resolution and Unification

• SLD Resolution and Procedural Semantics

• Herbrand Models

• Declarative and Fixpoint Semantics

Page 55: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Some useful Logical Equivalences

• ∀ x ¬ P equiv ¬ ∃x P

• ∀ x ( P if Q(x)) equiv P if ∃x Q(x)

• A if (B and C) equiv (A if B) if C

• A if (B and C) equiv (A if C) and B

• ¬ (A and B) equiv ¬ A or ¬ B

• ¬ A or ¬ B equiv ¬ A if B

• ¬ A equiv false if A

Page 56: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Logic Programming is Mechanized Reasoning

• Program = given assumptions A

• Output = desired conseuence C

• Computation = deduction of C from A

• Meaning of program =

all consequences of A

Page 57: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

(Standard) Logic Programming

• Uses FOL to Describe Knowledge• Uses Inferences to Proces Knowledge

• Uses Clausal Form• Uses SLD Resolution as an Inference Method

• Definite Clause

Page 58: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Herbrand Models

• P logic program• Domain H(P)= ground terms of the

language in question• Herbrand Base B(P) = set of all atomic

formulas constructed from H(P) and predicate symbol of the language

• Logic program then compute with terms from H(P) and ground instances in B(P)

Page 59: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

The not Predicate

• not(P) :- call(P), fail.

• not(P).

• Negation as failure in derivation. It is the source of non-monotonicity.

Page 60: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Example

x is a member of a list y

member(X, [X | Y]).

member(X, [ _ | Y]) :- member(X, Y).

Page 61: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Description logic

• Concept and role descriptions

• Restrictions on role interpretations

• Concept constructors

• Role constructors

• Axioms

Page 62: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

References I• Franz Baader – Diego Calvanese – Deborah

McGuinness – Daniele Nardi – Peter Patel-Schneider (eds.): The Description Logic Handbook Theory, Implementation and Applications. Cambridge Univ. Press 2003.

• Gregory J. Chaitin: The Unknowable. Springer 1999.• Melvin Fitting – Eva Orlowska (eds.): Beyond Two:

Theory and Applications of Multiple-Valued Logic. Physica Verlag 2003.

• Peter Gärdenfors: Knowledge in Flux. Modelling the Dynamics of Epistemic States. The MIT Press 1988.

Page 63: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

References II

• Jaakko Hintikka: Knowledge and Belief. An Introduction to the Logic of the two notions. Cornell Univ. Press 1962.

• Raymond Turner: Truth and Modality for Knowledge Representation. Pitman 1990.

• Reasoning about Knowledge. The MIT Press• Russell, Bertrand: Logic and Knowledge. (Essays

1901-1950), edited by Robert Charles Marsh, Routledge, London and New York 1956.

Page 64: Knowledge From the Logical Point of View Tutorial by Marie Duží and Petr Jirků 2004.

Eventually End

This tutorial has been prepared nonmonotonically by Mary and Peter

distinctly from monotonical Mary and Paul.