0% found this document useful (0 votes)
57 views

Artificial Intelligence

- Logic provides a precise language for representing knowledge as sentences and reasoning about those sentences using logical rules of inference. - A knowledge base consists of sentences in a formal logical language. Formal logic allows for automated reasoning by describing what is true rather than how to solve problems. - First-order logic extends propositional logic by allowing terms to represent objects and predicates to represent properties and relations among objects. Quantifiers can make statements about collections of objects. This allows powerful representation of real-world domains.

Uploaded by

Suresh Chander
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Artificial Intelligence

- Logic provides a precise language for representing knowledge as sentences and reasoning about those sentences using logical rules of inference. - A knowledge base consists of sentences in a formal logical language. Formal logic allows for automated reasoning by describing what is true rather than how to solve problems. - First-order logic extends propositional logic by allowing terms to represent objects and predicates to represent properties and relations among objects. Quantifiers can make statements about collections of objects. This allows powerful representation of real-world domains.

Uploaded by

Suresh Chander
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Unit III

Logic
Representation of knowledge and the reasoning process are central to the entire field of artificial
intelligence. The primary component of a knowledge-based agent is its knowledge-base. A knowledge-
base is a set of sentences. Each sentence is expressed in a language called the knowledge representation
language. Sentences represent some assertions about the world. There must mechanisms to derive new
sentences from old ones. This process is known as inferencing or reasoning. Inference must obey the
primary requirement that the new sentences should follow logically from the previous ones. Logic is the
primary vehicle for representing and reasoning about knowledge. Specifically, we will be dealing with
formal logic. The advantage of using formal logic as a language of AI is that it is precise and definite.
This allows programs to be written which are declarative - they describe what is true and not how to solve
problems. This also allows for automated reasoning techniques for general purpose inferencing.
Knowledge base = set of sentences in a formal language

• The agent must be able to:


– Represent states, actions, etc.
– Incorporate new percepts
– Update internal representations of the world
– Deduce hidden properties of the world
– Deduce appropriate actions

A logic consists of two parts, a language and a method of reasoning. The logical language, in turn, has
two aspects, syntax and semantics. Thus, to specify or define a particular logic, one needs to specify three
things:
Syntax: The atomic symbols of the logical language, and the rules for constructing well-formed, non-
atomic expressions (symbol structures) of the logic. Syntax specifies the symbols in the language and
how they can be combined to form sentences. Hence facts about the world are represented as sentences in
logic.
Semantics: The meanings of the atomic symbols of the logic, and the rules for determining the meanings
of non-atomic expressions of the logic. It specifies what facts in the world a sentence refers to. Hence,
also specifies how you assign a truth value to a sentence based on its meaning in the world. A fact is a
claim about the world, and may be true or false.
Syntactic Inference Method: The rules for determining a subset of logical expressions, called theorems
of the logic. It refers to mechanical method for computing (deriving) new (true) sentences from existing
sentences.

Entailment:
• Entailment means that one thing follows from another:
KB ╞ α
• Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true
– E.g., x+y = 4 entails 4 = x+y
Entailment is a relationship between sentences (i.e., syntax) that is based on semantics
Reasoning Patterns in propositional logic
First Order Logic
•In propositional logic, each possible atomic fact requires a separate unique propositional symbol.
•If there are n people and m locations, representing the fact that some person moved from one location to
another requires nm2 separate symbols.
•Predicate logic includes a richer ontology:
-objects (terms)
-properties (unary predicates on terms)
-relations (n-ary predicates on terms)
-functions (mappings from terms to other terms)
Syntax for First-Order Logic
Sentence → AtomicSentence | Sentence Connective Sentence | Quantifier Variable Sentence |
⇁Sentence | (Sentence)
AtomicSentence → Predicate(Term, Term, ...) | Term=Term
Term → Function(Term,Term,...) | Constant | Variable
Connective → V | ∧ |⇒ | ⇔
Quanitfier → ∀ | ∃
Constant → A | John | Car1
Variable →x | y | z |...
Predicate → Brother | mother | ...
Function → father-of | plus | Owns...
Terms and Predicates
•Objects are represented by terms:
-Constants: Block1, John
-Function symbols: father-of, successor, plus An n-ary function maps a tuple of n terms to another term:
father-of(John), succesor(0), plus(plus(1,1),2)
•Terms are simply names for objects. Logical functions are not procedural as in programming languages.
They do not need to be defined, and do not really return a value. Allows for the representation of an
infinite number of terms.
•Propositions are represented by a predicate applied to a tuple of terms. A predicate represents a property
of or
relation between terms that can be true or false: Brother(John, Fred), Left-of(Square1, Square2)
GreaterThan(plus(1,1), plus(0,1))
•In a given interpretation, an n-ary predicate can defined as a function from tuples of n terms to {True,
False} or
equivalently, a set tuples that satisfy the predicate: {<John, Fred>, <John, Tom>, <Bill, Roger>, ...}
Sentences in First-Order Logic
An atomic sentence is simply a predicate applied to a set of terms. An atomic sentence is true in a given
model, under a given interpretation, if the relation referred to by the predicate symbol holds among the
objects referred to by the arguments
Owns(John,Car1)
Sold(John,Car1,Fred)
Semantics is True or False depending on the interpretation, i.e. is the predicate true of these arguments.
•The standard propositional connectives (V ∧⇒⇔ ∀ ∃) can be used to construct complex sentences:
Owns(John,Car1) V Owns(Fred, Car1)
Sold(John,Car1,Fred) ⇁Owns(John, Car1)
Semantics same as in propositional logic.
Two sentences are equivalent if they hold in exactly the same models.
Quantifiers
Once we have a logic that allows objects, it is only natural to want to express properties of entire
collections of objects, instead of enumerating the objects by name. Quantifiers let us do this. First-order
logic contains two standard quantifiers, called Universal nd existential

