Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

AI MID 2 ANSWERS

1.A)Explain Proof by Resolution method for propositional logic.


The resolution method is a proof technique used in propositional logic
to determine the validity of a logical argument. The method works by
assuming the negation of the conclusion and then attempting to derive
a contradiction from the premises. If a contradiction is derived, then the
original argument is valid.
The method proceeds by converting the premises and negation of the
conclusion into a set of clauses, where each clause is a disjunction of
literals (propositional variables or their negations). The clauses are then
combined using the resolution rule, which states that if two clauses
contain complementary literals (i.e., one clause contains a literal and
the other contains its negation), then a new clause can be derived by
taking the disjunction of the remaining literals in each clause.
The resolution rule is applied repeatedly until either a contradiction is
derived (in which case the argument is valid), or no new clauses can be
derived (in which case the argument is invalid).
For example, consider the argument:
Premise 1: P → Q
Premise 2: ¬Q
Conclusion: ¬P
To apply the resolution method, we first convert the premises and
negation of the conclusion into a set of clauses:
C1: ¬P ∨ Q
C2: ¬Q
C3: P
We then apply the resolution rule to derive a new clause:
C4: ¬P
Since C4 is the negation of the conclusion, and we were able to derive
it using the resolution rule, the original argument is valid.
1.B)Differentiate between Universal and Existential Quantifier
with 2 examples.
In predicate logic, quantifiers are used to specify the scope of a variable
in a logical expression. There are two types of quantifiers: universal
quantifiers and existential quantifiers.
Universal quantifiers (∀) are used to express that a statement is true
for all values of a variable. For example:
1. ∀x P(x) where P(x) is "x is an even number." This statement means
that every value of x is an even number.
2. ∀y Q(y) where Q(y) is "y is a positive number." This statement means
that every value of y is a positive number.
Existential quantifiers (∃) are used to express that a statement is true
for at least one value of a variable. For example:
1. ∃x P(x) where P(x) is "x is an odd number." This statement means
that there is at least one value of x that is an odd number.
2. ∃y Q(y) where Q(y) is "y is a negative number." This statement
means that there is at least one value of y that is a negative number.
In summary, universal quantifiers are used to express that a statement
is true for all values of a variable, while existential quantifiers are used
to express that a statement is true for at least one value of a variable.
2.A)Describe syntax, semantics First Order Logic and its use.
First-order logic (FOL) is a formal language used to represent
knowledge and reason about the world. It is a mathematical system that
has a precise syntax and semantics. Here is a brief description of the
syntax, semantics, and use of FOL:
Syntax:
The syntax of FOL consists of three main components: terms,
predicates, and quantifiers. Terms represent objects or variables,
predicates represent properties or relations, and quantifiers represent
the scope of a formula. The syntax of FOL is defined by a set of rules
that specify how these components can be combined to form well-
formed formulas (WFFs).
Semantics:
The semantics of FOL defines the meaning of the language by
assigning truth values to formulas in a given interpretation. An
interpretation consists of a domain of objects, a set of relations over the
domain, and a set of functions over the domain. The truth value of a
formula in an interpretation is determined by the satisfaction relation
between the formula and the interpretation.
Use:
FOL is used in a wide range of applications, including artificial
intelligence, computer science, mathematics, and philosophy. It is used
to represent knowledge in formal systems, to reason about the
properties of objects and relations, and to develop algorithms for
automated reasoning. FOL is also used as a foundation for more
expressive logics, such as modal logic, temporal logic, and description
logic.
In summary, FOL is a formal language that provides a precise way to
represent and reason about the world. Its syntax and semantics are well-
defined, and its use is widespread in many fields.
2.B) Explain the conversion from FOL to CNF with at 3 examples.
Converting a first-order logic (FOL) formula into conjunctive normal
form (CNF) is a process that involves several steps. The goal is to
transform the FOL formula into a set of clauses, where each clause is a
disjunction of literals (propositional variables or their negations). Here
are three examples of how to convert FOL formulas into CNF:
1. FOL formula: ∀x (P(x) → Q(x))
CNF form:
¬P(x) ∨ Q(x)
Explanation: To convert this formula into CNF, we first apply the
implication rule to get ¬P(x) ∨ Q(x). Then, we use the universal
quantifier to generalize the formula to all values of x.
2. FOL formula: ∃x (P(x) ∧ Q(x))
CNF form:
P(a) ∧ Q(a)
Explanation: To convert this formula into CNF, we first use the
existential quantifier to introduce a new constant symbol a. Then, we
apply the conjunction rule to get P(a) ∧ Q(a).
3. FOL formula: ∀x ∃y (P(x, y) ∧ Q(y))
CNF form:
P(x, f(x)) ∧ Q(f(x))
Explanation: To convert this formula into CNF, we first use the
universal quantifier to generalize the formula to all values of x. Then,
we use the existential quantifier to introduce a new function symbol
f(x) that depends on x. Finally, we apply the conjunction rule to get P(x,
f(x)) ∧ Q(f(x)).
In summary, to convert an FOL formula into CNF, we need to apply the
rules of inference and quantifiers to transform the formula into a set of
clauses. The resulting CNF form is a conjunction of these clauses.
3) Explain Unification and Forward chaining in FOL.
Unification and forward chaining are two important concepts in first-
order logic (FOL). Here's a brief explanation of each:
Unification:
Unification is the process of finding a substitution that makes two terms
identical. In FOL, unification is used to match a query with a set of
rules or facts in a knowledge base. The substitution is used to replace
variables in the query with constants or other terms, so that the query
can be matched with the rules or facts in the knowledge base. If a
substitution can be found, the query is said to be unifiable with the
knowledge base.
Forward Chaining:
Forward chaining is a reasoning method that starts with a set of known
facts and uses them to derive new facts. In FOL, forward chaining is
used to derive new propositions from a set of axioms or rules. The
process starts with a set of known facts, and applies the rules to generate
new facts. These new facts are then added to the set of known facts,
and the process continues until no more new facts can be derived.
Forward chaining is often used in expert systems and other AI
applications to generate new knowledge from existing knowledge.
In summary, unification is used to match a query with a set of rules or
facts in a knowledge base, while forward chaining is used to derive new
facts from a set of known facts or axioms. Both concepts are important
in FOL and are used in many applications, including expert systems,
natural language processing, and automated reasoning.

4.) Describe how to make reasoning with default information.


Reasoning with default information is a way to make inferences based
on incomplete or uncertain information. Here are the steps to follow to
make reasoning with default information:
1. Identify the default assumptions: Default assumptions are
generalizations that are assumed to be true unless there is evidence to
the contrary. For example, the default assumption might be that "birds
can fly", or "all mammals have hair". These assumptions are not always
true, but they are generally true and provide a starting point for
reasoning.
2. Identify the exceptions: Exceptions are cases where the default
assumption does not hold. For example, a penguin is a bird that cannot
fly, so it is an exception to the default assumption that "birds can fly".
Exceptions are important because they provide evidence that the
default assumption is not always true.
3. Apply the default assumption: If there is no evidence to the contrary,
the default assumption is applied. For example, if we know that a
creature is a bird, we can assume that it can fly, unless we have evidence
to the contrary.
4. Revise the assumption based on evidence: If there is evidence that
contradicts the default assumption, the assumption must be revised. For
example, if we see a bird that cannot fly, we must revise our assumption
that "birds can fly".
5. Use probabilistic reasoning: Reasoning with default information
often involves probabilistic reasoning, where the probability of a
conclusion is based on the probability of the evidence and the
probability of the assumptions. Probabilistic reasoning is used to make
inferences based on incomplete or uncertain information.
In summary, reasoning with default information involves identifying
default assumptions, identifying exceptions, applying the default
assumption, revising the assumption based on evidence, and using
probabilistic reasoning to make inferences. This type of reasoning is
useful in many applications, including natural language processing,
expert systems, and automated reasoning.
5.) Explain Beyes’ Theorem and Its use..
Bayes' Theorem is a mathematical formula that describes the
probability of an event based on prior knowledge of related events. The
formula is named after Reverend Thomas Bayes, an 18th-century
statistician and theologian who first proposed the idea.
Bayes' Theorem states that the probability of an event A occurring
given that event B has occurred is equal to the probability of event B
occurring given that event A has occurred, multiplied by the probability
of event A occurring, divided by the probability of event B occurring.
Mathematically, it can be expressed as:
P(A|B) = P(B|A)*P(A) / P(B)
where:
P(A|B) is the probability of event A occurring given that event B has
occurred
P(B|A) is the probability of event B occurring given that event A has
occurred
P(A) is the probability of event A occurring
P(B) is the probability of event B occurring
Bayes' Theorem is used in many areas, including statistics, machine
learning, artificial intelligence, and data science. It is particularly useful
in situations where there is incomplete or uncertain information, and
where new evidence can be used to update prior beliefs or probabilities.
For example, Bayes' Theorem can be used in medical diagnosis to
calculate the probability of a patient having a disease given their
symptoms and other relevant information. It can also be used in spam
filtering to calculate the probability that an email is spam given its
content and other features.
Overall, Bayes' Theorem is a powerful tool for reasoning under
uncertainty, and has many applications in a wide range of fields.

5.B) Three identical boxes contain red and white balls. The first box
contains 3 red and 2 white balls, the second box has 4 red and 5
white balls, and the third box has 2 red and 4 white balls. A box is
chosen very randomly and a ball is drawn from it. If the ball that
is drawn out is red, what will be the probability that the second box
is chosen?
Let A1, A2, A3 be the events of choosing the first, second, and third
boxes, respectively. Let B be the event of drawing a red ball. We want
to find the probability of A2 given B, which is P(A2|B).
Using Bayes' theorem, we have:
P(A2|B) = P(B|A2) * P(A2) / [P(B|A1) * P(A1) + P(B|A2) * P(A2) +
P(B|A3) * P(A3)]
We know that P(B|A2) is the probability of drawing a red ball given
that the second box is chosen, which is 4/9. We also know that P(A2)
is the probability of choosing the second box, which is 1/3.
To find P(B|A1), we note that there are a total of 3+2=5 balls in the first
box. Therefore, the probability of drawing a red ball from the first box
is 3/5. Similarly, P(B|A3) is 2/6. We also know that P(A1) = P(A2) =
P(A3) = 1/3.
Substituting these values into the formula, we get:
P(A2|B) = (4/9) * (1/3) / [(3/5) * (1/3) + (4/9) * (1/3) + (2/6) * (1/3)]
Simplifying this expression, we get:
P(A2|B) = 16/47
Therefore, the probability that the second box is chosen given that a red
ball is drawn is approximately 0.34 or 34%.

6.) Explain about Knowledge based agents with an example of


Wumpus World.
A knowledge-based agent is an intelligent agent that uses knowledge to
make decisions and take actions. It maintains an internal representation
of the world, which is updated as new information is received. The
agent uses this knowledge to reason about the world and make
decisions based on its goals.
The Wumpus World is a classic example of a knowledge-based agent.
In this scenario, the agent is placed in a grid-like world that contains a
Wumpus (a dangerous monster), pits (deadly holes), and gold. The
agent's goal is to find the gold and return to the starting point without
being killed by the Wumpus or falling into a pit.
To achieve this goal, the agent must reason about the world and make
decisions based on its knowledge. For example, the agent might know
that the Wumpus is nearby if it smells a foul odor, or that a pit is nearby
if it feels a breeze. The agent can use this knowledge to update its
internal representation of the world and make decisions about where to
move next.
The agent can also use its knowledge to plan ahead and avoid
dangerous situations. For example, if the agent knows that the gold is
located near a pit, it might decide to first find a way to safely cross the
pit before attempting to retrieve the gold.
Overall, the Wumpus World is a good example of how knowledge-
based agents can use their internal representation of the world to make
decisions and achieve their goals. By reasoning about the world and
using their knowledge to plan ahead, these agents can navigate complex
environments and solve challenging problems.

7.A) Explain the process of converting logic sentence into CNF.


Converting a logical sentence into Conjunctive Normal Form (CNF)
involves several steps:
1. Eliminate all the implications and bi-implications in the sentence
using logical equivalences. For example, to eliminate the implication
in the sentence "If P then Q", we can use the equivalence "P -> Q" is
equivalent to "P v Q", where "" represents negation and "v" represents
disjunction.
2. Move negation inwards by applying De Morgan's laws. For example,
to move negation inwards in the sentence "(P v Q)", we can use the
equivalence "(P v Q)" is equivalent to "~P ^ ~Q", where "^" represents
conjunction.
3. Standardize variables by renaming them to unique variable names.
This is done to avoid variable name conflicts when combining clauses.
4. Distribute conjunctions over disjunctions using the distributive
property. This involves creating new clauses for each possible
combination of disjuncts. For example, to distribute conjunctions over
disjunctions in the sentence "(P v Q) ^ R", we can create two new
clauses: "P ^ R" and "Q ^ R".
5. Combine all the resulting clauses using conjunctions to form the
CNF sentence.
The resulting CNF sentence will be in the form of a conjunction of
disjunctions, where each disjunction represents a clause containing one
or more literals. A literal is either a variable or the negation of a
variable. The CNF form is useful for automated reasoning and theorem
proving since it can be easily manipulated using logical rules.

7.B) Convert the following logic sentence into CNF B1,1 (P1,2 V
P2,1)
To convert the sentence B1,1 <=> (P1,2 V P2,1) into CNF form, we can
use the following steps:
1. Eliminate the bi-implication using logical equivalence: B1,1 <=>
(P1,2 V P2,1) is equivalent to (B1,1 -> (P1,2 V P2,1)) ^ ((P1,2 V P2,1)
-> B1,1)
2. Eliminate the implication using logical equivalence: (B1,1 -> (P1,2
V P2,1)) is equivalent to (~B1,1 V (P1,2 V P2,1))
3. Distribute disjunction over conjunction in the sentence ((P1,2 V
P2,1) -> B1,1) using logical equivalence: ((P1,2 V P2,1) -> B1,1) is
equivalent to (~(P1,2 V P2,1) V B1,1)
4. Standardize variables by renaming them to unique variable names.
Since there are no variables in the sentence, we don't need to do
anything here.
5. Combine all the resulting clauses using conjunctions to form the
CNF sentence: (~B1,1 V P1,2 V P2,1) ^ (~P1,2 V ~P2,1 V B1,1)
Therefore, the CNF form of the sentence B1,1 <=> (P1,2 V P2,1) is
(~B1,1 V P1,2 V P2,1) ^ (~P1,2 V ~P2,1 V B1,1).

8.) What are the steps associated with the knowledge Engineering
process with suitable example?
The Knowledge Engineering process involves the following steps:
1. Knowledge Acquisition: This step involves identifying the
knowledge sources and extracting knowledge from them. For example,
in the field of medicine, knowledge can be acquired from medical
textbooks, research papers, patient records, and expert consultations.
2. Knowledge Representation: The acquired knowledge needs to be
represented in a form that can be used by the computer system. This
step involves selecting a suitable knowledge representation language
and encoding the knowledge in that language. For instance, in a
medical diagnosis system, the knowledge can be represented using
rules, frames, or ontologies.
3. Knowledge Validation: After the knowledge has been represented, it
needs to be validated to ensure that it is accurate, complete, and
consistent. This step involves checking the knowledge for errors,
contradictions, and omissions. In the medical diagnosis system, the
knowledge can be validated by comparing it with established medical
guidelines and consulting with domain experts.
4. Knowledge Verification: Once the knowledge has been validated, it
needs to be verified to ensure that it is suitable for the intended
application. This step involves testing the knowledge in a simulated or
real-world environment to evaluate its performance. In the medical
diagnosis system, the knowledge can be verified by testing it on a
sample of patient cases and comparing the results with those obtained
by human experts.
5. Knowledge Maintenance: After the knowledge has been verified, it
needs to be maintained to ensure that it remains up-to-date and relevant.
This step involves monitoring the knowledge sources and updating the
knowledge as needed. In the medical diagnosis system, the knowledge
can be maintained by regularly reviewing the medical literature and
consulting with domain experts.
6. Knowledge Deployment: Finally, the knowledge needs to be
deployed in a form that can be used by the end-users. This step involves
integrating the knowledge with the computer system and providing a
user interface for accessing the knowledge. In the medical diagnosis
system, the knowledge can be deployed as a software application that
can be used by healthcare professionals to assist in the diagnosis of
medical conditions.
Overall, the Knowledge Engineering process involves identifying,
acquiring, representing, validating, verifying, maintaining, and
deploying knowledge for use in computer systems.

9.) Explain Resolution process in First Order Logic with Example.


In First Order Logic, the resolution process is a technique used to derive
new logical statements from a set of given statements. The resolution
process involves the following steps:
1. Convert the statements into clausal form: This involves converting
the given statements into a set of clauses, where each clause is a
disjunction of literals. For example, the statement "All cats are
mammals" can be converted into the clause "not cats(x) or
mammals(x)".
2. Negate the statement to be proved: This involves negating the
statement that we want to prove and converting it into clausal form. For
example, if we want to prove that "John is not a cat", we can negate this
statement to get "cats(john)" and then convert it into clausal form as
"cats(john)".
3. Apply resolution: This involves applying the resolution rule to the
set of clauses obtained in steps 1 and 2. The resolution rule states that
if there are two clauses that contain complementary literals, then we
can derive a new clause that is the union of the two clauses with the
complementary literals removed. For example, if we have the clauses
"not cats(x) or mammals(x)" and "cats(john)", we can derive the new
clause "mammals(john)" by removing the complementary literals
"cats(john)" and "not cats(john)".
4. Repeat the process: We repeat steps 1-3 until we either derive the
empty clause (which means that the original set of clauses is
unsatisfiable) or we cannot derive any new clauses (which means that
the original set of clauses is satisfiable).
Overall, the resolution process involves repeatedly applying the
resolution rule to a set of clauses until we either derive the empty clause
(which means that the original set of clauses is unsatisfiable) or we
cannot derive any new clauses (which means that the original set of
clauses is satisfiable).
For example, let's say we have the following set of clauses:
1. not cats(x) or mammals(x)
2. cats(john)
3. not mammals(x) or dogs(x)
We want to prove the statement "John is not a dog". To do this, we first
negate the statement to get "dogs(john)" and convert it into clausal form
as "dogs(john)". We then apply the resolution rule as follows:
- We can resolve clause 1 and 2 to derive the new clause
"mammals(john)".
- We can resolve clause 3 and the

10.B) You toss a fair coin three times:


i) What is the probability of three heads, HHH?
ii)What is the probability of having at least 2 Heads given that
you observe at least one heads?
i) The probability of getting three heads in a row is (1/2) * (1/2) * (1/2)
= 1/8, or 0.125, or 12.5%.
ii) The probability of getting at least 2 heads given that you observe at
least one head is (3/7) or approximately 0.43, or 43%. This can be
calculated as follows:
- There are 8 possible outcomes when you toss a coin three times: HHH,
HHT, HTH, THH, HTT, THT, TTH, TTT.
- Out of these 8 outcomes, 4 have at least one head: HHH, HHT, HTH,
THH.
- Out of the 4 outcomes that have at least one head, 3 have at least 2
heads: HHH, HHT, THH.
- Therefore, the probability of getting at least 2 heads given that you
observe at least one head is 3/4 or 0.75.

11.) Describe the reasoning systems for categories with the proper
example.
Categorization is the process of grouping together objects or events that
share similar properties or features. There are two main reasoning
systems for categories: prototype and exemplar.
The prototype system categorizes objects based on how closely they
resemble a typical or idealized example, or prototype, of that category.
For example, if you were asked to think of a bird, you might think of a
robin or a sparrow, which are both prototypical examples of birds.
Other birds that share fewer features with this prototype, such as
ostriches or penguins, might be considered less typical or less
representative of the category of birds.
The exemplar system, on the other hand, categorizes objects based on
their similarity to specific examples, or exemplars, of that category. For
example, if you were asked to think of a bird, you might think of
specific birds that you have encountered in the past, such as a blue jay
or a cardinal. Other birds that share fewer features with these
exemplars, such as an owl or a pheasant, might be considered less
representative of the category of birds.
Both reasoning systems have their advantages and disadvantages. The
prototype system is useful because it allows us to quickly and
efficiently categorize objects based on their similarity to a typical
example. However, it can be less flexible and less accurate when
dealing with atypical or unusual examples. The exemplar system, on
the other hand, is more flexible and accurate because it allows us to
categorize objects based on their similarity to specific examples that we
have encountered in the past. However, it can be more time-consuming
and less efficient than the prototype system.
Overall, both reasoning systems are important for our ability to
categorize and understand the world around us.
12.) Describe propositional Logic along with syntax, semantics and
inference Procedure.
Propositional logic is a type of formal logic that deals with
propositions, or statements that are either true or false. It is used to
study the logical relationships between propositions and to determine
the truth or falsity of complex statements based on the truth or falsity
of their component propositions.
Syntax: Propositional logic uses a specific syntax to represent
propositions. It uses variables to represent propositions and logical
operators to connect them. The variables can take on the values of either
true or false. The logical operators include negation, conjunction,
disjunction, implication, and biconditional.
Semantics: The semantics of propositional logic is concerned with the
meaning of the logical operators and how they combine to form
compound propositions. It deals with the truth or falsity of propositions
and how they are related to one another. The truth values of compound
propositions are determined by the truth values of their component
propositions and the logical operators that connect them.
Inference Procedure: The inference procedure in propositional logic
involves using logical rules to determine the truth or falsity of complex
statements based on the truth or falsity of their component propositions.
It involves using deductive reasoning to draw conclusions based on the
premises provided. There are several inference rules in propositional
logic, including modus ponens, modus tollens, disjunctive syllogism,
and hypothetical syllogism.
Overall, propositional logic is a powerful tool for reasoning about the
truth or falsity of complex statements. It provides a formal language for
representing propositions and a set of logical rules for determining the
truth or falsity of compound propositions.

You might also like