0% found this document useful (0 votes)
18 views24 pages

Ai (Unit 2)

Uploaded by

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

Ai (Unit 2)

Uploaded by

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

UNIT – 2

1. What is Knowledge Representation ? Explain issues in Knowledge


Representation.

Ans = Humans are best at understanding, reasoning, and interpreting knowledge. Human
knows things, which is knowledge and as per their knowledge they perform various actions in
the real world. But how machines do all these things comes under knowledge
representation and reasoning. Hence we can describe Knowledge representation as
following:

 Knowledge representation and reasoning (KR, KRR) is the part of Artificial


intelligence which concerned with AI agents thinking and how thinking contributes to
intelligent behavior of agents.
 It is responsible for representing information about the real world so that a computer
can understand and can utilize this knowledge to solve the complex real world
problems such as diagnosis a medical condition or communicating with humans in
natural language.
 It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some database, but
it also enables an intelligent machine to learn from that knowledge and experiences so
that it can behave intelligently like a human.

What to Represent:

Following are the kind of knowledge which needs to be represented in AI systems:

 Object: All the facts about objects in our world domain. E.g., Guitars contains strings,
trumpets are brass instruments.
 Events: Events are the actions which occur in our world.
 Performance: It describe behavior which involves knowledge about how to do
things.
 Meta-knowledge: It is knowledge about what we know.
 Facts: Facts are the truths about the real world and what we represent.
 Knowledge-Base: The central component of the knowledge-based agents is the
knowledge base. It is represented as KB. The Knowledgebase is a group of the
Sentences (Here, sentences are used as a technical term and not identical with the
English language).

Knowledge: Knowledge is awareness or familiarity gained by experiences of facts, data, and


situations. Following are the types of knowledge in artificial intelligence:

Types of knowledge

Following are the various types of knowledge:


1. Declarative Knowledge:

 Declarative knowledge is to know about something.


 It includes concepts, facts, and objects.
 It is also called descriptive knowledge and expressed in declarativesentences.
 It is simpler than procedural language.

2. Procedural Knowledge

 It is also known as imperative knowledge.


 Procedural knowledge is a type of knowledge which is responsible for knowing how
to do something.
 It can be directly applied to any task.
 It includes rules, strategies, procedures, agendas, etc.
 Procedural knowledge depends on the task on which it can be applied.

3. Meta-knowledge:

 Knowledge about the other types of knowledge is called Meta-knowledge.

4. Heuristic knowledge:

 Heuristic knowledge is representing knowledge of some experts in a filed or subject.


 Heuristic knowledge is rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.

5. Structural knowledge:
 Structural knowledge is basic knowledge to problem-solving.
 It describes relationships between various concepts such as kind of, part of, and
grouping of something.
 It describes the relationship that exists between concepts or objects.

 Isssues in Knowledge Representation:

Knowledge representation is a crucial aspect of artificial intelligence (AI) that involves


capturing information about the world in a form that a computer system can utilize. While
there have been significant advancements in this field, there are still some challenges and
issues associated with knowledge representation in AI. Here are several notable ones:

Ambiguity and Uncertainty: Real-world knowledge often contains ambiguity and


uncertainty. Representing uncertain or ambiguous information in a precise and efficient
manner is challenging. Dealing with probabilistic information and fuzzy logic is an
ongoing research area.

Incomplete Information: AI systems may not have access to complete information


about a domain. Representing partial or incomplete knowledge and reasoning with it
effectively is a challenge. Handling situations where information is missing or uncertain
is crucial for AI systems.

Context Sensitivity : Knowledge often depends on the context in which it is applied.


Representing and managing context-dependent knowledge is complex. AI systems may
struggle to adapt to different contexts and provide accurate responses in diverse
situations.

Expressiveness of Representation Languages: The choice of representation language


significantly impacts an AI system's ability to capture and manipulate knowledge. Some
representation languages may lack the expressive power to represent certain types of
knowledge accurately.

Scalability: As knowledge bases grow in size and complexity, managing and retrieving
information in a scalable way becomes a challenge. Efficiently handling vast amounts of
data while maintaining quick access times is a critical issue.

Dynamic and Evolving Knowledge:Real-world knowledge is dynamic and evolves over


time. Representing and updating knowledge in real-time is a challenge. AI systems need
to adapt to changes in the environment and continuously update their knowledge base.