Universal quantification naturally uses implication:


"All kings are persons,'' is written in first-order logic as
∀x King(x) ⇒Person(x)
∀is usually pronounced "For all . . .". (Remember that the upside-down A stands for "all.") Thus, the
sentence says, "For all x, if x is a king, then xis a person." The symbol x is called a variable. By
convention, variables are lowercase letters. A variable is a term all by itself, and as such can also serve as
the argument of a function-for example, LeftLeg(x). A term with no variables is called a ground term.
Intuitively, the sentence ∀x P, where P is any logical expression, says that P is true for every object x.
More precisely, ∀x P is true in a given. model under a given interpretation if P is true in all possible
extended interpretations constructed from the given interpretation, where each extended interpretation
specifies a domain element to which x refers.
This sounds complicated, but it is really just a careful way of stating the intuitive meaning of universal
quantification. We can extend the interpretation in five ways:
x →Richard
x → King John,
x →Richard's left leg,
x →John's left leg,
x → the crown.
The universally quantified sentence ∀x King(x) ⇒Person(x) is true under the original interpretation if the
sentence King(x) ⇒Person(x) is true in each of the five extended interpretations. That is, the universally
quantified sentence is equivalent to asserting the following five sentences:
Richard is a king ⇒Richard the Lionheart is a person.
King John is a king ⇒King John is a person.
Richard's left leg is a king ⇒Richard's left leg is a person.
John's left leg is a king ⇒John's left leg is a person.
The crown is a king ⇒the crown is a person.
Looking at the truth table for ⇒ we see that the implication is true whenever its premise is false-regardless
of the truth of the conclusion. Thus, by asserting the universally quantified sentence, which is equivalent
to asserting a whole list of individual implications, we end up asserting the conclusion of the rule just for
those objects for whom the premise is true and saying nothing at all about those individuals for whom the
premise is false. Thus, the truth-table entries for ⇒turn out to be perfect for writing general rules with
universal quantifiers.
A common mistake, made frequently even by diligent readers who have read this paragraph
several times, is to use conjunction instead of implication. The sentence
∀x King (x) A Person (x)
would be equivalent to asserting
Richard is a king A Richard the Lionheart is a person,
King John is a king A King John is a person,
Richard's left leg is a king A Richard's left leg is a person,
and so on. Obviously, this does not capture what we want.
Existential quantification (∃)
Universal quantification makes statements about every object. Similarly, we can make a statement about
some object in the universe without naming it, by using an existential quantifier.
To say, for example, that King John has a crown on his head, we write
∃ x Crown(x) A OnHead (x, John) .
∃ xis pronounced "There exists an x such that . . ."or "For some x . . .".
Intuitively, the sentence ∃x P says that P is true for at least one object x. More precisely, ∃x P is true in a
given model under a given interpretation if P is true in at least one extended interpretation that assigns x
to a domain element. For our example, this means that at least one of the following must be true:
Richard is a crown A Richard is on John's head;
King John is a crown A King John is on John's head;
Richard's left leg is a crown A Richard's left leg is on John's head;
John's left leg is a crown A John's left leg is on John's head;
The crown is a crown A the crown is on John's head.
The fifth assertion is true in the model, so the original existentially quantified sentence is true in the
model. Notice that, by our definition, the sentence would also be true in a model in which King John was
wearing two crowns. This is entirely consistent with the original sentence "King John has a crown on his
head."
Just as ⇒ appears to be the natural connective to use with ∀, A is the natural connective to use with ∃.
Using A as the main connective with ∀ led to an overly strong statement in the example in the previous
section; using ⇒ with ∃ usually leads to a very weak statement, indeed. Consider the following sentence:
∃ x Crown(x) ⇒OnHead(x, John) .
On the surface, this might look like a reasonable rendition of our sentence. Applying the semantics, we
see that the sentence says that at least one of the following assertions is true:
Richard the Lionheart is a crown ⇒Richard the Lionheart is on John's head;
King John is a crown ⇒ King John is on John's head;
Richard's left leg is a crown ⇒ Richard's left leg is on John's head;
and so on. Now an implication is true if both premise and conclusion are true, or if its premise isfalse. So
if Richard is not a crown, then the first assertion is true and the existential is satisfied. So, an existentially
quantified implication sentence is true in any model containing an object for which the premise of the
implication is false; hence such sentences really do not say much at all.
Nested quantifiers
We will often want to express more complex sentences using multiple quantifiers. The simplest case is
where the quantifiers are of the same type. For example, "Brothers are siblings" can be written as
∀x ∀y Brother(x, y) ⇒Sibling(x, y) .
Consecutive quantifiers of the same type can be written as one quantifier with several variables.
For example, to say that siblinghood is a symmetric relationship, we can write
∀x, y Sibling(x, y) ⇔ Sibing(y, z) .
In other cases we will have mixtures. "Everybody loves somebody" means that for every person, there is
someone that person loves:
∀x ∃y Loves(x,y)
On the other hand, to say "There is someone who is loved by everyone," we write
∃y∀x Loves(x,y)

