New version page

USC CSCI 561 - session19

Upgrade to remove ads

This preview shows page 1-2-3-20-21-40-41-42 out of 42 pages.

Save
View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

Logical reasoning systemsSlide 2Basic tasksIndexing, retrieval & unificationComplexityTable-based indexingSlide 7Tree-based indexingSlide 9Unification algorithm: ExampleUnification algorithmLogic programmingLogic programming systemsProlog systemsBasic syntax of facts, rules and queriesA PROLOG ProgramSlide 17A PROLOG QuerySlide 19A PROLOG Query IISlide 21Prolog exampleAppendExpanding PrologTheorem proversOTTERSlide 27ExampleExample: Robbins Algebras Are BooleanSlide 30Slide 31Forward-chaining production systemsImplementationMatch phaseRete networkRete matchAdvantages of Rete networksConflict resolution phaseFrame systems & semantic networksSyntax and SemanticsSemantic Network RepresentationSemantic network link typesCS 561, Session 191Logical reasoning systems•Theorem provers and logic programming languages•Production systems•Frame systems and semantic networks•Description logic systemsCS 561, Session 192Logical reasoning systems•Theorem provers and logic programming languages – Provers: use resolution to prove sentences in full FOL. Languages: use backward chaining on restricted set of FOL constructs.•Production systems – based on implications, with consequents interpreted as action (e.g., insertion & deletion in KB). Based onforward chaining + conflict resolution if several possible actions.•Frame systems and semantic networks – objects as nodes in agraph, nodes organized as taxonomy, links represent binaryrelations.•Description logic systems – evolved from semantic nets. Reasonwith object classes & relations among them.CS 561, Session 193Basic tasks•Add a new fact to KB – TELL•Given KB and new fact, derive facts implied by conjunction of KB and new fact. In forward chaining: part of TELL•Decide if query entailed by KB – ASK•Decide if query explicitly stored in KB – restricted ASK•Remove sentence from KB: distinguish between correcting false sentence, forgetting useless sentence, or updating KB re. change in the world.CS 561, Session 194Indexing, retrieval & unification•Implementing sentences & terms: define syntax and map sentences onto machine representation.Compound: has operator & arguments.e.g., c = P(x)  Q(x) Op[c] =  ; Args[c] = [P(x), Q(x)]•FETCH: find sentences in KB that have same structure as query.ASK makes multiple calls to FETCH.•STORE: add each conjunct of sentence to KB. Used by TELL.e.g., implement KB as list of conjunctsTELL(KB, A  B) TELL(KB, C  D)then KB contains: [A, B, C, D]CS 561, Session 195Complexity•With previous approach, FETCH takes O(n) time on n-element KBSTORE takes O(n) time on n-element KB (if check for duplicates)Faster solution?CS 561, Session 196Table-based indexing•What are you indexing on? Predicates (relations/functions). Example:Key Positive Negative Conclu-sionPremiseMother Mother(ann,sam)Mother(grace,joe)-Mother(ann,al) xxxx xxxxdog dog(rover)dog(fido)-dog(alice) xxxx xxxxCS 561, Session 197Table-based indexing•Use hash table to avoid looping over entire KB for each TELL or FETCHe.g., if only allowed literals are single letters, use a 26-element array to store their values.•More generally: - convert to Horn form- index table by predicate symbol- for each symbol, store: list of positive literalslist of negative literalslist of sentences in which predicate is in conclusionlist of sentences in which predicate is in premiseCS 561, Session 198Tree-based indexing•Hash table impractical if many clauses for a given predicate symbol•Tree-based indexing (or more generally combined indexing):compute indexing key from predicate and argument symbolsPredicate?First arg?CS 561, Session 199Tree-based indexingExample:Person(age,height,weight,income)Person(30,72,210,45000)Fetch( Person(age,72,210,income))Fetch(Person(age,height>72,weight<210,income))CS 561, Session 1910Unification algorithm: ExampleUnderstands(mary,x) implies Loves(mary,x)Understands(mary,pete) allows the system to substitute pete for x and make the implication that IFUnderstands(mary,pete) THEN Loves(mary,pete)CS 561, Session 1911Unification algorithm•Using clever indexing, can reduce number of calls to unification•Still, unification called very often (at basis of modus ponens) => need efficient implementation.•See AIMA p. 303 for example of algorithm with O(n^2) complexity(n being size of expressions being unified).CS 561, Session 1912Logic programmingRemember: knowledge engineering vs. programming…CS 561, Session 1913Logic programming systemse.g., Prolog:•Program = sequence of sentences (implicitly conjoined)•All variables implicitly universally quantified•Variables in different sentences considered distinct•Horn clause sentences only (= atomic sentences or sentences with no negated antecedent and atomic consequent)•Terms = constant symbols, variables or functional terms•Queries = conjunctions, disjunctions, variables, functional terms•Instead of negated antecedents, use negation as failure operator: goal NOT P considered proved if system fails to prove P•Syntactically distinct objects refer to distinct objects•Many built-in predicates (arithmetic, I/O, etc)CS 561, Session 1914Prolog systemsCS 561, Session 1915Basic syntax of facts, rules and queries <fact> ::= <term> .<rule> ::= <term> :- <term> .<query> ::= <term> .<term> ::= <number> | <atom> | <variable> | <atom> (<terms>)<terms> ::= <term> | <term>, <terms>CS 561, Session 1916A PROLOG ProgramA PROLOG Program•A PROLOG program is a set of facts and rules.•A simple program with just facts :parent(alice, jim).parent(jim, tim).parent(jim, dave).parent(jim, sharon).parent(tim, james).parent(tim, thomas).CS 561, Session 1917A PROLOG ProgramA PROLOG Program•c.f. a table in a relational database.•Each line is a fact (a.k.a. a tuple or a row).•Each line states that some person X is a parent of some (other) person Y.•In GNU PROLOG the program is kept in an ASCII file.CS 561, Session 1918A PROLOG QueryA PROLOG Query•Now we can ask PROLOG questions :| ?- parent(alice, jim).yes| ?- parent(jim, herbert).no| ?-CS 561, Session 1919A PROLOG QueryA PROLOG Query•Not very exciting. But what about this :| ?- parent(alice, Who).Who = jimyes| ?-•Who is called a logical variable.•PROLOG will set a logical variable to any value which makes the query succeed.CS 561, Session 1920A PROLOG Query IIA PROLOG Query II•Sometimes there is more than one correct answer to a query. •PROLOG gives the


View Full Document
Download session19
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view session19 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view session19 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?