Common-Sense Reasoning:Capturing common-sense knowledge, which is often implicit


and not explicitly stated, is a significant challenge. AI systems may struggle to make
inferences that humans find straightforward due to a lack of innate common-sense
reasoning abilities.
Interoperability : In heterogeneous environments, different knowledge representation
systems and databases may exist. Achieving interoperability between these systems,
ensuring seamless communication and integration, can be challenging.
Ethical Considerations:Representing ethical considerations and biases in knowledge is a
growing concern. Ensuring that AI systems make fair and unbiased decisions requires
careful consideration of how knowledge is represented and utilized.

Explainability:As AI systems become more complex, understanding and explaining the


knowledge representation and decision-making processes become crucial. Ensuring that
AI systems can provide interpretable explanations for their actions is an ongoing
challenge.

Researchers and practitioners in the field of AI continue to address these challenges


through ongoing research and the development of more sophisticated knowledge
representation techniques. Solutions often involve a combination of symbolic approaches,
machine learning, and probabilistic methods to create more robust and flexible
representations of knowledge.

2. Explain Control Knowledge in AI.

Ans = Description- Knowledge about which paths are most likely to lead quickly to a goal
state is often called search control knowledge.

– Which states are more preferable to others?

– Which rule to apply in a given situation.

– The order in which to pursue sub goals

– Useful sequences of rules to apply.

Search control knowledge = Meta knowledge

There are a number of AI systems that represent their control knowledge with rules.

Example SOAR, PRODIG. SOAR is a general architecture for building intelligent systems.
3. Explain Matching.

Ans = MATCHING: So far, we have seen the process of using search to solve problems as
the application of appropriate rules to individual problem states to generate new states to
which the rules can then be applied, and so forth, until a solution is found. Clever search
involves choosing from among the rules that can be applied at a particular point, the ones that
are most likely to lead to a solution. We need to extract from the entire collection of rules,
those that can be applied at a given point. To do so requires some kind of matching between
the current state and the preconditions of the rules.

How should this be done?

One way to select applicable rules is to do a simple search through all the rules comparing
one’s preconditions to the current state and extracting all the ones that match . this requires
indexing of all the rules. But there are two problems with this simple solutions:
A. It requires the use of a large number of rules. Scanning through all of them would be
hopelessly inefficeint.

B. It is not always immediately obvious whether a rule’s preconditions are satisfied by a


particular state.

Sometimes , instead of searching through the rules, we can use the current state as an index
into the rules and select the matching ones immediately. In spite of limitations, indexing in
some form is very important in the efficient operation of rules based systems.

A more complex matching is required when the preconditions of rule specify required
properties that are not stated explicitly in the description of the current state. In this case, a
separate set of rules must be used to describe how some properties can be inferred from
others. An even more complex matching process is required if rules should be applied and if
their pre condition approximately match the current situation. This is often the case in
situations involving physical descriptions of the world.

4. Explain Resolution.

Ans = Resolution in FOL

Resolution

Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e.,
proofs by contradictions. It was invented by a Mathematician John Alan Robinson in the year
1965.

Resolution is used, if there are various statements are given, and we need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions.
Resolution is a single inference rule which can efficiently operate on the conjunctive normal
form or clausal form.

Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as a
unit clause.

Conjunctive Normal Form: A sentence represented as a conjunction of clauses is said to


be conjunctive normal form or CNF.

Note: To better understand this topic, firstly learns the FOL in AI.

The resolution inference rule:

The resolution rule for first-order logic is simply a lifted version of the propositional rule.
Resolution can resolve two clauses if they contain complementary literals, which are assumed
to be standardized apart so that they share no variables.
Where li and mj are complementary literals.

This rule is also called the binary resolution rule because it only resolves exactly two
literals.

Example:

We can resolve two clauses which are given below:

[Animal (g(x) V Loves (f(x), x)] and [¬ Loves(a, b) V ¬Kills(a, b)]

Where two complimentary literals are: Loves (f(x), x) and ¬ Loves (a, b)

These literals can be unified with unifier θ= [a/f(x), and b/x] , and it will generate a resolvent
clause:

[Animal (g(x) V ¬ Kills(f(x), x)].

Steps for Resolution:

1. Conversion of facts into first-order logic.


2. Convert FOL statements into CNF
3. Negate the statement which needs to prove (proof by contradiction)
4. Draw resolution graph (unification).

To better understand all the above steps, we will take an example in which we will apply
resolution.

Example:

a. John likes all kind of food.

b. Apple and vegetable are food

c. Anything anyone eats and not killed is food.

d. Anil eats peanuts and still alive

e. Harry eats everything that Anil eats.


Prove by resolution that:

f. John likes peanuts.

Step-1: Conversion of Facts into FOL


In the first step we will convert all the given statements into its first order logic.

Step-2: Conversion of FOL into CNF

In First order logic resolution, it is required to convert the FOL into CNF as CNF form makes
easier for resolution proofs.

o Eliminate all implication (→) and rewrite

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)

c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀x ¬ eats(Anil, x) V eats(Harry, x)

f. ∀x¬ [¬ killed(x) ] V alive(x)

g. ∀x ¬ alive(x) V ¬ killed(x)

h. likes(John, Peanuts).

o Move negation (¬)inwards and rewrite

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y)

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀x ¬ eats(Anil, x) V eats(Harry, x)

f. ∀x ¬killed(x) ] V alive(x)

g. ∀x ¬ alive(x) V ¬ killed(x)

h. likes(John, Peanuts).

o Rename variables or standardize variables

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)

c. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀w¬ eats(Anil, w) V eats(Harry, w)

f. ∀g ¬killed(g) ] V alive(g)

g. ∀k ¬ alive(k) V ¬ killed(k)

h. likes(John, Peanuts).

Eliminate existential instantiation quantifier by elimination.


In this step, we will eliminate existential quantifier ∃, and this process is known
o

as Skolemization. But in this example problem since there is no existential quantifier


so all the statements will remain same in this step.
o Drop Universal quantifiers.
In this step we will drop all universal quantifier since all the statements are not
implicitly quantified so we don't need it.

a. ¬ food(x) V likes(John, x)

b. food(Apple)
c. food(vegetables)

d. ¬ eats(y, z) V killed(y) V food(z)

e. eats (Anil, Peanuts)

f. alive(Anil)

g. ¬ eats(Anil, w) V eats(Harry, w)

h. killed(g) V alive(g)

i. ¬ alive(k) V ¬ killed(k)

j. likes(John, Peanuts).

Note: Statements "food(Apple) Λ food(vegetables)" and "eats (Anil, Peanuts) Λ alive(Anil)"


can be written in two separate statements.

o Distribute conjunction ∧ over disjunction ¬.


This step will not make any change in this problem.

Step-3: Negate the statement to be proved

In this statement, we will apply negation to the conclusion statements, which will be written
as ¬likes(John, Peanuts)

Step-4: Draw Resolution graph:

Now in this step, we will solve the problem by resolution tree using substitution. For the
above problem, it will be given as follows:
Hence the negation of the conclusion has been proved as a complete contradiction with the
given set of statements.

Explanation of Resolution graph:

o In the first step of resolution graph, ¬likes(John, Peanuts) , and likes(John, x) get
resolved(canceled) by substitution of {Peanuts/x}, and we are left with ¬
food(Peanuts)
o In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get resolved
(canceled) by substitution of { Peanuts/z}, and we are left with ¬ eats(y, Peanuts) V
killed(y) .
o In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil,
Peanuts) get resolved by substitution {Anil/y}, and we are left with Killed(Anil) .
o In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get resolve by
substitution {Anil/k}, and we are left with ¬ alive(Anil) .
o In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.

5. Explain forward versus backward reasoning.


Ans = The objective of search in Artificial Intelligence (AI) is to find the path to solve
different problems. The search in AI can be executed in two ways namely, Forward
Reasoning and Backward Reasoning. The most basic difference between the two is that
forward reasoning starts with the new data to find conclusions, whereas backward reasoning
starts with a conclusion to determining the initial data.
Read this article to learn more about Forward Reasoning and Backward Reasoning and
how they are different from each other.

What is Forward Reasoning?

Forward reasoning is a process in artificial intelligence that finds all the possible solutions
of a problem based on the initial data and facts. Thus, the forward reasoning is a data-driven
task as it begins with new data. The main objective of the forward reasoning in AI is to find a
conclusion that would follow. It uses an opportunistic type of approach.

