1 / 9

Logical Foundations of AI

Logical Foundations of AI. Logic Programming. Making FOL Practical. Barriers to using FOL: Choice of clauses to resolve Huge amount of memory to store DAG Getting useful answers to queries (not just “yes” or “no”) PROLOG’s answers:

royce
Télécharger la présentation

Logical Foundations of AI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Logical Foundations of AI Logic Programming

  2. Making FOL Practical • Barriers to using FOL: • Choice of clauses to resolve • Huge amount of memory to store DAG • Getting useful answers to queries (not just “yes” or “no”) • PROLOG’s answers: • Simple backward-chaining resolution strategy – left/right, first to last clause • Tree-shaped proofs – no need to store entire proof in memory at one time • Extract answers to queries by returning variable bindings

  3. PROLOG Examples Happy Ancestor Lists Genesis

  4. Lists • Terms in Prolog can be used as data structures • Lists: can be built using a 2-place function symbol "list" and a constant "nil" list(a,list(b,list(c,nil))) • (note: most implementations call the list function symbol ".") • Prolog provides shorthand: [a,b,c] • Notation: [a, b, | R] is a list where R is the "rest of the list" (also a list). • Suppose variable R is bound to [c,d] • Then [a,b|R] is [a,b,c,d]

  5. Unifying Lists [a,b,c] and X X=[a,b,c] [a,b,c] and [a,X,Y] X=b,Y=c [a,b,c] and [X|Y] X=a, Y=[b,c] [X,b,Y] and [a,Z,Z] X=a, Z=b, Y=b

  6. PROLOG Examples Lists Genesis

  7. Prolog Limitations • Only handles definite clauses (exactly one positive literal per clause) • Cannot express e.g. happy(bill) v happy(henry) • Tree-shaped proofs means some sub-steps may be repeatedly derived • DATALOG: does forward-chaining inference and caches derived unit clauses • Interpreter can get into an infinite loop if care is not taken in form & order of clauses

  8. Exercise • You have just been hired by snacks.com, an Internet startup that provides snacking recommendations. Your first assignment is to create an expert system that will recommend snacks according to the following rules: • Every snack should contain one beverage and one munchie. • Sweet beverages are good with salty munchies. • Bitter beverages are good with sweet munchies or salty munchies. • Define a predicate snack(X,Y) that makes such recommendations.

  9. Procedural Control • Order of clauses • cousin(jane,sam). • cousin(X,Y):-granparent(Z,X),grandparent(Z,Y) • Order of literals within a clause • americanCousin(X,Y):-american(X,Y),cousin(X). • americanCousin(X,Y):-cousin(X,Y),american(X) • Cut (commit) operator ! • americanCousin(X,Y):-cousin(X,Y),!,american(X).

More Related