knowledge representation-part 2

Upload: maryam-tariq

Post on 03-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Knowledge Representation-Part 2

    1/66

    First-Order Logic

    Study Material:

    Section 2.2-2.4,Chapter 2 in Luger, Artificial Intelligence:

    Structures and StrategiesExample 3.3.5, Chapter 3 in Luger, Artificial Intelligence:Structures and Strategies, pp 115-116

    1CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    2/66

    Propositional Logic Simple logic in which all sentences are assertions with

    truth values.

    e.g. it is raining

    We cannot access the components of an individualassertion

    e.g. if P represents A bug is in my soup we cannot

    access the bug or soup components No variables are allowed cannot create general

    assertions about entities.

    2CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    3/66

    Example 2

    Blocks WorldGoal: to create a set of expressionsthat is to represent a static snapshot ofthe blocks world.

    Assumption: predicates evaluatedtop-down, and left-right.

    b

    da

    c

    17CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    4/66

    Example 2

    Blocks Worldblock X is on block Y

    on(X, Y)

    block X is on the tableon_table(X)

    block X has nothing on top of it

    clear(x)

    the robots hand is emptyhand_empty

    b

    da

    c

    18CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    5/66

    Example 2

    Blocks WorldWhat is the domain of the variables X and

    Y in this world for the previousexpressions?

    D={a,b,c,d}

    What are the possible interpretations forX and Y for on(X,Y)?

    {, ,, ,,,,,,, }

    Which interpretations make on(X,Y) truein this world?

    {, }

    b

    da

    c

    19CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    6/66

    Example 2

    Blocks WorldA description of this blocks world:

    on(b,a)ontable(a)

    ontable(d)

    on(c,d)

    clear(b)clear(c)

    hand_empty

    b

    da

    c

    20CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    7/66

    Models and Interpretations Models are mathematical abstractions of the possible world.

    Models are defined by: a set of objects.

    the relations between them and the functions that can be applied to them

    Interpretations map the symbols of a language to the model: constant symbols are mapped to objects

    function symbols are mapped to functions

    predicate symbols are mapped relations in the model. Interpretations and models together determine the truth of a

    sentence.

    m is a model of sentence smeans sentence s is true in m.

    21CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    8/66

    Interpretations If an interpretation Imakes S true, we sayIsatisfiesS.

    If there is at least one interpretation Ithat makes Strue, we saySis satisfiable.

    If there is no interpretation I that makes Strue, we saySis unsatisfiable:

    X (p(X) p(X))

    22CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    9/66

    Interpretations If a sentence S is T under all interpretations, S is said

    to be valid.

    Examples: X (p(X) p(X))

    true

    The deduction theorem

    For any sentences s1 and S2, S1 entails sS2 if and only ifthe sentence (S1S2) is valid.

    (proof?)

    23CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    10/66

    Interpretations

    valid: All interpretations make S

    true

    satisfiableThere is aninterpretation

    that makes S true

    unsatisfiable

    Nointerpretationmakes S true

    24CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    11/66

    Example 2

    Blocks WorldGoal: to create a set of expressions that isto represent a static snapshot of the blocks

    world.Assumption: predicates evaluated top-

    down, and left-right.

    on(b,a)ontable(a)ontable(d)

    on(c,d)clear(b)clear(c)hand_empty

    b

    da

    c

    The blocks worldin this figure is amodelfor thisinterpretation

    25CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    12/66

    Example 2

    Blocks WorldWhen is a block clear?

    A block in our world is clear if there are no other blocks on top of it

    X ((Y on(Y,X)) clear(X))How can we clear a block clear?

    X ((Y on(Y,X)) clear(X))

    conditions action

    How can we stack a block on top of another?

    XY (hand_empty clear(X) clear(Y) pick_up(X) put_down(X,Y) stack(X,Y))

    b

    da

    c

    26CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    13/66

    Using FOL to Represent a Domain Domain: A part of the world of which we would like to express some

    knowledge. Components:

    assertions axioms (basic sentences that do not need to be proven)

    facts about the domainon(a, b) properties of objects or predicates (possibly partial)

    XY(on(Y,X) ontable(Y)) definitions

    X (((Y on(Y,X)) clear(X)) (clear(X)(Y on(Y,X)))

    theorems (entailed by axioms )X ((Y on(Y,X)) clear(X)) (assuming the definition is used in KB)

    queries/goals clear(a) => repsonse should be F X clear(X) => response: {X/b, X/c} Substitution list

    27CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    14/66

    Knowledge Endgineering

    The general process of knowledge base construction

    (Russell and Norvig, 2003)

    28CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    15/66

    Knowledge Endgineering Process1. Identify the task

    2. Assemble the relevant information

    3. Decide on a vocabulary of predicates, functions, andconstants.

    4. Encode general knowledge about the domain

    5. Encode a description of the specific problem instance

    6. Pose queries to the inference procedure and get answers.7. Debug the knowledge base

    29CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    16/66

    Example 3

    A Logic-Based Financial Advisor

    Goal: to help the user decide whether to invest in a savings account, thestock market only, or a combination of the two.

    Recommendations will be based on the investors current savings andtheir income according to the criteria:

    1. Individuals with an inadequate savings account should make

    increasing their savings a first priority.2. Individuals with an adequate savings account and an adequate

    income should consider investing in the stock market.

    3. Individuals with an adequate savings account and a lower incomeshould consider splitting their surplus income between savings

    and stocks. the adequacy of their savings account is determined by the number

    of dependents: s/he has to have at least $5000/dependent.

    An adequate income must be steady, at least $15,000/year plus anadditional $4,000 per dependent.

    30CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    17/66

    Example 3

    A Logic-Based Financial Advisor

    1. Identify the task

    Goal: to help the user decide whether to invest in a savingsaccount, the stock market only, or a combination of the

    two.

    31CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    18/66

    Example 3

    A Logic-Based Financial Advisor

    2. Assemble the relevant information

    Recommendations will be based on the investors current savings and theirincome according to the criteria:

    1. Individuals with an inadequate savings account should makeincreasing their savings a first priority.

    2. Individuals with an adequate savings account and an adequate incomeshould consider investing in the stock market.

    3. Individuals with an adequate savings account and a lower income

    should consider splitting their surplus income between savings andstocks.

    the adequacy of their savings account is determined by the number ofdependents: s/he has to have at least $5000/dependent.

    An adequate income must be steady, at least $15,000/year plus an

    additional $4,000 per dependent. 32CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    19/66

    Example 3

    A Logic-Based Financial Advisor

    3. Decide on a vocabulary of predicates, functions, andconstants.

    Recommendations will be based on the investors current savings andtheir income according to the criteria:

    1. Individuals with an inadequate savings account should make

    increasing their savings a first priority.

    2. Individuals with an adequate savings account and an adequateincome should consider investing in the stock market.

    3. Individuals with an adequate savings account and a lower incomeshould consider splitting their surplus income between savingsand stocks.

    the adequacy of their savings account is determined by the numberof dependents: s/he has to have at least $5000/dependent.

    An adequate income must be steady, at least $15,000/year plus an

    additional $4,000 per dependent. 33CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    20/66

    Example 3

    A Logic-Based Financial Advisor

    3. Decide on a vocabulary of predicates, functions, andconstants.

    Concepts

    the investors current savings

    adequate/inadequate

    the investors income

    adequate/inadequate

    steady/unsteady

    investment

    savings stock

    combination (savings and stock)

    the number of dependents

    An adequate income must be steady

    34CP468, Dr. Reem K. Al-Halimi

    E l 3

  • 7/28/2019 Knowledge Representation-Part 2

    21/66

    Example 3

    A Logic-Based Financial Advisor

    3. Decide on a vocabulary of predicates, functions, andconstants.

    Symbol Type Concept Name

    Function Symbols the investors current savings amount_saved

    the investors income earningsConstants adequate adequate

    inadequate inadequate

    savings savings

    stock stock

    combination combination

    steady steady

    unsteady unsteady

    Predicate Symbols invest invest

    dependents dependents 35CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    22/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    Decisions are based on savings_account(adequate)

    savings_account(inadequate)

    income(adequate)

    income(inadequate)

    decisions: invest(savings)

    invest(stocks)

    invest(combination)

    36CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    23/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    Decision criteria:1. savings_account(inadequate) invest(savings)

    2. savings_account(adequate) income(adequate) invest(stocks)

    3. savings_account(adequate) income(inadequate) invest(combination)

    37CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    24/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    adequate savings? the adequacy of their savings account is determined by the

    number of dependents: s/he has to have at least

    $5000/dependent.

    How many dependents? Y such that dependents(Y) is true

    What is the minimum savings required?

    minsavings(Y) = 5000*Y What are the actual savings?

    amount_saved(X) Are the actual savings greater than the minimum?

    greaterThan(X, minsavings(Y))

    38CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    25/66

    Example 3:A Logic-Based Financial Advisor

    3. Decide on a vocabulary of predicates, functions, and constants.

    Symbol Type Concept NameFunction Symbols the investors current savings amount_saved

    the investors income earnings

    minimum adequate savings minsavings

    Constants adequate adequate

    inadequate inadequate

    savings savings

    stock stock

    combination combination

    steady steadyunsteady unsteady

    Predicate Symbols invest invest

    dependents dependents

    test if one number is greater than another greaterThan 39CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    26/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    adequate savings? Are the savings adequate (check all amounts saved)?

    X amount_saved(X) Y (dependents(Y) greaterThan(X,minsavings(Y)) savings_account(adequate)

    X amount_saved(X) Y (dependents(Y) greaterThan(X,minsavings(Y)) savings_account(inadequate)

    40CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    27/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    adequate income? An adequate income must be steady, at least $15,000/year

    plus an additional $4,000 per dependent

    What is the minimum savings required? minincome(Y) = 15000 + 4000*Y

    What are the actual savings? earnings(X, Z)

    Are the actual earnings greater than the minimum? greaterThan(X, minincome(Y))

    41CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    28/66

    Example 3:A Logic-Based Financial Advisor

    3. Decide on a vocabulary of predicates, functions, and constants.

    Symbol Type Concept NameFunction Symbols the investors current savings amount_saved

    the investors income earnings

    minimum adequate savings minsavings

    minimum adequate income minincome

    Constants adequate adequate

    inadequate inadequate

    savings savings

    stock stock

    combination combinationsteady steady

    unsteady unsteady

    Predicate Symbols invest invest

    dependents dependents

    test if one number is greater than another greaterThan 42CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    29/66

    Example 3

    A Logic-Based Financial Advisor4. Encode general knowledge about the domain

    adequate income? An adequate income must be steady, at least $15,000/year

    plus an additional $4,000 per dependent

    Are the savings adequate (check all amounts saved)? X earnings(X, steady) Y (dependents(Y) greaterThan(X,

    minincome(Y)) income(adequate) X earnings(X, steady) Y (dependents(Y) greaterThan(X,

    minincome(Y)) income(inadequate)

    X earnings(X, unsteady) income(inadequate)

    43CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    30/66

    Example 3

    A Logic-Based Financial Advisor5. Encode a description of the specific problem

    instance

    Given a particular investor, we add his/her informationto the knowledge base:

    e.g. an investor with three children, $22,000 in savings,and $25,000 in steady income:

    earnings(25000, steady)

    amount_saved(22000)

    dependents(3)

    44CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    31/66

    Example 3

    A Logic-Based Financial Advisor6. Pose queries to the inference procedure and get

    answers.

    What type of investment should the customer make?

    X invest(X)

    How can the system find out the answer?

    45CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    32/66

    Components of First-Order Logic

    Proof System In propositional logic we could test an assumption

    using a truth table.

    We can use the same approach for sentences notcontaining variables

    46CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    33/66

    Components of First-Order Logic

    Proof System Let us take an example:

    if it is sunny, the weather will be warm

    S W (1) if it is warm, the school will be open

    W O (2)

    It is sunny

    S (3)

    Will the school be open?

    i.e. is true that in every world in which all of the abovesentences are true that O is true as well? Does Ologically follow from sentences 1, 2, and 3 above?

    47CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    34/66

    Components of First-Order Logic

    Proof SystemS W O SW WO

    T T F T F

    T T T T T

    T F T F T

    T F F F T

    F T T T T

    F T F T F

    F F T T T

    F F F T T

    48CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    35/66

    Components of First-Order Logic

    Proof SystemS W O SW WO

    T T F T F

    T T T T T

    T F T F T

    T F F F T

    F T T T T

    F T F T FF F T T T

    F F F T T

    49CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    36/66

    Components of First-Order Logic

    Proof SystemS W O SW WO

    T T F T F

    T T T T T

    T F T F T

    T F F F T

    F T T T T

    F T F T FF F T T T

    F F F T T

    Yes! The School will be open!

    50CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    37/66

    Components of First-Order Logic

    Proof System In propositional logic we could test an assumption

    using a truth table.

    this cannot necessarily be done in first-order logic.Why not?

    Solution? Use rules to create new conclusions fromgiven predicates

    51CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    38/66

    Components of First-Order Logic

    Proof System Logical inference is the ability to infer new correct

    expressions from a set of true assertions.

    Aproof procedure is a combination of an inference ruleand an algorithm for applying that rule on a set oflogical expressions to generate new sentences

    52CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    39/66

    Knowledge-Based System(from previous lectures) Consists of

    world knowledge (knowledge base) and a way to reason about this knowledge.

    KnowledgeBase

    InferenceEngine

    53CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    40/66

    Knowledge-Based SystemWorld knowledge is expressed in a language using the

    languages syntax and semantics rules.

    KnowledgeBase

    InferenceEngine

    Chirpy is a birdBirds have wings

    54CP468, Dr. Reem K. Al-Halimi

    World knowledge is expressed as a set of trueassertions about a problem domain.

  • 7/28/2019 Knowledge Representation-Part 2

    41/66

    Knowledge-Based System Inference rules are used to reason about the world inorder to determine when a predicate expressionlogically follows from a knowledge base.

    KnowledgeBase

    InferenceEngine

    Chirpy is a birdBirds have wingsChirpy has wings

    55CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    42/66

    Using Inference RulesA sentence (predicate expression) P is said to logically

    followfroma set of assertions S if and only if everyinterpretation and variable assignment that makes S

    true, also makes P true.

    S PS entails P

    S is true

    interpretations

    S is true

    56CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    43/66

    Using Inference Rules In our financial advisor problem our question is:

    given the knowledge base KB, does it logically followfrom the facts in KB that

    X invest(X)

    57CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    44/66

    Using Inference RulesAn inference rule is soundif every predicate calculus

    expression produced by the rule from a set S ofpredicate calculus expressions logically follows from S.

    An inference rule is complete if, given a set S ofpredicate calculus expressions, the rule can infer every

    expression that logically follows from S.

    58CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    45/66

    Using Inference Rules

    Examples Modus Ponens

    PQ

    P

    Q

    Modus ponens is a sound inference rule.

    Example:

    lawyer(john)

    rich(john)lawyer(john)

    We can conclude:

    rich(john)

    59CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    46/66

    Using Inference Rules

    Examples Modus Tollens

    PQ

    Q

    P

    Modus tollens is a sound inference rule.

    Example:

    lawyer(john)

    rich(john)rich(john)

    We can conclude:

    lawyer(john)

    60CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    47/66

    Using Inference Rules

    Examples Elimination

    P Q P Q

    Q P Elimination is a sound inference rule.

    Example:

    cat(snowball) white(snowball)

    We can conclude:

    cat(snowball )

    white(snowball)

    61CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    48/66

    Using Inference Rules

    ExamplesAnd Introduction

    P

    Q

    P Q

    And introduction is a sound inference rule.

    Example:

    cat(snowball )white(snowball)

    We can conclude:

    cat(snowball) white(snowball)

    62CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    49/66

    Using Inference Rules

    Examples Universal Instantionation

    X P(X)

    P(a) Universal instantiation is a sound inference rule.

    Example:

    X mortal(X)

    if russell is in the domain of X, we can conclude:

    mortal(russell)

    63CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    50/66

    Using Inference Rules

    ExamplesX (man(X)mortal(X))

    man(socrates)

    Prove that Socrates is mortal?

    X (man(X)mortal(X))

    man(socrates)mortal(socrates) using Universal Instantiation

    mortal(socrates) by applying modus ponens

    64CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    51/66

    Using Inference Rules

    Unification Unification is an algorithm for determining the

    substitutions needed to make two or more predicateexpressions match.

    To use the unification algorithm all variables in alogical database must be universally quantified.

    65CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    52/66

    Using Inference Rules

    Unification unify:

    1. mortal(X) and mortal(socrates)

    {socrates/X}

    2. knows(john, X) and knows(john, jane){jane/X}

    3. knows(john, X) and knows(Y, bill)

    {bill/X, john/Y}

    4. knows(john, X) and knows(Y, mother(Y))

    {john/Y, mother(john)/X}

    5. knows(john, X) and knows(X, bill)fail

    Substitution list

    66CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    53/66

    Using Inference Rules

    Unification substitution list {X/Y} means: X replaces Y in the

    original expression

    67CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    54/66

    Using Inference Rules

    Unification Rules1. constants cannot be replaced2. a variable cannot be unified with a term containing

    it.

    e.g. X cannot be replaced by f(X)

    Why?

    3. Once a variable has been bound, future unifications

    must take the value of this binding into account.

    68CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    55/66

    Using Inference Rules

    Unification Algorithm Basic idea:

    1. sentences are represented as lists

    2. equal constants return an empty substitution list

    3. individual variables are bound to whatever occurs inthe other sentence.

    4. if either expression is empty, unification fails

    5. sentences are bound by

    1. recursively unifying the first elements in each,2. then applying the substitution list to the rest of each list

    3. recursively unifying the remainder of the two lists.

    4. creating a single substitution list bycomposition of the listsfrom steps 5.1 and 5.3 above.

    69CP468, Dr. Reem K. Al-Halimi

    Using In erence Ru es

  • 7/28/2019 Knowledge Representation-Part 2

    56/66

    Using In erence Ru esUnification Algorithm

    Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009 70CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    57/66

    Using Inference Rules

    Unification Algorithm: Composition Composition the process of creating a single

    substitution list from two or more lists by applying oneto the other:

    {X/Y, W/Z} and {V/X} and {a/V, f(b)/W}

    1. composing {V/X} and {a/V, f(b)/W}:

    {a/X, a/V, f(b)/W}

    2. composing {X/Y, W/Z} and {a/X, a/V, f(b)/W}{a/Y, a/X, a/V, f(b)/Z, f(b)/W}

    71CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    58/66

    Using Inference Rules

    Unification Algorithm: Composition Composition is associative

    composition(sub1, composition(sub2, sub3)) =composition(composition(sub1, sub2), sub3)

    but not commutative

    composition(sub1, sub2) composition(sub1, sub2)

    72CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    59/66

    Using Inference Rules

    Unification Algorithm: Most General Unifier Unify:

    knows(john, X)knows(Y,Z)

    Possible substitutions:G = {john/Y, Z/X}S = {john/Y, john/X, john/Z}

    G is the substitution list with the least restrictions on thevariable values => G is called the most general unifier The unification algorithm described earlier calculates the

    most general unifier for any given set of expressions .

    73CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    60/66

    Using Inference Rules

    Unification Algorithm Unify:

    knows(john, X)

    knows(Y,Z)

    74CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    61/66

    Using Inference Rules

    Unification Algorithmunify((knows john X), (knows Y Z))

    unify(knows, knows )

    return {}

    unify(( john X), (Y Z))

    unify(john, Y)

    return {john/Y}

    unify((X), (Z))

    unify(X, Z)

    return {Z/X}

    unify((), ())

    return {}

    return {Z/X}

    return {john/Y, Z/X}

    1 2 3

    4 5 6

    7 89

    11

    12

    10

    75CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    62/66

    Using Inference Rules

    Financial Advisor Example continued How can we choose which investment is best for the

    investor?

    One approach: Goal-directed, depth-first search

    Goal: X invest(X)

    76CP468, Dr. Reem K. Al-Halimi

    Using In erence Ru es

  • 7/28/2019 Knowledge Representation-Part 2

    63/66

    Using In erence Ru esFinancial Advisor Example continued

    Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009

    77CP468, Dr. Reem K. Al-Halimi

    s ng n erence u es

  • 7/28/2019 Knowledge Representation-Part 2

    64/66

    s ng n erence u esFinancial Advisor Example continued

    Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009From Fig 3.26 And/or graph searched by the financial advisor.

    1. savings_account(inadequate) invest(savings)

    78CP468, Dr. Reem K. Al-Halimi

    Using In erence Ru es

  • 7/28/2019 Knowledge Representation-Part 2

    65/66

    Using In erence Ru esFinancial Advisor Example continued

    Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009From Fig 3.26 And/or graph searched by the financial advisor.

    X amount_saved(X) Y (dependents(Y) greaterThan(X,

    minsavings(Y)) savings_account(inadequate)

    Unificationresult

    {20000/X}

    Unificationresult {2/Y}

    79CP468, Dr. Reem K. Al-Halimi

  • 7/28/2019 Knowledge Representation-Part 2

    66/66

    Summary Presented First Order Logic (FOL) as a powerful knowledge

    representation language. Discussed the component of FOL: alphabet, syntax, semantics,

    and proof systems.

    Defined models and interpretations.

    Looked at the components of a knowledge base and the

    procedure involved in creating a knowledge-based system. Discussed inference rules and their properties: valid, satisfiable,

    and unsatisfiable.

    Looked at the use of sound inference rules in generating newfacts from a given set of assertions.

    Presented important sound inference rules: modus ponens,modus tollens, and elimination, and universal instantiation.

    Looked at the use of inference rules and search in a simple expertsystem through the financial advisor example.