Forward reasoning flows from incipient to the consequence. The inference engine searches
the knowledge base with the given information depending on the constraints. The precedence
of these constraints have to match the current state.

In forward reasoning, the first step is that the system is given one or more constraints. The
rules are then searched for in the knowledge base for every constraint. The rule that fulfils the
condition is selected. Also, every rule can generate a new condition from the conclusion
which is obtained from the invoked one. This new conditions can be added and are processed
again.

The step ends if no new conditions exist. Hence, we can conclude that forward reasoning
follows the top-down approach.

What is Backward Reasoning?

Backward reasoning is the reverse process of the forward reasoning in which a goal or
hypothesis is selected and it is analyzed to find the initial data, facts, and rules. Therefore, the
backward reasoning is a goal driven task as it begins with conclusions or goals that are
uncertain. The main objective of the backward reasoning is to find the facts that support the
conclusions.

Backward reasoning uses a conservative type of approach and flows from consequence to the
incipient. The system helps to choose a goal state and reasons in a backward direction. The
first step in the backward reasoning is that the goal state and rules are selected. Then, sub-
goals are made from the selected rule, which need to be satisfied for the goal state to be true.

The initial conditions are set such that they satisfy all the sub-goals. Also, the established
states are matched to the initial state provided. If the condition is fulfilled, the goal is the
solution, otherwise the goal is rejected. Therefore, backward reasoning follows bottom-up
technique.
Backward reasoning is also known as a decision-driven or goal-driven inference technique
because the system selects a goal state and reasons in the backward direction.

Difference between Forward and Backward Reasoning in AI

The following are the important differences between Forward and Backward Reasoning in AI

S.No. Forward Reasoning Backward Reasoning

1. It is a data-driven task. It is a goal driven task.

2. It begins with new data. It begins with conclusions that are uncertain.

The objective is to find a conclusion that would The objective is to find the facts that support
3.
follow. the conclusions.

4. It uses an opportunistic type of approach. It uses a conservative type of approach.

5. It flows from incipient to the consequence. It flows from consequence to the incipient.

Forward reasoning begins with the initial facts. Backward reasoning begins with some goal
6.
(hypothesis).

7. Forward reasoning tests all the rules. Backward reasons tests some rules.

8. Forward reasoning is a bottom-up approach. Backward reasoning is a top-down approach.

Forward reasoning can produce an infinite number Backward reasoning produces a finite number
9.
of conclusion. of conclusions.

In the forward reasoning, all the data is available. In the backward reasoning, the data is acquired
10.
on demand.

Forward reasoning has a small number of initial Backward reasoning has a smaller number of
11.
states but a large number of conclusions. goals and a larger number of rules.

In forward reasoning, the goal formation is In backward reasoning, it is easy to form a


12.
difficult. goal.

Forward reasoning works in forward direction to Backward reasoning work in backward


13.
find all the possible conclusions from facts. direction to find the facts that justify the goal.
Forward reason is suitable to answer the problems Backward reasoning is suitable for diagnosis
14.
such as planning, control, monitoring, etc. like problems.

6. Explain Logical Programming.


Ans = Concept : Logic Programming is the combination of two words, logic and
programming. Logic Programming is a programming paradigm in which the problems are
expressed as facts and rules by program statements but within a system of formal logic. Just
like other programming paradigms like object oriented, functional, declarative, and
procedural, etc., it is also a particular way to approach programming.

How to Solve Problems with Logic Programming


Logic Programming uses facts and rules for solving the problem. That is why they are called
the building blocks of Logic Programming. A goal needs to be specified for every program in
logic programming. To understand how a problem can be solved in logic programming, we
need to know about the building blocks − Facts and Rules −
Facts : Actually, every logic program needs facts to work with so that it can achieve the
given goal. Facts basically are true statements about the program and data. For example,
Delhi is the capital of India.
Rules : Actually, rules are the constraints which allow us to make conclusions about the
problem domain. Rules basically written as logical clauses to express various facts. For
example, if we are building any game then all the rules must be defined.
Rules are very important to solve any problem in Logic Programming. Rules are basically
logical conclusion which can express the facts. Following is the syntax of rule −
A∶− B1,B2,...,Bn.
Here, A is the head and B1, B2, ... Bn is the body.
For example − ancestor(X,Y) :- father(X,Y).
ancestor(X,Z) :- father(X,Y), ancestor(Y,Z).
This can be read as, for every X and Y, if X is the father of Y and Y is an ancestor of Z, X is
the ancestor of Z. For every X and Y, X is the ancestor of Z, if X is the father of Y and Y is
an ancestor of Z.
Installing Useful Packages

For starting logic programming in Python, we need to install the following two packages −

Kanren : It provides us a way to simplify the way we made code for business logic. It lets us
express the logic in terms of rules and facts. The following command will help you install
kanren −

pip install kanren


SymPy : SymPy is a Python library for symbolic mathematics. It aims to become a full-
featured computer algebra system (CAS) while keeping the code as simple as possible in
order to be comprehensible and easily extensible. The following command will help you
install SymPy −

pip install sympy


Examples of Logic Programming
Followings are some examples which can be solved by logic programming −

Matching mathematical expressions

Actually we can find the unknown values by using logic programming in a very effective
way. The following Python code will help you match a mathematical expression −

Consider importing the following packages first −

from kanren import run, var, fact


from kanren.assoccomm import eq_assoccomm as eq
from kanren.assoccomm import commutative, associative
We need to define the mathematical operations which we are going to use −

add = 'add'
mul = 'mul'
Both addition and multiplication are communicative processes. Hence, we need to specify it
and this can be done as follows −

fact(commutative, mul)
fact(commutative, add)
fact(associative, mul)
fact(associative, add)
It is compulsory to define variables; this can be done as follows −

a, b = var('a'), var('b')
We need to match the expression with the original pattern. We have the following original
pattern, which is basically (5+a)*b −

Original_pattern = (mul, (add, 5, a), b)


We have the following two expressions to match with the original pattern −

exp1 = (mul, 2, (add, 3, 1))


exp2 = (add,5,(mul,8,1))
Output can be printed with the following command −

print(run(0, (a,b), eq(original_pattern, exp1)))


print(run(0, (a,b), eq(original_pattern, exp2)))
After running this code, we will get the following output −

((3,2))
()
The first output represents the values for a and b. The first expression matched the original
pattern and returned the values for a and b but the second expression did not match the
original pattern hence nothing has been returned.
Checking for Prime Numbers

With the help of logic programming, we can find the prime numbers from a list of numbers
and can also generate prime numbers. The Python code given below will find the prime
number from a list of numbers and will also generate the first 10 prime numbers.

Let us first consider importing the following packages −

from kanren import isvar, run, membero


from kanren.core import success, fail, goaleval, condeseq, eq, var
from sympy.ntheory.generate import prime, isprime
import itertools as it
Now, we will define a function called prime_check which will check the prime numbers
based on the given numbers as data.

def prime_check(x):
if isvar(x):
return condeseq([(eq,x,p)] for p in map(prime, it.count(1)))
else:
return success if isprime(x) else fail
Now, we need to declare a variable which will be used −

x = var()
print((set(run(0,x,(membero,x,(12,14,15,19,20,21,22,23,29,30,41,44,52,62,65,85)),
(prime_check,x)))))
print((run(10,x,prime_check(x))))
The output of the above code will be as follows −

{19, 23, 29, 41}