The order of quantification is therefore very important. It becomes clearer if we insert parentheses.
∀x (∃y Loves (x, y)) says that everyone has a particular property, namely, the property that they love
someone. On the other hand, ∃y (∀x Loves(x, y)) says that someone in the world has a particular
property, namely the property of being loved by everybody.
Some confusion can arise when two quantifiers are used with the same variable name.
Consider the sentence
∀x [Crown( x )V (∃x Brother (Richard,x ))] .
Here the x in Brother(Richard, x) is existentially quantified. The rule is that the variable belongs to the
innermost quantifier that mentions it; then it will not be subject to any other quantification. Another way
to think of it is this: ∃x Brother(Richard, x) is a sentence about Richard (that he has a brother), not about
x; so putting a ∀x outside it has no effect. It could equally well have been written ∃z Brother (Richard,
z). Because this can be a source of confusion, we will always use different variables.
Connections between ∀and ∃
The two quantifiers are actually intimately connected with each other, through negation. Asserting
that everyone dislikes parsnips is the same as asserting there does not exist someone who likes them,
and vice versa:
∀x ⇁Likes(x, coffee) is equivalent to ⇁∃x Likes(x, coffee) .
We can go one step further: "Everyone likes ice cream" means that there is no one who does not like ice
cream:
∀x Likes (x, IceCream) is equivalent to ⇁∃x ⇁Likes(x, IceCream) .
Because ∀is really a conjunction over the universe of objects and ∃is a disjunction, it should not be
surprising that they obey De Morgan's rules. The De Morgan rules for quantified and unquantified
sentences are as follows:
Equality
First-order logic includes one more way to make atomic sentences, other than using a predicate and terms
as described earlier. We can use the equality symbol to make statements to the effect that two terms
refer to the same object. For example,
Father( John) = Henry
says that the object referred to by Father(John) and the object referred to by Henry are the same.
Because an interpretation fixes the referent of any term, determining the truth of an equality sentence is
simply a matter of seeing that the referents of the two terms are the same object.
The equality symbol can be used to state facts about a given function, as we just did for the Father
symbol. It can also be used with negation to insist that two terms are not the same object. To say that
Richard has at least two brothers, we would write
∃ x, y Brother(x,Richard) A Brother(y, Richard) A⇁(x=y)

The sentence
∃ x, y Brother(x,Richard) A Brother(y,Richard) ,
does not have the intended meaning. In particular, it is true in a model where Richard has only one
brother. To see this, consider the extended interpretation in which both x and y are assigned to King John.
The addition of ⇁(x=y) rules out such models. The notation x ≠y is sometimes used as an abbreviation far
⇁(x=y).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy