logica e intelligenza artificiale - … · [2] michael r. genesereth, nils j. nilsson, logical...

41
LOGICA E INTELLIGENZA ARTIFICIALE Matteo Palmonari, Alessandro Mosca matteo.palmonari;[email protected] DISCo - Università di Milano-Bicocca

Upload: hoangbao

Post on 15-Sep-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

LOGICA E INTELLIGENZA ARTIFICIALE

Matteo Palmonari, Alessandro Moscamatteo.palmonari;[email protected]

DISCo - Università di Milano-Bicocca

Intelligenza e computazioneIntelligenza e computazione

►► Diversi modelli di intelligenza... filosofia, psicologia... Diversi modelli di intelligenza... filosofia, psicologia...

►► UnaUna tradizione... Intelligenza come tradizione... Intelligenza come calcolocalcolo..

►►Approccio formale allo studio della mente come Approccio formale allo studio della mente come manipolazione di simboli. Se lmanipolazione di simboli. Se l’’intelligenza intelligenza èèmanipolare simboli, una macchina può pensare? manipolare simboli, una macchina può pensare?

►►Un Agente Intelligente secondo questo approccio ha Un Agente Intelligente secondo questo approccio ha una descrizione simbolica del mondo e delle regole una descrizione simbolica del mondo e delle regole per per ““manipolaremanipolare”” questi simboli.questi simboli.

Mente vs. Comportamento vs. Mente vs. Comportamento vs. Fisiologia: funzionalismo Fisiologia: funzionalismo cognitivista vs cognitivista vs comportamentismo e fisiologiacomportamentismo e fisiologia

Che cosChe cos’è’è un calcolo? un calcolo? Alan Turing: una nozione Alan Turing: una nozione formale di algoritmo: formale di algoritmo: la Macchina di Turingla Macchina di Turing

Intelligenza Artificiale ... da questo Intelligenza Artificiale ... da questo punto di vistapunto di vista

► Uno studio empirico delle attività cognitive umane. (modelli psicologici computrazionali)

► Una ricerca sugli strumenti di rappresentazione. Linguaggi, tecniche e modelli computazionali �KR (Rappresentazione della conoscenza)

► Una disciplina ingegneristica; svolgimento di compiti complesso sulla base di tali modelli.

Una teoria della mente Una teoria della mente rappresentazionalerappresentazionale

► Le rappresentazioni sono di tipo simbolico.

The Phisical Symbolic System HypothesisA phisical symbolic system has necessary and sufficient instruments to perform general intelligent actions.

[Newell, Simon]

1. Simboli primitivi (atomi);2. Strutture complesse;3. Regole di Trasformazione dei simboli e delle strutture

complesse;4. Denotazione dei simboli.

... La disciplina della Rappresentazione della Conoscenza.

1) Queste strutture, viste da un osservatore esterno al sistema, possano essere interpretate come rappresentazione della conoscenza di cui il sistema dispone;

2) Indipendentemente da tale attribuzione semantica, tali strutturedevono poter essere manipolabili formalmente, in modo da poter giocare un ruolo causale nel determinare il comportamento del sistema.

[The Knowledge Representation Hypothesis - Brian Smith,Prologue to “Reflection and Semantics in a Procedural Language”, 1982]

Il fine di un sistema di rappresentazione della conoscenza èindividuare strutture simboliche e meccanismi di inferenza appropriati sia per rispondere a domande che per acquisire nuove informazioni, in accordo con la teoria della verità del linguaggio di rappresentazione sottostante.

[R. Brachman e H. Levesque, Readings in Knowledge Representation, 1985]

Ogni sistema “intelligente” deve incorporare un insieme di strutture tali che:

PerchPerchèè la Logica come sistema la Logica come sistema simbolico...simbolico...

1) La Logica è Formal (e quanto più generale possibile).

2) La Logica è Mathematical.

3) La Logica è Symbolic (sintassi, semantica).

4) La Logica ha un Calculus (corretto e completo).

... La Logica è Rappresentazione della Conoscenza.

La LogicaLa Logica

►► SintassiSintassi�� formule corretteformule corrette�� manipolazione simbolicamanipolazione simbolica

►► SemanticaSemantica�� Interpretazione dei simboli, concetto di veritInterpretazione dei simboli, concetto di veritàà

►► InferenzeInferenze�� Tautologie e conseguenze logiche (semantica)Tautologie e conseguenze logiche (semantica)�� DerivabilitDerivabilitàà (sintassi)(sintassi)

►► EspressivitEspressivitàà::�� Logica ProposizionaleLogica Proposizionale�� Logica PredicativaLogica Predicativa

The “logical” constituent of the language,

The “extra-logical” constituent of the language,

First Order Logic (FOL)First Order Logic (FOL)

Termini

Formule Atomiche

Formule ben formate

Alcune espressioniAlcune espressioni

The satisfiability of logical sentence depends on the interpretation : under some intepretations, a sentence can be true; under other intepretations, it can be false.

The relative notion of Truth called Satisfaction

The concept of L-structure.

Satisfiability

Validity

Logical Consequence

1. Mario è un architetto oppure è un geometra.Se Mario fosse architetto, allora Mario sarebbe laureato.Mario non è laureato.Quindi: Mario è un geometra .

2. Giovanni Paolo II è siciliano.Tutti i siciliani sono giardinieri.Quindi: Giovanni Paolo II è giardiniere.

3. Tutti i cigni osservati sinora in Europa sono bianchi.Tutti i cigni osservati sinora in Nord America sono bianchi.Tutti i cigni osservati sinora in Sud America sono bianchi […]Non sono mai stati osservati cigni che non fossero bianchi.Quindi: Tutti i cigni sono bianchi.

4. L’assassino ha sporcato di fango il tappeto.Chiunque fosse entrato dal giradino avrebbe sporcato di fango il tappeto.Quindi: L’assassino è entrato dal giardino.

5. Gli uccelli, salvo eccezioni, sono in grado di volare.Titti è un uccello.Quindi: Titti è in grado di volare.

Alcune inferenzeAlcune inferenze

Resolution Principle[Abraham Robinson, 1965]

If we know that “P is true or Q is true” and we also know that “P is false or R is false”, then it is the case that “Q is true or R is true”

“The idea of resolution is simple”[Michael R. Genesereth, Nils J. Nilsson Logical Foundations of Artificial Intelligence]

Resolution [I]

Propositional Case...need of Clausal Form of logical sentences.

Φ with ϕ ∈ΦΨ with ¬ϕ ∈Ψ

(Φ - {ϕ }) ∪ ( Ψ - {¬ϕ })

1. {P, Q} ∆2. {¬P, R} ∆

3. {Q, R} 1,2

Example

Given a clause Φ containing the literal φ and another clause Ψ containing the literal ¬φ , we can infer the clause consisting of all the literals of both the clauses without the complementary pair.

Φ with ϕ ∈ΦΨ with ¬ψ ∈Ψ

((Φ - {ϕ }) ∪ ( Ψ - {¬ψ}))σ where σ (ϕ )=σ (ψ),is the most general unifier.

First-order Case...need of Unification and Clausal Form of logical sentences.

Resolution [II]

1. {P (x), Q (x,y)} ∆2. {¬P (a), R (b, z)} ∆

3. {Q (a,y), R (b, z)} 1,2

where the most general unifier is

σ = {x / a}.

Example

Resolution [III]

The concept of factor

If a subset of the literals in a clause Φ has a most general unifier γ, then the clause Φ’obtained by applying γ to Φ is called factor of Φ. Obviously, any clause is a trivial factor of itself.

Φ with ϕ ∈Φ’

Ψ with ¬ψ ∈Ψ’

((Φ’ - {ϕ }) ∪ ( Ψ’ - {¬ψ}))σ where σ (ϕ )=σ (ψ),is the most general unifier.

The last step

Scegliere un linguaggio:

• una sintassi

• una semantica

Problemi:

Espressività (cosa posso rappresentare?)

Reasoning (cosa ci faccio?)

Logica e modelli: cosLogica e modelli: cos’è’è un modello?un modello?

Logica come strumento di modellazione!

Qualche problema...Qualche problema...

Problems with FOL and logic Problems with FOL and logic programmingprogramming

►► FOL is undecidable.FOL is undecidable. ►► Combinatorial Combinatorial explosion. explosion.

�� The complexity of a The complexity of a proof rise exponentially proof rise exponentially with the formulawith the formula’’s s lengthlength

Decidable subsets :

Horn Clauses - Prolog

Limitation in the expressiveness

Heuristics, refinement of search algorithms

Logicists vs. AntiLogicists vs. Anti--logicists in logicists in symbolic AIsymbolic AI

►►A long argument: A long argument: ’’60 60 �� ’’8080

►►Logical ApproachLogical Approach: McCarthy, : McCarthy, McDermott, R.C. Moore, Reiter, McDermott, R.C. Moore, Reiter, KowalskyKowalsky

►►AntiAnti--logical Approachlogical Approach: Minsky, : Minsky, Simon, NewellSimon, Newell

AntiAnti--logicists: general considerationslogicists: general considerations

►► MinskyMinsky�� Logical reasoning is not enaugh flexible.Logical reasoning is not enaugh flexible.

�� Knowledge does not consist of a set of atomic sentences Knowledge does not consist of a set of atomic sentences plus plus a set a set of rules of inference: it is fairly more structured.of rules of inference: it is fairly more structured.

�� A A fully declarative fully declarative approach is questionable: relevance of approach is questionable: relevance of procedural descriptions.procedural descriptions.

►► Shank e RiegerShank e Rieger

Logical Logical ““proofproof”” (formal concept)(formal concept)

VsVs

InferenceInference as psycological processas psycological process

(maybe incorrect, associations driven)(maybe incorrect, associations driven)

AntiAnti--logicists: three pointslogicists: three points

►►Definite conceptsDefinite concepts (logic (logic �� necessary and/or necessary and/or sufficient conditions) sufficient conditions) vsvs prototypesprototypes (normal (normal object with defaut values).object with defaut values).

►► Human Human inferencesinferences are are sistematically sistematically incorrectincorrectfrom a logical point of view. Commonsense from a logical point of view. Commonsense Reasoning does not follow logic rules.Reasoning does not follow logic rules.

►►MemoryMemory is structured in a more complex way is structured in a more complex way than into logical theories (axioms): semantical than into logical theories (axioms): semantical closeness (e.g. Comet/Chrisrtmas).closeness (e.g. Comet/Chrisrtmas).

Logicists: three pointsLogicists: three points

►► Formalisms for KR need a suitable Formalisms for KR need a suitable semanticsemantic to to preserve soundness preserve soundness

�� (especially for long and complex programs).(especially for long and complex programs).

►► Expression levelExpression level vsvs implementation level implementation level

[P. Hayes]. [P. Hayes].

�� Logic at the expression level: inferences justification.Logic at the expression level: inferences justification.

►► Logic for Logic for models of commonsense reasoningmodels of commonsense reasoning..

�� Extending logic.Extending logic.

SubsumingSubsuming

►►Logic is very general and need no Logic is very general and need no ontological assumption [Moore].ontological assumption [Moore].

►►Representation in terms of individuals, Representation in terms of individuals, relations and functions relations and functions �� almost every almost every domain.domain.

Different solutionsDifferent solutions

Flexiibility

Uncertainty

Incompletenessof information

Approaches closer to

classic logic

Numerical Analysys

Based approaches

Fuzzy and Probability Logics,Neural Network and Genetic Algorithms

Different approaches:Common element � nonmonotonicity

NONMONOTONIC LOGICS

Common sense reasoningCommon sense reasoning►► Inferences with incomplete informationsInferences with incomplete informations

�� We do not need all the details of a situation to draw We do not need all the details of a situation to draw many inferencesmany inferences

