Top Banner

of 43

bab2bab1

Apr 14, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/27/2019 bab2bab1

    1/43

    1

    Predicate Logic

    A Logic is a formal language, with precisely defined syntax andsemantics, which supports sound inference. Independent of domain of application.Different logics exist, which allow you to represent different kinds of things, and which allow more or less efficient inference.

    Ch02 / 1

    propositional logic, predicate logic, temporal logic, modal logic,

    description logic..But representing some things in logic may not be very natural, andinferences may not be efficient. More specialised languages may bebetter.

  • 7/27/2019 bab2bab1

    2/43

    2

    Review of Proposition Logic

    We need formal notation to represent knowledge, allowing automatedinference and problem solving.

    syntax: what expressions are allowed in the language.

    Ch02 / 2

    Semantics: what they mean, in terms of a mapping to real worldproof theory: how we can draw new conclusions from existingstatements in the logic. Propositional logic is the simplest..

    Propositional logic is the simplest.Symbols represent facts: P, Q, etc..These are joined by logical connectives (and, or, implication) e.g., P

    Q; Q RGiven some statements in the logic we can deduce new facts (e.g.,from above deduce R)

    In general a logic is defined byOne popular choice is use of logic.

  • 7/27/2019 bab2bab1

    3/43

    3

    Review of Proposition Logic

    Propositional Logic/Calculus Sentences:

    Ch02 / 3

    Every propositional symbol and truth symbol is a sentences.E.g.: true, false, P, Q, and R

    The negation of a sentence is a sentence.E.g.: Q and true

    The conjunction, or and, of two sentences is a sentence.E.g.: P Q, P P

    The disjunction, or or and, of two sentences is a sentence.E.g.: P Q, P P

    The implication of one sentence from another is a sentence.E.g.: P Q

    The equivalence of two sentences is a sentence.E.g.: P Q R

    An expression is a sentence, or well-formed formula (WFF), of thepropositional logic if and only if it can be formed of legals symbolthrough some sequence of rules. E.g.:

    ((P Q ) R) P Q R Why?

  • 7/27/2019 bab2bab1

    4/43

    4

    Review of Proposition Logic: Syntax

    Ch02 / 4

    Symbols (e.g., letters, words) are used to represent facts about theworld, e.g.,

    P represents the fact Ahmad likes chocolate Q represents the fact Ahmad has chocolate Simple facts above are called atomic propositions.Complex facts can be built by combining atomic propositions with thelogical connectives :

    and: , conjunction of two sentencesor: , disjunction of two sentencesif-then: (implication), P Q where P premise & Q conclusion

    : equivalencenot: negation

    Statements or sentences in the language are constructed from atomic

    propositions and logical connectives.P Q Ahmad likes chocolate and he doesnt have any. P Q If Ahmad likes chocolate then Ahmad has chocolate P Q If Ahmad likes chocolate then Ahmad has chocolate, andvice versa

    Q Ahmad doesnt have chocolate

  • 7/27/2019 bab2bab1

    5/43

    5

    Review of Proposition Logic: Semantics

    Ch02 / 5

    What does it all mean?Sentences in propositional logic tell you about what is true or false.

    P Q means that both P and Q are true.P Q means that either P or Q is true (or both)P Q means that false if P is true and Q is false, otherwise true.

    To determine whether the sentences are truth or falsity, truth tableswill be used .

    X Y X Y X Y X X Y X Y ( X Y) ( X Y ) T T T T F T T T T F T F F F F T F T T F T T T T F F F F T T T T

    We now know exactly what is meant in terms of the truth of theelementary propositions when we get a sentence in the language (e.g., P

    Q R).

    P Q means that true if both P and Q are have the same truthvalue

  • 7/27/2019 bab2bab1

    6/43

    6

    Review of Proposition Logic: Proof Theory

    Ch02 / 6

    How do we draw new conclusions from existing supplied facts?We can define inference rules, which are guaranteed to give trueconclusions given true premises.For propositional logic useful one is modus ponens:

    If A is true and A B is true, then conclude B is true.

    A, A B

    B

  • 7/27/2019 bab2bab1

    7/43

    7

    Review of Proposition Logic: Proof Theory

    Proof Theory and InferenceSo, let P mean It is raining , Q mean I carry my umbrella .

    Ch02 / 7

    If we know that P is true, and P Q is true

    think about P Q and P Q.Other rules of inference can be used, e.g.,:

    This is essentially the resolution rule of inference, used in Prolog.

    We can conclude that Q is true.Note that certain expressions are equivalent

    A B, B C

    A C

  • 7/27/2019 bab2bab1

    8/43

    8

    Review of Proposition Logic: Proof Theory

    Consider:

    Ch02 / 8

    What can we conclude?

    sunny rainingraining umbrella

    We can use the rule of inference, given the first two sentences, toconclude sunny carryumbrella .

    Proof:Suppose we want to try and prove that a certain proposition istrue, given some sentences that are true.It turns out that the resolution rule is sufficient to do this.

    We put all the sentences into a standard or normal form(replacing A B with A B)There is then a standard procedure that lets you determine if theproposition in question is true.

  • 7/27/2019 bab2bab1

    9/43

    9

    Predicate Logic

    Propositional logic isnt powerful enough as a general knowledgerepresentation language.

    Ch02 / 9

    Impossible to make general statements. E.g., It rained on Tuesday .

    In proposition logic, each atomic symbol (P, Q, etc) denotes aproposition of some complexity.

    Through inference rule we can manipulate predicate logic expressions,

    accessing their individual components and inferring new sentences.

    Instead of letting a single propositional symbol, P, denote the entiresentence It rained on Tuesday, we can create a predicate weather that describes a relationship between a date and the weather:weather(Tuesday,rain)

    No way to access the components of an individual assertion.

    Predicate logic provides this ability. How?

  • 7/27/2019 bab2bab1

    10/43

    10

    Predicate Logic

    Ch02 / 10

    In predicate logic the basic unit is a predicate/argument structurecalled an atomic sentence:

    Predicate(Argument1,Argument2,..,ArgumentN)- Predicate like constants and function names, begin with a lowercase letter - Predicate names a relationship between zero or more object in the world- Number of object related is the arity of the object

    Suppose Arguments can be any of:

    constant symbol, such as Ahmad variable symbol, such as Xfunction expression, e.g., motherof(Abu)

    Advantages:well defined formal sentences.sound and complete inference rules.

    E.g.:likes(Ahmad, chocolate)tall(Abu)

    So we can have:likes(X, Abdullah)friends(motherof(Abu), motherof(Lim))

  • 7/27/2019 bab2bab1

    11/43

    11

    Predicate Logic: Syntax

    Ch02 / 11

    Syntax

    Symbols must begin with a letter and are followed by any sequence of these legal characters.

    Not include special characters (#,%,@,/,&, ,#) Valid symbols:George fire3 tom_and_jerry bill XXXX friends_of

    Symbols include:Truth symbols true and false (reserved symbols)

    Constant symbols symbols expressions having the first character lowercaseVariable symbols symbols expressions beginning with anuppercase character Function symbols symbols expressions having the first character lowercase. Have arity indicates the number of elements of the

    domain mapped onto each element of the range.

    The set of letters, both upper- and lowercaseThe set of digits, 0,1,,9 The underscore, _

    Predicate logic symbols consist of

  • 7/27/2019 bab2bab1

    12/43

    12

    Predicate Logic: Syntax

    Ch02 / 12

    Sentences can also be formed using quantifiers (forall) and (thereexists) to indicate how to treat variables:

    X lovely(X) Everything is lovely.X lovely(X) Something is lovely.X in(X, garden) lovely(X) Everything in the garden is lovely.

    Can have several quantifiers, e.g.,X Y loves(X, Y)Everything loves something

    X handsome(X) Y loves(Y, X)Every handsome has something that they love.

    These atomic sentences can be combined using logic connectiveslikes(john, mary) tall(mary)

    tall(john) nice(john)

  • 7/27/2019 bab2bab1

    13/43

    13

    Predicate Logic:Syntax

    So we can represent things like:All men are mortal.

    No one likes brussel sprouts.Everyone taking SAK4602 will pass their exams.Every race has a winner.John likes everyone who is tall.John doesnt like anyone who likes brussel sprouts. There is something small and slimy on the table.

    Ch02 / 13

    TermEither constant, variable, or expression.May used to denote objects and properties in a problem domain.Examples:

    Cat, times(2,3), X, blue, mother(jane), kate

  • 7/27/2019 bab2bab1

    14/43

    14

    Predicate Logic:Syntax

    Atomic sentences

    Ch02 / 14

    A predicate constant of arity n followed by n terms, t 1,t2,..,tn enclosed in

    parentheses and separated by commas.Examples:Truth values, true and falselikes(ahmad, aminah)helps(bill, george)Friends(bill, george)friends(father_of(ahmad), father_of(abu))

    Describes a relationship between two objects in a domaindiscourse.Arguments are represented as function expressions whosemappings (given that the father_of ahmad is salleh and the

    father_of abu is bakar) form the parameters of the predicate

  • 7/27/2019 bab2bab1

    15/43

    15

    Predicate Logic:Syntax

    Complex sentences

    Ch02 / 15

    Combination of atomic sentences with logical connectives: , , , ,

    , and ., Universal quantifier indicates that the sentence is true for allvalues of the domain.

    , Existential quantifier indicates that the sentence is true for atleats one value in the domain.

    Examples 1: Y friends(Y, abdullah)

    True if there is at least one object , indicated by Y that is afriend of abdullah.

    X likes(X, ice_cream)True for all values in the domain of the definition of X

    X(likes(usman, X) eats(usman, X)Usman eate everything that he likes.X (bird(X) flies(X))

    There exists some bird that doesnt fly. X (person(X) Y loves(X, Y))

    Every person has something that they love.

  • 7/27/2019 bab2bab1

    16/43

    16

    Predicate Logic:Syntax

    Ch02 / 16

    Examples 2: Set of family relationshipmother(rokiah, salleh)mother(rokiah, usman)father(abdullah, salleh)father(abdullah, usman)

    X Y (father(X,Y) mother(X,Y) parent(X, Y))

    X Y Z (parent(X,Y) parent(X,Z) sibling(Y,Z))In this example, we use the predicates mother and father to define aset of parent-child relationshipsImplications give general definitions of other relationships

    parent

    siblingImplications above can be used to infer facts

    sibling(usman,salleh)

  • 7/27/2019 bab2bab1

    17/43

    17

    Predicate Logic:Semantics

    Ch02 / 17

    SemanticsThere is a precise meaning to expressions in predicate logic.

    Like in propositional logic, it is all about determining whether something is true or false.

    X P(X) means that P(X) must be true for every object X in the domainof interest .

    X P(X) means that P(X) must be true for at least one object X in thedomain of interest.So if we have a domain of interest consisting of just two people, johnand mary, and we know that tall(mary) and tall(john) are true, we cansay that X tall(X) is true.

    It determine their meaning in terms of objects, properties, andrelationship in the world.The truth of expressions depends on the mapping of constants,variables, predicates, and functions into objects and relationship inthe domain of interest.

  • 7/27/2019 bab2bab1

    18/43

    18

    Predicate Logic:Semantics

    Ch02 / 18

    Examples 1:If it doesnt rain tomorrow, ahmad will go fishing.

    weather(rain, tomorrow) go(ahmad, fishing).Allbasketball players are tall. X (basketball_players( X ) tall( X ) ).

    Nobodylikes taxes. X likes( X , taxes).

    da

    bc

    Examples 2: Blocks World with its predicate logic descriptionon(c,a)on(b,d)ontable(a)

    ontable(d)clear(b)clear(c)hand_empty

    d

  • 7/27/2019 bab2bab1

    19/43

    19

    Predicate Logic:Semantics

    Ch02 / 19

    We need to represent knowledge based on:Does a given block have a clear top surface?

    Can we pick up block a? etc.Assume that the computer has knowledge of the location of each blockand the arm and is able to keep track of these location as the handmoves blocks about the table.

    The arm can move blocks, change the state, and clear.Example 2.1: Pick up a block and stack it on another block.

    Is block a clear ?Remove block c.Delete the knowledge of on(c,a).Pick up block a.

    The following rule describes when a block is clear:X( Y on(Y,X) clear(X))

    For all X, X is clear if there does not exist a Y such that Y is onX.

    P di L i S i

  • 7/27/2019 bab2bab1

    20/43

    20

    Predicate Logic:Semantics

    Ch02 / 20

    Example 2.2: To stack X on YFirst empty the hand,

    Clear X Clear Y Pick up X Put down X on Y

    The following rule describes when a block is clear:

    X Y((hand_empty clear(X) clear(Y) pick_up(X) put_down(X,Y)) stack(X,Y))For all X and Y, if hand empty, and X and Y is clear, and pick upX and put X on Y such that X stack on Y.

    P di t L i S ti

  • 7/27/2019 bab2bab1

    21/43

    21

    Predicate Logic:Semantics

    Ch02 / 21

    Examples 3: Mapping of symbols into objects and relations in the domainof definition

    friends(ali, bakar)friends(ali, ismail) Objects and relations

    Asking expression :? friends(ali, bakar)? friends(ali, ali)

    TrueFalse

    First-Order Predicate LogicUniversally and existentially quantified variables may refer only toobjects (constants) in the domain of discourse.Predicate and function names may not be replaced by quantifiedvariables.Examples of valid sentences for predicate p and q and variables X and Y:

    p(X) = X p(X)X p(X) = X p(X)

    X p(X) = Y p(Y)

    X q(X) = Y q(Y)X(p(X) q(X)) = Xp(X) Yq(Y)X(p(X) q(X)) = Xp(X) Yq(Y)

    P di t L gi P f d I f

  • 7/27/2019 bab2bab1

    22/43

    22

    Predicate Logic: Proof and Inference

    Ch02 / 22

    Proof and InferenceThere again we can define inference rules allowing us to say that if

    certain things are true, certain other things are sure to be true, e.g.X P(X) Q(X)P(something)----------------- (so we can conclude)Q(something)This involves matching P(X) against P(something) and binding thevariable X to the symbol something.What can we conclude from the following?

    X tall(X) strong(X)tall(john)

    X strong(X) loves(mary, X)Proof Procedure

    A combination of an inference rule and an algorithm for applyingthat rule to a set of logical expressions to generate new sentences.

    Predicate Logic: Proof and Inference

  • 7/27/2019 bab2bab1

    23/43

    23

    Predicate Logic: Proof and Inference

    Ch02 / 23

    A predicate logic expression X logically follows from a set S of predicate logic expressions if every interpretation and variableassignment that satisfies S also satifies X.

    Logically follows mean that X is true for every interpretation thatsatisfies S

    Inference rule

    soundIf every predicate logic expression produced by the rulefrom a set S of predicate logic expressions also logically

    follows from S.Two examples:Modus ponensResolution

    Essentially a mechanical means of producing new predicatelogic sentences from other sentences.Its produce new sentences based on the syntactic form of givenlogical assertion.

    Predicate Logic: Proof and Inference

  • 7/27/2019 bab2bab1

    24/43

    24

    Predicate Logic: Proof and Inference

    Ch02 / 24

    CompleteIf, given a set S of predicate logic expressions, the rule can

    infer every expression that logically follows from S.Modus ponens.Sound inference rule.If the premise is true then the conclusions are guaranteed true.If we are given an expression of the form P Q and another expression of the form P such that both are true under aninterpretation I, then modus ponens allows us to infer that Q is alsotrue for that interpretation.

    Because modus ponens is sound, Q is true for allinterpretations for which P and P Q are true.

    Example 1: Assume the following observations

    P denotes itis raining. Q denotes theground is wet. P Q denotes if it is raining then the ground is wet. How to proof Q is true?Now is raining (P is true) and P Q generally true, then Q is true.

    Predicate Logic: Proof and Inference

  • 7/27/2019 bab2bab1

    25/43

    25

    Predicate Logic: Proof and Inference

    Ch02 / 25

    Example 2: Expression containing variablesallmen are mortal and Socrates is a men; therefore Socrates is

    mortal.

    man(socrates) mortal(socrates) conclusionThis is added to the set of expressions that logically follow from theoriginal assertions.

    Represents the all men are mortal in predicate calculus:X(man(X) mortal(X)

    Represents the Socrates is a man in predicate calculus:man(socrates)

    Because the X in the implication is universally quantified, we maysubstitute any value in the domain for X.By subtituting socrates for X in the implication, then we can infer:

  • 7/27/2019 bab2bab1

    26/43

    Predicate Logic: Unification

  • 7/27/2019 bab2bab1

    27/43

    27

    Predicate Logic: Unification

    Ch02 / 27

    Example 2: Some instances of the expressionfoo(X,a,goo(Y))

    Generated by legal substitutions are given below:1. foo(fred, a, goo(Z))2. foo(W, a, goo(jack))3. foo(Z, a, goo(moo(Z)))

    In the example above, the substitution instances or unification thatwould make the initial expression identical to each of the other three are written as

    1. {fred/X, Z/Y}2. {W/X, jack/Y}3. {Z/X, moo(Z)/Y}

    The notation X/Y, indicates that X is substituted for the variable Y

    in the original expression.

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    28/43

    28

    Predicate Logic: Application

    Ch02 / 28

    Example 1: A Logic-Based Financial Advisor The function of the advisor is to help a user decide whether to

    invest in a savings account or the stock market. The investmentthat will be recommended for individual investors depends on their income and the current amount they have saved according to thefollowing criteria:1. Individuals with an inadequate savings account should always

    increasing the amount saved the priority, regardless of their income2. Individuals with an adequate savings account and an adequateincome should consider a riskier but potentially more profitableinvestment in the stock market.

    3. Individuals with a lower income who already have an savingsaccount may want to consider splitting their surplus incomebetween savings and stocks, to increase the cushion in savingswhile attempting to increase their income through stocks.

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    29/43

    29

    Predicate Logic: Application

    Ch02 / 29

    The adequacy of both is determined by the number of dependentsan individual must support.

    Our rule:1. At least RM5000 in the bank for each dependent.2. An adequate income must be steady income and supply at least

    RM15,000 per year plus an additional RM4000 for eachdependent.

    To automate this advice, we translate these guidelines intosentences in the predicate logic.1. Determines the major features that must be considered. Here,

    they are the adequacy of the savings and the income. They arerepresented by:

    savings_account(adequate).

    savings_account(inadequate).income(adequate).income(inadequate).

    2. Conclusion are represented by the unary predicate investment,with possible values of its argument being stock, savings or combination (implying that the investment should be split)

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    30/43

    30

    g pp

    Ch02 / 30

    The different investment strategies are represented byimplications:

    savings_account(inadequate) investment(savings)savings_account(inadequate) income(adequate) investment(savings)

    savings_account(inadequate) income(inadequate) investment(savings)

    3. The advisor must determines when savings and income areadequate or inadequate:

    Xamount_saved(X) Y(dependents(Y) greater(X,minsavings(Y) ) ) savings_account(adequate).

    Xamount_saved(X) Y(dependents(Y) greater(X, minsavings(Y))) savings_account(inadequate).

    minsavings (Y) is a function : minsavings(Y) = 5000*Y;

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    31/43

    31

    g pp

    Ch02 / 31

    4. Determines when income are adequate or inadequate:Xearnings(X,steady) Y(dependents(Y)

    greater(X, minincome(Y)) ) income(adequate).Xearnings(X,steady) Y(dependents(Y) greater(X, minincome(Y) ) ) income(inadequate).

    X earnings(X,unsteady) income(inadequate).

    Where minincome(Y) = 15000+(4000*Y)

    Inorder to perform a consultation, a description of a particular investor is added to this set of sentences using:amount_saved(22000).earnings(25000, steady).dependents(3).

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    32/43

    32

    g pp

    Ch02 / 32

    This yield a logical system consisting:

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    33/43

    33Ch02 / 33

    Unification Process:Unify the conjunction of 10 and 11 with the first two components of the premise of 7 under substitution {25000/X, 3/Y} i.e.,

    earnings(25000,steady) (dependents(3) greater(25000, minincome(3) ) income(inadequate).

    Evaluating the function minincome yielding:

    earnings(25000,steady) dependents(3)unify with

    earnings(X,steady) dependents(Y)under substitution {25000/X, 3/Y}

    yields the new implication:

    earnings(25000,steady) (dependents(3) greater(25000, 27000) income(inadequate).

    Since premises are true by applying modus ponen theconclusion is true. This is added as assertion 12:

    12. income(inadequate).

    Predicate Logic: Application

  • 7/27/2019 bab2bab1

    34/43

    34Ch02 / 34

    Similarly, unify sentence 9 and 10 with sentence 4, under thesubstitution {22000/X, 3/Y}, yielding the implication

    amount_saved(22000) (dependents(3) greater(22000, minsavings(3)) savings_account(adequate).Evaluating the function minsavings(3) yields the expression:

    amount_saved(22000) (dependents(3) greater(22000,15000)savings_account(adequate).

    Again, since premises are true by applying modus ponen theconclusion is true. This is added as assertion 13:13. Savings_account(adequate).

    Finally by examining 3, 12, and 13 indicates, the premise of implication 3 is true. When we apply modus ponens a third time, theconclusion is investment(combination).

    This is the suggested investment for this individual.

    Logic Programming

  • 7/27/2019 bab2bab1

    35/43

    35Ch02 / 35

    Logic programming languages view a computer program as a set of statements in logic.Contradict to procedural languages, we can give the systemstatements to try to prove.Prolog is a logic programming language that the most widely used.Prolog is based on predicate logic, but with slightly differentnotation/syntax.

    We can ask Prolog to prove that grandfather(joe,fred) was true

    Example 1:a(X) :- b(X), c(X).Equivalent to X a(X) b(X) c(X)Or equivalently

    X b(X) c(X) a(X)Example 2:

    father(jim, fred).father(joe, jim).grandfather(X, Y) :- father(X, Z), father(Z, Y). Equivalent to

    XYZ ( (father(X,Z) father(Z,Y)) grandfather(X,Y))

    ?grandfather(joe,fred)yes

    Logic Programming

  • 7/27/2019 bab2bab1

    36/43

    36Ch02 / 36

    Prolog has a built in proof/inference procedure, that lets you determinewhat is true given some initial set of facts. Proof method calledresolution.

    Knowledge Representation using Predicate LogicRepresenting Facts in Logic

    We must know how to represent things in predicate logic and whatexpressions mean.Outline how you get from a statement expressed in English to astatement in predicate logic:

    Use the verb as predicate and the nouns as the argumentsExample:

    Ahmadlikes ice-cream likes(ahmad,ice_cream)Johanloves Sarah loves(johan,sarah)

    Use logical connective to represent complex statements and itscannot be used within an argument of a predicate.Example:

    Ahmadlikes ice-cream likes(ahmad,ice_cream) and chocolate likes(ahmad,chocolate)

    Representing Facts in Logic

  • 7/27/2019 bab2bab1

    37/43

    37Ch02 / 37

    Atheer is tall and slim tall(atheer) slim(atheer) Statements of the form If X then Y can be translated intoX YExample:

    Hassanis thirsty then thirsty(hassan) he drinks coffee drinks(hassan,coffee)

    Malikis thirsty then thirsty(malik) he drinks coffee or tea drinks(malik,coffee)

    drinks(malik,tea)Use to represent the facts that not true/nothingExample:

    Safuan doesnt like drinks coffee like(safuan,coffee)Use quantifiers (for all thing) and (there exists)Example:

    Allstudents study Xstudent(X) study(X)- Thing is a student then that thing will study

    Someonestrange likes Xstrange(X) likes(brusselsprouts) brussel sprouts

    Representing Facts in Logic

  • 7/27/2019 bab2bab1

    38/43

    38Ch02 / 38

    There is some table that doesnt have 4 legsX(table(X) snumlegs(X,4))

    All elephants are greyX(elephant(X) grey(X))

    All Glaswegians support either Celtic or RangersX(glaswegian(X) (supports(X,rangers)

    supports(X,celtic)))There is something small and slimy on the table

    X(small(X) slimy(X) on(X,table))There is no brussel sprout which is tastyX(brusselsprout(X) tasty(X))

    The use of Logic in AI

  • 7/27/2019 bab2bab1

    39/43

    39Ch02 / 39

    Predicate logic provides a powerful way to represent and reason withknowledge.Its can represent knowledge that cannot represented using frame suchas negation, disjunction and quantification.Its provide much wider range of inference because of the predicatelogic have inference rules and proof procedures compare to a framesystem that has the simple inheritance inference.Predicate logic is used to:

    Representing knowledgeCommunicate AI theories with the community.

    As the basis of AI programming languages

    Give the meaning of natural language sentences in a naturallanguage understanding systemDefine the semantics of other simpler representation languages

    Logic used to describe new theory of human reasoning or language use some people

    The use of Logic in AI

  • 7/27/2019 bab2bab1

    40/43

    40Ch02 / 40

    Predicate logic hard to represent facts that involve uncertainty,defaults, beliefs, and time/change, for example:

    It will probably rain tomorrow. - uncertaintyIt normally rains in Glasgow. - defaultsJohn believes it will rain, but I dont. - beliefsIt will get wetter and wetter as you near Glasgow. - time/change

    For complex problem solving, AI programmer have toChoose between a logic-based approach, with clear semantics andguranteed sound reference, and a more ad hoc proceduralapproach which might be more efficient fot the particular problem.

    Logic and Frames

  • 7/27/2019 bab2bab1

    41/43

    41Ch02 / 41

    For a simple frame system, without defaults, one way to translate thinginto logic is as follows:

    For an object o with slot s and value v we get: X Y (o( X ) (v (Y ) s( X,Y ) ) )Example:

    Elephanthas_part head X Y (elephant ( X ) (head (Y ) haspart ( X,Y )))

    For one object o is an instance of class c we get:c (o )

    Example:Nelliesan elephant

    elephant (nellie)If one class c1 is subclass of another class c2 we get:

    X (c1 (X ) c2 (X ) ).Example:

    Allelephants are mammal Xelephant ( X ) mammal( X )

    Logic and Frames

  • 7/27/2019 bab2bab1

    42/43

    42Ch02 / 42

    Inheritance still works in the logic-based version by applying theinference rule modus ponens:

    Example:Elephanthas_part head X Y (elephant ( X ) (head (Y ) haspart ( X,Y )))

    andNelliesan elephant

    elephant (nellie)to conclude that

    Nelliehas a head Y head(Y ) haspart (nellie,Y )

    Summary

  • 7/27/2019 bab2bab1

    43/43

    43

    Intelligent systems require that we haveKnowledge formally representedNew inferences/conclusions possible.

    Formal languages have been developed to support knowledgerepresentation.

    Ch02 / 43

    One important one is the use of logic - very general purpose way toformally represent truths about the world, and draw sound conclusionsfrom these.Predicate logic provides well defined language for knowledge repsupporting inference.But representing some things in logic may not be very natural, andinferences may not be efficient. More specialised languages may bebetter.

    Frames/Networks/Objects more natural, but only explicitly supportinheritance, and may not have well defined semantics.Current trend is either to just use OO, or to use logic, but specialisesnon-logic-based languages still exist.