(2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
Solving Puzzles

Logic programming can be used to solve many problems like 8-puzzles, Zebra puzzle,
Sudoku, N-queen, etc. Here we are taking an example of a variant of Zebra puzzle which is as
follows −

There are five houses.


The English man lives in the red house.
The Swede has a dog.
The Dane drinks tea.
The green house is immediately to the left of the white house.
They drink coffee in the green house.
The man who smokes Pall Mall has birds.
In the yellow house they smoke Dunhill.
In the middle house they drink milk.
The Norwegian lives in the first house.
The man who smokes Blend lives in the house next to the house with cats.
In a house next to the house where they have a horse, they smoke Dunhill.
The man who smokes Blue Master drinks beer.
The German smokes Prince.
The Norwegian lives next to the blue house.
They drink water in a house next to the house where they smoke Blend.

We are solving it for the question who owns zebra with the help of Python.

Let us import the necessary packages −

from kanren import *


from kanren.core import lall
import time

Now, we need to define two functions − left() and next() to check whose house is left or next
to who’s house −

def left(q, p, list):


return membero((q,p), zip(list, list[1:]))
def next(q, p, list):
return conde([left(q, p, list)], [left(p, q, list)])

Now, we will declare a variable house as follows −

houses = var()

We need to define the rules with the help of lall package as follows.

There are 5 houses −

rules_zebraproblem = lall(
(eq, (var(), var(), var(), var(), var()), houses),

(membero,('Englishman', var(), var(), var(), 'red'), houses),


(membero,('Swede', var(), var(), 'dog', var()), houses),
(membero,('Dane', var(), 'tea', var(), var()), houses),
(left,(var(), var(), var(), var(), 'green'),
(var(), var(), var(), var(), 'white'), houses),
(membero,(var(), var(), 'coffee', var(), 'green'), houses),
(membero,(var(), 'Pall Mall', var(), 'birds', var()), houses),
(membero,(var(), 'Dunhill', var(), var(), 'yellow'), houses),
(eq,(var(), var(), (var(), var(), 'milk', var(), var()), var(), var()), houses),
(eq,(('Norwegian', var(), var(), var(), var()), var(), var(), var(), var()), houses),
(next,(var(), 'Blend', var(), var(), var()),
(var(), var(), var(), 'cats', var()), houses),
(next,(var(), 'Dunhill', var(), var(), var()),
(var(), var(), var(), 'horse', var()), houses),
(membero,(var(), 'Blue Master', 'beer', var(), var()), houses),
(membero,('German', 'Prince', var(), var(), var()), houses),
(next,('Norwegian', var(), var(), var(), var()),
(var(), var(), var(), var(), 'blue'), houses),
(next,(var(), 'Blend', var(), var(), var()),
(var(), var(), 'water', var(), var()), houses),
(membero,(var(), var(), var(), 'zebra', var()), houses)
)

Now, run the solver with the preceding constraints −

solutions = run(0, houses, rules_zebraproblem)

With the help of the following code, we can extract the output from the solver −

output_zebra = [house for house in solutions[0] if 'zebra' in house][0][0]

The following code will help print the solution −

print ('\n'+ output_zebra + 'owns zebra.')

The output of the above code would be as follows −

German owns zebra.

7. Explain Isa and Instance relationship in AI.


Ans = In the context of artificial intelligence, the terms "ISA" and "instance" typically
relate to the concepts of inheritance and instantiation in object-oriented programming
and knowledge representation. Here's a brief explanation of each:

ISA (Is-a) Relationship:

The ISA relationship represents inheritance or specialization. It is used to indicate that


one class is a subtype or a specific kind of another class. For example, if you have a
class "Animal," you might have subclasses like "Mammal," "Bird," and "Fish." In this
case, you can say that "Mammal IS-A Animal" and "Bird IS-A Animal."
plaintext
Copy code
Animal
|
Mammal
In terms of artificial intelligence, this kind of relationship is often used in knowledge
representation to model hierarchical taxonomies or ontologies.

Instance Relationship:
An instance is a specific occurrence or realization of a class. If you have a class "Car," a
specific car, say a "Toyota Camry," is an instance of the "Car" class.
plaintext
Copy code
Car
|
Toyota Camry (Instance of Car)

vbnet
Copy code

Instances are concrete objects that belong to a specific class. In AI, instances are used to
represent individual entities in the world.

**Representing ISA and Instance Relationship in AI:**

In AI, you might use various methods to represent these relationships, depending on the
specific application. Some common approaches include:

1. **Graph-based Representation:**
- Representing classes as nodes and relationships as edges in a graph. In the example
above, you'd have nodes for "Animal," "Mammal," and edges indicating the ISA
relationship.

2. **Semantic Networks:**
- Using semantic networks to represent entities and their relationships. Each class or
instance is a node, and relationships are represented by labeled links between nodes.

3. **Class Hierarchies:**
- In object-oriented programming, you might represent classes and their relationships
using class hierarchies. Each class represents a type, and the ISA relationship is
expressed through inheritance.

4. **Ontologies:**
- Using ontologies to formally represent knowledge, where classes, instances, and
relationships are defined in a structured and standardized way.

Here's a simple textual representation of the ISA relationship:

```plaintext
Animal
|
Mammal
|
Dog (Instance of Mammal)
In summary, the representation of ISA and instance relationships in AI often involves
hierarchical structures and various knowledge representation techniques, such as
graphs, ontologies, and semantic networks. The choice of representation depends on the
specific requirements of the AI system being developed.

8. Explain Natural Deduction.


Ans = Natural deduction is a style of reasoning and a system of formal logic that is
commonly used in artificial intelligence (AI) and philosophy. It provides a way to
represent and analyze arguments in a systematic and rigorous manner. The goal of
natural deduction is to capture the structure of valid reasoning and to establish rules for
deriving conclusions from given premises.

In the context of AI, natural deduction is often employed in automated theorem proving
and reasoning systems. Here are the key components and concepts associated with
natural deduction:

Inference Rules: Natural deduction uses a set of inference rules that define how
conclusions can be drawn from premises. These rules are typically expressed in the
form of "if-then" statements and dictate how reasoning steps can be made.

Logical Connectives: Natural deduction incorporates logical connectives such as AND


(∧), OR (∨), NOT (¬), IMPLICATION (→), etc. These connectives allow the
representation of complex statements and relationships between propositions.

Assumptions and Discharges: In natural deduction, one can make temporary


assumptions and later discharge them when the conclusion is reached. This mirrors the
way humans often make temporary assumptions during reasoning and discard them
when they are no longer needed.

Proof Trees: Arguments in natural deduction are often represented using proof trees. A
proof tree shows the structure of an argument, with branches representing different
assumptions and sub-arguments leading to the final conclusion.

Universal and Existential Quantifiers: Natural deduction handles quantifiers like "for
all" (∀) and "there exists" (∃), allowing reasoning about statements that involve
variables and quantified expressions.

Here's a simple example using the implication (→) and AND (∧) connectives:

Premises:

Q∧R
P→Q

Conclusion:

R
Proof:

Assume P (temporary assumption)


2. P → Q (premise)

Q ∧ R (premise)
Q (modus ponens: 1, 2)

R (conjunction elimination: 4)
P → R (implication introduction: 1-5)
In this example, the proof starts with the assumption of P and uses inference rules to
derive the conclusion R. The structure of the proof reflects the logical relationships
between the premises and the conclusion.

Automated reasoning systems in AI often use natural deduction principles to perform


logical inference, make decisions, and solve problems in various domains.

9. Explain Predicate ?
Ans = Consider the statement, “x is greater than 3″. It has two parts. The first part, the
variable , is the subject of the statement. The second part, “is greater than 3”, is
the predicate. It refers to a property that the subject of the statement can have.
The statement “x is greater than 3″ can be denoted by P(x) where x denotes the predicate
“is greater than 3” and is the variable.
2)The predicate P can be considered as a function. It tells the truth value of the
statement P(x) at x. Once a value has been assigned to the variable x, the
statement P(x) becomes a proposition and has a truth or false(tf) value.
In general, a statement involving n variables x1, x2, x3…….xn can be denoted
by P(x1,x2,x3,……..xn). Here P is also referred to as n-place predicate or a n-ary
predicate.
 Example 1: Let P(x) denote the statement “x > 10″. What are the truth values of

andP(11) and P(5)?


Solution: P(11) is equivalent to the statement 11 > 10, which is True.
P(5) is equivalent to the statement 5 > 10, which is False.
 Example 2: Let R(x,y) denote the statement “x=y+1“. What is the truth value of
the propositions R(1,3) and R(2,1)?
Solution: R(1,3) is the statement 1 = 3 + 1, which is False.
R(2,1) is the statement 2 = 1 + 1, which is True.

A predicate is an expression of one or more variables determined on some specific domain. A


predicate with variables can be made a proposition by either authorizing a value to the
variable or by quantifying the variable.

The following are some examples of predicates.


 Consider E(x, y) denote "x = y"
 Consider X(a, b, c) denote "a + b + c = 0"
 Consider M(x, y) denote "x is married to y."
Predicate Logic :
Predicates are properties, additional information to better express the subject of the
sentence. A quantified predicate is a proposition , that is, when you assign values to a
predicate with variables it can be made a proposition.
For example :
In P(x) : x>5, x is the subject or the variable and ‘>5’ is the predicate.
P(7) : 7>5 is a proposition where we are assigning values to the variable x, and it has a
truth value, i.e. True.
The set of values that the variables of the predicate can assume is called the Universe or
Domain of Discourse or Domain of Predicat

10. Explain Computable Functions.


Ans = In the context of artificial intelligence (AI) and computer science, computable
functions refer to functions that can be computed or calculated by an algorithm. A function is
computable if there exists a well-defined procedure or algorithm that, given an input, can
produce the corresponding output. This concept is foundational to the theory of computation
and the development of algorithms.

The idea of computable functions is closely related to the broader field of computability
theory, which explores the limits and capabilities of computation. Alan Turing, one of the
pioneers of computer science, introduced the concept of a Turing machine, a theoretical
model of computation that can simulate any algorithm. Turing machines are used to define
what it means for a function to be computable.

A function is computable if there exists a Turing machine (or equivalent computational


model) that, when given an input, can produce the correct output after a finite number of
steps. This implies that the function must be well-defined for all possible inputs, and the
computation must terminate in a finite amount of time.

In the context of AI, the concept of computable functions is fundamental because it sets the
theoretical foundation for what can be achieved algorithmically. Many AI algorithms and
models are based on the idea of manipulating and processing data through well-defined
procedures, which aligns with the concept of computable functions.

It's worth noting that not all functions are computable. There are functions that are
undecidable or incomputable, meaning that there is no algorithm that can compute their
values for all possible inputs. The study of these limits and the nature of computation is an
essential aspect of theoretical computer science.
Computable Problems –
You are familiar with many problems (or functions) that are computable (or decidable),
meaning there exists some algorithm that computes an answer (or output) to any instance of
the problem (or for any input to the function) in a finite number of simple steps. A simple
example is the integer increment operation:
f(x) = x + 1
It should be intuitive that given any integer x, we can compute x + 1 in a finite number of
steps. Since x is finite, it may be represented by a finite string of digits. Using the addition
method (or algorithm) we all learned in school, we can clearly compute another string of
digits representing the integer equivalent to x + 1. Yet there are also problems and functions
that are non-computable (or undecidable or uncomputable), meaning that there exists no
algorithm that can compute an answer or output for all inputs in a finite number of simple
steps. (Undecidable simply means non-computable in the context of a decision problem,
whose answer (or output) is either “true” or “false”).

11. Explain Representation and Mapping.

Ans = In the context of artificial intelligence (AI), representation and mapping are
fundamental concepts that play a crucial role in how machines understand and process
information.

Representation:

Definition: Representation refers to the way information is encoded and presented in a form
that can be processed by a system. In AI, this often involves transforming real-world objects,
concepts, or phenomena into a format that can be understood and manipulated by a computer.
Importance: The choice of representation significantly impacts the efficiency and
effectiveness of AI systems. A well-chosen representation can simplify complex problems,
making them more tractable for computational solutions.

Mapping:

Definition: Mapping involves establishing a relationship or correspondence between


different elements in one or more domains. In AI, this typically involves creating associations
between the representations of entities, such as connecting inputs to outputs in a machine
learning model.
Importance: Mapping is critical for AI systems to make sense of data and draw meaningful
conclusions. It enables the transformation of information from one form to another,
facilitating tasks like pattern recognition, decision-making, and problem-solving.

Examples:
1. Natural Language Processing (NLP): Representation: In NLP, words and sentences need
to be represented in a way that a machine can understand. This could involve techniques like
word embeddings, where words are mapped to high-dimensional vectors.
Mapping: The mapping process involves connecting these word embeddings to convey the
meaning of a sentence or document, enabling tasks like sentiment analysis or language
translation.

2.Computer Vision: Representation: Images are often represented as pixel values, but this
raw representation may be too complex for certain tasks. Feature extraction techniques are
employed to represent images in a more meaningful way, such as through the identification of
edges, shapes, or textures.
Mapping: Mapping, in this case, involves connecting these extracted features to specific
objects or concepts, enabling object recognition or image classification.
Machine Learning:
3.Representation: In machine learning, data needs to be represented in a format suitable for
training models. Features are extracted or engineered to create a representation that captures
relevant information for the learning task.
Mapping: The mapping process involves establishing the relationship between input features
and the target variable, allowing the model to generalize and make predictions on new,
unseen data.
In summary, representation involves encoding information in a machine-readable format,
while mapping involves establishing connections between different representations to enable
intelligent processing and decision-making in AI systems. The effectiveness of these
processes is crucial for the success of various AI applications.

You might also like