►► UncertaintyUncertainty�� These inferences may not to be as certain as These inferences may not to be as certain as

mathematical inferencesmathematical inferences

►► FlexibilityFlexibility�� Knowledge base changes. New facts are added Knowledge base changes. New facts are added

Logic is classically monotonic

Common sense reasoning is NONMONOTONIC

AppendiceAppendice

NonmonotonicityNonmonotonicity

►►Monotonicity is a mathematical property of Monotonicity is a mathematical property of a function such that:a function such that:

if , then if , then ..

►►A notion of inference is monotonic A notion of inference is monotonic

if and only if if and only if imply imply ..

►►Nonmonotonicity is a property defined by Nonmonotonicity is a property defined by negation (absence of monotonicity. negation (absence of monotonicity.

x y≤ ( ) ( )f x f y≤

pΓ ⊢� A pΓ ∪ ⊢

f

Nonmonotonic logicNonmonotonic logic

►►Draws reasonable inferences on the basis of Draws reasonable inferences on the basis of incomplete information.incomplete information.

►►Defeasible logics Defeasible logics �� new facts can defease new facts can defease some inferences. some inferences.

►►Inferences may be valid relatively to a Inferences may be valid relatively to a theory. Changing the theory questions the theory. Changing the theory questions the inferencesinferences’’ soundness.soundness.

NMR NMR exampleexample II

►► In a database with a train timetable imagine to query a In a database with a train timetable imagine to query a train train

►► If the train does not exist, a If the train does not exist, a classic theorem proverclassic theorem prover cannot cannot prooveproove

The nonThe non--existence of the trains not in the timetable connot existence of the trains not in the timetable connot be proved unless specifying every nonbe proved unless specifying every non--existent train.existent train.

( , )sT s Milano,Bologna,8.30∃

( , )sT s Milano,Bologna,8.30¬∃

Nonmonotonicity � if in the summer the train above is added to the timetable, we should retract the inference draft.

CWA, NEGATION AS FAILURE

CLOSED WORLD ASSUMPTIONIf a ground term cannot be inferred from the database, its negation is added to the closure:

{ }CWA(DB) DB ( ) | DB ( )P t P t= ∪ ¬ ⊨

NMR example II (1)NMR example II (1)

►► This inference is reasonable, although not sound This inference is reasonable, although not sound with respect to classic logic.with respect to classic logic.

►► I) is a I) is a default ruledefault rule : it can be thought as valid in : it can be thought as valid in most of situation most of situation –– the normal onesthe normal ones

“John is planning a holiday to Maldives. He’s thinking which of his friend is likely to come with him. Unfortunately, his best friend Jack is a PhD student; so, John argues Jack will not have enough money to go with him and calls Mary.”

His crucial inference is that Jack will not have enough money because

I) most of PhD Students are short of money

Of course John can find out that Jack has won a big amount of money at the horse races. He will have to retract his inference as the situation is an exception.

Nonmonotonicity

NMR example II (2)NMR example II (2)

With DEFAULT LOGICWith DEFAULT LOGIC

►►Example II is a typical case of nonmonotonic reasoning Example II is a typical case of nonmonotonic reasoning

►►Many formalismsMany formalisms

Most of PhD Students are short of money

( ): _ _ ( )

_ _ ( )

PhD Short of money

Short of money

x xx

М

If PhD(x) is proved and Short_of_money(x) is consistent with my theory

Then infer Short_of_money(x), i.e. extend the theory with that sentence

Default LogicDefault Logic

►► Extends a theory (propositional or predicate calculus) with Extends a theory (propositional or predicate calculus) with new inference rules, new inference rules, default rulesdefault rules of the form: of the form:

where where means thatmeans that are are consistent with the final theory, i.e. consistent with the final theory, i.e. the extensionthe extension..

►► There can be There can be one, more or noneone, more or none extensions for every extensions for every default theory (i.e a set of axioms and a set of default default theory (i.e a set of axioms and a set of default rules).rules).

►► Semantic Semantic �� preferred modelspreferred models

1( ): ( ),..., ( )

( )m

w

α β βx x xx

М

1( ),..., ( )mβ βx xМ 1( ),..., ( )mβ βx x

Main Nonmonotonic LogicsMain Nonmonotonic Logics

►►Logic programming, prolog, negation as Logic programming, prolog, negation as failurefailure

►►CWACWA

►►Default LogicDefault Logic

►►Circumscription Circumscription [circumscription of certain special predicates][circumscription of certain special predicates]

►►Abduction Abduction [inferring explanations from facts and hypothesis][inferring explanations from facts and hypothesis]

►►Autoepistemic Logic Autoepistemic Logic [an ideal and rational subject [an ideal and rational subject

reasoning on his own beliefs]reasoning on his own beliefs]

Actractiveness Actractiveness vsvs problemsproblems

►► Formalisms close to Formalisms close to classic logic: iclassic logic: intuitivityntuitivity

►► Solution to traditional Solution to traditional problems (frame and problems (frame and qualification problems)qualification problems)

►► Rational aspects of Rational aspects of common sense common sense reasoning are caughtreasoning are caught

►► Logical approach Logical approach

► Problems inherited from classic logic

►Undecidability (condition of satisfability or non-provability in many definitions)

Bibliography

[1] Stuart Russell, Peter Norvig, Artificial Intelligence. A modern Approach, Prentice Hall, New Jersey, 1995.

[2] Michael R. Genesereth, Nils J. Nilsson, Logical Foundations of Artificial Intelligence, Morgan Kaufmann Publishers Inc., California, 1987.

[3] Corrado Mangione e Silvio Bozzi, Storia della Logica. Da Boole ai giorni nostri, Garzanti, Milano, 1993.

[4] Maurizio Negri, Elementi di Logica, LED - Edizioni Universitarie di Lettere, Economia, Diritto, Milano, 1994.

[5] John McCarthy e Patrick J. Hayes, Some Philosophical Problems from the Standpoint of Artificial Intelligence, Computer Science Department, Stanford University, Stanford, 1969.

[6] John McCarthy, Epistemological Problems of Artificial Intelligence, Computer Science Department, Stanford University, Stanford, 1977.

[7] Randall Davis, Howard Shrobe e Peter Szolovits, What is a Knowledge Representation?, Artificial Intelligence Laboratory and Laboratory for ComputerScience at MIT, published by AI Magazine, 14(1):17-33, 1993.

[8] Robert Kowalski, The limitations of Logic, Department of Computing, Imperial College, London. An earlier version of this paper was presented at the Workshop on Knowledge Base Management System, Creta, Giugno 1985 [published by Springler Verlag].

[9] Frixione, M. (1994), Logica, Significato e Intelligenza Artificiale. - Milano: Francoangeli.

[10] J. Cheng, Logical Tool of Knowledge Engineering: Using Entailment Logic rather than Mathematical Logic, Depertment of Computer Science and Communication Engineering, Kyushu University, Fukuoka, Japan, 1991.

BibliographyBibliography

NONMONOTONIC REASONING

[11] BREWKA, G. (1991), Nonmonotonic Reasoning: Logical Foundations of Commonsense. -Cambridge: Cambridge University Press.

[12] BREWKA, G., DIX, J. AND KONOLIGE, K. (1997), Non Monotonic Reasoning: An Overview. - Stanford: Center For The Study Of Language And Information.

[13] FISHER SERVI, G. (2001), Quando l'eccezione è la regola: le logiche non monotone. -Milano: McGraw-Hill.

[14] GABBAY, D.M., HOGGER, C.J. e ROBINSON, J.A. (a cura di) (1993 e 1994), Handbook of Logic in Artificial Intelligence and Logic Programming, Vol. III: Non Monotonic and Uncertain Reasoning. - Oxford.

La possibilità di costruire sistemi logici diversimostra che la logica non è ristretta alla riproduzionedei fatti, ma è un libero prodotto dell’uomo come un’opera d’arte.

Jan Łukasiewicz